]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Initial commit
authorArnie Reynoso <arnier@ti.com>
Tue, 19 Feb 2013 18:20:15 +0000 (10:20 -0800)
committerChris Ring <cring@ti.com>
Sat, 23 Feb 2013 20:20:12 +0000 (12:20 -0800)
These sources roughly match the 'ipc-j09' tag from the previously internal
development repo.

537 files changed:
.gitignore [new file with mode: 0644]
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
aclocal.m4 [new file with mode: 0644]
config.guess [new file with mode: 0755]
config.sub [new file with mode: 0755]
configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
depcomp [new file with mode: 0755]
install-sh [new file with mode: 0755]
ipc-bios.bld [new file with mode: 0644]
ipc-bios.mak [new file with mode: 0644]
ipc-linux.mak [new file with mode: 0644]
linux/etc/Makefile.am [new file with mode: 0644]
linux/etc/Makefile.in [new file with mode: 0644]
linux/etc/omapl138/dump_trace.sh [new file with mode: 0644]
linux/etc/omapl138/hawkboard_rpmsg_3.4_rc1.config [new file with mode: 0644]
linux/etc/omapl138/load_firmware.sh [new file with mode: 0644]
linux/etc/omapl138/nano_test.sh [new file with mode: 0644]
linux/etc/omapl138/omapl138_rpmsg_3.4_rc1.config [new file with mode: 0644]
linux/etc/omapl138/unload_firmware.sh [new file with mode: 0644]
linux/etc/panda/dump_trace.sh [new file with mode: 0644]
linux/etc/panda/load_firmware.sh [new file with mode: 0644]
linux/etc/panda/panda_rpmsg_3.4_rc1.config [new file with mode: 0644]
linux/etc/panda/unload_firmware.sh [new file with mode: 0644]
linux/etc/run_lad.sh [new file with mode: 0644]
linux/etc/tci66xx/dump_trace.sh [new file with mode: 0644]
linux/etc/tci66xx/load_firmware.sh [new file with mode: 0644]
linux/etc/tci66xx/tci6614.config [new file with mode: 0644]
linux/etc/tci66xx/test_multi.sh [new file with mode: 0644]
linux/etc/tci66xx/unload_firmware.sh [new file with mode: 0644]
linux/include/SocketFxns.h [new file with mode: 0644]
linux/include/Std.h [new file with mode: 0644]
linux/include/SysLink.h [new file with mode: 0644]
linux/include/_MessageQ.h [new file with mode: 0644]
linux/include/_MultiProc.h [new file with mode: 0644]
linux/include/_NameServer.h [new file with mode: 0644]
linux/include/_NameServerRemoteRpmsg.h [new file with mode: 0644]
linux/include/_lad.h [new file with mode: 0644]
linux/include/ladclient.h [new file with mode: 0644]
linux/include/net/rpmsg.h [new file with mode: 0644]
linux/src/api/Makefile.am [new file with mode: 0644]
linux/src/api/Makefile.in [new file with mode: 0644]
linux/src/api/MessageQ.c [new file with mode: 0644]
linux/src/api/NameServer.c [new file with mode: 0644]
linux/src/api/SysLink.c [new file with mode: 0644]
linux/src/daemon/Makefile.am [new file with mode: 0644]
linux/src/daemon/Makefile.in [new file with mode: 0644]
linux/src/daemon/MessageQ_daemon.c [new file with mode: 0644]
linux/src/daemon/NameServer_daemon.c [new file with mode: 0644]
linux/src/daemon/lad.c [new file with mode: 0644]
linux/src/family/Makefile.am [new file with mode: 0644]
linux/src/family/Makefile.in [new file with mode: 0644]
linux/src/family/SystemCfg_omap4430.c [new file with mode: 0644]
linux/src/family/SystemCfg_omapl138.c [new file with mode: 0644]
linux/src/family/SystemCfg_tci6614.c [new file with mode: 0644]
linux/src/family/SystemCfg_tci6638.c [new file with mode: 0644]
linux/src/tests/Makefile.am [new file with mode: 0644]
linux/src/tests/Makefile.in [new file with mode: 0644]
linux/src/tests/MessageQApp.c [new file with mode: 0644]
linux/src/tests/MessageQBench.c [new file with mode: 0644]
linux/src/tests/MessageQMulti.c [new file with mode: 0644]
linux/src/tests/NameServerApp.c [new file with mode: 0644]
linux/src/tests/multi_process.sh [new file with mode: 0644]
linux/src/tests/nano_test.c [new file with mode: 0644]
linux/src/utils/LAD_client.c [new file with mode: 0644]
linux/src/utils/Makefile.am [new file with mode: 0644]
linux/src/utils/Makefile.in [new file with mode: 0644]
linux/src/utils/MultiProc.c [new file with mode: 0644]
linux/src/utils/SocketFxns.c [new file with mode: 0644]
ltmain.sh [new file with mode: 0644]
missing [new file with mode: 0755]
packages/ti/ipc/GateMP.h [new file with mode: 0644]
packages/ti/ipc/HeapBufMP.h [new file with mode: 0644]
packages/ti/ipc/HeapMemMP.h [new file with mode: 0644]
packages/ti/ipc/HeapMultiBufMP.h [new file with mode: 0644]
packages/ti/ipc/Ipc.h [new file with mode: 0644]
packages/ti/ipc/ListMP.h [new file with mode: 0644]
packages/ti/ipc/MessageQ.h [new file with mode: 0644]
packages/ti/ipc/MultiProc.h [new file with mode: 0644]
packages/ti/ipc/NameServer.h [new file with mode: 0644]
packages/ti/ipc/Notify.h [new file with mode: 0644]
packages/ti/ipc/SharedRegion.h [new file with mode: 0644]
packages/ti/ipc/family/omapl138/VirtQueue.c [new file with mode: 0644]
packages/ti/ipc/family/omapl138/VirtQueue.xdc [new file with mode: 0644]
packages/ti/ipc/family/omapl138/VirtQueue.xs [new file with mode: 0644]
packages/ti/ipc/family/omapl138/package.bld [new file with mode: 0644]
packages/ti/ipc/family/omapl138/package.xdc [new file with mode: 0644]
packages/ti/ipc/family/omapl138/package.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6614/Interrupt.c [new file with mode: 0644]
packages/ti/ipc/family/tci6614/Interrupt.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6614/Interrupt.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6614/NotifySetup.c [new file with mode: 0644]
packages/ti/ipc/family/tci6614/NotifySetup.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6614/NotifySetup.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6614/VirtQueue.c [new file with mode: 0644]
packages/ti/ipc/family/tci6614/VirtQueue.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6614/VirtQueue.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6614/package.bld [new file with mode: 0644]
packages/ti/ipc/family/tci6614/package.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6614/package.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6638/Interrupt.c [new file with mode: 0644]
packages/ti/ipc/family/tci6638/Interrupt.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6638/Interrupt.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6638/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/ipc/family/tci6638/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6638/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6638/VirtQueue.c [new file with mode: 0644]
packages/ti/ipc/family/tci6638/VirtQueue.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6638/VirtQueue.xs [new file with mode: 0644]
packages/ti/ipc/family/tci6638/package.bld [new file with mode: 0644]
packages/ti/ipc/family/tci6638/package.xdc [new file with mode: 0644]
packages/ti/ipc/family/tci6638/package.xs [new file with mode: 0644]
packages/ti/ipc/getPragmas.xs [new file with mode: 0644]
packages/ti/ipc/ipcmgr/IpcMgr.c [new file with mode: 0644]
packages/ti/ipc/ipcmgr/package.bld [new file with mode: 0644]
packages/ti/ipc/ipcmgr/package.xdc [new file with mode: 0644]
packages/ti/ipc/ipcmgr/package.xs [new file with mode: 0644]
packages/ti/ipc/namesrv/NameServerRemoteRpmsg.c [new file with mode: 0644]
packages/ti/ipc/namesrv/NameServerRemoteRpmsg.xdc [new file with mode: 0644]
packages/ti/ipc/namesrv/NameServerRemoteRpmsg.xs [new file with mode: 0644]
packages/ti/ipc/namesrv/_NameServerRemoteRpmsg.h [new file with mode: 0644]
packages/ti/ipc/namesrv/package.bld [new file with mode: 0644]
packages/ti/ipc/namesrv/package.xdc [new file with mode: 0644]
packages/ti/ipc/namesrv/package.xs [new file with mode: 0644]
packages/ti/ipc/package.bld [new file with mode: 0644]
packages/ti/ipc/package.xdc [new file with mode: 0644]
packages/ti/ipc/remoteproc/Resource.c [new file with mode: 0644]
packages/ti/ipc/remoteproc/Resource.xdc [new file with mode: 0644]
packages/ti/ipc/remoteproc/Resource.xdt [new file with mode: 0644]
packages/ti/ipc/remoteproc/Resource.xdt.v33 [new file with mode: 0644]
packages/ti/ipc/remoteproc/Resource.xs [new file with mode: 0644]
packages/ti/ipc/remoteproc/package.bld [new file with mode: 0644]
packages/ti/ipc/remoteproc/package.xdc [new file with mode: 0644]
packages/ti/ipc/remoteproc/package.xs [new file with mode: 0644]
packages/ti/ipc/remoteproc/rsc_table_omapl138.h [new file with mode: 0644]
packages/ti/ipc/remoteproc/rsc_table_tci6614.h [new file with mode: 0644]
packages/ti/ipc/remoteproc/rsc_table_tci6614_v3.3.h [new file with mode: 0644]
packages/ti/ipc/remoteproc/rsc_table_tci6638.h [new file with mode: 0644]
packages/ti/ipc/remoteproc/rsc_types.h [new file with mode: 0644]
packages/ti/ipc/rpmsg/Rpmsg.h [new file with mode: 0644]
packages/ti/ipc/rpmsg/package.bld [new file with mode: 0644]
packages/ti/ipc/rpmsg/package.xdc [new file with mode: 0644]
packages/ti/ipc/rpmsg/virtio_ring.h [new file with mode: 0644]
packages/ti/ipc/tests/dual_transports.c [new file with mode: 0644]
packages/ti/ipc/tests/dual_transports.cfg [new file with mode: 0644]
packages/ti/ipc/tests/messageq_common.cfg.xs [new file with mode: 0644]
packages/ti/ipc/tests/messageq_multi.c [new file with mode: 0644]
packages/ti/ipc/tests/messageq_multicore.c [new file with mode: 0644]
packages/ti/ipc/tests/messageq_multicore.cfg [new file with mode: 0644]
packages/ti/ipc/tests/messageq_single.c [new file with mode: 0644]
packages/ti/ipc/tests/nano_test.c [new file with mode: 0644]
packages/ti/ipc/tests/package.bld [new file with mode: 0644]
packages/ti/ipc/tests/package.bld.no_host_kepler [new file with mode: 0644]
packages/ti/ipc/tests/package.xdc [new file with mode: 0644]
packages/ti/ipc/tests/rpmsg_transport.cfg [new file with mode: 0644]
packages/ti/ipc/transports/TransportVirtio.c [new file with mode: 0644]
packages/ti/ipc/transports/TransportVirtio.xdc [new file with mode: 0644]
packages/ti/ipc/transports/TransportVirtio.xs [new file with mode: 0644]
packages/ti/ipc/transports/TransportVirtioSetup.c [new file with mode: 0644]
packages/ti/ipc/transports/TransportVirtioSetup.xdc [new file with mode: 0644]
packages/ti/ipc/transports/TransportVirtioSetup.xs [new file with mode: 0644]
packages/ti/ipc/transports/_TransportVirtio.h [new file with mode: 0644]
packages/ti/ipc/transports/package.bld [new file with mode: 0644]
packages/ti/ipc/transports/package.xdc [new file with mode: 0644]
packages/ti/ipc/transports/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/Build.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/Build.xdt [new file with mode: 0644]
packages/ti/sdo/ipc/Build.xs [new file with mode: 0644]
packages/ti/sdo/ipc/GateMP.c [new file with mode: 0644]
packages/ti/sdo/ipc/GateMP.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/GateMP.xs [new file with mode: 0644]
packages/ti/sdo/ipc/Ipc.c [new file with mode: 0644]
packages/ti/sdo/ipc/Ipc.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/Ipc.xdt [new file with mode: 0644]
packages/ti/sdo/ipc/Ipc.xs [new file with mode: 0644]
packages/ti/sdo/ipc/ListMP.c [new file with mode: 0644]
packages/ti/sdo/ipc/ListMP.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/ListMP.xs [new file with mode: 0644]
packages/ti/sdo/ipc/MessageQ.c [new file with mode: 0644]
packages/ti/sdo/ipc/MessageQ.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/MessageQ.xs [new file with mode: 0644]
packages/ti/sdo/ipc/Notify.c [new file with mode: 0644]
packages/ti/sdo/ipc/Notify.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/Notify.xs [new file with mode: 0644]
packages/ti/sdo/ipc/SharedRegion.c [new file with mode: 0644]
packages/ti/sdo/ipc/SharedRegion.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/SharedRegion.xs [new file with mode: 0644]
packages/ti/sdo/ipc/_GateMP.h [new file with mode: 0644]
packages/ti/sdo/ipc/_Ipc.h [new file with mode: 0644]
packages/ti/sdo/ipc/_ListMP.h [new file with mode: 0644]
packages/ti/sdo/ipc/_MessageQ.h [new file with mode: 0644]
packages/ti/sdo/ipc/_Notify.h [new file with mode: 0644]
packages/ti/sdo/ipc/_SharedRegion.h [new file with mode: 0644]
packages/ti/sdo/ipc/build/common.bld [new file with mode: 0644]
packages/ti/sdo/ipc/build/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/build/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/build/test.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/Settings.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/Settings.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/InterruptArp32.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/InterruptArp32.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/InterruptArp32.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/arctic/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/Interrupt.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/Interrupt.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/Interrupt.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/MultiProcSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/MultiProcSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/MultiProcSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c647x/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptEve.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptEve.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptEve.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptHost.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptHost.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/InterruptHost.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/c6a8149/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/InterruptArm.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/InterruptArm.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/InterruptArm.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/da830/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/InterruptArm.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/InterruptArm.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/InterruptArm.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/dm6446/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/doc-files/procNamesHead.inc [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/IpcMgr.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/IpcMgr.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/IpcMgr.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/TransportCirc.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/linkcmd.xdt [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/f28m35x/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/InterruptHost.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/InterruptHost.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/InterruptHost.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap3530/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/InterruptDucati.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/InterruptDucati.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/InterruptDucati.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/omap4430/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/procNamesDocGen.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/Interrupt.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/Interrupt.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/Interrupt.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/tci663x/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptHost.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptHost.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/InterruptHost.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/ti81xx/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptArp32.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptArp32.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptArp32.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptDsp.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptDsp.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptDsp.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptHost.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptHost.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptHost.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptIpu.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptIpu.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/InterruptIpu.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/NotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/NotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/NotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/TableInit.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/TableInit.xs [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/family/vayu/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateAAMonitor.c [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateAAMonitor.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateAAMonitor.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateAAMonitor_asm.s64P [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateHWSem.c [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateHWSem.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateHWSem.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateHWSpinlock.c [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateHWSpinlock.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateHWSpinlock.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateMPSupportNull.c [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateMPSupportNull.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GateMPSupportNull.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GatePeterson.c [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GatePeterson.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GatePeterson.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GatePetersonN.c [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GatePetersonN.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/GatePetersonN.xs [new file with mode: 0644]
packages/ti/sdo/ipc/gates/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/gates/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/gates/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapBufMP.c [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapBufMP.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapBufMP.xs [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapMemMP.c [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapMemMP.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapMemMP.xs [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapMultiBufMP.c [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapMultiBufMP.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/HeapMultiBufMP.xs [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/_HeapBufMP.h [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/_HeapMemMP.h [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/_HeapMultiBufMP.h [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/heaps/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/instrumented.cfg [new file with mode: 0644]
packages/ti/sdo/ipc/instrumented.cfg.xs [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/IGateMPSupport.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/IMessageQTransport.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/INotifyDriver.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/INotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/ITransportSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/interfaces/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/linkcmd.xdt [new file with mode: 0644]
packages/ti/sdo/ipc/makefile.xdt [new file with mode: 0644]
packages/ti/sdo/ipc/makefile_gccArmLto.xdt [new file with mode: 0644]
packages/ti/sdo/ipc/nonInstrumented.cfg [new file with mode: 0644]
packages/ti/sdo/ipc/nonInstrumented.cfg.xs [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/IInterrupt.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.c [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.xs [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.c [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.xs [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.c [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.xs [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/notifyDrivers/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xs [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.c [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.xs [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/nsremote/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/package.xs [new file with mode: 0644]
packages/ti/sdo/ipc/smpInstrumented.cfg [new file with mode: 0644]
packages/ti/sdo/ipc/smpNonInstrumented.cfg [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportNullSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportNullSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportNullSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShm.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShm.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShm.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmCirc.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmCirc.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmCirc.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmCircSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmCircSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmCircSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmNotify.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmNotify.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmNotify.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmNotifySetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmNotifySetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmNotifySetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmSetup.c [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmSetup.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/TransportShmSetup.xs [new file with mode: 0644]
packages/ti/sdo/ipc/transports/package.bld [new file with mode: 0644]
packages/ti/sdo/ipc/transports/package.xdc [new file with mode: 0644]
packages/ti/sdo/ipc/transports/package.xs [new file with mode: 0644]
packages/ti/sdo/utils/Build.xdc [new file with mode: 0644]
packages/ti/sdo/utils/Build.xdt [new file with mode: 0644]
packages/ti/sdo/utils/Build.xs [new file with mode: 0644]
packages/ti/sdo/utils/INameServerRemote.xdc [new file with mode: 0644]
packages/ti/sdo/utils/List.c [new file with mode: 0644]
packages/ti/sdo/utils/List.xdc [new file with mode: 0644]
packages/ti/sdo/utils/List.xs [new file with mode: 0644]
packages/ti/sdo/utils/MultiProc.c [new file with mode: 0644]
packages/ti/sdo/utils/MultiProc.xdc [new file with mode: 0644]
packages/ti/sdo/utils/MultiProc.xs [new file with mode: 0644]
packages/ti/sdo/utils/NameServer.c [new file with mode: 0644]
packages/ti/sdo/utils/NameServer.xdc [new file with mode: 0644]
packages/ti/sdo/utils/NameServer.xs [new file with mode: 0644]
packages/ti/sdo/utils/NameServerRemoteNull.c [new file with mode: 0644]
packages/ti/sdo/utils/NameServerRemoteNull.xdc [new file with mode: 0644]
packages/ti/sdo/utils/NameServerRemoteNull.xs [new file with mode: 0644]
packages/ti/sdo/utils/UTILS.c [new file with mode: 0644]
packages/ti/sdo/utils/_MultiProc.h [new file with mode: 0644]
packages/ti/sdo/utils/_NameServer.h [new file with mode: 0644]
packages/ti/sdo/utils/instrumented.cfg [new file with mode: 0644]
packages/ti/sdo/utils/instrumented.cfg.xs [new file with mode: 0644]
packages/ti/sdo/utils/makefile.xdt [new file with mode: 0644]
packages/ti/sdo/utils/makefile_gccArmLto.xdt [new file with mode: 0644]
packages/ti/sdo/utils/nonInstrumented.cfg [new file with mode: 0644]
packages/ti/sdo/utils/nonInstrumented.cfg.xs [new file with mode: 0644]
packages/ti/sdo/utils/package.bld [new file with mode: 0644]
packages/ti/sdo/utils/package.xdc [new file with mode: 0644]
packages/ti/sdo/utils/package.xs [new file with mode: 0644]
packages/ti/sdo/utils/smpInstrumented.cfg [new file with mode: 0644]
packages/ti/sdo/utils/smpNonInstrumented.cfg [new file with mode: 0644]
products.mak [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..743d7f0
--- /dev/null
@@ -0,0 +1,37 @@
+# BIOS stuff
+package/
+lib/
+bin/
+.libraries*
+.dlls
+.executables
+.interfaces
+.xdcenv.mak
+package.mak
+packages/ti/sdo/*/*.p*
+packages/ti/sdo/ipc/family/doc-files/procNames.html
+packages/ti/sdo/ipc/*.h
+packages/ti/sdo/ipc/*/*.h
+packages/ti/sdo/ipc/*/*/*.h
+packages/ti/sdo/utils/*.h
+packages/ti/ipc/family/omapl138/VirtQueue.h
+packages/ti/ipc/family/tci6614/Interrupt.h
+packages/ti/ipc/family/tci6614/NotifySetup.h
+packages/ti/ipc/family/tci6614/VirtQueue.h
+packages/ti/ipc/family/tci6638/Interrupt.h
+packages/ti/ipc/family/tci6638/NotifyCircSetup.h
+packages/ti/ipc/family/tci6638/VirtQueue.h
+packages/ti/ipc/namesrv/NameServerRemoteRpmsg.h
+packages/ti/ipc/remoteproc/Resource.h
+packages/ti/ipc/transports/TransportVirtio.h
+packages/ti/ipc/transports/TransportVirtioSetup.h
+
+# Linux stuff
+/autom4te.cache
+/config.log
+/config.status
+/libtool
+.deps/
+/Makefile
+/linux/etc/Makefile
+/linux/src/*/Makefile
\ No newline at end of file
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..623b625
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..23e5f25
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..70aae16
--- /dev/null
@@ -0,0 +1,15 @@
+# the subdirectories of the project to go into
+SUBDIRS =  linux/etc linux/src/utils linux/src/api linux/src/family linux/src/daemon linux/src/tests
+
+# hook to remove libtools library extention files (.la)
+install-exec-hook:
+       rm -f $(DESTDIR)$(libdir)/*.la
+
+# where to install common headers on the system
+ipcincludedir = $(includedir)/ti/ipc
+
+# the list of common header files (to be installed later)
+ipcinclude_HEADERS = $(top_srcdir)/packages/ti/ipc/MessageQ.h \
+                $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+                $(top_srcdir)/packages/ti/ipc/NameServer.h
+
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..244953e
--- /dev/null
@@ -0,0 +1,649 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(ipcinclude_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
+       config.guess config.sub depcomp install-sh ltmain.sh missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(ipcincludedir)"
+ipcincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(ipcinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+# the subdirectories of the project to go into
+SUBDIRS = linux/etc linux/src/utils linux/src/api linux/src/family linux/src/daemon linux/src/tests
+
+# where to install common headers on the system
+ipcincludedir = $(includedir)/ti/ipc
+
+# the list of common header files (to be installed later)
+ipcinclude_HEADERS = $(top_srcdir)/packages/ti/ipc/MessageQ.h \
+                $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+                $(top_srcdir)/packages/ti/ipc/NameServer.h
+
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+       @:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(srcdir) && $(AUTOMAKE) --gnu  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-ipcincludeHEADERS: $(ipcinclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(ipcincludedir)" || $(mkdir_p) "$(DESTDIR)$(ipcincludedir)"
+       @list='$(ipcinclude_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(ipcincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(ipcincludedir)/$$f'"; \
+         $(ipcincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(ipcincludedir)/$$f"; \
+       done
+
+uninstall-ipcincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(ipcinclude_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(ipcincludedir)/$$f'"; \
+         rm -f "$(DESTDIR)$(ipcincludedir)/$$f"; \
+       done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       mkdir $(distdir)
+       $(mkdir_p) $(distdir)/packages/ti/ipc
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r $(distdir)
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && cd $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+       @cd $(distuninstallcheck_dir) \
+       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(ipcincludedir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+       distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-ipcincludeHEADERS
+
+install-exec-am:
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-ipcincludeHEADERS
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+       check-am clean clean-generic clean-libtool clean-recursive \
+       ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+       dist-shar dist-tarZ dist-zip distcheck distclean \
+       distclean-generic distclean-libtool distclean-recursive \
+       distclean-tags distcleancheck distdir distuninstallcheck dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-exec install-exec-am \
+       install-exec-hook install-info install-info-am \
+       install-ipcincludeHEADERS install-man install-strip \
+       installcheck installcheck-am installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic \
+       maintainer-clean-recursive mostlyclean mostlyclean-generic \
+       mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+       tags tags-recursive uninstall uninstall-am uninstall-info-am \
+       uninstall-ipcincludeHEADERS
+
+
+# hook to remove libtools library extention files (.la)
+install-exec-hook:
+       rm -f $(DESTDIR)$(libdir)/*.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..4723f85
--- /dev/null
@@ -0,0 +1,7227 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 48 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+                [m4_ifdef([AC_PROVIDE_$1],
+                          [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+       [AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+            [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+            [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+            [define([LT_AC_PROG_GCJ],
+               defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+       [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+       [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+            [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+        [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+        test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+        echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+        test "X$echo_testing_string" = "X$echo_test_string"; then
+       # Cool, printf works
+       :
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+       export CONFIG_SHELL
+       SHELL="$CONFIG_SHELL"
+       export SHELL
+       echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+       # maybe with a smaller string...
+       prev=:
+
+       for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+         if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+         then
+           break
+         fi
+         prev="$cmd"
+       done
+
+       if test "$prev" != 'sed 50q "[$]0"'; then
+         echo_test_string=`eval $prev`
+         export echo_test_string
+         exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+       else
+         # Oops.  We lost completely, so just stick with echo.
+         echo=echo
+       fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+       [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#              [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[       ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+              = "XX$teststring") >/dev/null 2>&1 &&
+           new_result=`expr "X$teststring" : ".*" 2>&1` &&
+           lt_cv_sys_max_cmd_len=$new_result &&
+           test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+         [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+           [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+       [AC_CHECK_FUNC([dlopen],
+             [lt_cv_dlopen="dlopen"],
+         [AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+           [AC_CHECK_LIB([svld], [dlopen],
+                 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+             [AC_CHECK_LIB([dld], [dld_link],
+                   [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+             ])
+           ])
+         ])
+       ])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+         lt_cv_dlopen_self, [dnl
+         _LT_AC_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+           lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+         lt_cv_dlopen_self_static, [dnl
+         _LT_AC_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+           lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,   ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+       ;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+       if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+           ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+           (test "X$CXX" != "Xg++"))) ; then
+         AC_LIBTOOL_LANG_CXX_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      F77)
+       if test -n "$F77" && test "X$F77" != "Xno"; then
+         AC_LIBTOOL_LANG_F77_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      GCJ)
+       if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+         AC_LIBTOOL_LANG_GCJ_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      RC)
+       AC_LIBTOOL_LANG_RC_CONFIG
+       ;;
+
+      *)
+       AC_MSG_ERROR([Unsupported tag name: $tagname])
+       ;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+       [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+       [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+       [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!).  If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+        [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+          [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+       grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+       for ld_flag in $LDFLAGS; do
+         case $ld_flag in
+         *-brtl*)
+           aix_use_runtimelinking=yes
+           break
+           ;;
+         esac
+       done
+       ;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+       collect2name=`${CC} -print-prog-name=collect2`
+       if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+       then
+         # We have reworked collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+       else
+         # We have old collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+       fi
+       ;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+       shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+       shared_flag='-G'
+      else
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag='${wl}-G'
+       else
+         shared_flag='${wl}-bM:SRE'
+       fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       # Warning - without using the other run time loading flags,
+       # -berok will link without error, but may produce a broken library.
+       _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+       # Exported symbols can be pulled into shared objects from archives
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+       # This is similar to how AIX traditionally builds its shared libraries.
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+       cp $export_symbols $output_objdir/$soname.def;
+      else
+       echo EXPORTS > $output_objdir/$soname.def;
+       cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      ghcx*)
+       # Green Hills C++ Compiler
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  freebsd[[12]]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | kfreebsd*-gnu | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                               # but as the default
+                               # location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+      case $host_cpu in
+      hppa*64*|ia64*)
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+        ;;
+      *)
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      aCC*)
+       case $host_cpu in
+       hppa*64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       esac
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test $with_gnu_ld = no; then
+           case $host_cpu in
+           hppa*64*)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           ia64*)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           *)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           esac
+         fi
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  interix3*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+       # SGI C++
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       # Archives containing C++ object files must be created using
+       # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test "$with_gnu_ld" = no; then
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+         else
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+         fi
+       fi
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+       ;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+       ;;
+      icpc*)
+       # Intel C++
+       with_gnu_ld=yes
+       # version 8.0 and above of icpc choke on multiply defined symbols
+       # if we add $predep_objects and $postdep_objects, however 7.1 and
+       # earlier do not add the objects themselves.
+       case `$CC -V 2>&1` in
+       *"Version 7."*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       *)  # Version 8.0 or newer
+         tmp_idyn=
+         case $host_cpu in
+           ia64*) tmp_idyn=' -i_dynamic';;
+         esac
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       esac
+       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+       ;;
+      pgCC*)
+        # Portland Group C++ compiler
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+       # Compaq C++
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+       runpath_var=LD_RUN_PATH
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  openbsd*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    fi
+    output_verbose_link_cmd='echo'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      cxx*)
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Archives containing C++ object files must be created using
+       # the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      cxx*)
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+         echo "-hidden">> $lib.exp~
+         $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+         $rm $lib.exp'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.x
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      lcc*)
+       # Lucid
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.2, 5.x and Centerline C++
+        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+       _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+       case $host_os in
+         solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+         *)
+           # The C++ compiler is used as linker so we must use $wl
+           # flag to pass the commands to the underlying system
+           # linker. We must also pass each convience library through
+           # to the system linker between allextract/defaultextract.
+           # The C++ compiler will combine linker options so we
+           # cannot just pass the convience library names through
+           # without $wl.
+           # Supported since Solaris 2.6 (maybe 2.5.1?)
+           _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+           ;;
+       esac
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+       output_verbose_link_cmd='echo'
+
+       # Archives containing C++ object files must be created using
+       # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+       ;;
+      gcx*)
+       # Green Hills C++ Compiler
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+       # The C++ compiler must be used to create the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+       ;;
+      *)
+       # GNU C++ compiler with Solaris linker
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+         if $CC --version | grep -v '^2\.7' > /dev/null; then
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         else
+           # g++ 2.7 appears to require `-G' NOT `-shared' on this
+           # platform.
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         fi
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+       fi
+       ;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+       # NonStop-UX NCC 3.20
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+         || test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+            _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+          else
+            _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+          _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+        else
+          _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+          _LT_AC_TAGVAR(predep_objects, $1)="$p"
+        else
+          _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+        fi
+       else
+        if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+          _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+        else
+          _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_AC_TAGVAR(predep_objects,$1)=
+  _LT_AC_TAGVAR(postdep_objects,$1)=
+  _LT_AC_TAGVAR(postdeps,$1)=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDGIRSTW]]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[     ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+       if grep ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+         cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+         cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+         if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       else
+         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | kfreebsd*-gnu | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+           fi
+           ;;
+         aCC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux*)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         icpc* | ecpc*)
+           # Intel C++
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         pgCC*)
+           # Portland Group C++ compiler.
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd*)
+       ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+       ;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux*)
+      case $cc_basename in
+      icc* | ecc*)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  _LT_CC_BASENAME([$compiler])
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix3*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           _LT_AC_TAGVAR(ld_shlibs, $1)=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+       else
+         _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[[012]]|aix4.[[012]].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+         else
+         # We have old collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        _LT_AC_SYS_LIBPATH_AIX
+        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+         _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+         ;;
+       *)
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+         _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      else
+       case $host_os in
+        openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+          _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+          ;;
+        *)
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+       *)
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+       motorola)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+       pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_MSG_RESULT([$SED])
+])
+
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/config.guess b/config.guess
new file mode 100755 (executable)
index 0000000..910f4ee
--- /dev/null
@@ -0,0 +1,1473 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_MACHINE}" in
+    i?86)
+       test -z "$VENDOR" && VENDOR=pc
+       ;;
+    *)
+       test -z "$VENDOR" && VENDOR=unknown
+       ;;
+esac
+test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    x86:Interix*:[34]*)
+       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+       exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-${VENDOR}-linux
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux"; exit; }
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux"; exit; }
+       ;;
+    ppc:Linux:*:*)
+       echo powerpc-${VENDOR}-linux
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-${VENDOR}-linux
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-${VENDOR}-linux ;;
+         PA8*) echo hppa2.0-${VENDOR}-linux ;;
+         *)    echo hppa-${VENDOR}-linux ;;
+       esac
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-${VENDOR}-linux
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR}-linux
+       exit ;;
+    x86_64:Linux:*:*)
+       echo x86_64-${VENDOR}-linux
+       exit ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-${VENDOR}-linuxaout"
+               exit ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff"
+               exit ;;
+         "")
+               # Either a pre-BFD a.out linker (linuxoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld"
+               exit ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #ifdef __INTEL_COMPILER
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/'
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           *86) UNAME_PROCESSOR=i686 ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755 (executable)
index 0000000..6e2bdbf
--- /dev/null
@@ -0,0 +1,1576 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | ms1 \
+       | msp430 \
+       | ns16k | ns32k \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b \
+       | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m32c)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | ms1-* \
+       | msp430-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | xstormy16-* | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       m32c-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16c)
+               basic_machine=cr16c-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+        -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+        -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..d934787
--- /dev/null
+++ b/configure
@@ -0,0 +1,18127 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for TI IPC 3.0.0.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+        test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+        echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+        test "X$echo_testing_string" = "X$echo_test_string"; then
+       # Cool, printf works
+       :
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+       export CONFIG_SHELL
+       SHELL="$CONFIG_SHELL"
+       export SHELL
+       echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+       # maybe with a smaller string...
+       prev=:
+
+       for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+         if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+         then
+           break
+         fi
+         prev="$cmd"
+       done
+
+       if test "$prev" != 'sed 50q "$0"'; then
+         echo_test_string=`eval $prev`
+         export echo_test_string
+         exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+       else
+         # Oops.  We lost completely, so just stick with echo.
+         echo=echo
+       fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='TI IPC'
+PACKAGE_TARNAME='ti-ipc'
+PACKAGE_VERSION='3.0.0'
+PACKAGE_STRING='TI IPC 3.0.0'
+PACKAGE_BUGREPORT=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_unique_file="packages/ti/ipc/MessageQ.h"
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP LIBTOOL AM_CFLAGS AM_LDFLAGS PLATFORM CMEM_INSTALL_DIR OMAPL138_TRUE OMAPL138_FALSE OMAP4430_TRUE OMAP4430_FALSE TCI6614_TRUE TCI6614_FALSE TCI6638_TRUE TCI6638_FALSE CMEM_TRUE CMEM_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_CXXCPP_set=${CXXCPP+set}
+ac_env_CXXCPP_value=$CXXCPP
+ac_cv_env_CXXCPP_set=${CXXCPP+set}
+ac_cv_env_CXXCPP_value=$CXXCPP
+ac_env_PLATFORM_set=${PLATFORM+set}
+ac_env_PLATFORM_value=$PLATFORM
+ac_cv_env_PLATFORM_set=${PLATFORM+set}
+ac_cv_env_PLATFORM_value=$PLATFORM
+ac_env_CMEM_INSTALL_DIR_set=${CMEM_INSTALL_DIR+set}
+ac_env_CMEM_INSTALL_DIR_value=$CMEM_INSTALL_DIR
+ac_cv_env_CMEM_INSTALL_DIR_set=${CMEM_INSTALL_DIR+set}
+ac_cv_env_CMEM_INSTALL_DIR_value=$CMEM_INSTALL_DIR
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures TI IPC 3.0.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of TI IPC 3.0.0:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-shared[=PKGS]
+                          build shared libraries [default=yes]
+  --enable-static[=PKGS]
+                          build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]
+                          include additional configurations [automatic]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  PLATFORM    Platform to build. Options are: 'omapl138' 'omap4330' 'tci6614'
+              and 'tci6638'. If not defined all platforms will be built.
+  CMEM_INSTALL_DIR
+              Installation path directory to the CMEM libraries
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+TI IPC configure 3.0.0
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by TI IPC $as_me 3.0.0, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Initilize automake
+am__api_version="1.9"
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='ti-ipc'
+ VERSION='3.0.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+# Initalize libtool but disable fortran check
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi;
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi;
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi;
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+DEPDIR="${am__leading_dot}deps"
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+       ;;
+    conftest.$ac_ext )
+       # This is the source file.
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       # FIXME: I believe we export ac_cv_exeext for Libtool,
+       # but it would be cool to find out if it's true.  Does anybody
+       # maintain Libtool? --akim.
+       export ac_cv_exeext
+       break;;
+    * )
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         export ac_cv_exeext
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
+NM="$lt_cv_path_NM"
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 3674 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to the TI IPC lists.  ##
+## --------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+fi
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[        ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+              = "XX$teststring") >/dev/null 2>&1 &&
+           new_result=`expr "X$teststring" : ".*" 2>&1` &&
+           lt_cv_sys_max_cmd_len=$new_result &&
+           test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
+else
+  echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDGIRSTW]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[      ]\($symcode$symcode*\)[         ][      ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+       if grep ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+         cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+         cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+         if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&5
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+else
+  echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+fi
+
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  AR=$ac_ct_AR
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi;
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6099: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:6103: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      else
+       lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic='-qnocommon'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux*)
+      case $cc_basename in
+      icc* | ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fpic'
+       lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic='-Kconform_pic'
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6367: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:6371: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works=yes
+       fi
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:6471: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:6475: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    interix3*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           ld_shlibs=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct=yes
+         else
+         # We have old collect2
+         hardcode_direct=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L=yes
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_libdir_separator=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag="-z nodefs"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag=' ${wl}-bernotok'
+         allow_undefined_flag=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec='$convenience'
+         archive_cmds_need_lc=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc=no
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec=''
+      link_all_deplibs=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+
+       hardcode_direct=yes
+       export_dynamic_flag_spec='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_libdir_flag_spec_ld='+b $libdir'
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+         ;;
+       *)
+         hardcode_direct=yes
+         export_dynamic_flag_spec='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec='-R$libdir'
+          ;;
+        *)
+          archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+       *)
+         whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds='$CC -r -o $output$reload_objs'
+         hardcode_direct=no
+        ;;
+       motorola)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+       pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc=no
+        else
+         archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var" || \
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+       else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+       ;;
+   *)
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shl_load;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 8816 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 8916 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which library types will actually be built
+echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags or --without-tags was given.
+if test "${with_tags+set}" = set; then
+  withval="$with_tags"
+  tagnames="$withval"
+fi;
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+       ;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+       if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+           ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+           (test "X$CXX" != "Xg++"))) ; then
+         ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+       grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+       for ld_flag in $LDFLAGS; do
+         case $ld_flag in
+         *-brtl*)
+           aix_use_runtimelinking=yes
+           break
+           ;;
+         esac
+       done
+       ;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+       collect2name=`${CC} -print-prog-name=collect2`
+       if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+       then
+         # We have reworked collect2
+         hardcode_direct_CXX=yes
+       else
+         # We have old collect2
+         hardcode_direct_CXX=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_CXX=yes
+         hardcode_libdir_flag_spec_CXX='-L$libdir'
+         hardcode_libdir_separator_CXX=
+       fi
+       ;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+       shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+       shared_flag='-G'
+      else
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag='${wl}-G'
+       else
+         shared_flag='${wl}-bM:SRE'
+       fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+       hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+       allow_undefined_flag_CXX="-z nodefs"
+       archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+       # Warning - without using the other run time loading flags,
+       # -berok will link without error, but may produce a broken library.
+       no_undefined_flag_CXX=' ${wl}-bernotok'
+       allow_undefined_flag_CXX=' ${wl}-berok'
+       # Exported symbols can be pulled into shared objects from archives
+       whole_archive_flag_spec_CXX='$convenience'
+       archive_cmds_need_lc_CXX=yes
+       # This is similar to how AIX traditionally builds its shared libraries.
+       archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag_CXX=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+       cp $export_symbols $output_objdir/$soname.def;
+      else
+       echo EXPORTS > $output_objdir/$soname.def;
+       cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      archive_cmds_need_lc_CXX=no
+      hardcode_direct_CXX=no
+      hardcode_automatic_CXX=yes
+      hardcode_shlibpath_var_CXX=unsupported
+      whole_archive_flag_spec_CXX=''
+      link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_CXX=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      ghcx*)
+       # Green Hills C++ Compiler
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | kfreebsd*-gnu | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+                               # but as the default
+                               # location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC*)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_CXX=:
+
+      case $host_cpu in
+      hppa*64*|ia64*)
+       hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
+        ;;
+      *)
+       export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      aCC*)
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       *)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       esac
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test $with_gnu_ld = no; then
+           case $host_cpu in
+           hppa*64*)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           ia64*)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           *)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           esac
+         fi
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  interix3*)
+    hardcode_direct_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+       # SGI C++
+       archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       # Archives containing C++ object files must be created using
+       # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test "$with_gnu_ld" = no; then
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+         else
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+         fi
+       fi
+       link_all_deplibs_CXX=yes
+       ;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+       archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+       ;;
+      icpc*)
+       # Intel C++
+       with_gnu_ld=yes
+       # version 8.0 and above of icpc choke on multiply defined symbols
+       # if we add $predep_objects and $postdep_objects, however 7.1 and
+       # earlier do not add the objects themselves.
+       case `$CC -V 2>&1` in
+       *"Version 7."*)
+         archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       *)  # Version 8.0 or newer
+         tmp_idyn=
+         case $host_cpu in
+           ia64*) tmp_idyn=' -i_dynamic';;
+         esac
+         archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       esac
+       archive_cmds_need_lc_CXX=no
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+       whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+       ;;
+      pgCC*)
+        # Portland Group C++ compiler
+       archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+       archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+       whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+       # Compaq C++
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+       runpath_var=LD_RUN_PATH
+       hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    ld_shlibs_CXX=no
+    ;;
+  openbsd*)
+    hardcode_direct_CXX=yes
+    hardcode_shlibpath_var_CXX=no
+    archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      export_dynamic_flag_spec_CXX='${wl}-E'
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    fi
+    output_verbose_link_cmd='echo'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      cxx*)
+       allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+         archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Archives containing C++ object files must be created using
+       # the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      cxx*)
+       allow_undefined_flag_CXX=' -expect_unresolved \*'
+       archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+         echo "-hidden">> $lib.exp~
+         $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+         $rm $lib.exp'
+
+       hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+        archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.x
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      lcc*)
+       # Lucid
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.2, 5.x and Centerline C++
+        archive_cmds_need_lc_CXX=yes
+       no_undefined_flag_CXX=' -zdefs'
+       archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+       archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+       hardcode_libdir_flag_spec_CXX='-R$libdir'
+       hardcode_shlibpath_var_CXX=no
+       case $host_os in
+         solaris2.[0-5] | solaris2.[0-5].*) ;;
+         *)
+           # The C++ compiler is used as linker so we must use $wl
+           # flag to pass the commands to the underlying system
+           # linker. We must also pass each convience library through
+           # to the system linker between allextract/defaultextract.
+           # The C++ compiler will combine linker options so we
+           # cannot just pass the convience library names through
+           # without $wl.
+           # Supported since Solaris 2.6 (maybe 2.5.1?)
+           whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+           ;;
+       esac
+       link_all_deplibs_CXX=yes
+
+       output_verbose_link_cmd='echo'
+
+       # Archives containing C++ object files must be created using
+       # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+       ;;
+      gcx*)
+       # Green Hills C++ Compiler
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+       # The C++ compiler must be used to create the archive.
+       old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+       ;;
+      *)
+       # GNU C++ compiler with Solaris linker
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+         if $CC --version | grep -v '^2\.7' > /dev/null; then
+           archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         else
+           # g++ 2.7 appears to require `-G' NOT `-shared' on this
+           # platform.
+           archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         fi
+
+         hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+       fi
+       ;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+    no_undefined_flag_CXX='${wl}-z,text'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    no_undefined_flag_CXX='${wl}-z,text'
+    allow_undefined_flag_CXX='${wl}-z,nodefs'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+    export_dynamic_flag_spec_CXX='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+       # NonStop-UX NCC 3.20
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+         || test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$compiler_lib_search_path_CXX"; then
+            compiler_lib_search_path_CXX="${prev}${p}"
+          else
+            compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$postdeps_CXX"; then
+          postdeps_CXX="${prev}${p}"
+        else
+          postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$predep_objects_CXX"; then
+          predep_objects_CXX="$p"
+        else
+          predep_objects_CXX="$predep_objects_CXX $p"
+        fi
+       else
+        if test -z "$postdep_objects_CXX"; then
+          postdep_objects_CXX="$p"
+        else
+          postdep_objects_CXX="$postdep_objects_CXX $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    postdeps_CXX='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       ;;
+      *)
+       lt_prog_compiler_pic_CXX='-fPIC'
+       ;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         lt_prog_compiler_static_CXX='-Bstatic'
+       else
+         lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           lt_prog_compiler_pic_CXX='-qnocommon'
+           lt_prog_compiler_wl_CXX='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | kfreebsd*-gnu | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             lt_prog_compiler_pic_CXX='+Z'
+           fi
+           ;;
+         aCC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             lt_prog_compiler_pic_CXX='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux*)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         icpc* | ecpc*)
+           # Intel C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         pgCC*)
+           # Portland Group C++ compiler.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fpic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           lt_prog_compiler_pic_CXX='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd*)
+       ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           lt_prog_compiler_wl_CXX='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           lt_prog_compiler_pic_CXX='-pic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       lt_prog_compiler_can_build_shared_CXX=no
+       ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:11256: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:11260: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6
+
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:11360: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:11364: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+       pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_CXX=no
+        else
+         archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var_CXX" || \
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_CXX"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      F77)
+       if test -n "$F77" && test "X$F77" != "Xno"; then
+         :
+       else
+         tagname=""
+       fi
+       ;;
+
+      GCJ)
+       if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12667: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:12671: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_GCJ='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+       lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_GCJ='-qnocommon'
+         lt_prog_compiler_wl_GCJ='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_GCJ='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux*)
+      case $cc_basename in
+      icc* | ecc*)
+       lt_prog_compiler_wl_GCJ='-Wl,'
+       lt_prog_compiler_pic_GCJ='-KPIC'
+       lt_prog_compiler_static_GCJ='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl_GCJ='-Wl,'
+       lt_prog_compiler_pic_GCJ='-fpic'
+       lt_prog_compiler_static_GCJ='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl_GCJ='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic_GCJ='-Kconform_pic'
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12935: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:12939: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_GCJ=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_GCJ=yes
+       fi
+     else
+       lt_prog_compiler_static_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6
+
+if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+    :
+else
+    lt_prog_compiler_static_GCJ=
+fi
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:13039: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:13043: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec_GCJ=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs_GCJ=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag_GCJ=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    interix3*)
+      hardcode_direct_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs_GCJ=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs_GCJ=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           ld_shlibs_GCJ=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_GCJ=
+      export_dynamic_flag_spec_GCJ=
+      whole_archive_flag_spec_GCJ=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct_GCJ=yes
+         else
+         # We have old collect2
+         hardcode_direct_GCJ=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_GCJ=yes
+         hardcode_libdir_flag_spec_GCJ='-L$libdir'
+         hardcode_libdir_separator_GCJ=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag_GCJ="-z nodefs"
+         archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag_GCJ=' ${wl}-bernotok'
+         allow_undefined_flag_GCJ=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec_GCJ='$convenience'
+         archive_cmds_need_lc_GCJ=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_GCJ=no
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ=''
+      link_all_deplibs_GCJ=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_GCJ=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_GCJ=:
+
+       hardcode_direct_GCJ=yes
+       export_dynamic_flag_spec_GCJ='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L_GCJ=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_GCJ=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+         hardcode_direct_GCJ=no
+         hardcode_shlibpath_var_GCJ=no
+         ;;
+       *)
+         hardcode_direct_GCJ=yes
+         export_dynamic_flag_spec_GCJ='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_GCJ=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_GCJ='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec_GCJ='-R$libdir'
+          ;;
+        *)
+          archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag_GCJ=' -expect_unresolved \*'
+       archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag_GCJ=' -expect_unresolved \*'
+       archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+       *)
+         whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_GCJ=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+         hardcode_direct_GCJ=no
+        ;;
+       motorola)
+         archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var_GCJ=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+      no_undefined_flag_GCJ='${wl}-z,text'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_GCJ='${wl}-z,text'
+      allow_undefined_flag_GCJ='${wl}-z,nodefs'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+       pic_flag=$lt_prog_compiler_pic_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_GCJ=no
+        else
+         archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var_GCJ" || \
+   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_GCJ"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      RC)
+
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_RC"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+       ;;
+
+      *)
+       { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+       ;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check common src files to ensure integrity of the package
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in gcc
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in gcc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+# Checks for header files.
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+
+for ac_header in fcntl.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to the TI IPC lists.  ##
+## --------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Export CFLAGS and LDFLAGS to Makefile(s)
+
+
+
+# Add config variables/options and check them
+
+
+
+# Test platform variable for setting
+if test "x$PLATFORM" = "xomapl138"; then
+  { echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
+echo "$as_me: PLATFORM is set to ${PLATFORM}" >&6;}
+else
+  if test "x$PLATFORM" = "xomap4430"; then
+  { echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
+echo "$as_me: PLATFORM is set to ${PLATFORM}" >&6;}
+else
+  if test "x$PLATFORM" = "xtci6614"; then
+  { echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
+echo "$as_me: PLATFORM is set to ${PLATFORM}" >&6;}
+else
+  if test "x$PLATFORM" = "xtci6638"; then
+  { echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
+echo "$as_me: PLATFORM is set to ${PLATFORM}" >&6;}
+else
+  if test "x$PLATFORM" = "x"; then
+  { echo "$as_me:$LINENO: PLATFORM is not set. All supported platforms will be built ...." >&5
+echo "$as_me: PLATFORM is not set. All supported platforms will be built ...." >&6;}
+else
+  { { echo "$as_me:$LINENO: error: PLATFORM is set to \"${PLATFORM}\": run ./configure --help for available PLATFORM options" >&5
+echo "$as_me: error: PLATFORM is set to \"${PLATFORM}\": run ./configure --help for available PLATFORM options" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+
+fi
+
+fi
+
+fi
+
+
+# Export optional user variable to Makefile(s)
+
+
+
+# Define specific variables to be used in Makefile.am
+
+
+if test "x$PLATFORM" = "xomapl138"; then
+  OMAPL138_TRUE=
+  OMAPL138_FALSE='#'
+else
+  OMAPL138_TRUE='#'
+  OMAPL138_FALSE=
+fi
+
+
+
+if test "x$PLATFORM" = "xomap4430"; then
+  OMAP4430_TRUE=
+  OMAP4430_FALSE='#'
+else
+  OMAP4430_TRUE='#'
+  OMAP4430_FALSE=
+fi
+
+
+
+if test "x$PLATFORM" = "xtci6614"; then
+  TCI6614_TRUE=
+  TCI6614_FALSE='#'
+else
+  TCI6614_TRUE='#'
+  TCI6614_FALSE=
+fi
+
+
+
+if test "x$PLATFORM" = "xtci6638"; then
+  TCI6638_TRUE=
+  TCI6638_FALSE='#'
+else
+  TCI6638_TRUE='#'
+  TCI6638_FALSE=
+fi
+
+
+
+
+if test "x$CMEM_INSTALL_DIR" != "x"; then
+  CMEM_TRUE=
+  CMEM_FALSE='#'
+else
+  CMEM_TRUE='#'
+  CMEM_FALSE=
+fi
+
+
+# Generate Makefile(s)
+          ac_config_files="$ac_config_files Makefile"
+
+          ac_config_files="$ac_config_files linux/etc/Makefile"
+
+          ac_config_files="$ac_config_files linux/src/utils/Makefile"
+
+          ac_config_files="$ac_config_files linux/src/api/Makefile"
+
+          ac_config_files="$ac_config_files linux/src/family/Makefile"
+
+          ac_config_files="$ac_config_files linux/src/daemon/Makefile"
+
+          ac_config_files="$ac_config_files linux/src/tests/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
+t quote
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[     `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${OMAPL138_TRUE}" && test -z "${OMAPL138_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"OMAPL138\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"OMAPL138\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${OMAP4430_TRUE}" && test -z "${OMAP4430_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"OMAP4430\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"OMAP4430\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${TCI6614_TRUE}" && test -z "${TCI6614_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"TCI6614\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"TCI6614\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${TCI6638_TRUE}" && test -z "${TCI6638_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"TCI6638\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"TCI6638\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${CMEM_TRUE}" && test -z "${CMEM_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"CMEM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CMEM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by TI IPC $as_me 3.0.0, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+TI IPC config.status 3.0.0
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "linux/etc/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/etc/Makefile" ;;
+  "linux/src/utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/src/utils/Makefile" ;;
+  "linux/src/api/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/src/api/Makefile" ;;
+  "linux/src/family/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/src/family/Makefile" ;;
+  "linux/src/daemon/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/src/daemon/Makefile" ;;
+  "linux/src/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/src/tests/Makefile" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LN_S@,$LN_S,;t t
+s,@ECHO@,$ECHO,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@CPP@,$CPP,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
+s,@CXXCPP@,$CXXCPP,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@AM_CFLAGS@,$AM_CFLAGS,;t t
+s,@AM_LDFLAGS@,$AM_LDFLAGS,;t t
+s,@PLATFORM@,$PLATFORM,;t t
+s,@CMEM_INSTALL_DIR@,$CMEM_INSTALL_DIR,;t t
+s,@OMAPL138_TRUE@,$OMAPL138_TRUE,;t t
+s,@OMAPL138_FALSE@,$OMAPL138_FALSE,;t t
+s,@OMAP4430_TRUE@,$OMAP4430_TRUE,;t t
+s,@OMAP4430_FALSE@,$OMAP4430_FALSE,;t t
+s,@TCI6614_TRUE@,$TCI6614_TRUE,;t t
+s,@TCI6614_FALSE@,$TCI6614_FALSE,;t t
+s,@TCI6638_TRUE@,$TCI6638_TRUE,;t t
+s,@TCI6638_FALSE@,$TCI6638_FALSE,;t t
+s,@CMEM_TRUE@,$CMEM_TRUE,;t t
+s,@CMEM_FALSE@,$CMEM_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_dest" : 'X\(//\)[^/]' \| \
+        X"$ac_dest" : 'X\(//\)$' \| \
+        X"$ac_dest" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+echo \
+"-----------------------------------------------------------
+
+Thank you for installing the Linux ${PACKAGE_NAME} package
+
+Installation directory prefix: '${prefix}'.
+Compilation command: '${CC} ${CFLAGS} ${CPPFLAGS}'
+
+You have configured to build for the '${PLATFORM}' platform
+
+Your CMEM installation is at:
+    '${CMEM_INSTALL_DIR}'
+
+Now type 'make; sudo make install' to generate the program
+and install it to your system.
+
+------------------------------------------------------------"
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..33000b6
--- /dev/null
@@ -0,0 +1,84 @@
+# Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.59)
+
+# Initilize autoconf
+AC_INIT(TI IPC, 3.0.0, ) 
+
+# Initilize automake
+AM_INIT_AUTOMAKE
+
+# Initalize libtool but disable fortran check
+define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
+AC_PROG_LIBTOOL(gcc)
+
+# Check common src files to ensure integrity of the package
+AC_CONFIG_SRCDIR([packages/ti/ipc/MessageQ.h])
+
+# Checks for programs.
+AC_PROG_CC(gcc)
+AC_PROG_INSTALL
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h])
+
+# Export CFLAGS and LDFLAGS to Makefile(s)
+AC_SUBST([AM_CFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
+# Add config variables/options and check them
+AC_ARG_VAR(PLATFORM, Platform to build. Options are: 'omapl138' 'omap4330' 'tci6614' and 'tci6638'. If not defined all platforms will be built.)
+AC_ARG_VAR(CMEM_INSTALL_DIR, Installation path directory to the CMEM libraries)
+
+# Test platform variable for setting
+AS_IF([test "x$PLATFORM" = "xomapl138"],
+  [AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
+  [AS_IF([test "x$PLATFORM" = "xomap4430"],
+  [AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
+  [AS_IF([test "x$PLATFORM" = "xtci6614"],
+  [AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
+  [AS_IF([test "x$PLATFORM" = "xtci6638"],
+  [AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
+  [AS_IF([test "x$PLATFORM" = "x"],
+  [AC_MSG_NOTICE([PLATFORM is not set. All supported platforms will be built ....])],
+  [AC_MSG_ERROR([PLATFORM is set to "${PLATFORM}": run ./configure --help for available PLATFORM options])])])])])])
+
+# Export optional user variable to Makefile(s)
+AC_SUBST([PLATFORM])
+AC_SUBST([CMEM_INSTALL_DIR])
+
+# Define specific variables to be used in Makefile.am
+AM_CONDITIONAL([OMAPL138], [test "x$PLATFORM" = "xomapl138"]) 
+AM_CONDITIONAL([OMAP4430], [test "x$PLATFORM" = "xomap4430"]) 
+AM_CONDITIONAL([TCI6614], [test "x$PLATFORM" = "xtci6614"]) 
+AM_CONDITIONAL([TCI6638], [test "x$PLATFORM" = "xtci6638"]) 
+
+AM_CONDITIONAL([CMEM], [test "x$CMEM_INSTALL_DIR" != "x"]) 
+
+# Generate Makefile(s)
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([linux/etc/Makefile])
+AC_CONFIG_FILES([linux/src/utils/Makefile])
+AC_CONFIG_FILES([linux/src/api/Makefile])
+AC_CONFIG_FILES([linux/src/family/Makefile])
+AC_CONFIG_FILES([linux/src/daemon/Makefile])
+AC_CONFIG_FILES([linux/src/tests/Makefile])
+AC_OUTPUT
+
+echo \
+"-----------------------------------------------------------
+
+Thank you for installing the Linux ${PACKAGE_NAME} package
+
+Installation directory prefix: '${prefix}'.
+Compilation command: '${CC} ${CFLAGS} ${CPPFLAGS}'
+
+You have configured to build for the '${PLATFORM}' platform
+
+Your CMEM installation is at:
+    '${CMEM_INSTALL_DIR}'
+
+Now type 'make; sudo make install' to generate the program
+and install it to your system.
+
+------------------------------------------------------------"
diff --git a/depcomp b/depcomp
new file mode 100755 (executable)
index 0000000..04701da
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+    *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/install-sh b/install-sh
new file mode 100755 (executable)
index 0000000..4d4a951
--- /dev/null
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+       shift
+       shift
+       continue;;
+
+    -T) no_target_directory=true
+       shift
+       continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       # When -t is used, the destination is already specified.
+       test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dstarg: Is a directory" >&2
+       exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit 1
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/ipc-bios.bld b/ipc-bios.bld
new file mode 100644 (file)
index 0000000..caf9a9c
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Generally there is no need to edit this file!
+ *
+ * This file controls which libraries are built, as well as compiler options
+ * to use.
+ *
+ * The contents of this file usually don't change, but having it in your
+ * ownership allows you to tweak your compiler options.  If you do change
+ * this file, however, on the next upgrade of the product we recommend
+ * that you take "ipc.bld" file as supplied by the upgrade and then merge
+ * your changes with it.
+ */
+
+/*
+ *  ======== ipc.bld ========
+ *  This script is run prior to all build scripts. It sets host-system-
+ *  independent values for targets and platforms, then it attempts to
+ *  find the host-system-specific user.bld script that sets rootDirs.
+ *
+ *  These settings may be a function of the following global variables:
+ *
+ *     environment a hash table of environment strings
+ *
+ *     arguments   an array of string arguments to the _config.bld script
+ *                 initialized as follows:
+ *                     arguments[0] - the file name of the _config.bld script
+ *                     arguments[1] - the first argument specified in XDCARGS
+ *                         :
+ *                     arguments[n] - the n'th argument in XDCARGS
+ *
+ *     Build       an alias for xdc.om.xdc.bld.BuildEnvironment
+ */
+
+/* Common ccopts suffix used for all C6x targets */
+var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
+
+/*
+ * -mi10 => maximum cycles that interrupts may be disabled is 10
+ * -mo => place each function in subsection
+ * -pdr => show remarks
+ * -pden => show remark ids
+ * -pds=238 => ignore "controlling expression is constant"
+ * -pds=880 => ignore "unused parameter"
+ */
+
+var ccOpts = {
+    "ti.targets.C28_large"            : " -mo -g ",
+    "ti.targets.C28_float"            : " -mo -g ",
+
+    "ti.targets.C64P"                 : c6xOpts,
+    "ti.targets.C64P_big_endian"      : c6xOpts,
+    "ti.targets.C674"                 : c6xOpts,
+
+    "ti.targets.elf.C64P"             : c6xOpts,
+    "ti.targets.elf.C64P_big_endian"  : c6xOpts,
+    "ti.targets.elf.C64T"             : c6xOpts,
+    "ti.targets.elf.C66"              : c6xOpts,
+    "ti.targets.elf.C66_big_endian"   : c6xOpts,
+    "ti.targets.elf.C674"             : c6xOpts,
+
+    "ti.targets.arm.elf.Arm9"         : " -ms -g ",
+    "ti.targets.arm.elf.A8F"          : " -ms -g ",
+    "ti.targets.arm.elf.A8Fnv"        : " -ms -g ",
+    "ti.targets.arm.elf.M3"           : " -ms -g ",
+    "ti.targets.arm.elf.M4"           : " -ms -g ",
+    "ti.targets.arm.elf.M4F"          : " -ms -g ",
+
+    "ti.targets.arp32.elf.ARP32"      : " -g ",
+    "ti.targets.arp32.elf.ARP32_far"  : " -g ",
+
+    "gnu.targets.arm.A8F"             : " -g ",
+    "gnu.targets.arm.A15F"            : " -g "
+};
+
+/* Enable building SMP-BIOS enabled libraries for targets that support it */
+xdc.module("ti.targets.arm.elf.M3").profiles["smp"] =
+        xdc.module("ti.targets.arm.elf.M3").profiles["debug"];
+xdc.module("ti.targets.arm.elf.M4").profiles["smp"] =
+        xdc.module("ti.targets.arm.elf.M4").profiles["debug"];
+
+/* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */
+for (arg = 0; arg < arguments.length; arg++) {
+    /*
+     * Get the compiler's installation directory.
+     * For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0"
+     */
+    var targetName = arguments[arg].split("=")[0];
+    var rootDir = arguments[arg].split("=")[1];
+
+    /* only build for the specified compilers */
+    if (rootDir == "" || rootDir == undefined) {
+        continue;
+    }
+
+    var target = xdc.useModule(targetName);
+    target.rootDir = rootDir;
+    target.ccOpts.suffix += ccOpts[targetName];
+
+    /* Add appropriate platforms to build for based on target name */    
+    if (targetName.match(/elf\.C674/)) {
+        target.platforms = [ "ti.platforms.evmOMAPL138:DSP" ];
+    }
+
+    if (targetName.match(/elf\.C66/)) {
+        target.platforms = [ 
+            "ti.platforms.simKepler"
+            //"ti.platforms.evm6614:DSP"
+        ];
+    }
+
+    Build.targets.$add(target);
+}
+
+
+/* lib/ is a generated directory that 'xdc clean' should remove */
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+Pkg.generatedFiles.$add("lib/");
+
+/*
+ * Some packages build for 'all profiles' - but that's too much to ship.
+ * Loop over all profiles in all Build.targets and remove everything
+ * except 'release' and 'debug'.
+ */
+for (var t = 0; t < Build.targets.length; t++) {
+    for (prof in Build.targets[t].profiles) {
+       if ((prof != 'release') && (prof != 'debug') && (prof != 'smp')) {
+            delete Build.targets[t].profiles[prof];
+        }
+    }
+}
+
+/* -----------------------------------------------------------------------*/
+/* make release files '.tar.gz' files (.tar is default) */
+Pkg.attrs.compress = true;
diff --git a/ipc-bios.mak b/ipc-bios.mak
new file mode 100644 (file)
index 0000000..b822000
--- /dev/null
@@ -0,0 +1,163 @@
+#
+#   Copyright (c) 2012-2013, Texas Instruments Incorporated
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#   *  Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   *  Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+#   *  Neither the name of Texas Instruments Incorporated nor the names of
+#      its contributors may be used to endorse or promote products derived
+#      from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+#   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+#   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+#   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+#   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#  ======== ipc.mak ========
+#
+
+#
+# Where to install/stage the packages
+# Typically this would point to the devkit location
+#
+DESTDIR ?= <UNDEFINED>
+
+packagesdir ?= /packages
+libdir ?= /lib
+includedir ?= /include
+
+ifeq ($(docdir),)
+docdir := /share/ti/ipc/doc
+packagedocdir := /docs/ipc
+else
+packagedocdir := $(docdir)
+endif
+
+ifeq ($(prefix),)
+prefix := /usr
+packageprefix := /
+else
+packageprefix := $(prefix)
+endif
+
+include ./products.mak
+
+#
+# Set XDCARGS to some of the variables above.  XDCARGS are passed
+# to the XDC build engine... which will load ipc-bios.bld... which will
+# extract these variables and use them to determine what to build and which
+# toolchains to use.
+#
+# Note that not all of these variables need to be set to something valid.
+# Unfortunately, since these vars are unconditionally assigned, your build line
+# will be longer and more noisy than necessary (e.g., it will include C66
+# assignment even if you're just building for C64P).
+#
+# Some background is here:
+#     http://rtsc.eclipse.org/docs-tip/Command_-_xdc#Environment_Variables
+#
+XDCARGS= \
+    ti.targets.C28_large=\"$(ti.targets.C28_large)\" \
+    ti.targets.C28_float=\"$(ti.targets.C28_float)\" \
+    ti.targets.C64P=\"$(ti.targets.C64P)\" \
+    ti.targets.C64P_big_endian=\"$(ti.targets.C64P_big_endian)\" \
+    ti.targets.C674=\"$(ti.targets.C674)\" \
+    ti.targets.arm.elf.Arm9=\"$(ti.targets.arm.elf.Arm9)\" \
+    ti.targets.arm.elf.A8F=\"$(ti.targets.arm.elf.A8F)\" \
+    ti.targets.arm.elf.A8Fnv=\"$(ti.targets.arm.elf.A8Fnv)\" \
+    ti.targets.arm.elf.M3=\"$(ti.targets.arm.elf.M3)\" \
+    ti.targets.arm.elf.M4=\"$(ti.targets.arm.elf.M4)\" \
+    ti.targets.arm.elf.M4F=\"$(ti.targets.arm.elf.M4F)\" \
+    ti.targets.elf.C64P=\"$(ti.targets.elf.C64P)\" \
+    ti.targets.elf.C64P_big_endian=\"$(ti.targets.elf.C64P_big_endian)\" \
+    ti.targets.elf.C64T=\"$(ti.targets.elf.C64T)\" \
+    ti.targets.elf.C66=\"$(ti.targets.elf.C66)\" \
+    ti.targets.elf.C66_big_endian=\"$(ti.targets.elf.C66_big_endian)\" \
+    ti.targets.elf.C674=\"$(ti.targets.elf.C674)\" \
+    ti.targets.arp32.elf.ARP32=\"$(ti.targets.arp32.elf.ARP32)\" \
+    ti.targets.arp32.elf.ARP32_far=\"$(ti.targets.arp32.elf.ARP32_far)\" \
+    gnu.targets.arm.A8F=\"$(gnu.targets.arm.A8F)\" \
+    gnu.targets.arm.A15F=\"$(gnu.targets.arm.A15F)\"
+
+#
+# Get list of packages to rebuild. Remove examples from the list.
+#
+XDCPKG := $(XDC_INSTALL_DIR)/bin/xdcpkg
+
+# Check for Windows specific env vars to determine if we are on Windows
+ifeq (,$(findstring :,$(WINDIR)$(windir)$(COMSPEC)$(comspec)))
+   FILTER = grep -v
+else
+   # Find is the rough equivalent of grep on Windows
+   FILTER = find /v
+   # Replace '/' with '\' because cmd.exe requires '\'s in command names
+   XDCPKG := $(subst /,\,$(XDCPKG))
+endif
+
+LIST = $(shell $(XDCPKG) ./packages | $(FILTER) "examples")
+
+#
+# Set XDCPATH to contain necessary repositories.
+#
+XDCPATH = $(BIOS_INSTALL_DIR)/packages
+export XDCPATH
+
+#
+# Set XDCOPTIONS.  Use -v for a verbose build.
+#
+#XDCOPTIONS=v
+export XDCOPTIONS
+
+#
+# Set XDC executable command
+# Note that XDCBUILDCFG points to the ipc-bios.bld file which uses
+# the arguments specified by XDCARGS
+#
+XDC = $(XDC_INSTALL_DIR)/xdc XDCARGS="$(XDCARGS)" XDCBUILDCFG=./ipc-bios.bld
+
+######################################################
+## Shouldnt have to modify anything below this line ##
+######################################################
+
+all:
+       @ echo building ipc packages ...
+# build everything in the Bios IPC package
+       @ $(XDC) -P $(LIST)
+
+release:
+       @ echo building ipc packages ...
+# create a XDC release for the Bios IPC package
+       @ $(XDC) release -P $(LIST)
+
+clean:
+       @ echo cleaning ipc packages ...
+       @ $(XDC) clean -Pr ./packages
+
+install-packages:
+       @ echo installing ipc packages to $(DESTDIR) ...
+       @ mkdir -p $(DESTDIR)/$(packageprefix)/$(packagedocdir)
+       @ cp -rf $(wildcard ipc_*_release_notes.html) docs/* $(DESTDIR)/$(packageprefix)/$(packagedocdir)
+       @ mkdir -p $(DESTDIR)/$(packageprefix)/$(packagesdir)
+       @ cp -rf packages/* $(DESTDIR)/$(packageprefix)/$(packagesdir)
+
+install:
+       @ echo installing ti/ipc to $(DESTDIR) ...
+       @ mkdir -p $(DESTDIR)/$(prefix)/$(docdir)
+       @ cp -rf $(wildcard ipc_*_release_notes.html) docs/* $(DESTDIR)/$(prefix)/$(docdir)
+       @ mkdir -p $(DESTDIR)/$(prefix)/$(includedir)/ti/ipc
+       @ cp -rf packages/ti/ipc/*.h $(DESTDIR)/$(prefix)/$(includedir)/ti/ipc
diff --git a/ipc-linux.mak b/ipc-linux.mak
new file mode 100644 (file)
index 0000000..a45278d
--- /dev/null
@@ -0,0 +1,58 @@
+#
+#   Copyright (c) 2012-2013, Texas Instruments Incorporated
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#   *  Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   *  Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+#   *  Neither the name of Texas Instruments Incorporated nor the names of
+#      its contributors may be used to endorse or promote products derived
+#      from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+#   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+#   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+#   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+#   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ======== Makefile ========
+#
+
+include products.mak
+
+.PHONY: config config-static config-shared
+
+config:
+       @echo "Configuring Linux Ipc ..."
+       ./configure --host=$(TOOLCHAIN_LONGNAME) \
+            CC=$(TOOLCHAIN_PREFIX)gcc \
+            PLATFORM=$(PLATFORM) \
+            CMEM_INSTALL_DIR=$(CMEM_INSTALL_DIR)
+
+config-static:
+       @echo "Configuring Linux Ipc static only libaries ..."
+       ./configure --host=$(TOOLCHAIN_LONGNAME) --disable-shared \
+            CC=$(TOOLCHAIN_PREFIX)gcc \
+            PLATFORM=$(PLATFORM) \
+            CMEM_INSTALL_DIR=$(CMEM_INSTALL_DIR)
+
+
+config-shared:
+       @echo "Configuring Linux Ipc shared (dynamic) only libaries ..."
+       ./configure --host=$(TOOLCHAIN_LONGNAME) --disable-static \
+            CC=$(TOOLCHAIN_PREFIX)gcc \
+            PLATFORM=$(PLATFORM) \
+            CMEM_INSTALL_DIR=$(CMEM_INSTALL_DIR)
diff --git a/linux/etc/Makefile.am b/linux/etc/Makefile.am
new file mode 100644 (file)
index 0000000..e571adc
--- /dev/null
@@ -0,0 +1,12 @@
+# etc/Makefile.am
+
+###############################################################################
+
+# Additional file to be added to the distribution
+EXTRA_DIST =    \
+                 omapl138 \
+                 panda \
+                 tci66xx \
+                 run_lad.sh
+                                               
+###############################################################################
diff --git a/linux/etc/Makefile.in b/linux/etc/Makefile.in
new file mode 100644 (file)
index 0000000..451c040
--- /dev/null
@@ -0,0 +1,332 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# etc/Makefile.am
+
+###############################################################################
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = linux/etc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+# Additional file to be added to the distribution
+EXTRA_DIST = \
+                 omapl138 \
+                 panda \
+                 tci66xx \
+                 run_lad.sh
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  linux/etc/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  linux/etc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+       distclean distclean-generic distclean-libtool distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-exec install-exec-am \
+       install-info install-info-am install-man install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-info-am
+
+
+###############################################################################
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/linux/etc/omapl138/dump_trace.sh b/linux/etc/omapl138/dump_trace.sh
new file mode 100644 (file)
index 0000000..33d08fc
--- /dev/null
@@ -0,0 +1,2 @@
+echo "Core 0 Trace..."
+cat /debug/remoteproc/davinci-rproc.0/trace0
diff --git a/linux/etc/omapl138/hawkboard_rpmsg_3.4_rc1.config b/linux/etc/omapl138/hawkboard_rpmsg_3.4_rc1.config
new file mode 100644 (file)
index 0000000..181c97f
--- /dev/null
@@ -0,0 +1,1792 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0-rc1 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_CHIP=y
+
+#
+# RCU Subsystem
+#
+CONFIG_TINY_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+# CONFIG_EMBEDDED is not set
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+# CONFIG_JUMP_LABEL is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_MSM is not set
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+CONFIG_ARCH_DAVINCI=y
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+CONFIG_CP_INTC=y
+
+#
+# TI DaVinci Implementations
+#
+
+#
+# DaVinci Core Type
+#
+# CONFIG_ARCH_DAVINCI_DM644x is not set
+# CONFIG_ARCH_DAVINCI_DM355 is not set
+# CONFIG_ARCH_DAVINCI_DM646x is not set
+CONFIG_ARCH_DAVINCI_DA830=y
+CONFIG_ARCH_DAVINCI_DA850=y
+CONFIG_ARCH_DAVINCI_DA8XX=y
+# CONFIG_ARCH_DAVINCI_DM365 is not set
+# CONFIG_ARCH_DAVINCI_TNETV107X is not set
+
+#
+# DaVinci Board Type
+#
+# CONFIG_MACH_DAVINCI_DA830_EVM is not set
+# CONFIG_MACH_DAVINCI_DA850_EVM is not set
+CONFIG_GPIO_PCA953X=y
+CONFIG_KEYBOARD_GPIO_POLLED=y
+# CONFIG_MACH_MITYOMAPL138 is not set
+CONFIG_MACH_OMAPL138_HAWKBOARD=y
+CONFIG_DAVINCI_MUX=y
+# CONFIG_DAVINCI_MUX_DEBUG is not set
+# CONFIG_DAVINCI_MUX_WARNINGS is not set
+# CONFIG_DAVINCI_RESET_CLOCKS is not set
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_ARM926T=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5TJ=y
+CONFIG_CPU_PABRT_LEGACY=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_COPY_V4WB=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_USE_DOMAINS=y
+
+#
+# Processor Features
+#
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+CONFIG_CPU_DCACHE_WRITETHROUGH=y
+# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT=5
+CONFIG_ARM_NR_BANKS=8
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+CONFIG_HAVE_ARCH_PFN_VALID=y
+# CONFIG_HIGHMEM is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=999999
+# CONFIG_COMPACTION is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_NEED_PER_CPU_KM=y
+# CONFIG_CLEANCACHE is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_LEDS=y
+# CONFIG_LEDS_CPU is not set
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+# CONFIG_CC_STACKPROTECTOR is not set
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+
+#
+# Boot options
+#
+# CONFIG_USE_OF is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+
+#
+# ARM CPU frequency scaling drivers
+#
+# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_VFP is not set
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_PM_SLEEP=y
+# CONFIG_PM_RUNTIME is not set
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=m
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_UDP_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=m
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+CONFIG_INET6_XFRM_MODE_TRANSPORT=m
+CONFIG_INET6_XFRM_MODE_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_BEET=m
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+# CONFIG_NETFILTER_NETLINK_QUEUE is not set
+# CONFIG_NETFILTER_NETLINK_LOG is not set
+# CONFIG_NF_CONNTRACK is not set
+# CONFIG_NETFILTER_XTABLES is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+# CONFIG_NF_DEFRAG_IPV4 is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+
+#
+# IPv6: Netfilter Configuration
+#
+# CONFIG_NF_DEFRAG_IPV6 is not set
+# CONFIG_IP6_NF_QUEUE is not set
+# CONFIG_IP6_NF_IPTABLES is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+# CONFIG_DNS_RESOLVER is not set
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=m
+# CONFIG_DMA_SHARED_BUFFER is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=1
+CONFIG_BLK_DEV_RAM_SIZE=32768
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_VIRTIO_BLK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+CONFIG_EEPROM_AT24=y
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=m
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=m
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=m
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+# CONFIG_CHR_DEV_SCH is not set
+# CONFIG_SCSI_MULTI_LUN is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_VIRTIO is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+# CONFIG_DUMMY is not set
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+CONFIG_NETCONSOLE=y
+CONFIG_NETPOLL=y
+CONFIG_NETPOLL_TRAP=y
+CONFIG_NET_POLL_CONTROLLER=y
+CONFIG_TUN=m
+# CONFIG_VETH is not set
+# CONFIG_VIRTIO_NET is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+# CONFIG_SMC91X is not set
+# CONFIG_SMC911X is not set
+# CONFIG_SMSC911X is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_NET_VENDOR_TI=y
+CONFIG_TI_DAVINCI_EMAC=y
+CONFIG_TI_DAVINCI_MDIO=y
+CONFIG_TI_DAVINCI_CPDMA=y
+# CONFIG_TI_CPSW is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+CONFIG_LXT_PHY=y
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+CONFIG_LSI_ET1011C_PHY=y
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_IPHETH is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+CONFIG_INPUT_POLLDEV=y
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=m
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=m
+CONFIG_INPUT_EVBUG=m
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=m
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+CONFIG_KEYBOARD_XTKBD=m
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+# CONFIG_VT_CONSOLE is not set
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=3
+CONFIG_SERIAL_8250_RUNTIME_UARTS=3
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_VIRTIO_CONSOLE is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=m
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+# CONFIG_HW_RANDOM_VIRTIO is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+CONFIG_I2C_DAVINCI=y
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_SPI is not set
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+# CONFIG_GPIO_SYSFS is not set
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCA953X_IRQ is not set
+CONFIG_GPIO_PCF857X=y
+# CONFIG_GPIO_SX150X is not set
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MCP23S08 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_CORE is not set
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+# CONFIG_DW_WATCHDOG is not set
+# CONFIG_DAVINCI_WATCHDOG is not set
+# CONFIG_MAX63XX_WATCHDOG is not set
+
+#
+# USB-based Watchdog Cards
+#
+# CONFIG_USBPCWATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_MFD_WL1273_CORE is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+CONFIG_REGULATOR_DUMMY=y
+# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+# CONFIG_REGULATOR_GPIO is not set
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+CONFIG_REGULATOR_TPS6507X=y
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_CFB_REV_PIXELS_IN_BYTE=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+CONFIG_FB_DA8XX=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_EXYNOS_VIDEO is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Console display driver support
+#
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_SOUND=m
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=m
+CONFIG_SND_TIMER=m
+CONFIG_SND_PCM=m
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+CONFIG_SND_ARM=y
+CONFIG_SND_USB=y
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=m
+CONFIG_SND_DAVINCI_SOC=m
+CONFIG_SND_SOC_I2C_AND_SPI=m
+# CONFIG_SND_SOC_ALL_CODECS is not set
+# CONFIG_SOUND_PRIME is not set
+# CONFIG_HID_SUPPORT is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_OHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+# CONFIG_USB_STORAGE is not set
+# CONFIG_USB_UAS is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_DAVINCI=y
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+CONFIG_VIRTIO=m
+CONFIG_VIRTIO_RING=m
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+# CONFIG_STAGING is not set
+CONFIG_CLKDEV_LOOKUP=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_IOMMU_SUPPORT=y
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+CONFIG_REMOTEPROC=m
+CONFIG_DAVINCI_REMOTEPROC=m
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+CONFIG_RPMSG=m
+# CONFIG_RPMSG_SERVER_SAMPLE is not set
+# CONFIG_RPMSG_OMX is not set
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+CONFIG_AUTOFS4_FS=m
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+CONFIG_ROOT_NFS=y
+CONFIG_NFS_USE_LEGACY_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+CONFIG_NLS_UTF8=m
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_SECTION_MISMATCH is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+CONFIG_SCHED_DEBUG=y
+# CONFIG_SCHEDSTATS is not set
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+CONFIG_DEBUG_PREEMPT=y
+CONFIG_DEBUG_RT_MUTEXES=y
+CONFIG_DEBUG_PI_LIST=y
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_LKDTM is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_LL is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+# CONFIG_CRYPTO_HW is not set
+# CONFIG_BINARY_PRINTF is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=m
+# CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/linux/etc/omapl138/load_firmware.sh b/linux/etc/omapl138/load_firmware.sh
new file mode 100644 (file)
index 0000000..51be2cb
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+depmod -a
+if [ ! -d "/debug" ]; then
+       mkdir /debug
+fi
+mount -t debugfs none /debug
+echo 8 > /proc/sys/kernel/printk
+modprobe remoteproc
+modprobe davinci_remoteproc
+modprobe virtio_rpmsg_bus
+modprobe rpmsg_proto
+echo 0 > /proc/sys/kernel/printk
diff --git a/linux/etc/omapl138/nano_test.sh b/linux/etc/omapl138/nano_test.sh
new file mode 100644 (file)
index 0000000..59d4e2a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -x
+if [ ! -z "$1" ]
+then
+   numsecs=$1
+else
+   numsecs=10
+fi
+echo "Piping" $numsecs "seconds of data to DSP at 96Khz..."
+arecord -d $numsecs -r 96000 -f S32_LE -D default:CARD=EVM -t raw | nano_test
diff --git a/linux/etc/omapl138/omapl138_rpmsg_3.4_rc1.config b/linux/etc/omapl138/omapl138_rpmsg_3.4_rc1.config
new file mode 100644 (file)
index 0000000..fd78630
--- /dev/null
@@ -0,0 +1,1798 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0-rc1 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_CHIP=y
+
+#
+# RCU Subsystem
+#
+CONFIG_TINY_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+# CONFIG_EMBEDDED is not set
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+# CONFIG_JUMP_LABEL is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_DEFAULT_NOOP=y
+CONFIG_DEFAULT_IOSCHED="noop"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_MSM is not set
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+CONFIG_ARCH_DAVINCI=y
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+CONFIG_CP_INTC=y
+
+#
+# TI DaVinci Implementations
+#
+
+#
+# DaVinci Core Type
+#
+# CONFIG_ARCH_DAVINCI_DM644x is not set
+# CONFIG_ARCH_DAVINCI_DM355 is not set
+# CONFIG_ARCH_DAVINCI_DM646x is not set
+CONFIG_ARCH_DAVINCI_DA830=y
+CONFIG_ARCH_DAVINCI_DA850=y
+CONFIG_ARCH_DAVINCI_DA8XX=y
+# CONFIG_ARCH_DAVINCI_DM365 is not set
+# CONFIG_ARCH_DAVINCI_TNETV107X is not set
+
+#
+# DaVinci Board Type
+#
+# CONFIG_MACH_DAVINCI_DA830_EVM is not set
+CONFIG_MACH_DAVINCI_DA850_EVM=y
+CONFIG_DA850_UI_NONE=y
+# CONFIG_DA850_UI_RMII is not set
+# CONFIG_DA850_WL12XX is not set
+CONFIG_GPIO_PCA953X=y
+CONFIG_KEYBOARD_GPIO_POLLED=y
+# CONFIG_MACH_MITYOMAPL138 is not set
+# CONFIG_MACH_OMAPL138_HAWKBOARD is not set
+CONFIG_DAVINCI_MUX=y
+# CONFIG_DAVINCI_MUX_DEBUG is not set
+# CONFIG_DAVINCI_MUX_WARNINGS is not set
+# CONFIG_DAVINCI_RESET_CLOCKS is not set
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_ARM926T=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5TJ=y
+CONFIG_CPU_PABRT_LEGACY=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_COPY_V4WB=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_USE_DOMAINS=y
+
+#
+# Processor Features
+#
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+CONFIG_CPU_DCACHE_WRITETHROUGH=y
+# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT=5
+CONFIG_ARM_NR_BANKS=8
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+CONFIG_HAVE_ARCH_PFN_VALID=y
+# CONFIG_HIGHMEM is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=999999
+# CONFIG_COMPACTION is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_NEED_PER_CPU_KM=y
+# CONFIG_CLEANCACHE is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_LEDS=y
+# CONFIG_LEDS_CPU is not set
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+# CONFIG_CC_STACKPROTECTOR is not set
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+
+#
+# Boot options
+#
+# CONFIG_USE_OF is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+
+#
+# ARM CPU frequency scaling drivers
+#
+# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_VFP is not set
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_PM_SLEEP=y
+# CONFIG_PM_RUNTIME is not set
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=m
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_UDP_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=m
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+CONFIG_INET6_XFRM_MODE_TRANSPORT=m
+CONFIG_INET6_XFRM_MODE_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_BEET=m
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+# CONFIG_NETFILTER_NETLINK_QUEUE is not set
+# CONFIG_NETFILTER_NETLINK_LOG is not set
+# CONFIG_NF_CONNTRACK is not set
+# CONFIG_NETFILTER_XTABLES is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+# CONFIG_NF_DEFRAG_IPV4 is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+
+#
+# IPv6: Netfilter Configuration
+#
+# CONFIG_NF_DEFRAG_IPV6 is not set
+# CONFIG_IP6_NF_QUEUE is not set
+# CONFIG_IP6_NF_IPTABLES is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+# CONFIG_DNS_RESOLVER is not set
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+# CONFIG_DMA_SHARED_BUFFER is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=1
+CONFIG_BLK_DEV_RAM_SIZE=32768
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_VIRTIO_BLK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+CONFIG_EEPROM_AT24=y
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=m
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=m
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=m
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+# CONFIG_CHR_DEV_SCH is not set
+# CONFIG_SCSI_MULTI_LUN is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_VIRTIO is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+# CONFIG_DUMMY is not set
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+CONFIG_NETCONSOLE=y
+CONFIG_NETPOLL=y
+CONFIG_NETPOLL_TRAP=y
+CONFIG_NET_POLL_CONTROLLER=y
+CONFIG_TUN=m
+# CONFIG_VETH is not set
+# CONFIG_VIRTIO_NET is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+# CONFIG_SMC91X is not set
+# CONFIG_SMC911X is not set
+# CONFIG_SMSC911X is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_NET_VENDOR_TI=y
+CONFIG_TI_DAVINCI_EMAC=y
+CONFIG_TI_DAVINCI_MDIO=y
+CONFIG_TI_DAVINCI_CPDMA=y
+# CONFIG_TI_CPSW is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+CONFIG_LXT_PHY=y
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+CONFIG_LSI_ET1011C_PHY=y
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_IPHETH is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_HOSTAP is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+CONFIG_INPUT_POLLDEV=y
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=m
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=m
+CONFIG_INPUT_EVBUG=m
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=m
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+CONFIG_KEYBOARD_XTKBD=m
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+# CONFIG_VT_CONSOLE is not set
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=3
+CONFIG_SERIAL_8250_RUNTIME_UARTS=3
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_VIRTIO_CONSOLE is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=m
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+# CONFIG_HW_RANDOM_VIRTIO is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+CONFIG_I2C_DAVINCI=y
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_SPI is not set
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+# CONFIG_GPIO_SYSFS is not set
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCA953X_IRQ is not set
+CONFIG_GPIO_PCF857X=y
+# CONFIG_GPIO_SX150X is not set
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MCP23S08 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_CORE is not set
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+# CONFIG_DW_WATCHDOG is not set
+# CONFIG_DAVINCI_WATCHDOG is not set
+# CONFIG_MAX63XX_WATCHDOG is not set
+
+#
+# USB-based Watchdog Cards
+#
+# CONFIG_USBPCWATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_MFD_WL1273_CORE is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+CONFIG_REGULATOR_DUMMY=y
+# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+# CONFIG_REGULATOR_GPIO is not set
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+CONFIG_REGULATOR_TPS6507X=y
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_CFB_REV_PIXELS_IN_BYTE=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+CONFIG_FB_DA8XX=y
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_EXYNOS_VIDEO is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Console display driver support
+#
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+CONFIG_SND_ARM=y
+CONFIG_SND_USB=y
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=y
+CONFIG_SND_DAVINCI_SOC=y
+CONFIG_SND_DAVINCI_SOC_MCASP=y
+CONFIG_SND_DA850_SOC_EVM=y
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_TLV320AIC3X=y
+# CONFIG_SOUND_PRIME is not set
+# CONFIG_HID_SUPPORT is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_OHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+# CONFIG_USB_STORAGE is not set
+# CONFIG_USB_UAS is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_DAVINCI=y
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+CONFIG_VIRTIO=m
+CONFIG_VIRTIO_RING=m
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+# CONFIG_STAGING is not set
+CONFIG_CLKDEV_LOOKUP=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_IOMMU_SUPPORT=y
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+CONFIG_REMOTEPROC=m
+CONFIG_DAVINCI_REMOTEPROC=m
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+CONFIG_RPMSG=m
+# CONFIG_RPMSG_SERVER_SAMPLE is not set
+# CONFIG_RPMSG_OMX is not set
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+CONFIG_AUTOFS4_FS=m
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+CONFIG_ROOT_NFS=y
+CONFIG_NFS_USE_LEGACY_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+CONFIG_NLS_UTF8=m
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_SECTION_MISMATCH is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+CONFIG_SCHED_DEBUG=y
+# CONFIG_SCHEDSTATS is not set
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+CONFIG_DEBUG_PREEMPT=y
+CONFIG_DEBUG_RT_MUTEXES=y
+CONFIG_DEBUG_PI_LIST=y
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_LKDTM is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_DYNAMIC_DEBUG=y
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_LL is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+# CONFIG_CRYPTO_HW is not set
+# CONFIG_BINARY_PRINTF is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=m
+# CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/linux/etc/omapl138/unload_firmware.sh b/linux/etc/omapl138/unload_firmware.sh
new file mode 100644 (file)
index 0000000..e35ca31
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+rmmod rpmsg_proto
+rmmod virtio_rpmsg_bus
+rmmod davinci_remoteproc
+rmmod remoteproc
diff --git a/linux/etc/panda/dump_trace.sh b/linux/etc/panda/dump_trace.sh
new file mode 100644 (file)
index 0000000..6b2ffb6
--- /dev/null
@@ -0,0 +1,2 @@
+echo "Core 0 Trace..."
+cat /debug/remoteproc/omap-rproc.1/trace0
diff --git a/linux/etc/panda/load_firmware.sh b/linux/etc/panda/load_firmware.sh
new file mode 100644 (file)
index 0000000..2540d38
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+depmod -a
+if [ ! -d "/debug" ]; then
+       mkdir /debug
+fi
+mount -t debugfs none /debug
+modprobe remoteproc
+modprobe omap_remoteproc
+modprobe virtio_rpmsg_bus
+modprobe rpmsg_proto
diff --git a/linux/etc/panda/panda_rpmsg_3.4_rc1.config b/linux/etc/panda/panda_rpmsg_3.4_rc1.config
new file mode 100644 (file)
index 0000000..d4ac6bd
--- /dev/null
@@ -0,0 +1,2684 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0-rc1 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_IRQ_DOMAIN=y
+# CONFIG_IRQ_DOMAIN_DEBUG is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_PREEMPT_RCU is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_RCU_FAST_NO_HZ is not set
+# CONFIG_TREE_RCU_TRACE is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=16
+# CONFIG_CGROUPS is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+# CONFIG_EMBEDDED is not set
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_COMPAT_BRK=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_KPROBES=y
+# CONFIG_JUMP_LABEL is not set
+CONFIG_KRETPROBES=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_FORCE_LOAD=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_MODVERSIONS is not set
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_MSM is not set
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+# CONFIG_ARCH_DAVINCI is not set
+CONFIG_ARCH_OMAP=y
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+
+#
+# TI OMAP Common Features
+#
+CONFIG_ARCH_OMAP_OTG=y
+# CONFIG_ARCH_OMAP1 is not set
+CONFIG_ARCH_OMAP2PLUS=y
+
+#
+# OMAP Feature Selections
+#
+CONFIG_OMAP_DEBUG_DEVICES=y
+# CONFIG_OMAP_SMARTREFLEX is not set
+CONFIG_OMAP_RESET_CLOCKS=y
+CONFIG_OMAP_MUX=y
+CONFIG_OMAP_MUX_DEBUG=y
+CONFIG_OMAP_MUX_WARNINGS=y
+CONFIG_OMAP_MBOX_FWK=y
+CONFIG_OMAP_MBOX_KFIFO_SIZE=256
+CONFIG_OMAP_32K_TIMER=y
+# CONFIG_OMAP3_L2_AUX_SECURE_SAVE_RESTORE is not set
+CONFIG_OMAP_32K_TIMER_HZ=128
+CONFIG_OMAP_DM_TIMER=y
+CONFIG_OMAP_PM_NOOP=y
+CONFIG_MACH_OMAP_GENERIC=y
+
+#
+# TI OMAP2/3/4 Specific Features
+#
+CONFIG_ARCH_OMAP2PLUS_TYPICAL=y
+CONFIG_ARCH_OMAP2=y
+CONFIG_ARCH_OMAP3=y
+CONFIG_ARCH_OMAP4=y
+
+#
+# OMAP Core Type
+#
+CONFIG_SOC_OMAP2420=y
+CONFIG_SOC_OMAP2430=y
+CONFIG_SOC_OMAP3430=y
+CONFIG_SOC_OMAPTI81XX=y
+CONFIG_SOC_OMAPAM33XX=y
+CONFIG_OMAP_PACKAGE_ZAF=y
+CONFIG_OMAP_PACKAGE_ZAC=y
+CONFIG_OMAP_PACKAGE_CBB=y
+CONFIG_OMAP_PACKAGE_CUS=y
+CONFIG_OMAP_PACKAGE_CBP=y
+CONFIG_OMAP_PACKAGE_CBL=y
+CONFIG_OMAP_PACKAGE_CBS=y
+
+#
+# OMAP Board Type
+#
+CONFIG_MACH_OMAP2_TUSB6010=y
+CONFIG_MACH_OMAP_H4=y
+CONFIG_MACH_OMAP_APOLLON=y
+CONFIG_MACH_OMAP_2430SDP=y
+CONFIG_MACH_OMAP3_BEAGLE=y
+CONFIG_MACH_DEVKIT8000=y
+CONFIG_MACH_OMAP_LDP=y
+CONFIG_MACH_OMAP3530_LV_SOM=y
+CONFIG_MACH_OMAP3_TORPEDO=y
+CONFIG_MACH_OVERO=y
+CONFIG_MACH_OMAP3EVM=y
+CONFIG_MACH_OMAP3517EVM=y
+# CONFIG_MACH_CRANEBOARD is not set
+CONFIG_MACH_OMAP3_PANDORA=y
+CONFIG_MACH_OMAP3_TOUCHBOOK=y
+CONFIG_MACH_OMAP_3430SDP=y
+CONFIG_MACH_NOKIA_N800=y
+CONFIG_MACH_NOKIA_N810=y
+CONFIG_MACH_NOKIA_N810_WIMAX=y
+CONFIG_MACH_NOKIA_N8X0=y
+CONFIG_MACH_NOKIA_RM680=y
+CONFIG_MACH_NOKIA_RX51=y
+CONFIG_MACH_OMAP_ZOOM2=y
+CONFIG_MACH_OMAP_ZOOM3=y
+CONFIG_MACH_CM_T35=y
+CONFIG_MACH_CM_T3517=y
+CONFIG_MACH_CM_T3730=y
+CONFIG_MACH_IGEP0020=y
+CONFIG_MACH_IGEP0030=y
+CONFIG_MACH_SBC3530=y
+CONFIG_MACH_OMAP_3630SDP=y
+CONFIG_MACH_TI8168EVM=y
+CONFIG_MACH_TI8148EVM=y
+CONFIG_MACH_OMAP_4430SDP=y
+CONFIG_MACH_OMAP4_PANDA=y
+# CONFIG_OMAP3_EMU is not set
+# CONFIG_OMAP3_SDRC_AC_TIMING is not set
+# CONFIG_OMAP4_ERRATA_I688 is not set
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_V6=y
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV6=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V6=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V6=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_USE_DOMAINS=y
+
+#
+# Processor Features
+#
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+CONFIG_ARM_THUMBEE=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_OUTER_CACHE=y
+CONFIG_OUTER_CACHE_SYNC=y
+CONFIG_CACHE_L2X0=y
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+CONFIG_ARM_NR_BANKS=8
+CONFIG_MULTI_IRQ_HANDLER=y
+CONFIG_ARM_ERRATA_411920=y
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_742230 is not set
+# CONFIG_ARM_ERRATA_742231 is not set
+CONFIG_PL310_ERRATA_588369=y
+CONFIG_ARM_ERRATA_720789=y
+CONFIG_PL310_ERRATA_727915=y
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+# CONFIG_ARM_ERRATA_764369 is not set
+# CONFIG_PL310_ERRATA_769419 is not set
+CONFIG_ARM_GIC=y
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_HAVE_SMP=y
+CONFIG_SMP=y
+CONFIG_SMP_ON_UP=y
+CONFIG_ARM_CPU_TOPOLOGY=y
+# CONFIG_SCHED_MC is not set
+# CONFIG_SCHED_SMT is not set
+CONFIG_HAVE_ARM_SCU=y
+CONFIG_HAVE_ARM_TWD=y
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_NR_CPUS=2
+CONFIG_HOTPLUG_CPU=y
+CONFIG_LOCAL_TIMERS=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_HZ=128
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+CONFIG_HAVE_ARCH_PFN_VALID=y
+# CONFIG_HIGHMEM is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=999999
+# CONFIG_COMPACTION is not set
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+# CONFIG_CLEANCACHE is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_LEDS=y
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+# CONFIG_CC_STACKPROTECTOR is not set
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+
+#
+# Boot options
+#
+CONFIG_USE_OF=y
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+# CONFIG_ARM_APPENDED_DTB is not set
+CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
+# CONFIG_CMDLINE_EXTEND is not set
+# CONFIG_CMDLINE_FORCE is not set
+# CONFIG_XIP_KERNEL is not set
+CONFIG_KEXEC=y
+CONFIG_ATAGS_PROC=y
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+# CONFIG_CPU_FREQ is not set
+# CONFIG_CPU_IDLE is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+CONFIG_BINFMT_MISC=y
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
+CONFIG_PM_DEBUG=y
+# CONFIG_PM_ADVANCED_DEBUG is not set
+# CONFIG_PM_TEST_SUSPEND is not set
+CONFIG_CAN_PM_TRACE=y
+# CONFIG_APM_EMULATION is not set
+CONFIG_ARCH_HAS_OPP=y
+CONFIG_PM_OPP=y
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+# CONFIG_XFRM_SUB_POLICY is not set
+CONFIG_XFRM_MIGRATE=y
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_NET_KEY=y
+CONFIG_NET_KEY_MIGRATE=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_UDP_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETLABEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+# CONFIG_NETFILTER_NETLINK_QUEUE is not set
+# CONFIG_NETFILTER_NETLINK_LOG is not set
+# CONFIG_NF_CONNTRACK is not set
+# CONFIG_NETFILTER_XTABLES is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+# CONFIG_NF_DEFRAG_IPV4 is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+CONFIG_DNS_RESOLVER=y
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_RPS=y
+CONFIG_RFS_ACCEL=y
+CONFIG_XPS=y
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=m
+# CONFIG_BT_RFCOMM is not set
+# CONFIG_BT_BNEP is not set
+# CONFIG_BT_HIDP is not set
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIBTUSB is not set
+# CONFIG_BT_HCIBTSDIO is not set
+CONFIG_BT_HCIUART=m
+CONFIG_BT_HCIUART_H4=y
+CONFIG_BT_HCIUART_BCSP=y
+# CONFIG_BT_HCIUART_ATH3K is not set
+CONFIG_BT_HCIUART_LL=y
+CONFIG_BT_HCIBCM203X=m
+CONFIG_BT_HCIBPA10X=m
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_BT_MRVL is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_CFG80211=m
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_DEBUGFS is not set
+# CONFIG_CFG80211_INTERNAL_REGDB is not set
+CONFIG_CFG80211_WEXT=y
+# CONFIG_WIRELESS_EXT_SYSFS is not set
+CONFIG_LIB80211=m
+# CONFIG_LIB80211_DEBUG is not set
+CONFIG_MAC80211=m
+CONFIG_MAC80211_HAS_RC=y
+CONFIG_MAC80211_RC_PID=y
+CONFIG_MAC80211_RC_MINSTREL=y
+CONFIG_MAC80211_RC_MINSTREL_HT=y
+CONFIG_MAC80211_RC_DEFAULT_PID=y
+# CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set
+CONFIG_MAC80211_RC_DEFAULT="pid"
+# CONFIG_MAC80211_MESH is not set
+# CONFIG_MAC80211_DEBUGFS is not set
+# CONFIG_MAC80211_DEBUG_MENU is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGMAP_SPI=m
+# CONFIG_DMA_SHARED_BUFFER is not set
+CONFIG_CMA=y
+CONFIG_CMA_DEBUG=y
+
+#
+# Default contiguous memory area size:
+#
+CONFIG_CMA_SIZE_MBYTES=16
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+CONFIG_CONNECTOR=y
+CONFIG_PROC_EVENTS=y
+CONFIG_MTD=y
+# CONFIG_MTD_TESTS is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_OF_PARTS is not set
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_SM_FTL is not set
+CONFIG_MTD_OOPS=y
+# CONFIG_MTD_SWAP is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_PHYSMAP_OF is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SST25L is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_DOCG3 is not set
+CONFIG_MTD_NAND_ECC=y
+# CONFIG_MTD_NAND_ECC_SMC is not set
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_BCH is not set
+# CONFIG_MTD_SM_COMMON is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+# CONFIG_MTD_NAND_GPIO is not set
+CONFIG_MTD_NAND_OMAP2=y
+CONFIG_MTD_NAND_IDS=y
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_DOCG4 is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+# CONFIG_MTD_NAND_PLATFORM is not set
+# CONFIG_MTD_ALAUDA is not set
+CONFIG_MTD_ONENAND=y
+CONFIG_MTD_ONENAND_VERIFY_WRITE=y
+# CONFIG_MTD_ONENAND_GENERIC is not set
+CONFIG_MTD_ONENAND_OMAP2=y
+# CONFIG_MTD_ONENAND_OTP is not set
+# CONFIG_MTD_ONENAND_2X_PROGRAM is not set
+# CONFIG_MTD_ONENAND_SIM is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MTD_UBI_BEB_RESERVE=1
+# CONFIG_MTD_UBI_GLUEBI is not set
+# CONFIG_MTD_UBI_DEBUG is not set
+CONFIG_DTC=y
+CONFIG_OF=y
+
+#
+# Device Tree and Open Firmware support
+#
+CONFIG_PROC_DEVICETREE=y
+# CONFIG_OF_SELFTEST is not set
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_DEVICE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_I2C=y
+CONFIG_OF_NET=y
+CONFIG_OF_SPI=y
+CONFIG_OF_MDIO=y
+CONFIG_OF_MTD=y
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_DRBD is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=16384
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+CONFIG_VIRTIO_BLK=m
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+CONFIG_EEPROM_93CX6=y
+# CONFIG_EEPROM_93XX46 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+# CONFIG_CHR_DEV_SCH is not set
+CONFIG_SCSI_MULTI_LUN=y
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+CONFIG_SCSI_SCAN_ASYNC=y
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_VIRTIO is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+# CONFIG_BLK_DEV_DM is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+# CONFIG_DUMMY is not set
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+CONFIG_VIRTIO_NET=m
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+CONFIG_KS8851=y
+CONFIG_KS8851_MLL=y
+CONFIG_NET_VENDOR_MICROCHIP=y
+# CONFIG_ENC28J60 is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+# CONFIG_SMC911X is not set
+CONFIG_SMSC911X=y
+# CONFIG_SMSC911X_ARCH_HOOKS is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_NET_VENDOR_TI=y
+# CONFIG_TI_DAVINCI_EMAC is not set
+# CONFIG_TI_DAVINCI_MDIO is not set
+# CONFIG_TI_DAVINCI_CPDMA is not set
+# CONFIG_TI_CPSW is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+CONFIG_SMSC_PHY=y
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MICREL_KS8995MA is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+CONFIG_USB_USBNET=y
+CONFIG_USB_NET_AX8817X=y
+CONFIG_USB_NET_CDCETHER=y
+# CONFIG_USB_NET_CDC_EEM is not set
+CONFIG_USB_NET_CDC_NCM=y
+# CONFIG_USB_NET_DM9601 is not set
+# CONFIG_USB_NET_SMSC75XX is not set
+CONFIG_USB_NET_SMSC95XX=y
+# CONFIG_USB_NET_GL620A is not set
+CONFIG_USB_NET_NET1080=y
+# CONFIG_USB_NET_PLUSB is not set
+# CONFIG_USB_NET_MCS7830 is not set
+# CONFIG_USB_NET_RNDIS_HOST is not set
+CONFIG_USB_NET_CDC_SUBSET=y
+CONFIG_USB_ALI_M5632=y
+CONFIG_USB_AN2720=y
+CONFIG_USB_BELKIN=y
+CONFIG_USB_ARMLINUX=y
+CONFIG_USB_EPSON2888=y
+CONFIG_USB_KC2190=y
+CONFIG_USB_NET_ZAURUS=y
+# CONFIG_USB_NET_CX82310_ETH is not set
+# CONFIG_USB_NET_KALMIA is not set
+# CONFIG_USB_NET_QMI_WWAN is not set
+# CONFIG_USB_NET_INT51X1 is not set
+# CONFIG_USB_IPHETH is not set
+# CONFIG_USB_SIERRA_NET is not set
+# CONFIG_USB_VL600 is not set
+CONFIG_WLAN=y
+# CONFIG_LIBERTAS_THINFIRM is not set
+# CONFIG_AT76C50X_USB is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_RTL8187 is not set
+# CONFIG_MAC80211_HWSIM is not set
+# CONFIG_ATH_COMMON is not set
+# CONFIG_B43 is not set
+# CONFIG_B43LEGACY is not set
+# CONFIG_BRCMFMAC is not set
+# CONFIG_HOSTAP is not set
+# CONFIG_IWM is not set
+CONFIG_LIBERTAS=m
+CONFIG_LIBERTAS_USB=m
+CONFIG_LIBERTAS_SDIO=m
+# CONFIG_LIBERTAS_SPI is not set
+CONFIG_LIBERTAS_DEBUG=y
+# CONFIG_LIBERTAS_MESH is not set
+# CONFIG_P54_COMMON is not set
+# CONFIG_RT2X00 is not set
+# CONFIG_RTL8192CU is not set
+# CONFIG_WL1251 is not set
+# CONFIG_WL12XX_MENU is not set
+# CONFIG_ZD1211RW is not set
+# CONFIG_MWIFIEX is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+CONFIG_INPUT_JOYDEV=y
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+CONFIG_KEYBOARD_TWL4030=y
+# CONFIG_KEYBOARD_XTKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_MOUSE_SYNAPTICS_USB is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+CONFIG_TOUCHSCREEN_ADS7846=y
+# CONFIG_TOUCHSCREEN_AD7877 is not set
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_TI_TSCADC is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2005 is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_AD714X is not set
+# CONFIG_INPUT_BMA150 is not set
+# CONFIG_INPUT_MMA8450 is not set
+# CONFIG_INPUT_MPU3050 is not set
+# CONFIG_INPUT_GP2A is not set
+# CONFIG_INPUT_GPIO_TILT_POLLED is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_KXTJ9 is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+# CONFIG_INPUT_CM109 is not set
+CONFIG_INPUT_TWL4030_PWRBUTTON=y
+# CONFIG_INPUT_TWL4030_VIBRA is not set
+# CONFIG_INPUT_TWL6040_VIBRA is not set
+# CONFIG_INPUT_UINPUT is not set
+# CONFIG_INPUT_PCF8574 is not set
+# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
+# CONFIG_INPUT_ADXL34X is not set
+# CONFIG_INPUT_CMA3000 is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_VT_CONSOLE_SLEEP=y
+CONFIG_HW_CONSOLE=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=32
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_MANY_PORTS=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_8250_DETECT_IRQ=y
+CONFIG_SERIAL_8250_RSA=y
+# CONFIG_SERIAL_8250_DW is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+# CONFIG_SERIAL_MAX3107 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_OF_PLATFORM is not set
+CONFIG_SERIAL_OMAP=y
+CONFIG_SERIAL_OMAP_CONSOLE=y
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_IFX6X60 is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+# CONFIG_TTY_PRINTK is not set
+CONFIG_HVC_DRIVER=y
+# CONFIG_HVC_DCC is not set
+CONFIG_VIRTIO_CONSOLE=m
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+CONFIG_HW_RANDOM_OMAP=y
+CONFIG_HW_RANDOM_VIRTIO=m
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+CONFIG_I2C_OMAP=y
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_ALTERA is not set
+# CONFIG_SPI_BITBANG is not set
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_OC_TINY is not set
+CONFIG_SPI_OMAP24XX=y
+# CONFIG_SPI_PXA2XX_PCI is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+CONFIG_DEBUG_GPIO=y
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCF857X is not set
+# CONFIG_GPIO_SX150X is not set
+CONFIG_GPIO_TWL4030=y
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+# CONFIG_GPIO_74X164 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+CONFIG_W1=y
+CONFIG_W1_CON=y
+
+#
+# 1-wire Bus Masters
+#
+# CONFIG_W1_MASTER_DS2490 is not set
+# CONFIG_W1_MASTER_DS2482 is not set
+# CONFIG_W1_MASTER_DS1WM is not set
+# CONFIG_W1_MASTER_GPIO is not set
+# CONFIG_HDQ_MASTER_OMAP is not set
+
+#
+# 1-wire Slaves
+#
+# CONFIG_W1_SLAVE_THERM is not set
+# CONFIG_W1_SLAVE_SMEM is not set
+# CONFIG_W1_SLAVE_DS2408 is not set
+# CONFIG_W1_SLAVE_DS2423 is not set
+# CONFIG_W1_SLAVE_DS2431 is not set
+# CONFIG_W1_SLAVE_DS2433 is not set
+# CONFIG_W1_SLAVE_DS2760 is not set
+# CONFIG_W1_SLAVE_DS2780 is not set
+# CONFIG_W1_SLAVE_DS2781 is not set
+# CONFIG_W1_SLAVE_BQ27000 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
+# CONFIG_BATTERY_DS2780 is not set
+# CONFIG_BATTERY_DS2781 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_SBS is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+# CONFIG_BATTERY_MAX17040 is not set
+# CONFIG_BATTERY_MAX17042 is not set
+# CONFIG_CHARGER_MAX8903 is not set
+# CONFIG_CHARGER_TWL4030 is not set
+# CONFIG_CHARGER_LP8727 is not set
+# CONFIG_CHARGER_GPIO is not set
+# CONFIG_CHARGER_MANAGER is not set
+# CONFIG_CHARGER_SMB347 is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7314 is not set
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS620 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_GPIO_FAN is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_JC42 is not set
+# CONFIG_SENSORS_LINEAGE is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4151 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LTC4261 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_LM95245 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX16065 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX1668 is not set
+# CONFIG_SENSORS_MAX6639 is not set
+# CONFIG_SENSORS_MAX6642 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_MCP3021 is not set
+# CONFIG_SENSORS_NTC_THERMISTOR is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_PMBUS is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_SHT21 is not set
+# CONFIG_SENSORS_SMM665 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
+# CONFIG_SENSORS_EMC6W201 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SCH56XX_COMMON is not set
+# CONFIG_SENSORS_SCH5627 is not set
+# CONFIG_SENSORS_SCH5636 is not set
+# CONFIG_SENSORS_ADS1015 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_ADS7871 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83795 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_THERMAL is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_CORE is not set
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+# CONFIG_DW_WATCHDOG is not set
+# CONFIG_MPCORE_WATCHDOG is not set
+CONFIG_OMAP_WATCHDOG=y
+CONFIG_TWL4030_WATCHDOG=y
+# CONFIG_MAX63XX_WATCHDOG is not set
+
+#
+# USB-based Watchdog Cards
+#
+# CONFIG_USBPCWATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+CONFIG_MFD_CORE=y
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS65912_SPI is not set
+CONFIG_MENELAUS=y
+CONFIG_TWL4030_CORE=y
+# CONFIG_TWL4030_MADC is not set
+CONFIG_TWL4030_POWER=y
+CONFIG_MFD_TWL4030_AUDIO=y
+# CONFIG_TWL6030_PWM is not set
+# CONFIG_TWL6040_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_SPI is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM831X_SPI is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13XXX is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_WL1273_CORE is not set
+CONFIG_MFD_OMAP_USB_HOST=y
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+# CONFIG_REGULATOR_DUMMY is not set
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+# CONFIG_REGULATOR_GPIO is not set
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+CONFIG_REGULATOR_TPS65023=y
+CONFIG_REGULATOR_TPS6507X=y
+# CONFIG_REGULATOR_TPS6524X is not set
+CONFIG_REGULATOR_TWL4030=y
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=m
+CONFIG_FB_CFB_COPYAREA=m
+CONFIG_FB_CFB_IMAGEBLIT=m
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_UVESA is not set
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_TMIO is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+CONFIG_OMAP2_VRAM=y
+CONFIG_OMAP2_VRFB=y
+CONFIG_OMAP2_DSS=m
+CONFIG_OMAP2_VRAM_SIZE=0
+CONFIG_OMAP2_DSS_DEBUG_SUPPORT=y
+# CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS is not set
+CONFIG_OMAP2_DSS_DPI=y
+CONFIG_OMAP2_DSS_RFBI=y
+CONFIG_OMAP2_DSS_VENC=y
+CONFIG_OMAP4_DSS_HDMI=y
+CONFIG_OMAP2_DSS_SDI=y
+CONFIG_OMAP2_DSS_DSI=y
+# CONFIG_OMAP2_DSS_FAKE_VSYNC is not set
+CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=0
+CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y
+CONFIG_FB_OMAP2=m
+CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
+CONFIG_FB_OMAP2_NUM_FBS=3
+
+#
+# OMAP2/3 Display Device Drivers
+#
+CONFIG_PANEL_GENERIC_DPI=m
+# CONFIG_PANEL_DVI is not set
+# CONFIG_PANEL_LGPHILIPS_LB035Q02 is not set
+CONFIG_PANEL_SHARP_LS037V7DW01=m
+CONFIG_PANEL_NEC_NL8048HL11_01B=m
+# CONFIG_PANEL_PICODLP is not set
+CONFIG_PANEL_TAAL=m
+CONFIG_PANEL_TPO_TD043MTEA1=m
+CONFIG_PANEL_ACX565AKM=m
+# CONFIG_PANEL_N8X0 is not set
+# CONFIG_EXYNOS_VIDEO is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=y
+# CONFIG_LCD_L4F00242T03 is not set
+# CONFIG_LCD_LMS283GF05 is not set
+# CONFIG_LCD_LTV350QV is not set
+# CONFIG_LCD_TDO24M is not set
+# CONFIG_LCD_VGG2432A4 is not set
+CONFIG_LCD_PLATFORM=y
+# CONFIG_LCD_S6E63M0 is not set
+# CONFIG_LCD_LD9040 is not set
+# CONFIG_LCD_AMS369FG06 is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=m
+CONFIG_BACKLIGHT_GENERIC=m
+# CONFIG_BACKLIGHT_ADP8860 is not set
+# CONFIG_BACKLIGHT_ADP8870 is not set
+# CONFIG_BACKLIGHT_LP855X is not set
+# CONFIG_BACKLIGHT_PANDORA is not set
+
+#
+# Console display driver support
+#
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
+CONFIG_FONTS=y
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+# CONFIG_FONT_MINI_4x6 is not set
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+CONFIG_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_SOUND=m
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
+CONFIG_SND=m
+CONFIG_SND_TIMER=m
+CONFIG_SND_PCM=m
+CONFIG_SND_HWDEP=m
+CONFIG_SND_RAWMIDI=m
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_PCM_OSS_PLUGINS=y
+# CONFIG_SND_HRTIMER is not set
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+CONFIG_SND_VERBOSE_PRINTK=y
+CONFIG_SND_DEBUG=y
+# CONFIG_SND_DEBUG_VERBOSE is not set
+# CONFIG_SND_PCM_XRUN_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+CONFIG_SND_ARM=y
+CONFIG_SND_SPI=y
+CONFIG_SND_USB=y
+CONFIG_SND_USB_AUDIO=m
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=m
+CONFIG_SND_OMAP_SOC=m
+CONFIG_SND_OMAP_SOC_MCBSP=m
+# CONFIG_SND_OMAP_SOC_N810 is not set
+# CONFIG_SND_OMAP_SOC_RX51 is not set
+# CONFIG_SND_OMAP_SOC_OVERO is not set
+# CONFIG_SND_OMAP_SOC_OMAP3EVM is not set
+# CONFIG_SND_OMAP_SOC_AM3517EVM is not set
+# CONFIG_SND_OMAP_SOC_SDP3430 is not set
+# CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040 is not set
+# CONFIG_SND_OMAP_SOC_OMAP4_HDMI is not set
+CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
+# CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE is not set
+# CONFIG_SND_OMAP_SOC_ZOOM2 is not set
+# CONFIG_SND_OMAP_SOC_IGEP0020 is not set
+CONFIG_SND_SOC_I2C_AND_SPI=m
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_TWL4030=m
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_HID_BATTERY_STRENGTH=y
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_ACRUX is not set
+# CONFIG_HID_APPLE is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_PRODIKEYS is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_DRAGONRISE is not set
+# CONFIG_HID_EMS_FF is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_HOLTEK is not set
+# CONFIG_HID_KEYTOUCH is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_UCLOGIC is not set
+# CONFIG_HID_WALTOP is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LCPOWER is not set
+# CONFIG_HID_LOGITECH is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_MULTITOUCH is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_ORTEK is not set
+# CONFIG_HID_PANTHERLORD is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_PRIMAX is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_SAITEK is not set
+# CONFIG_HID_SAMSUNG is not set
+# CONFIG_HID_SONY is not set
+# CONFIG_HID_SPEEDLINK is not set
+# CONFIG_HID_SUNPLUS is not set
+# CONFIG_HID_GREENASIA is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TIVO is not set
+# CONFIG_HID_TOPSEED is not set
+# CONFIG_HID_THRUSTMASTER is not set
+# CONFIG_HID_ZEROPLUS is not set
+# CONFIG_HID_ZYDACRON is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+CONFIG_USB_DEBUG=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEVICEFS=y
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_DWC3 is not set
+CONFIG_USB_MON=y
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+CONFIG_USB_EHCI_HCD_OMAP=y
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_OHCI_HCD is not set
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_MUSB_HDRC is not set
+# CONFIG_USB_RENESAS_USBHS is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+CONFIG_USB_WDM=y
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+# CONFIG_USB_STORAGE_DEBUG is not set
+# CONFIG_USB_STORAGE_REALTEK is not set
+# CONFIG_USB_STORAGE_DATAFAB is not set
+# CONFIG_USB_STORAGE_FREECOM is not set
+# CONFIG_USB_STORAGE_ISD200 is not set
+# CONFIG_USB_STORAGE_USBAT is not set
+# CONFIG_USB_STORAGE_SDDR09 is not set
+# CONFIG_USB_STORAGE_SDDR55 is not set
+# CONFIG_USB_STORAGE_JUMPSHOT is not set
+# CONFIG_USB_STORAGE_ALAUDA is not set
+# CONFIG_USB_STORAGE_ONETOUCH is not set
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
+# CONFIG_USB_STORAGE_ENE_UB6250 is not set
+# CONFIG_USB_UAS is not set
+CONFIG_USB_LIBUSUAL=y
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+CONFIG_USB_TEST=y
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DEBUG=y
+CONFIG_USB_GADGET_DEBUG_FILES=y
+CONFIG_USB_GADGET_DEBUG_FS=y
+CONFIG_USB_GADGET_VBUS_DRAW=2
+CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
+# CONFIG_USB_FUSB300 is not set
+# CONFIG_USB_OMAP is not set
+# CONFIG_USB_R8A66597 is not set
+# CONFIG_USB_MV_UDC is not set
+# CONFIG_USB_M66592 is not set
+# CONFIG_USB_NET2272 is not set
+# CONFIG_USB_DUMMY_HCD is not set
+CONFIG_USB_ZERO=m
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_G_NCM is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_ACM_MS is not set
+# CONFIG_USB_G_MULTI is not set
+# CONFIG_USB_G_HID is not set
+# CONFIG_USB_G_DBGP is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_ISP1301_OMAP is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_TWL4030_USB is not set
+# CONFIG_TWL6030_USB is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+CONFIG_MMC_BLOCK_BOUNCE=y
+CONFIG_SDIO_UART=y
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_OMAP=y
+CONFIG_MMC_OMAP_HS=y
+# CONFIG_MMC_SPI is not set
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+CONFIG_RTC_DRV_TWL92330=y
+CONFIG_RTC_DRV_TWL4030=y
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+# CONFIG_RTC_DRV_EM3027 is not set
+# CONFIG_RTC_DRV_RV3029C2 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T93 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+CONFIG_VIRTIO=m
+CONFIG_VIRTIO_RING=m
+
+#
+# Virtio drivers
+#
+CONFIG_VIRTIO_BALLOON=m
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+# CONFIG_STAGING is not set
+CONFIG_CLKDEV_LOOKUP=y
+
+#
+# Hardware Spinlock drivers
+#
+# CONFIG_HWSPINLOCK_OMAP is not set
+CONFIG_CLKSRC_MMIO=y
+CONFIG_IOMMU_API=y
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_OMAP_IOMMU=y
+CONFIG_OMAP_IOVMM=m
+CONFIG_OMAP_IOMMU_DEBUG=m
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+CONFIG_REMOTEPROC=m
+CONFIG_OMAP_REMOTEPROC=m
+CONFIG_OMAP_DUCATI_CMA_SIZE=0x6500000
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+CONFIG_RPMSG=m
+CONFIG_RPMSG_SERVER_SAMPLE=m
+CONFIG_RPMSG_OMX=m
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
+# CONFIG_EXT3_FS_XATTR is not set
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+CONFIG_QUOTA=y
+# CONFIG_QUOTA_NETLINK_INTERFACE is not set
+CONFIG_PRINT_QUOTA_WARNING=y
+# CONFIG_QUOTA_DEBUG is not set
+CONFIG_QUOTA_TREE=y
+# CONFIG_QFMT_V1 is not set
+CONFIG_QFMT_V2=y
+CONFIG_QUOTACTL=y
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
+CONFIG_JFFS2_FS_POSIX_ACL=y
+CONFIG_JFFS2_FS_SECURITY=y
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_LZO=y
+CONFIG_JFFS2_RTIME=y
+CONFIG_JFFS2_RUBIN=y
+# CONFIG_JFFS2_CMODE_NONE is not set
+CONFIG_JFFS2_CMODE_PRIORITY=y
+# CONFIG_JFFS2_CMODE_SIZE is not set
+# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_XATTR is not set
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+# CONFIG_UBIFS_FS_DEBUG is not set
+# CONFIG_LOGFS is not set
+CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFS_USE_LEGACY_DNS is not set
+CONFIG_NFS_USE_KERNEL_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_SECTION_MISMATCH is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+CONFIG_SCHED_DEBUG=y
+CONFIG_SCHEDSTATS=y
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_MUTEXES=y
+CONFIG_DEBUG_LOCK_ALLOC=y
+CONFIG_PROVE_LOCKING=y
+# CONFIG_PROVE_RCU is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+CONFIG_LOCKDEP=y
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_LOCKDEP is not set
+CONFIG_TRACE_IRQFLAGS=y
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+# CONFIG_RCU_CPU_STALL_INFO is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_KPROBES_SANITY_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_LKDTM is not set
+# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_KPROBE_EVENT=y
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+CONFIG_DYNAMIC_DEBUG=y
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+# CONFIG_DEBUG_USER is not set
+# CONFIG_DEBUG_LL is not set
+# CONFIG_ARM_KPROBES_TEST is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+CONFIG_SECURITY=y
+# CONFIG_SECURITYFS is not set
+# CONFIG_SECURITY_NETWORK is not set
+# CONFIG_SECURITY_PATH is not set
+# CONFIG_SECURITY_TOMOYO is not set
+# CONFIG_SECURITY_APPARMOR is not set
+# CONFIG_SECURITY_YAMA is not set
+# CONFIG_IMA is not set
+# CONFIG_EVM is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=m
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_GHASH is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+CONFIG_CRYPTO_MICHAEL_MIC=y
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=m
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=m
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+CONFIG_CRYPTO_LZO=y
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_OMAP_SHAM is not set
+# CONFIG_CRYPTO_DEV_OMAP_AES is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=y
+CONFIG_CRC16=y
+CONFIG_CRC_T10DIF=y
+CONFIG_CRC_ITU_T=y
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+CONFIG_CRC7=y
+CONFIG_LIBCRC32C=y
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_CPU_RMAP=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_AVERAGE=y
+# CONFIG_CORDIC is not set
diff --git a/linux/etc/panda/unload_firmware.sh b/linux/etc/panda/unload_firmware.sh
new file mode 100644 (file)
index 0000000..3e3be6f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+rmmod rpmsg_proto
+rmmod virtio_rpmsg_bus
+rmmod omap_remoteproc
+rmmod remoteproc
diff --git a/linux/etc/run_lad.sh b/linux/etc/run_lad.sh
new file mode 100644 (file)
index 0000000..c29cedd
--- /dev/null
@@ -0,0 +1,2 @@
+lad lad.txt
+# tail -f /tmp/LAD/lad.txt &
diff --git a/linux/etc/tci66xx/dump_trace.sh b/linux/etc/tci66xx/dump_trace.sh
new file mode 100644 (file)
index 0000000..cfac518
--- /dev/null
@@ -0,0 +1,11 @@
+echo "Core 0 Trace..."
+cat /debug/remoteproc/dsp-core0/trace0
+echo "-----------------------------------------"
+echo "Core 1 Trace..."
+cat /debug/remoteproc/dsp-core1/trace0
+echo "-----------------------------------------"
+echo "Core 2 Trace..."
+cat /debug/remoteproc/dsp-core2/trace0
+echo "-----------------------------------------"
+echo "Core 3 Trace..."
+cat /debug/remoteproc/dsp-core3/trace0
diff --git a/linux/etc/tci66xx/load_firmware.sh b/linux/etc/tci66xx/load_firmware.sh
new file mode 100644 (file)
index 0000000..af27868
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+depmod -a
+echo 8 > /proc/sys/kernel/printk
+modprobe remoteproc
+modprobe keystone_remoteproc
+modprobe rpmsg_proto
+echo 0 > /proc/sys/kernel/printk
diff --git a/linux/etc/tci66xx/tci6614.config b/linux/etc/tci66xx/tci6614.config
new file mode 100644 (file)
index 0000000..54aada9
--- /dev/null
@@ -0,0 +1,1771 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.3.0 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+# CONFIG_SWAP is not set
+# CONFIG_SYSVIPC is not set
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_HAVE_SPARSE_IRQ=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_IRQ_DOMAIN=y
+# CONFIG_SPARSE_IRQ is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TINY_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+# CONFIG_RCU_TRACE is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+# CONFIG_ELF_CORE is not set
+# CONFIG_BASE_FULL is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_EMBEDDED=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_KPROBES=y
+CONFIG_KRETPROBES=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=1
+CONFIG_MODULES=y
+CONFIG_MODULE_FORCE_LOAD=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_SPIN_UNLOCK is not set
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+# CONFIG_MUTEX_SPIN_ON_OWNER is not set
+# CONFIG_FREEZER is not set
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_MSM is not set
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+CONFIG_ARCH_DAVINCI=y
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+CONFIG_CP_INTD=y
+CONFIG_OMAP_AINTC=y
+CONFIG_TI_KEYSTONE=y
+
+#
+# TI DaVinci Implementations
+#
+
+#
+# DaVinci Core Type
+#
+# CONFIG_ARCH_DAVINCI_DM644x is not set
+# CONFIG_ARCH_DAVINCI_DM355 is not set
+# CONFIG_ARCH_DAVINCI_DM646x is not set
+# CONFIG_ARCH_DAVINCI_DA830 is not set
+# CONFIG_ARCH_DAVINCI_DA850 is not set
+# CONFIG_ARCH_DAVINCI_DM365 is not set
+# CONFIG_ARCH_DAVINCI_TNETV107X is not set
+CONFIG_ARCH_DAVINCI_TCI6614=y
+
+#
+# DaVinci Board Type
+#
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+# CONFIG_MACH_TCI6614_SIM is not set
+CONFIG_MACH_TCI6614_EVM=y
+CONFIG_RAPIDIO=y
+# CONFIG_DAVINCI_MUX is not set
+# CONFIG_DAVINCI_RESET_CLOCKS is not set
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_LPAE is not set
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+# CONFIG_SWP_EMULATE is not set
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+CONFIG_ARM_NR_BANKS=8
+CONFIG_CPU_HAS_PMU=y
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_720789 is not set
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+# CONFIG_NO_HZ is not set
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_ARM_ARCH_TIMER is not set
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+CONFIG_HAVE_ARCH_PFN_VALID=y
+# CONFIG_HIGHMEM is not set
+CONFIG_HW_PERF_EVENTS=y
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_COMPACTION is not set
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_NEED_PER_CPU_KM=y
+# CONFIG_CLEANCACHE is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+# CONFIG_LEDS is not set
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+# CONFIG_CC_STACKPROTECTOR is not set
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+
+#
+# Boot options
+#
+CONFIG_USE_OF=y
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+# CONFIG_ARM_APPENDED_DTB is not set
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+# CONFIG_CPU_IDLE is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+# CONFIG_SUSPEND is not set
+# CONFIG_PM_RUNTIME is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+# CONFIG_ARM_CPU_SUSPEND is not set
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_UNIX_DIAG=y
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+CONFIG_XFRM_SUB_POLICY=y
+CONFIG_XFRM_MIGRATE=y
+CONFIG_XFRM_STATISTICS=y
+CONFIG_XFRM_IPCOMP=y
+CONFIG_NET_KEY=y
+CONFIG_NET_KEY_MIGRATE=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+# CONFIG_IP_FIB_TRIE_STATS is not set
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_IP_ROUTE_MULTIPATH=y
+CONFIG_IP_ROUTE_VERBOSE=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+CONFIG_NET_IPIP=y
+CONFIG_NET_IPGRE_DEMUX=y
+CONFIG_NET_IPGRE=y
+# CONFIG_NET_IPGRE_BROADCAST is not set
+CONFIG_IP_MROUTE=y
+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
+# CONFIG_IP_PIMSM_V1 is not set
+CONFIG_IP_PIMSM_V2=y
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+CONFIG_INET_AH=y
+# CONFIG_INET_ESP is not set
+CONFIG_INET_IPCOMP=y
+CONFIG_INET_XFRM_TUNNEL=y
+CONFIG_INET_TUNNEL=y
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+CONFIG_INET_LRO=y
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_UDP_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=y
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+CONFIG_INET6_XFRM_MODE_TRANSPORT=m
+CONFIG_INET6_XFRM_MODE_TUNNEL=m
+CONFIG_INET6_XFRM_MODE_BEET=m
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
+CONFIG_IPV6_MROUTE=y
+# CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set
+CONFIG_IPV6_PIMSM_V2=y
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+CONFIG_NETFILTER_NETLINK=y
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+# CONFIG_NETFILTER_NETLINK_QUEUE is not set
+# CONFIG_NETFILTER_NETLINK_LOG is not set
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_MARK=y
+CONFIG_NF_CONNTRACK_PROCFS=y
+# CONFIG_NF_CONNTRACK_EVENTS is not set
+# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
+# CONFIG_NF_CT_PROTO_DCCP is not set
+CONFIG_NF_CT_PROTO_SCTP=y
+# CONFIG_NF_CT_PROTO_UDPLITE is not set
+# CONFIG_NF_CONNTRACK_AMANDA is not set
+# CONFIG_NF_CONNTRACK_FTP is not set
+# CONFIG_NF_CONNTRACK_H323 is not set
+# CONFIG_NF_CONNTRACK_IRC is not set
+# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
+# CONFIG_NF_CONNTRACK_SNMP is not set
+# CONFIG_NF_CONNTRACK_PPTP is not set
+# CONFIG_NF_CONNTRACK_SANE is not set
+# CONFIG_NF_CONNTRACK_SIP is not set
+# CONFIG_NF_CONNTRACK_TFTP is not set
+CONFIG_NF_CT_NETLINK=y
+# CONFIG_NETFILTER_TPROXY is not set
+CONFIG_NETFILTER_XTABLES=y
+
+#
+# Xtables combined modules
+#
+CONFIG_NETFILTER_XT_MARK=y
+CONFIG_NETFILTER_XT_CONNMARK=y
+
+#
+# Xtables targets
+#
+# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
+CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
+# CONFIG_NETFILTER_XT_TARGET_CT is not set
+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
+CONFIG_NETFILTER_XT_TARGET_HL=y
+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
+CONFIG_NETFILTER_XT_TARGET_MARK=y
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
+# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
+# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
+# CONFIG_NETFILTER_XT_TARGET_TEE is not set
+# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
+# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
+# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
+
+#
+# Xtables matches
+#
+# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set
+# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
+CONFIG_NETFILTER_XT_MATCH_COMMENT=y
+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+CONFIG_NETFILTER_XT_MATCH_CPU=y
+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
+# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+CONFIG_NETFILTER_XT_MATCH_ECN=y
+# CONFIG_NETFILTER_XT_MATCH_ESP is not set
+# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
+# CONFIG_NETFILTER_XT_MATCH_HELPER is not set
+CONFIG_NETFILTER_XT_MATCH_HL=y
+CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
+CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
+CONFIG_NETFILTER_XT_MATCH_MAC=y
+CONFIG_NETFILTER_XT_MATCH_MARK=y
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
+# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
+# CONFIG_NETFILTER_XT_MATCH_OSF is not set
+# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
+# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
+# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
+# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
+# CONFIG_NETFILTER_XT_MATCH_REALM is not set
+# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
+CONFIG_NETFILTER_XT_MATCH_SCTP=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
+# CONFIG_NETFILTER_XT_MATCH_STRING is not set
+# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
+# CONFIG_NETFILTER_XT_MATCH_TIME is not set
+# CONFIG_NETFILTER_XT_MATCH_U32 is not set
+# CONFIG_IP_SET is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV4=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_CONNTRACK_PROC_COMPAT=y
+# CONFIG_IP_NF_QUEUE is not set
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_MATCH_AH=y
+CONFIG_IP_NF_MATCH_ECN=y
+# CONFIG_IP_NF_MATCH_RPFILTER is not set
+CONFIG_IP_NF_MATCH_TTL=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+CONFIG_IP_NF_TARGET_LOG=y
+CONFIG_IP_NF_TARGET_ULOG=y
+CONFIG_NF_NAT=y
+CONFIG_NF_NAT_NEEDED=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_NETMAP=y
+CONFIG_IP_NF_TARGET_REDIRECT=y
+CONFIG_NF_NAT_PROTO_SCTP=y
+# CONFIG_NF_NAT_FTP is not set
+# CONFIG_NF_NAT_IRC is not set
+# CONFIG_NF_NAT_TFTP is not set
+# CONFIG_NF_NAT_AMANDA is not set
+# CONFIG_NF_NAT_PPTP is not set
+# CONFIG_NF_NAT_H323 is not set
+# CONFIG_NF_NAT_SIP is not set
+CONFIG_IP_NF_MANGLE=y
+CONFIG_IP_NF_TARGET_CLUSTERIP=y
+CONFIG_IP_NF_TARGET_ECN=y
+CONFIG_IP_NF_TARGET_TTL=y
+CONFIG_IP_NF_RAW=y
+CONFIG_IP_NF_ARPTABLES=y
+CONFIG_IP_NF_ARPFILTER=y
+CONFIG_IP_NF_ARP_MANGLE=y
+
+#
+# IPv6: Netfilter Configuration
+#
+# CONFIG_NF_DEFRAG_IPV6 is not set
+# CONFIG_NF_CONNTRACK_IPV6 is not set
+# CONFIG_IP6_NF_QUEUE is not set
+CONFIG_IP6_NF_IPTABLES=m
+# CONFIG_IP6_NF_MATCH_AH is not set
+# CONFIG_IP6_NF_MATCH_EUI64 is not set
+# CONFIG_IP6_NF_MATCH_FRAG is not set
+# CONFIG_IP6_NF_MATCH_OPTS is not set
+# CONFIG_IP6_NF_MATCH_HL is not set
+# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set
+# CONFIG_IP6_NF_MATCH_MH is not set
+# CONFIG_IP6_NF_MATCH_RPFILTER is not set
+# CONFIG_IP6_NF_MATCH_RT is not set
+# CONFIG_IP6_NF_TARGET_LOG is not set
+# CONFIG_IP6_NF_FILTER is not set
+# CONFIG_IP6_NF_MANGLE is not set
+# CONFIG_IP6_NF_RAW is not set
+# CONFIG_IP_DCCP is not set
+CONFIG_IP_SCTP=y
+# CONFIG_NET_SCTPPROBE is not set
+# CONFIG_SCTP_DBG_MSG is not set
+# CONFIG_SCTP_DBG_OBJCNT is not set
+# CONFIG_SCTP_HMAC_NONE is not set
+# CONFIG_SCTP_HMAC_SHA1 is not set
+CONFIG_SCTP_HMAC_MD5=y
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+CONFIG_VLAN_8021Q=y
+# CONFIG_VLAN_8021Q_GVRP is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_BQL=y
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_FIB_RULES=y
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+# CONFIG_LIB80211 is not set
+
+#
+# CFG80211 needs to be enabled for MAC80211
+#
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+CONFIG_DEBUG_DRIVER=y
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+# CONFIG_DMA_SHARED_BUFFER is not set
+CONFIG_CMA=y
+# CONFIG_CMA_DEBUG is not set
+
+#
+# Default contiguous memory area size:
+#
+CONFIG_CMA_SIZE_MBYTES=16
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+# CONFIG_CONNECTOR is not set
+CONFIG_MTD=y
+# CONFIG_MTD_TESTS is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_OF_PARTS is not set
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_SM_FTL is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+# CONFIG_MTD_CFI is not set
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_RAM=y
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PLATRAM=y
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+CONFIG_MTD_M25P80=y
+CONFIG_M25PXX_USE_FAST_READ=y
+# CONFIG_MTD_SST25L is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_DOCG3 is not set
+CONFIG_MTD_NAND_ECC=y
+# CONFIG_MTD_NAND_ECC_SMC is not set
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_BCH is not set
+# CONFIG_MTD_SM_COMMON is not set
+# CONFIG_MTD_NAND_MUSEUM_IDS is not set
+# CONFIG_MTD_NAND_GPIO is not set
+CONFIG_MTD_NAND_IDS=y
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+# CONFIG_MTD_NAND_PLATFORM is not set
+CONFIG_MTD_NAND_DAVINCI=y
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MTD_UBI_BEB_RESERVE=1
+# CONFIG_MTD_UBI_GLUEBI is not set
+# CONFIG_MTD_UBI_DEBUG is not set
+CONFIG_DTC=y
+CONFIG_OF=y
+
+#
+# Device Tree and Open Firmware support
+#
+CONFIG_PROC_DEVICETREE=y
+# CONFIG_OF_SELFTEST is not set
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_DEVICE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_I2C=y
+CONFIG_OF_NET=y
+CONFIG_OF_SPI=y
+CONFIG_OF_MDIO=y
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_VIRTIO_BLK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+CONFIG_KEYSTONE_IPC_IRQ=y
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+CONFIG_EEPROM_AT24=y
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_EEPROM_93XX46 is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+# CONFIG_DUMMY is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_MII is not set
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_RIONET=y
+CONFIG_RIONET_TX_SIZE=32
+CONFIG_RIONET_RX_SIZE=32
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_VIRTIO_NET is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_MICROCHIP=y
+# CONFIG_ENC28J60 is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+# CONFIG_SMC91X is not set
+# CONFIG_SMC911X is not set
+# CONFIG_SMSC911X is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_NET_VENDOR_TI=y
+# CONFIG_TI_DAVINCI_EMAC is not set
+CONFIG_TI_DAVINCI_MDIO=y
+# CONFIG_TI_DAVINCI_CPDMA is not set
+# CONFIG_TI_CPSW is not set
+CONFIG_TI_KEYSTONE_NET=y
+CONFIG_TI_KEYSTONE_PA=y
+CONFIG_TI_KEYSTONE_NET_SA=y
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+CONFIG_MARVELL_PHY=y
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MICREL_KS8995MA is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+CONFIG_WLAN=y
+# CONFIG_HOSTAP is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=3
+CONFIG_SERIAL_8250_RUNTIME_UARTS=3
+# CONFIG_SERIAL_8250_EXTENDED is not set
+# CONFIG_SERIAL_8250_DW is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+# CONFIG_SERIAL_MAX3107 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_OF_PLATFORM is not set
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_IFX6X60 is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_VIRTIO_CONSOLE is not set
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+CONFIG_I2C_DAVINCI=y
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_ALTERA is not set
+CONFIG_SPI_BITBANG=y
+CONFIG_SPI_DAVINCI=y
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_OC_TINY is not set
+# CONFIG_SPI_PXA2XX_PCI is not set
+# CONFIG_SPI_XILINX is not set
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+CONFIG_SPI_SPIDEV=y
+# CONFIG_SPI_TLE62X0 is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCF857X is not set
+# CONFIG_GPIO_SX150X is not set
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+# CONFIG_GPIO_74X164 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_CORE is not set
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+# CONFIG_DW_WATCHDOG is not set
+CONFIG_DAVINCI_WATCHDOG=y
+# CONFIG_MAX63XX_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS65912_SPI is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_SPI is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM831X_SPI is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13XXX is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_WL1273_CORE is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_DRM is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_SOUND is not set
+# CONFIG_HID_SUPPORT is not set
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+CONFIG_DMADEVICES=y
+# CONFIG_DMADEVICES_DEBUG is not set
+
+#
+# DMA Devices
+#
+# CONFIG_DW_DMAC is not set
+# CONFIG_TIMB_DMA is not set
+CONFIG_KEYSTONE_DMA=y
+CONFIG_KEYSTONE_UDMA=y
+CONFIG_DMA_ENGINE=y
+
+#
+# DMA Clients
+#
+# CONFIG_NET_DMA is not set
+# CONFIG_ASYNC_TX_DMA is not set
+# CONFIG_DMATEST is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+CONFIG_VIRTIO=y
+CONFIG_VIRTIO_RING=y
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+# CONFIG_STAGING is not set
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_CLK_PREPARE=y
+CONFIG_COMMON_CLK=y
+
+#
+# Common Clock Framework
+#
+CONFIG_COMMON_CLK_DEBUG=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_HWQUEUE=y
+
+#
+# Hardware Queue drivers
+#
+CONFIG_HWQUEUE_KEYSTONE=y
+# CONFIG_HWQUEUE_TEST is not set
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_REMOTEPROC=m
+CONFIG_KEYSTONE_REMOTEPROC=m
+CONFIG_RPMSG=m
+CONFIG_RPMSG_SERVER_SAMPLE=m
+# CONFIG_RPMSG_OMX is not set
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+CONFIG_TI_KEYSTONE_RAPIDIO=y
+CONFIG_RAPIDIO_DISC_TIMEOUT=30
+CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS=y
+# CONFIG_RAPIDIO_DMA_ENGINE is not set
+# CONFIG_RAPIDIO_DEBUG is not set
+# CONFIG_RAPIDIO_TSI57X is not set
+# CONFIG_RAPIDIO_CPS_XX is not set
+# CONFIG_RAPIDIO_TSI568 is not set
+# CONFIG_RAPIDIO_CPS_GEN2 is not set
+# CONFIG_RAPIDIO_TSI500 is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_EXPORTFS=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+CONFIG_JFFS2_FS_WBUF_VERIFY=y
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_XATTR is not set
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+# CONFIG_UBIFS_FS_DEBUG is not set
+# CONFIG_LOGFS is not set
+CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+CONFIG_ROOT_NFS=y
+CONFIG_NFSD=y
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_CEPH_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+# CONFIG_NLS is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_SECTION_MISMATCH is not set
+CONFIG_DEBUG_KERNEL=y
+CONFIG_DEBUG_SHIRQ=y
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+CONFIG_SCHED_DEBUG=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_KPROBES_SANITY_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_LKDTM is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_LATENCYTOP is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_KPROBE_EVENT=y
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+CONFIG_DYNAMIC_DEBUG=y
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+# CONFIG_DEBUG_USER is not set
+# CONFIG_DEBUG_LL is not set
+# CONFIG_ARM_KPROBES_TEST is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+CONFIG_CRYPTO_USER=y
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+CONFIG_CRYPTO_NULL=y
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+CONFIG_CRYPTO_AUTHENC=y
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+CONFIG_CRYPTO_SEQIV=y
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+CONFIG_CRYPTO_CTR=y
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+CONFIG_CRYPTO_XCBC=y
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_GHASH is not set
+# CONFIG_CRYPTO_MD4 is not set
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+CONFIG_CRYPTO_SHA1=y
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+CONFIG_CRYPTO_LZO=y
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=y
+CONFIG_CRYPTO_USER_API=y
+CONFIG_CRYPTO_USER_API_HASH=y
+CONFIG_CRYPTO_USER_API_SKCIPHER=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_DEV_KEYSTONE=y
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=y
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/linux/etc/tci66xx/test_multi.sh b/linux/etc/tci66xx/test_multi.sh
new file mode 100644 (file)
index 0000000..8a20599
--- /dev/null
@@ -0,0 +1,4 @@
+for i in 1 2 3 4
+do
+MessageQApp $1 $i &
+done
diff --git a/linux/etc/tci66xx/unload_firmware.sh b/linux/etc/tci66xx/unload_firmware.sh
new file mode 100644 (file)
index 0000000..38f431a
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+rmmod rpmsg_proto
+rmmod keystone_remoteproc
+rmmod remoteproc
+
diff --git a/linux/include/SocketFxns.h b/linux/include/SocketFxns.h
new file mode 100644 (file)
index 0000000..3a92dd3
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+extern int ConnectSocket(int sock, UInt16 procId, int dst);
+extern int SocketBindAddr(int fd, UInt16 rprocId, UInt32 localAddr);
diff --git a/linux/include/Std.h b/linux/include/Std.h
new file mode 100644 (file)
index 0000000..63adabf
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ *  Copyright (c) 2008-2013, Texas Instruments Incorporated
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  *  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *  *  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  *  Neither the name of Texas Instruments Incorporated nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   Std.h
+ *
+ *  @brief      This will have definitions of standard data types for
+ *              platform abstraction.
+ *
+ *  ============================================================================
+ */
+
+#if !defined(STD_H)
+#define STD_H
+
+#ifdef SYSLINK_BUILDOS_LINUX
+#include <std_linux.h>
+#endif
+#include <unistd.h>
+#include <stdbool.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+typedef char              Char;
+typedef unsigned char     UChar;
+typedef short             Short;
+typedef unsigned short    UShort;
+typedef int               Int;
+typedef unsigned int      UInt;
+typedef long              Long;
+typedef unsigned long     ULong;
+typedef float             Float;
+typedef double            Double;
+typedef long double       LDouble;
+typedef void              Void;
+
+
+typedef bool              Bool;
+typedef void            * Ptr;       /* data pointer */
+typedef void            * Handle;    /* data pointer */
+typedef char            * String;    /* null terminated string */
+
+
+typedef int            *  IArg;
+typedef unsigned int   *  UArg;
+typedef char              Int8;
+typedef short             Int16;
+typedef int               Int32;
+
+typedef unsigned char     UInt8;
+typedef unsigned short    UInt16;
+typedef unsigned int      UInt32;
+typedef unsigned int      SizeT;
+typedef unsigned char     Bits8;
+typedef unsigned short    Bits16;
+typedef UInt32            Bits32;
+
+/* taken from bridge */
+typedef void           *PVOID;          /* p    */
+typedef PVOID           HANDLE;         /* h    */
+
+#define TRUE              1
+#define FALSE             0
+#define FAIL   -1
+//#define NULL            '\0'
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif
diff --git a/linux/include/SysLink.h b/linux/include/SysLink.h
new file mode 100644 (file)
index 0000000..62a6946
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       SysLink.h
+ *
+ *  @brief      This module contains startup/shutdown functions.
+ *
+ *  @ver        0002  (adapted from SysLink 2 GA product).
+ *
+ */
+
+
+#ifndef _SysLink_H_
+#define _SysLink_H_
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ *  @def    SysLink_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define SysLink_S_ALREADYSETUP      1
+
+/*!
+ *  @def    SysLink_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define SysLink_S_SUCCESS           0
+
+/*!
+ *  @def    SysLink_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define SysLink_E_FAIL             -1
+
+/*!
+ *  @def    SysLink_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define SysLink_E_ALREADYEXISTS    -2
+
+/*!
+ *  @def    SysLink_E_RESOURCE
+ *  @brief  Specified resource is not available
+ */
+#define SysLink_E_RESOURCE         -3
+
+
+
+/* =============================================================================
+ * APIs
+ * =============================================================================
+ */
+/**
+ *  @brief      Function to initialize SysLink.
+ *
+ *              This function must be called in every user process before making
+ *              calls to any other SysLink APIs.
+ *
+ *  @sa         SysLink_destroy()
+ */
+Int SysLink_setup (Void);
+
+/**
+ *  @brief      Function to finalize SysLink.
+ *
+ *              This function must be called in every user process at the end
+ *              after all usage of SysLink in that process is complete.
+ *
+ *  @sa         SysLink_setup()
+ */
+Void SysLink_destroy (Void);
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif /*_SysLink_H_*/
diff --git a/linux/include/_MessageQ.h b/linux/include/_MessageQ.h
new file mode 100644 (file)
index 0000000..dd70f31
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ *  Copyright (c) 2008-2012, Texas Instruments Incorporated
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  *  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *  *  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  *  Neither the name of Texas Instruments Incorporated nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   _MessageQ.h
+ *
+ *  @brief  Defines MessageQ module.
+ *  ============================================================================
+ */
+
+
+#ifndef MESSAGEQ_H_0xded2
+#define MESSAGEQ_H_0xded2
+
+/* Utilities headers */
+#include <ti/ipc/NameServer.h>
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*!
+ *  @def    MessageQ_MODULEID
+ *  @brief  Unique module ID.
+ */
+#define MessageQ_MODULEID               (0xded2)
+
+/*!
+ *  @def    MessageQ_ALLOWGROWTH
+ *  @brief  Allow runtime growth
+ */
+#define MessageQ_ALLOWGROWTH             NameServer_ALLOWGROWTH
+
+/*! @brief Number of queues */
+#define MessageQ_NUM_PRIORITY_QUEUES  2
+
+/*
+ *  Used to denote a message that was initialized
+ *  with the #MessageQ_staticMsgInit function.
+ */
+#define MessageQ_STATICMSG              0xFFFF
+
+/*! Version setting */
+#define MessageQ_HEADERVERSION   (UInt) 0x2000
+
+/*! Mask to extract Trace setting */
+#define MessageQ_TRACEMASK       (UInt) 0x1000
+
+/*! Shift for Trace setting */
+#define MessageQ_TRACESHIFT      (UInt) 12
+
+
+/*!
+ *  @brief  Structure defining config parameters for the MessageQ Buf module.
+ */
+typedef struct MessageQ_Config_tag {
+    Bool   traceFlag;
+    /*!< Trace flag
+     *  This flag allows the configuration of the default module trace
+     *  settings.
+     */
+    UInt maxRuntimeEntries;
+    /*!< Maximum number of MessageQs that can be dynamically created */
+    UInt maxNameLen;
+    /*!< Maximum length for Message queue names */
+} MessageQ_Config;
+
+/* =============================================================================
+ *  APIs
+ * =============================================================================
+ */
+/*!
+ *  @brief      Function to get the default configuration for the MessageQ
+ *              module.
+ *
+ *              This function can be called by the application to get their
+ *              configuration parameter to MessageQ_setup filled in by the
+ *              MessageQ module with the default parameters. If the user does
+ *              not wish to make any change in the default parameters, this API
+ *              is not required to be called.
+ *
+ *  @param      cfg     Pointer to the MessageQ module configuration structure
+ *                      in which the default config is to be returned.
+ *
+ *  @sa         MessageQ_setup
+ */
+Void MessageQ_getConfig (MessageQ_Config * cfg);
+
+/*!
+ *  @brief      Function to setup the MessageQ module.
+ *
+ *              This function sets up the MessageQ module. This function must
+ *              be called before any other instance-level APIs can be invoked.
+ *              Module-level configuration needs to be provided to this
+ *              function. If the user wishes to change some specific config
+ *              parameters, then MessageQ_getConfig can be called to get the
+ *              configuration filled with the default values. After this, only
+ *              the required configuration values can be changed. If the user
+ *              does not wish to make any change in the default parameters, the
+ *              application can simply call MessageQ with NULL parameters.
+ *              The default parameters would get automatically used.
+ *
+ *  @param      cfg   Optional MessageQ module configuration. If provided as
+ *                    NULL, default configuration is used.
+ *
+ *  @sa         MessageQ_destroy
+ *              NameServer_create
+ *              GateSpinlock_create
+ *              Memory_alloc
+ */
+Int MessageQ_setup (const MessageQ_Config * cfg);
+
+/* Function to destroy the MessageQ module. */
+Int MessageQ_destroy (void);
+
+/* Returns the amount of shared memory used by one transport instance.
+ *
+ *  The MessageQ module itself does not use any shared memory but the
+ *  underlying transport may use some shared memory.
+ */
+SizeT MessageQ_sharedMemReq (Ptr sharedAddr);
+
+/* Calls the SetupProxy function to setup the MessageQ transports. */
+Int MessageQ_attach (UInt16 remoteProcId, Ptr sharedAddr);
+
+/* Calls the SetupProxy function to detach the MessageQ transports. */
+Int MessageQ_detach (UInt16 remoteProcId);
+
+NameServer_Handle MessageQ_getNameServerHandle(void);
+
+Void MessageQ_setQueueOwner(MessageQ_Handle handle, Int pid);
+
+Void MessageQ_cleanupOwner(Int pid);
+
+Void MessageQ_msgInit(MessageQ_Msg msg);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+
+#endif /* MESSAGEQ_H_0xded2 */
diff --git a/linux/include/_MultiProc.h b/linux/include/_MultiProc.h
new file mode 100644 (file)
index 0000000..9cb691d
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ *  Copyright (c) 2008-2012, Texas Instruments Incorporated
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  *  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *  *  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *  *  Neither the name of Texas Instruments Incorporated nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   _MultiProc.h
+ *
+ *  @brief  Header file for_MultiProc on HLOS side
+ *  ============================================================================
+ */
+
+
+#ifndef _MULTIPROC_H_0XB522
+#define _MULTIPROC_H_0XB522
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*!
+ *  @brief  Max name length for a processor name.
+ */
+#define MultiProc_MAXNAMELENGTH 32
+
+/*!
+ *  @brief  Max number of processors supported.
+ */
+#define MultiProc_MAXPROCESSORS 10
+
+
+/*!
+ *  @brief  Configuration structure for MultiProc module
+ */
+typedef struct MultiProc_Config_tag {
+    Int32  numProcessors;
+    /*!< Max number of procs for particular system */
+    Char   nameList [MultiProc_MAXPROCESSORS][MultiProc_MAXNAMELENGTH];
+    /*!< Name List for processors in the system */
+    UInt16 id;
+    /*!< Local Proc ID. This needs to be set before calling any other APIs */
+} MultiProc_Config;
+
+/* This exported from family/<PLATFORM_DIR>/SystemCfg.c: */
+extern MultiProc_Config _MultiProc_cfg;
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif
diff --git a/linux/include/_NameServer.h b/linux/include/_NameServer.h
new file mode 100644 (file)
index 0000000..2b3e154
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       _NameServer.h
+ *
+ *  @brief      HLOS-specific NameServer header
+ *
+ */
+
+
+#ifndef NameServer_H_0XF414
+#define NameServer_H_0XF414
+
+/* Utilities headers */
+#include <ti/ipc/NameServer.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* =============================================================================
+ * Macros & Defines
+ * =============================================================================
+ */
+
+/*
+ * This must match on BIOS side. This will occupy queueIndex 0 of the MessageQ
+ * module queues array, forcing MessageQ indicies to start from 1.
+ */
+#define NAME_SERVER_RPMSG_ADDR 0
+
+/* =============================================================================
+ * APIs
+ * =============================================================================
+ */
+/*!
+ *  @brief      Function to setup the nameserver module.
+ *
+ *  @sa         NameServer_destroy
+ */
+Int NameServer_setup (Void);
+
+/*!
+ *  @brief      Function to destroy the nameserver module.
+ *
+ *  @sa         NameServer_setup
+ */
+Int NameServer_destroy (void);
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif
diff --git a/linux/include/_NameServerRemoteRpmsg.h b/linux/include/_NameServerRemoteRpmsg.h
new file mode 100644 (file)
index 0000000..9873871
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define NAMESERVER_REQUEST    0
+#define NAMESERVER_RESPONSE   1
+
+#define NAME_SERVER_RPMSG_ADDR  0
+
+#define MAXNAMEINCHAR 80
+#define NAMEARRAYSZIE   (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+
+#define NAMESERVER_GET_TIMEOUT  10 /* Seconds */
+
+#define NAMESERVER_MSG_TOKEN   0x5678abcd
+
+/* message sent to remote procId */
+typedef struct NameServerMsg {
+    Bits32  reserved;           /* reserved field: must be first!   */
+    Bits32  value;              /* holds value                      */
+    Bits32  request;            /* whether its a request/response   */
+    Bits32  requestStatus;      /* status of request                */
+                                /* name of NameServer instance      */
+    Bits32  instanceName[NAMEARRAYSZIE];
+                                /* name of NameServer entry         */
+    Bits32  name[NAMEARRAYSZIE];
+} NameServerMsg;
diff --git a/linux/include/_lad.h b/linux/include/_lad.h
new file mode 100644 (file)
index 0000000..d935bbb
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _lad.h ========
+ */
+
+#ifndef _lad_
+#define _lad_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "_MultiProc.h"
+#include <ti/ipc/MessageQ.h>
+#include <_MessageQ.h>
+#include <ti/ipc/NameServer.h>
+
+
+extern Bool logFile;
+extern FILE *logPtr;
+
+/* macros for writing to log file: */
+#define LOG0(a)  \
+    if (logFile == TRUE) {  fprintf(logPtr, a); fflush(logPtr); }
+
+#define LOG1(a, b)  \
+    if (logFile == TRUE) {  fprintf(logPtr, a, b); fflush(logPtr); }
+
+#define LOG2(a, b, c)  \
+    if (logFile == TRUE) {  fprintf(logPtr, a, b, c); fflush(logPtr); }
+
+
+/* macros for generating verbose output: */
+#define PRINTVERBOSE0(a)  \
+    if (verbose == TRUE) {  printf(a); }
+
+#define PRINTVERBOSE1(a, b)  \
+    if (verbose == TRUE) {  printf(a, b); }
+
+#define PRINTVERBOSE2(a, b, c)  \
+    if (verbose == TRUE) {  printf(a, b, c); }
+
+#define PRINTVERBOSE3(a, b, c, d)  \
+    if (verbose == TRUE) {  printf(a, b, c, d); }
+
+
+/* LAD commmand FIFO strings: */
+#define LAD_COMMANDFIFO         "/tmp/LAD/LADCMDS"
+#define LAD_WORKINGDIR          "/tmp/LAD/"
+#define LAD_RESPONSEFIFOPATH    LAD_WORKINGDIR
+#define LAD_PROTOCOLVERSION     "03000000"    /*  MMSSRRRR */
+
+#define LAD_MAXNUMCLIENTS  32      /* max simultaneous clients */
+#define LAD_CONNECTTIMEOUT 5.0  /* LAD connect response timeout (sec) */
+#define LAD_DISCONNECTTIMEOUT   5.0  /* LAD disconnect timeout (sec) */
+#define LAD_MAXLENGTHFIFONAME   128  /* max length client FIFO name */
+#define LAD_MAXLENGTHCOMMAND    512  /* size limit for LAD command string */
+#define LAD_MAXLENGTHRESPONSE   512  /* size limit for LAD response string */
+#define LAD_MAXLENGTHPROTOVERS  16   /* size limit for protocol version */
+#define LAD_MAXLOGFILEPATH 256  /* size limit for LAD log file path */
+#define LAD_COMMANDLENGTH       sizeof(struct LAD_CommandObj)
+#define LAD_RESPONSELENGTH      sizeof(union LAD_ResponseObj)
+
+#define LAD_MESSAGEQCREATEMAXNAMELEN 32
+
+
+typedef enum {
+    LAD_CONNECT = 0,
+    LAD_DISCONNECT,
+    LAD_NAMESERVER_SETUP,
+    LAD_NAMESERVER_DESTROY,
+    LAD_NAMESERVER_PARAMS_INIT,
+    LAD_NAMESERVER_CREATE,
+    LAD_NAMESERVER_DELETE,
+    LAD_NAMESERVER_ADDUINT32,
+    LAD_NAMESERVER_GETUINT32,
+    LAD_NAMESERVER_REMOVE,
+    LAD_NAMESERVER_REMOVEENTRY,
+    LAD_MESSAGEQ_GETCONFIG,
+    LAD_MESSAGEQ_SETUP,
+    LAD_MESSAGEQ_DESTROY,
+    LAD_MESSAGEQ_CREATE,
+    LAD_MESSAGEQ_DELETE,
+    LAD_MESSAGEQ_MSGINIT,
+    LAD_EXIT
+} _LAD_Command;
+
+struct LAD_CommandObj {
+    Int cmd;
+    Int clientId;
+    union {
+        struct {
+            Int pid;
+            Char name[LAD_MAXLENGTHFIFONAME];
+            Char protocol[LAD_MAXLENGTHPROTOVERS];
+        } connect;
+        struct {
+            Char name[NameServer_Params_MAXNAMELEN];
+            NameServer_Params params;
+        } create;
+        struct {
+            NameServer_Handle handle;
+        } delete;
+        struct {
+            NameServer_Handle handle;
+            Char name[NameServer_Params_MAXNAMELEN];
+            UInt32 val;
+        } addUInt32;
+        struct {
+            NameServer_Handle handle;
+            Char name[NameServer_Params_MAXNAMELEN];
+            UInt16 procId[MultiProc_MAXPROCESSORS];
+        } getUInt32;
+        struct {
+            NameServer_Handle handle;
+            Char name[NameServer_Params_MAXNAMELEN];
+        } remove;
+        struct {
+            NameServer_Handle handle;
+            Ptr entryPtr;
+        } removeEntry;
+        struct {
+            MessageQ_Config cfg;
+        } messageQSetup;
+        struct {
+            Char name[LAD_MESSAGEQCREATEMAXNAMELEN];
+            MessageQ_Params params;
+        } messageQCreate;
+        struct {
+            Void *serverHandle;
+        } messageQDelete;
+    } args;
+};
+
+union LAD_ResponseObj {
+    struct {
+       Int status;
+       UInt32 val;
+    } getUInt32;
+    struct {
+       Int status;
+       Int assignedId;
+    } connect;
+    struct {
+       Int status;
+       NameServer_Handle handle;
+    } delete;
+    struct {
+       Int status;
+       NameServer_Handle nameServerHandle;
+    } setup;
+    struct {
+       Int status;
+       Int queueId;
+       Void *serverHandle;
+    } messageQCreate;
+    struct {
+       Int status;
+    } messageQDelete;
+    struct {
+       Int status;
+       MessageQ_MsgHeader msg;
+    } msgInit;
+    struct {
+       Int status;
+       MessageQ_Config cfg;
+    } messageQGetConfig;
+    NameServer_Params params;
+    NameServer_Handle handle;
+    Ptr entryPtr;
+    Int status;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/linux/include/ladclient.h b/linux/include/ladclient.h
new file mode 100644 (file)
index 0000000..23b6ed1
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== ladclient.h ========
+ */
+
+/**
+ *  @file       ti/dsplink/utils/ladclient/ladclient.h
+ *
+ *  @brief      The Link Arbiter Daemon (LAD) communication interface.
+ *          Provides wrapper functions to communicate with LAD, allowing
+ *              a client to: establish a connection to LAD; and disconnect
+ *              from LAD.
+ */
+/**
+ *  @defgroup   _ladclient_LAD LAD - Link Arbiter Client Interface
+ *
+ *  This module provides an API to enable communication with the Link Arbiter
+ *  Daemon (LAD).
+ */
+
+#ifndef _ladclient_LAD_
+#define _ladclient_LAD_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <_lad.h>
+
+/* LAD return codes */
+typedef enum {
+    LAD_SUCCESS = 0,       /**< success */
+    LAD_FAILURE,           /**< general failure */
+    LAD_INVALIDARG,        /**< invalid argument */
+    LAD_ACCESSDENIED,      /**< the request was denied */
+    LAD_IOFAILURE,         /**< communication failure */
+    LAD_NOTCONNECTED,      /**< not connected to LAD yet */
+    LAD_INVALIDVERSION     /**< unsupported communication protocol */
+} LAD_Status;
+
+typedef UInt LAD_ClientHandle;  /**< handle for communicating with LAD  */
+
+
+/*
+ *  ======== LAD_connect ========
+ */
+/**
+ *  @brief      Connect to LAD.
+ *
+ *  @param[out] handle    The new client handle, as defined by LAD.
+ *
+ *  @retval     LAD_SUCCESS    Success.
+ *  @retval     LAD_INVALIDARG    The handle pointer is NULL.
+ *  @retval     LAD_ACCESSDENIED    Returned on either of two conditions: this
+ *              client is trying to establish a second active connection to
+ *              LAD, and the request is denied; or, the total number of
+ *              simultaneous client connections to LAD has been reached, and
+ *              no more client handles are available.
+ *  @retval     LAD_IOFAILURE    Unable to communicate with LAD, due to an
+ *              OS-level I/O failure.  A full system reboot may be necessary.
+ *  @retval     LAD_INVALIDVERSION    Unable to communicate with LAD due to a
+ *              mismatch in the communication protocol between the client and
+ *              LAD.
+ *
+ *  @sa         LAD_disconnect().
+ */
+extern LAD_Status LAD_connect(LAD_ClientHandle * handle);
+
+/*
+ *  ======== LAD_disconnect ========
+ */
+/**
+ *  @brief      Disconnect from LAD.
+ *
+ *  @param[in]  handle    The client handle, as returned from previous call to
+ *                        LAD_connect().
+ *
+ *  @retval     LAD_SUCCESS    Success.
+ *  @retval     LAD_INVALIDARG    Invalid client handle.
+ *  @retval     LAD_NOTCONNECTED    Not currently connected to LAD.
+ *  @retval     LAD_STILLRUNNING    This client has previously started the DSP
+ *              via a call to LAD_startupDsp, and must call LAD_releaseDsp
+ *              before attempting to disconnect from LAD.
+ *  @retval     LAD_IOFAILURE    Unable to communicate with LAD, due to an
+ *              OS-level I/O failure, or timeout.  A full system reboot may be
+ *              necessary.
+ *
+ *  @sa         LAD_connect().
+ */
+extern LAD_Status LAD_disconnect(LAD_ClientHandle handle);
+
+extern LAD_ClientHandle LAD_findHandle(Void);
+extern LAD_Status LAD_getResponse(LAD_ClientHandle handle, union LAD_ResponseObj *rsp);
+extern LAD_Status LAD_putCommand(struct LAD_CommandObj *cmd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/linux/include/net/rpmsg.h b/linux/include/net/rpmsg.h
new file mode 100644 (file)
index 0000000..223d6c4
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Remote processor messaging sockets
+ *
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Ohad Ben-Cohen <ohad@wizery.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 __NET_RPMSG_H
+#define __NET_RPMSG_H
+
+#include <linux/types.h>
+#include <sys/socket.h>
+
+/* user space needs this */
+#ifndef AF_RPMSG
+#define AF_RPMSG        40
+#define PF_RPMSG        AF_RPMSG
+#endif
+
+/* Connection and socket states */
+enum {
+        RPMSG_CONNECTED = 1, /* wait_for_packet() wants this... */
+        RPMSG_OPEN,
+        RPMSG_LISTENING,
+        RPMSG_CLOSED,
+};
+
+struct sockaddr_rpmsg {
+        sa_family_t family;
+        __u32 vproc_id;
+        __u32 addr;
+};
+
+#define RPMSG_LOCALHOST ((__u32) ~0UL)
+
+#ifdef __KERNEL__
+
+#include <net/sock.h>
+#include <linux/rpmsg.h>
+
+struct rpmsg_socket {
+        struct sock sk;
+        struct rpmsg_channel *rpdev;
+        bool unregister_rpdev;
+};
+
+#endif /* __KERNEL__ */
+#endif /* __NET_RPMSG_H */
diff --git a/linux/src/api/Makefile.am b/linux/src/api/Makefile.am
new file mode 100644 (file)
index 0000000..a16e9b3
--- /dev/null
@@ -0,0 +1,41 @@
+# src/api/Makefile.am
+
+# additional include paths necessary to compile the library
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+
+###############################################################################
+# THE LIBRARIES TO BUILD
+###############################################################################
+
+# the library names to build (note we are building shared libs)
+lib_LTLIBRARIES = libtiipc.la
+
+# where to install the headers on the system
+libtiipc_ladir = $(includedir)
+
+# the list of header files that belong to the library (to be installed later)
+libtiipc_la_HEADERS =    \
+                        $(top_srcdir)/linux/include/Std.h \
+                        $(top_srcdir)/linux/include/SysLink.h
+
+# the sources to add to the library and to add to the source distribution
+libtiipc_la_SOURCES =    \
+                        $(libtiipc_la_HEADERS) \
+                        $(top_srcdir)/linux/include/_MultiProc.h \
+                        $(top_srcdir)/linux/include/_MessageQ.h \
+                        $(top_srcdir)/linux/include/_NameServer.h \
+                        $(top_srcdir)/linux/include/ladclient.h \
+                        $(top_srcdir)/linux/include/_lad.h \
+                        $(top_srcdir)/linux/include/SocketFxns.h \
+                        $(top_srcdir)/linux/include/net/rpmsg.h \
+                        $(top_srcdir)/packages/ti/ipc/NameServer.h \
+                        $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+                        $(top_srcdir)/packages/ti/ipc/MessageQ.h \
+                        MessageQ.c \
+                        NameServer.c \
+                        SysLink.c
+
+# Add version info to the shared library
+libtiipc_la_LDFLAGS = -version-info 1:0:0
+                                               
+###############################################################################
diff --git a/linux/src/api/Makefile.in b/linux/src/api/Makefile.in
new file mode 100644 (file)
index 0000000..bcc0762
--- /dev/null
@@ -0,0 +1,527 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# src/api/Makefile.am
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = linux/src/api
+DIST_COMMON = $(libtiipc_la_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiipc_ladir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libtiipc_la_LIBADD =
+am__objects_1 =
+am_libtiipc_la_OBJECTS = $(am__objects_1) MessageQ.lo NameServer.lo \
+       SysLink.lo
+libtiipc_la_OBJECTS = $(am_libtiipc_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libtiipc_la_SOURCES)
+DIST_SOURCES = $(libtiipc_la_SOURCES)
+libtiipc_laHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libtiipc_la_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+
+# additional include paths necessary to compile the library
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+###############################################################################
+# THE LIBRARIES TO BUILD
+###############################################################################
+
+# the library names to build (note we are building shared libs)
+lib_LTLIBRARIES = libtiipc.la
+
+# where to install the headers on the system
+libtiipc_ladir = $(includedir)
+
+# the list of header files that belong to the library (to be installed later)
+libtiipc_la_HEADERS = \
+                        $(top_srcdir)/linux/include/Std.h \
+                        $(top_srcdir)/linux/include/SysLink.h
+
+
+# the sources to add to the library and to add to the source distribution
+libtiipc_la_SOURCES = \
+                        $(libtiipc_la_HEADERS) \
+                        $(top_srcdir)/linux/include/_MultiProc.h \
+                        $(top_srcdir)/linux/include/_MessageQ.h \
+                        $(top_srcdir)/linux/include/_NameServer.h \
+                        $(top_srcdir)/linux/include/ladclient.h \
+                        $(top_srcdir)/linux/include/_lad.h \
+                        $(top_srcdir)/linux/include/SocketFxns.h \
+                        $(top_srcdir)/linux/include/net/rpmsg.h \
+                        $(top_srcdir)/packages/ti/ipc/NameServer.h \
+                        $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+                        $(top_srcdir)/packages/ti/ipc/MessageQ.h \
+                        MessageQ.c \
+                        NameServer.c \
+                        SysLink.c
+
+
+# Add version info to the shared library
+libtiipc_la_LDFLAGS = -version-info 1:0:0
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  linux/src/api/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  linux/src/api/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libtiipc.la: $(libtiipc_la_OBJECTS) $(libtiipc_la_DEPENDENCIES) 
+       $(LINK) -rpath $(libdir) $(libtiipc_la_LDFLAGS) $(libtiipc_la_OBJECTS) $(libtiipc_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQ.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NameServer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SysLink.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-libtiipc_laHEADERS: $(libtiipc_la_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(libtiipc_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipc_ladir)"
+       @list='$(libtiipc_la_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libtiipc_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipc_ladir)/$$f'"; \
+         $(libtiipc_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipc_ladir)/$$f"; \
+       done
+
+uninstall-libtiipc_laHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libtiipc_la_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libtiipc_ladir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libtiipc_ladir)/$$f"; \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/../../../linux/include
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiipc_ladir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libtiipc_laHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
+       uninstall-libtiipc_laHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am \
+       install-libLTLIBRARIES install-libtiipc_laHEADERS install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-info-am uninstall-libLTLIBRARIES \
+       uninstall-libtiipc_laHEADERS
+
+
+###############################################################################
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/linux/src/api/MessageQ.c b/linux/src/api/MessageQ.c
new file mode 100644 (file)
index 0000000..55aabce
--- /dev/null
@@ -0,0 +1,1184 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       MessageQ.c
+ *  @brief      Prototype Mapping of SysLink MessageQ to Socket ABI
+ *              (SysLink 3).
+ *
+ *  @ver        02.00.00.51_alpha2 (kernel code is basis for this module)
+ *
+ */
+/*============================================================================
+ *  @file   MessageQ.c
+ *
+ *  @brief  MessageQ module "client" implementation
+ *
+ *  This implementation is geared for use in a "client/server" model, whereby
+ *  system-wide data is maintained in a "server" component and process-
+ *  specific data is handled here.  At the moment, this implementation
+ *  connects and communicates with LAD for the server connection.
+ *
+ *  The MessageQ module supports the structured sending and receiving of
+ *  variable length messages. This module can be used for homogeneous or
+ *  heterogeneous multi-processor messaging.
+ *
+ *  MessageQ provides more sophisticated messaging than other modules. It is
+ *  typically used for complex situations such as multi-processor messaging.
+ *
+ *  The following are key features of the MessageQ module:
+ *  -Writers and readers can be relocated to another processor with no
+ *   runtime code changes.
+ *  -Timeouts are allowed when receiving messages.
+ *  -Readers can determine the writer and reply back.
+ *  -Receiving a message is deterministic when the timeout is zero.
+ *  -Messages can reside on any message queue.
+ *  -Supports zero-copy transfers.
+ *  -Can send and receive from any type of thread.
+ *  -Notification mechanism is specified by application.
+ *  -Allows QoS (quality of service) on message buffer pools. For example,
+ *   using specific buffer pools for specific message queues.
+ *
+ *  Messages are sent and received via a message queue. A reader is a thread
+ *  that gets (reads) messages from a message queue. A writer is a thread that
+ *  puts (writes) a message to a message queue. Each message queue has one
+ *  reader and can have many writers. A thread may read from or write to multiple
+ *  message queues.
+ *
+ *  Conceptually, the reader thread owns a message queue. The reader thread
+ *  creates a message queue. Writer threads  a created message queues to
+ *  get access to them.
+ *
+ *  Message queues are identified by a system-wide unique name. Internally,
+ *  MessageQ uses the NameServermodule for managing
+ *  these names. The names are used for opening a message queue. Using
+ *  names is not required.
+ *
+ *  Messages must be allocated from the MessageQ module. Once a message is
+ *  allocated, it can be sent on any message queue. Once a message is sent, the
+ *  writer loses ownership of the message and should not attempt to modify the
+ *  message. Once the reader receives the message, it owns the message. It
+ *  may either free the message or re-use the message.
+ *
+ *  Messages in a message queue can be of variable length. The only
+ *  requirement is that the first field in the definition of a message must be a
+ *  MsgHeader structure. For example:
+ *  typedef struct MyMsg {
+ *      MessageQ_MsgHeader header;
+ *      ...
+ *  } MyMsg;
+ *
+ *  The MessageQ API uses the MessageQ_MsgHeader internally. Your application
+ *  should not modify or directly access the fields in the MessageQ_MsgHeader.
+ *
+ *  All messages sent via the MessageQ module must be allocated from a
+ *  Heap implementation. The heap can be used for
+ *  other memory allocation not related to MessageQ.
+ *
+ *  An application can use multiple heaps. The purpose of having multiple
+ *  heaps is to allow an application to regulate its message usage. For
+ *  example, an application can allocate critical messages from one heap of fast
+ *  on-chip memory and non-critical messages from another heap of slower
+ *  external memory
+ *
+ *  MessageQ does support the usage of messages that allocated via the
+ *  alloc function. Please refer to the staticMsgInit
+ *  function description for more details.
+ *
+ *  In a multiple processor system, MessageQ communications to other
+ *  processors via MessageQTransport instances. There must be one and
+ *  only one MessageQTransport instance for each processor where communication
+ *  is desired.
+ *  So on a four processor system, each processor must have three
+ *  MessageQTransport instance.
+ *
+ *  The user only needs to create the MessageQTransport instances. The instances
+ *  are responsible for registering themselves with MessageQ.
+ *  This is accomplished via the registerTransport function.
+ *
+ *  ============================================================================
+ */
+
+
+/* Standard headers */
+#include <Std.h>
+
+/* Linux specific header files, replacing OSAL: */
+#include <pthread.h>
+
+/* Module level headers */
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+#include <_MultiProc.h>
+#include <ti/ipc/MessageQ.h>
+#include <_MessageQ.h>
+
+/* Socket Headers */
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/eventfd.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+
+/* SysLink Socket Protocol Family */
+#include <net/rpmsg.h>
+
+/* Socket utils: */
+#include <SocketFxns.h>
+
+#include <ladclient.h>
+#include <_lad.h>
+
+/* =============================================================================
+ * Macros/Constants
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  Name of the reserved NameServer used for MessageQ.
+ */
+#define MessageQ_NAMESERVER  "MessageQ"
+
+/*!
+ *  @brief  Value of an invalid socket ID:
+ */
+#define Transport_INVALIDSOCKET  (0xFFFFFFFF)
+
+/* More magic rpmsg port numbers: */
+#define MESSAGEQ_RPMSG_PORT       61
+#define MESSAGEQ_RPMSG_MAXSIZE   512
+
+/* Trace flag settings: */
+#define TRACESHIFT    12
+#define TRACEMASK     0x1000
+
+/* Define BENCHMARK to quiet key MessageQ APIs: */
+//#define BENCHMARK
+
+/* =============================================================================
+ * Structures & Enums
+ * =============================================================================
+ */
+
+/* structure for MessageQ module state */
+typedef struct MessageQ_ModuleObject {
+    Int                 refCount;
+    /*!< Reference count */
+    NameServer_Handle   nameServer;
+    /*!< Handle to the local NameServer used for storing GP objects */
+    pthread_mutex_t     gate;
+    /*!< Handle of gate to be used for local thread safety */
+    MessageQ_Params     defaultInstParams;
+    /*!< Default instance creation parameters */
+    int                 sock[MultiProc_MAXPROCESSORS];
+    /*!< Sockets to for sending to each remote processor */
+    int                 seqNum;
+    /*!< Process-specific sequence number */
+} MessageQ_ModuleObject;
+
+/*!
+ *  @brief  Structure for the Handle for the MessageQ.
+ */
+typedef struct MessageQ_Object_tag {
+    MessageQ_Params         params;
+    /*! Instance specific creation parameters */
+    MessageQ_QueueId        queue;
+    /* Unique id */
+    int                     fd[MultiProc_MAXPROCESSORS];
+    /* File Descriptor to block on messages from remote processors. */
+    int                     unblockFd;
+    /* Write this fd to unblock the select() call in MessageQ _get() */
+    void                    *serverHandle;
+} MessageQ_Object;
+
+static Bool verbose = FALSE;
+
+
+/* =============================================================================
+ *  Globals
+ * =============================================================================
+ */
+static MessageQ_ModuleObject MessageQ_state =
+{
+    .refCount               = 0,
+    .nameServer             = NULL,
+};
+
+/*!
+ *  @var    MessageQ_module
+ *
+ *  @brief  Pointer to the MessageQ module state.
+ */
+MessageQ_ModuleObject * MessageQ_module = &MessageQ_state;
+
+
+/* =============================================================================
+ * Forward declarations of internal functions
+ * =============================================================================
+ */
+
+/* This is a helper function to initialize a message. */
+static Int transportCreateEndpoint(int * fd, UInt16 rprocId, UInt16 queueIndex);
+static Int transportCloseEndpoint(int fd);
+static Int transportGet(int sock, MessageQ_Msg * retMsg);
+static Int transportPut(MessageQ_Msg msg, UInt16 dstId, UInt16 dstProcId);
+
+/* =============================================================================
+ * APIS
+ * =============================================================================
+ */
+/* Function to get default configuration for the MessageQ module.
+ *
+ */
+Void MessageQ_getConfig (MessageQ_Config * cfg)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    assert (cfg != NULL);
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "MessageQ_getConfig: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return;
+    }
+
+    cmd.cmd = LAD_MESSAGEQ_GETCONFIG;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "MessageQ_getConfig: sending LAD command failed, status=%d\n", status)
+        return;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MessageQ_getConfig: no LAD response, status=%d\n", status)
+        return;
+    }
+    status = rsp.messageQGetConfig.status;
+
+    PRINTVERBOSE2(
+      "MessageQ_getConfig: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+    memcpy(cfg, &rsp.messageQGetConfig.cfg, sizeof(*cfg));
+
+    return;
+}
+
+/* Function to setup the MessageQ module. */
+Int MessageQ_setup (const MessageQ_Config * cfg)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+    Int i;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "MessageQ_setup: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return MessageQ_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_MESSAGEQ_SETUP;
+    cmd.clientId = handle;
+    memcpy(&cmd.args.messageQSetup.cfg, cfg, sizeof(*cfg));
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "MessageQ_setup: sending LAD command failed, status=%d\n", status)
+        return MessageQ_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MessageQ_setup: no LAD response, status=%d\n", status)
+        return(status);
+    }
+    status = rsp.setup.status;
+
+    PRINTVERBOSE2(
+      "MessageQ_setup: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+    MessageQ_module->nameServer = rsp.setup.nameServerHandle;
+    MessageQ_module->seqNum = 0;
+
+    /* Create a default local gate. */
+    pthread_mutex_init (&(MessageQ_module->gate), NULL);
+
+    /* Clear sockets array. */
+    for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
+       MessageQ_module->sock[i]      = Transport_INVALIDSOCKET;
+    }
+
+
+    return status;
+}
+
+/*
+ * Function to destroy the MessageQ module.
+ * Destroys socket/protocol maps;  sockets themselves should have been
+ * destroyed in MessageQ_delete() and MessageQ_detach() calls.
+ */
+Int MessageQ_destroy (void)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "MessageQ_destroy: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return MessageQ_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_MESSAGEQ_DESTROY;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "MessageQ_destroy: sending LAD command failed, status=%d\n", status)
+        return MessageQ_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MessageQ_destroy: no LAD response, status=%d\n", status)
+        return(status);
+    }
+    status = rsp.status;
+
+    PRINTVERBOSE2(
+      "MessageQ_destroy: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+    return status;
+}
+
+/* Function to initialize the parameters for the MessageQ instance. */
+Void MessageQ_Params_init (MessageQ_Params * params)
+{
+    memcpy (params, &(MessageQ_module->defaultInstParams),
+            sizeof (MessageQ_Params));
+
+    return;
+}
+
+/*
+ *   Function to create a MessageQ object for receiving.
+ *
+ *   Create a socket and bind the source address (local ProcId/MessageQ ID) in
+ *   order to get messages dispatched to this messageQ.
+ */
+MessageQ_Handle MessageQ_create (String name, const MessageQ_Params * params)
+{
+    Int                   status    = MessageQ_S_SUCCESS;
+    MessageQ_Object *     obj    = NULL;
+    UInt16                queueIndex = 0u;
+    UInt16                procId;
+    UInt16                rprocId;
+    LAD_ClientHandle      handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "MessageQ_create: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return NULL;
+    }
+
+    cmd.cmd = LAD_MESSAGEQ_CREATE;
+    cmd.clientId = handle;
+    strncpy(cmd.args.messageQCreate.name, name,
+            LAD_MESSAGEQCREATEMAXNAMELEN - 1);
+    cmd.args.messageQCreate.name[LAD_MESSAGEQCREATEMAXNAMELEN - 1] = '\0';
+    if (params) {
+        memcpy(&cmd.args.messageQCreate.params, params, sizeof(*params));
+    }
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "MessageQ_create: sending LAD command failed, status=%d\n", status)
+        return NULL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MessageQ_create: no LAD response, status=%d\n", status)
+        return NULL;
+    }
+    status = rsp.messageQCreate.status;
+
+    PRINTVERBOSE2(
+      "MessageQ_create: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+    if (status == -1) {
+       PRINTVERBOSE1(
+          "MessageQ_create: MessageQ server operation failed, status=%d\n",
+          status)
+       return NULL;
+    }
+
+    /* Create the generic obj */
+    obj = (MessageQ_Object *)calloc(1, sizeof (MessageQ_Object));
+
+    if (params != NULL) {
+       /* Populate the params member */
+        memcpy((Ptr) &obj->params, (Ptr)params, sizeof (MessageQ_Params));
+    }
+
+    procId = MultiProc_self();
+    queueIndex = (MessageQ_QueueIndex)rsp.messageQCreate.queueId;
+    obj->queue = rsp.messageQCreate.queueId;
+    obj->serverHandle = rsp.messageQCreate.serverHandle;
+
+    /*
+     * Create a set of communication endpoints (one per each remote proc),
+     * and return the socket as target for MessageQ_put() calls, and as
+     * a file descriptor to close during MessageQ_delete().
+     */
+    for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
+        obj->fd[rprocId] = Transport_INVALIDSOCKET;
+        if (procId == rprocId) {
+            /* Skip creating an endpoint for ourself. */
+            continue;
+        }
+
+        PRINTVERBOSE3("MessageQ_create: creating endpoint for: %s, rprocId: %d, queueIndex: %d\n", name, rprocId, queueIndex)
+
+        status = transportCreateEndpoint(&obj->fd[rprocId], rprocId,
+                                           queueIndex);
+        if (status < 0) {
+           goto cleanup;
+        }
+    }
+
+    /*
+     * Now, to support MessageQ_unblock() functionality, create an event object.
+     * Writing to this event will unblock the select() call in MessageQ_get().
+     */
+    obj->unblockFd = eventfd(0, 0);
+    if (obj->unblockFd == -1)  {
+        printf ("MessageQ_create: eventfd creation failed: %d, %s\n",
+                   errno, strerror(errno));
+        status = MessageQ_E_FAIL;
+    }
+
+cleanup:
+    /* Cleanup if fail: */
+    if (status < 0) {
+        MessageQ_delete((MessageQ_Handle *)&obj);
+    }
+
+    return ((MessageQ_Handle) obj);
+}
+
+/*
+ * Function to delete a MessageQ object for a specific slave processor.
+ *
+ * Deletes the socket associated with this MessageQ object.
+ */
+Int MessageQ_delete (MessageQ_Handle * handlePtr)
+{
+    Int               status    = MessageQ_S_SUCCESS;
+    MessageQ_Object * obj       = NULL;
+    UInt16            rprocId;
+    LAD_ClientHandle      handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "MessageQ_delete: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return MessageQ_E_FAIL;
+    }
+
+    obj = (MessageQ_Object *) (*handlePtr);
+
+    cmd.cmd = LAD_MESSAGEQ_DELETE;
+    cmd.clientId = handle;
+    cmd.args.messageQDelete.serverHandle = obj->serverHandle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "MessageQ_delete: sending LAD command failed, status=%d\n", status)
+        return MessageQ_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MessageQ_delete: no LAD response, status=%d\n", status)
+        return MessageQ_E_FAIL;
+    }
+    status = rsp.messageQDelete.status;
+
+    PRINTVERBOSE2(
+      "MessageQ_delete: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+
+    /* Close the event used for MessageQ_unblock(): */
+    close(obj->unblockFd);
+
+    /* Close the communication endpoint: */
+    for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
+        if (obj->fd[rprocId] != Transport_INVALIDSOCKET) {
+            status = transportCloseEndpoint(obj->fd[rprocId]);
+        }
+    }
+
+    /* Now free the obj */
+    free (obj);
+    *handlePtr = NULL;
+
+    return (status);
+}
+
+/*
+ *  Opens an instance of MessageQ for sending.
+ *
+ *  We need not create a socket here; the sockets for all remote processors
+ *  were created during MessageQ_attach(), and will be
+ *  retrieved during MessageQ_put().
+ */
+Int MessageQ_open (String name, MessageQ_QueueId * queueId)
+{
+    Int status = MessageQ_S_SUCCESS;
+
+    status = NameServer_getUInt32 (MessageQ_module->nameServer,
+                                     name, queueId, NULL);
+
+    if (status == NameServer_E_NOTFOUND) {
+        /* Set return queue ID to invalid. */
+        *queueId = MessageQ_INVALIDMESSAGEQ;
+        status = MessageQ_E_NOTFOUND;
+    }
+    else if (status >= 0) {
+        /* Override with a MessageQ status code. */
+        status = MessageQ_S_SUCCESS;
+    }
+    else {
+        /* Set return queue ID to invalid. */
+        *queueId = MessageQ_INVALIDMESSAGEQ;
+        /* Override with a MessageQ status code. */
+        if (status == NameServer_E_TIMEOUT) {
+            status = MessageQ_E_TIMEOUT;
+        }
+        else {
+            status = MessageQ_E_FAIL;
+        }
+    }
+
+    return (status);
+}
+
+/* Closes previously opened instance of MessageQ module. */
+Int MessageQ_close (MessageQ_QueueId * queueId)
+{
+    Int32 status = MessageQ_S_SUCCESS;
+
+    /* Nothing more to be done for closing the MessageQ. */
+    *queueId = MessageQ_INVALIDMESSAGEQ;
+
+    return (status);
+}
+
+/*
+ * Place a message onto a message queue.
+ *
+ * Calls TransportShm_put(), which handles the sending of the message using the
+ * appropriate kernel interface (socket, device ioctl) call for the remote
+ * procId encoded in the queueId argument.
+ *
+ */
+Int MessageQ_put (MessageQ_QueueId queueId, MessageQ_Msg msg)
+{
+    Int      status;
+    UInt16   dstProcId  = (UInt16)(queueId >> 16);
+    UInt16   queueIndex = (MessageQ_QueueIndex)(queueId & 0x0000ffff);
+
+    msg->dstId     = queueIndex;
+    msg->dstProc   = dstProcId;
+
+    status = transportPut(msg, queueIndex, dstProcId);
+
+    return (status);
+}
+
+/*
+ * Gets a message for a message queue and blocks if the queue is empty.
+ * If a message is present, it returns it.  Otherwise it blocks
+ * waiting for a message to arrive.
+ * When a message is returned, it is owned by the caller.
+ *
+ * We block using select() on the receiving socket's file descriptor, then
+ * get the waiting message via the socket API recvfrom().
+ * We use the socket stored in the messageQ object via a previous call to
+ * MessageQ_create().
+ *
+ */
+Int MessageQ_get (MessageQ_Handle handle, MessageQ_Msg * msg ,UInt timeout)
+{
+    Int     status = MessageQ_S_SUCCESS;
+    Int     tmpStatus;
+    MessageQ_Object * obj = (MessageQ_Object *) handle;
+    int     retval;
+    int     nfds;
+    fd_set  rfds;
+    struct  timeval tv;
+    void    *timevalPtr;
+    UInt16  rprocId;
+    int     maxfd = 0;
+
+    /* Wait (with timeout) and retreive message from socket: */
+    FD_ZERO(&rfds);
+    for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
+        if (rprocId == MultiProc_self()) {
+            continue;
+        }
+        maxfd = MAX(maxfd, obj->fd[rprocId]);
+        FD_SET(obj->fd[rprocId], &rfds);
+    }
+
+    /* Wait also on the event fd, which may be written by MessageQ_unblock(): */
+    FD_SET(obj->unblockFd, &rfds);
+
+    if (timeout == MessageQ_FOREVER) {
+        timevalPtr = NULL;
+    }
+    else {
+        /* Timeout given in msec: convert:  */
+        tv.tv_sec = timeout / 1000;
+        tv.tv_usec = (timeout % 1000) * 1000;
+        timevalPtr = &tv;
+    }
+    /* Add one to last fd created: */
+    nfds = MAX(maxfd, obj->unblockFd) + 1;
+
+    retval = select(nfds, &rfds, NULL, NULL, timevalPtr);
+    if (retval)  {
+        if (FD_ISSET(obj->unblockFd, &rfds))  {
+            /*
+             * Our event was signalled by MessageQ_unblock().
+             *
+             * This is typically done during a shutdown sequence, where
+             * the intention of the client would be to ignore (i.e. not fetch)
+             * any pending messages in the transport's queue.
+             * Thus, we shall not check for nor return any messages.
+             */
+            *msg = NULL;
+            status = MessageQ_E_UNBLOCKED;
+        }
+        else {
+            for (rprocId = 0; rprocId < MultiProc_getNumProcessors();
+                 rprocId++) {
+                if (rprocId == MultiProc_self()) {
+                    continue;
+                }
+                if (FD_ISSET(obj->fd[rprocId], &rfds)) {
+                    /* Our transport's fd was signalled: Get the message: */
+                    tmpStatus = transportGet(obj->fd[rprocId], msg);
+                    if (tmpStatus < 0) {
+                        printf ("MessageQ_get: tranposrtshm_get failed.");
+                        status = MessageQ_E_FAIL;
+                    }
+                }
+            }
+        }
+    }
+    else if (retval == 0) {
+        *msg = NULL;
+        status = MessageQ_E_TIMEOUT;
+    }
+
+    return (status);
+}
+
+/*
+ * Return a count of the number of messages in the queue
+ *
+ * TBD: Implement as a socket ioctl, using getsockopt().  Return -1 for now.
+ */
+Int MessageQ_count (MessageQ_Handle handle)
+{
+    Int               count = -1;
+#if 0
+    MessageQ_Object * obj   = (MessageQ_Object *) handle;
+    socklen_t         optlen;
+
+    /*
+     * TBD: Need to find a way to implement (if anyone uses it!), and
+     * push down into transport..
+     */
+
+    /*
+     * 2nd arg to getsockopt should be transport independent, but using
+     *  SSKPROTO_SHMFIFO for now:
+     */
+    getsockopt(obj->fd, SSKPROTO_SHMFIFO, SSKGETOPT_GETMSGQCOUNT,
+                 &count, &optlen);
+#endif
+
+    return (count);
+}
+
+/* Initializes a message not obtained from MessageQ_alloc. */
+Void MessageQ_staticMsgInit (MessageQ_Msg msg, UInt32 size)
+{
+    /* Fill in the fields of the message */
+    MessageQ_msgInit (msg);
+    msg->heapId  = MessageQ_STATICMSG;
+    msg->msgSize = size;
+}
+
+/*
+ * Allocate a message and initialize the needed fields (note some
+ * of the fields in the header are set via other APIs or in the
+ * MessageQ_put function,
+ */
+MessageQ_Msg MessageQ_alloc (UInt16 heapId, UInt32 size)
+{
+    MessageQ_Msg msg       = NULL;
+
+    /*
+     * heapId not used for local alloc (as this is over a copy transport), but
+     * we need to send to other side as heapId is used in BIOS transport:
+     */
+    msg = (MessageQ_Msg)calloc (1, size);
+    MessageQ_msgInit (msg);
+    msg->msgSize = size;
+    msg->heapId  = heapId;
+
+    return msg;
+}
+
+/* Frees the message back to the heap that was used to allocate it. */
+Int MessageQ_free (MessageQ_Msg msg)
+{
+    UInt32         status = MessageQ_S_SUCCESS;
+
+    /* Check to ensure this was not allocated by user: */
+    if (msg->heapId == MessageQ_STATICMSG)  {
+        status =  MessageQ_E_CANNOTFREESTATICMSG;
+    }
+    else {
+        free (msg);
+    }
+
+    return status;
+}
+
+/* Register a heap with MessageQ. */
+Int MessageQ_registerHeap (Ptr heap, UInt16 heapId)
+{
+    Int  status = MessageQ_S_SUCCESS;
+
+    /* Do nothing, as this uses a copy transport: */
+
+    return status;
+}
+
+/* Unregister a heap with MessageQ. */
+Int MessageQ_unregisterHeap (UInt16 heapId)
+{
+    Int  status = MessageQ_S_SUCCESS;
+
+    /* Do nothing, as this uses a copy transport: */
+
+    return status;
+}
+
+/* Unblocks a MessageQ */
+Void MessageQ_unblock (MessageQ_Handle handle)
+{
+    MessageQ_Object * obj   = (MessageQ_Object *) handle;
+    uint64_t     buf = 1;
+    int          numBytes;
+
+    /* Write 8 bytes to awaken any threads blocked on this messageQ: */
+    numBytes = write(obj->unblockFd, &buf, sizeof(buf));
+}
+
+/* Embeds a source message queue into a message. */
+Void MessageQ_setReplyQueue (MessageQ_Handle handle, MessageQ_Msg msg)
+{
+    MessageQ_Object * obj   = (MessageQ_Object *) handle;
+
+    msg->replyId   = (UInt16)(obj->queue);
+    msg->replyProc = (UInt16)(obj->queue >> 16);
+}
+
+/* Returns the QueueId associated with the handle. */
+MessageQ_QueueId MessageQ_getQueueId (MessageQ_Handle handle)
+{
+    MessageQ_Object * obj = (MessageQ_Object *) handle;
+    UInt32            queueId;
+
+    queueId = (obj->queue);
+
+    return queueId;
+}
+
+/* Sets the tracing of a message */
+Void MessageQ_setMsgTrace (MessageQ_Msg msg, Bool traceFlag)
+{
+    msg->flags = (msg->flags & ~TRACEMASK) |   (traceFlag << TRACESHIFT);
+}
+
+/*
+ *  Returns the amount of shared memory used by one transport instance.
+ *
+ *  The MessageQ module itself does not use any shared memory but the
+ *  underlying transport may use some shared memory.
+ */
+SizeT MessageQ_sharedMemReq (Ptr sharedAddr)
+{
+    SizeT memReq = 0u;
+
+    /* Do nothing, as this is a copy transport. */
+
+    return (memReq);
+}
+
+/*
+ *  Create a socket for this remote proc, and attempt to connect.
+ *
+ *  Only creates a socket if one does not already exist for this procId.
+ *
+ *  Note: remoteProcId may be MultiProc_Self() for loopback case.
+ */
+Int MessageQ_attach (UInt16 remoteProcId, Ptr sharedAddr)
+{
+    Int     status = MessageQ_S_SUCCESS;
+    int     sock;
+
+    PRINTVERBOSE1("MessageQ_attach: remoteProcId: %d\n", remoteProcId)
+
+    if (remoteProcId >= MultiProc_MAXPROCESSORS) {
+        status = MessageQ_E_INVALIDPROCID;
+        goto exit;
+    }
+
+    pthread_mutex_lock (&(MessageQ_module->gate));
+
+    /* Only create a socket if one doesn't exist: */
+    if (MessageQ_module->sock[remoteProcId] == Transport_INVALIDSOCKET)  {
+        /* Create the socket for sending messages to the remote proc: */
+        sock = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
+        if (sock < 0) {
+            status = MessageQ_E_FAIL;
+            printf ("MessageQ_attach: socket failed: %d, %s\n",
+                       errno, strerror(errno));
+        }
+        else  {
+            PRINTVERBOSE1("MessageQ_attach: created send socket: %d\n", sock)
+            MessageQ_module->sock[remoteProcId] = sock;
+            /* Attempt to connect: */
+            ConnectSocket(sock, remoteProcId, MESSAGEQ_RPMSG_PORT);
+        }
+    }
+    else {
+        status = MessageQ_E_ALREADYEXISTS;
+    }
+
+    pthread_mutex_unlock (&(MessageQ_module->gate));
+
+exit:
+    return (status);
+}
+
+/*
+ *  Close the socket for this remote proc.
+ *
+ */
+Int MessageQ_detach (UInt16 remoteProcId)
+{
+    Int status = MessageQ_S_SUCCESS;
+    int sock;
+
+    if (remoteProcId >= MultiProc_MAXPROCESSORS) {
+        status = MessageQ_E_INVALIDPROCID;
+        goto exit;
+    }
+
+    pthread_mutex_lock (&(MessageQ_module->gate));
+
+    sock = MessageQ_module->sock[remoteProcId];
+    if (close (sock)) {
+        status = MessageQ_E_OSFAILURE;
+        printf ("MessageQ_detach: close failed: %d, %s\n",
+                       errno, strerror(errno));
+    }
+    else {
+        PRINTVERBOSE1("MessageQ_detach: closed socket: %d\n", sock)
+        MessageQ_module->sock[remoteProcId] = Transport_INVALIDSOCKET;
+    }
+
+    pthread_mutex_unlock (&(MessageQ_module->gate));
+
+exit:
+    return (status);
+}
+
+/*
+ * This is a helper function to initialize a message.
+ */
+Void MessageQ_msgInit (MessageQ_Msg msg)
+{
+#if 0
+    Int                 status    = MessageQ_S_SUCCESS;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "MessageQ_setup: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return;
+    }
+
+    cmd.cmd = LAD_MESSAGEQ_MSGINIT;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "MessageQ_msgInit: sending LAD command failed, status=%d\n", status)
+        return;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MessageQ_msgInit: no LAD response, status=%d\n", status)
+        return;
+    }
+    status = rsp.msgInit.status;
+
+    PRINTVERBOSE2(
+      "MessageQ_msgInit: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+    memcpy(msg, &rsp.msgInit.msg, sizeof(*msg));
+#else
+    msg->reserved0 = 0;  /* We set this to distinguish from NameServerMsg */
+    msg->replyId   = (UInt16)MessageQ_INVALIDMESSAGEQ;
+    msg->msgId     = MessageQ_INVALIDMSGID;
+    msg->dstId     = (UInt16)MessageQ_INVALIDMESSAGEQ;
+    msg->flags     = MessageQ_HEADERVERSION | MessageQ_NORMALPRI;
+    msg->srcProc   = MultiProc_self();
+
+    pthread_mutex_lock(&(MessageQ_module->gate));
+    msg->seqNum  = MessageQ_module->seqNum++;
+    pthread_mutex_unlock(&(MessageQ_module->gate));
+#endif
+}
+
+/*
+ * =============================================================================
+ * Transport: Fxns kept here until need for a transport layer is realized.
+ * =============================================================================
+ */
+/*
+ * ======== transportCreateEndpoint ========
+ *
+ * Create a communication endpoint to receive messages.
+ */
+static Int transportCreateEndpoint(int * fd, UInt16 rprocId, UInt16 queueIndex)
+{
+    Int          status    = MessageQ_S_SUCCESS;
+    int         err;
+
+    /*  Create the socket to receive messages for this messageQ. */
+    *fd = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
+    if (*fd < 0) {
+        status = MessageQ_E_FAIL;
+        printf ("transportCreateEndpoint: socket call failed: %d, %s\n",
+                  errno, strerror(errno));
+        goto exit;
+    }
+
+    PRINTVERBOSE1("transportCreateEndpoint: created socket: fd: %d\n", *fd)
+
+    err = SocketBindAddr(*fd, rprocId, (UInt32)queueIndex);
+    if (err < 0) {
+        status = MessageQ_E_FAIL;
+        printf ("transportCreateEndpoint: bind failed: %d, %s\n",
+                  errno, strerror(errno));
+    }
+
+exit:
+    return (status);
+}
+
+/*
+ * ======== transportCloseEndpoint ========
+ *
+ *  Close the communication endpoint.
+ */
+static Int transportCloseEndpoint(int fd)
+{
+    Int status = MessageQ_S_SUCCESS;
+
+    PRINTVERBOSE1("transportCloseEndpoint: closing socket: %d\n", fd)
+
+    /* Stop communication to this socket:  */
+    close(fd);
+
+    return (status);
+}
+
+/*
+ * ======== transportGet ========
+ *  Retrieve a message waiting in the socket's queue.
+*/
+static Int transportGet(int sock, MessageQ_Msg * retMsg)
+{
+    Int           status    = MessageQ_S_SUCCESS;
+    MessageQ_Msg  msg;
+    struct sockaddr_rpmsg fromAddr;  // [Socket address of sender]
+    unsigned int  len;
+    int           byteCount;
+
+    /*
+     * We have no way of peeking to see what message size we'll get, so we
+     * allocate a message of max size to receive contents from the rpmsg socket
+     * (currently, a copy transport)
+     */
+    msg = MessageQ_alloc (0, MESSAGEQ_RPMSG_MAXSIZE);
+    if (!msg)  {
+        status = MessageQ_E_MEMORY;
+        goto exit;
+    }
+
+    memset(&fromAddr, 0, sizeof(fromAddr));
+    len = sizeof(fromAddr);
+
+    byteCount = recvfrom(sock, msg, MESSAGEQ_RPMSG_MAXSIZE, 0,
+                      (struct sockaddr *)&fromAddr, &len);
+    if (len != sizeof(fromAddr)) {
+        printf("recvfrom: got bad addr len (%d)\n", len);
+        status = MessageQ_E_FAIL;
+        goto exit;
+    }
+    if (byteCount < 0) {
+        printf("recvfrom failed: %s (%d)\n", strerror(errno), errno);
+        status = MessageQ_E_FAIL;
+        goto exit;
+    }
+    else {
+         /* Update the allocated message size (even though this may waste space
+          * when the actual message is smaller than the maximum rpmsg size,
+          * the message will be freed soon anyway, and it avoids an extra copy).
+          */
+         msg->msgSize = byteCount;
+
+         /*
+          * If the message received was statically allocated, reset the
+          * heapId, so the app can free it.
+          */
+         if (msg->heapId == MessageQ_STATICMSG)  {
+             msg->heapId = 0;  /* for a copy transport, heap id is 0. */
+         }
+    }
+
+    PRINTVERBOSE1("transportGet: recvfrom socket: fd: %d\n", sock)
+    PRINTVERBOSE3("\tReceived a msg: byteCount: %d, rpmsg addr: %d, rpmsg proc: %d\n", byteCount, fromAddr.addr, fromAddr.vproc_id)
+    PRINTVERBOSE2("\tMessage Id: %d, Message size: %d\n", msg->msgId, msg->msgSize)
+
+    *retMsg = msg;
+
+exit:
+    return (status);
+}
+
+/*
+ * ======== transportPut ========
+ *
+ * Calls the socket API sendto() on the socket associated with
+ * with this destination procID.
+ * Currently, both local and remote messages are sent via the Socket ABI, so
+ * no local object lists are maintained here.
+*/
+static Int transportPut(MessageQ_Msg msg, UInt16 dstId, UInt16 dstProcId)
+{
+    Int     status    = MessageQ_S_SUCCESS;
+    int     sock;
+    int     err;
+
+    /*
+     * Retrieve the socket for the AF_SYSLINK protocol associated with this
+     * transport.
+     */
+    sock = MessageQ_module->sock[dstProcId];
+
+    PRINTVERBOSE2("Sending msgId: %d via sock: %d\n", msg->msgId, sock)
+
+    err = send(sock, msg, msg->msgSize, 0);
+    if (err < 0) {
+        printf ("transportPut: send failed: %d, %s\n",
+                  errno, strerror(errno));
+        status = MessageQ_E_FAIL;
+    }
+
+    /*
+     * Free the message, as this is a copy transport, we maintain MessageQ
+     * semantics.
+     */
+    MessageQ_free (msg);
+
+    return (status);
+}
diff --git a/linux/src/api/NameServer.c b/linux/src/api/NameServer.c
new file mode 100644 (file)
index 0000000..f3441ca
--- /dev/null
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServer_client.c ========
+ */
+#include <Std.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+#include <pthread.h>
+
+#include <ti/ipc/NameServer.h>
+
+#include <ladclient.h>
+#include <_lad.h>
+
+static Bool verbose = FALSE;
+
+
+/*
+ * The NameServer_*() APIs are reproduced here.  These versions are just
+ * front-ends for communicating with the actual NameServer module (currently
+ * implemented as a daemon process ala LAD).
+ */
+
+Int NameServer_setup(Void)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "NameServer_setup: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return NameServer_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_SETUP;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_setup: sending LAD command failed, status=%d\n", status)
+        return NameServer_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("NameServer_setup: no LAD response, status=%d\n", status)
+        return(status);
+    }
+    status = rsp.status;
+
+    PRINTVERBOSE2(
+      "NameServer_setup: got LAD response for client %d, status=%d\n",
+      handle, status)
+
+    return status;
+}
+
+Int NameServer_destroy(Void)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    PRINTVERBOSE0("NameServer_destroy: entered\n")
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "NameServer_destroy: can't find connection to daemon for pid %d\n",
+          getpid())
+
+        return NameServer_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_DESTROY;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_destroy: sending LAD command failed, status=%d\n", status)
+        return NameServer_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_destroy: no LAD response, status=%d\n", status)
+        return(status);
+    }
+    status = rsp.status;
+
+    PRINTVERBOSE2(
+     "NameServer_destroy: got LAD response for client %d, status=%d\n",
+     handle, status)
+
+    return status;
+}
+
+Void NameServer_Params_init(NameServer_Params *params)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+         "NameServer_Params_init: can't find connection to daemon for pid %d\n",
+         getpid())
+
+        return;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_PARAMS_INIT;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_Params_init: sending LAD command failed, status=%d\n",
+          status)
+        return;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_Params_init: no LAD response, status=%d\n", status)
+        return;
+    }
+
+    PRINTVERBOSE1("NameServer_Params_init: got LAD response for client %d\n",
+                  handle)
+
+    memcpy(params, &rsp.params, sizeof(NameServer_Params));
+
+    return;
+}
+
+NameServer_Handle NameServer_create(String name,
+                                    const NameServer_Params *params)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    handle = LAD_findHandle();
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "NameServer_create: can't find connection to daemon for pid %d\n",
+          getpid())
+
+        return NULL;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_CREATE;
+    cmd.clientId = handle;
+    strncpy(cmd.args.create.name, name, NameServer_Params_MAXNAMELEN);
+    memcpy(&cmd.args.create.params, params, sizeof(NameServer_Params));
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_create: sending LAD command failed, status=%d\n",
+          status)
+        return NULL;
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("NameServer_create: no LAD response, status=%d\n", status)
+        return NULL;
+    }
+
+    PRINTVERBOSE1("NameServer_create: got LAD response for client %d\n", handle)
+
+    return rsp.handle;
+}
+
+Ptr NameServer_addUInt32(NameServer_Handle nsHandle, String name, UInt32 value)
+{
+    Int status;
+    LAD_ClientHandle clHandle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    clHandle = LAD_findHandle();
+    if (clHandle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "NameServer_addUInt32: can't find connection to daemon for pid %d\n",
+          getpid())
+
+        return NULL;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_ADDUINT32;
+    cmd.clientId = clHandle;
+    cmd.args.addUInt32.handle = nsHandle;
+    strncpy(cmd.args.addUInt32.name, name, NameServer_Params_MAXNAMELEN);
+    cmd.args.addUInt32.val = value;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_addUInt32: sending LAD command failed, status=%d\n",
+          status)
+        return NULL;
+    }
+
+    if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+           "NameServer_addUInt32: no LAD response, status=%d\n", status)
+        return NULL;
+    }
+
+    PRINTVERBOSE1(
+       "NameServer_addUInt32: got LAD response for client %d\n", clHandle)
+
+    return rsp.entryPtr;
+}
+
+Int NameServer_getUInt32(NameServer_Handle nsHandle, String name, Ptr buf,
+                          UInt16 procId[])
+{
+    Int status;
+    LAD_ClientHandle clHandle;
+    UInt32 *val;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    clHandle = LAD_findHandle();
+    if (clHandle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "NameServer_getUInt32: can't find connection to daemon for pid %d\n",
+           getpid())
+
+        return NameServer_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_GETUINT32;
+    cmd.clientId = clHandle;
+    cmd.args.getUInt32.handle = nsHandle;
+    strncpy(cmd.args.getUInt32.name, name, NameServer_Params_MAXNAMELEN);
+    if (procId != NULL) {
+        memcpy(cmd.args.getUInt32.procId, procId,
+               sizeof(UInt16) * MultiProc_MAXPROCESSORS);
+    }
+    else {
+        cmd.args.getUInt32.procId[0] = (UInt16)-1;
+    }
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+           "NameServer_getUInt32: sending LAD command failed, status=%d\n",
+            status)
+        return NameServer_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("NameServer_getUInt32: no LAD response, status=%d\n",
+                       status)
+        return NameServer_E_FAIL;
+    }
+
+    val = (UInt32 *)buf;
+    *val = rsp.getUInt32.val;
+    status = rsp.status;
+
+    PRINTVERBOSE1("NameServer_getUInt32: got LAD response for client %d\n",
+                   clHandle)
+
+    return status;
+}
+
+Int NameServer_remove(NameServer_Handle nsHandle, String name)
+{
+    Int status;
+    LAD_ClientHandle clHandle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    clHandle = LAD_findHandle();
+    if (clHandle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+         "NameServer_remove: can't find connection to daemon for pid %d\n",
+         getpid())
+
+        return NameServer_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_REMOVE;
+    cmd.clientId = clHandle;
+    cmd.args.remove.handle = nsHandle;
+    strncpy(cmd.args.remove.name, name, NameServer_Params_MAXNAMELEN);
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+         "NameServer_remove: sending LAD command failed, status=%d\n",
+         status)
+        return NameServer_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("NameServer_remove: no LAD response, status=%d\n", status)
+        return NameServer_E_FAIL;
+    }
+
+    status = rsp.status;
+
+    PRINTVERBOSE1("NameServer_remove: got LAD response for client %d\n",
+                   clHandle)
+
+    return status;
+}
+
+Int NameServer_removeEntry(NameServer_Handle nsHandle, Ptr entry)
+{
+    Int status;
+    LAD_ClientHandle clHandle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    clHandle = LAD_findHandle();
+    if (clHandle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+         "NameServer_removeEntry: can't find connection to daemon for pid %d\n",
+         getpid())
+
+        return NameServer_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_REMOVEENTRY;
+    cmd.clientId = clHandle;
+    cmd.args.removeEntry.handle = nsHandle;
+    cmd.args.removeEntry.entryPtr = entry;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_removeEntry: sending LAD command failed, status=%d\n",
+          status)
+        return NameServer_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("NameServer_removeEntry: no LAD response, status=%d\n",
+                       status)
+        return NameServer_E_FAIL;
+    }
+
+    status = rsp.status;
+
+    PRINTVERBOSE1("NameServer_removeEntry: got LAD response for client %d\n",
+                   clHandle)
+
+    return status;
+}
+
+Int NameServer_delete(NameServer_Handle *nsHandle)
+{
+    Int status;
+    LAD_ClientHandle clHandle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    clHandle = LAD_findHandle();
+    if (clHandle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1(
+          "NameServer_delete: can't find connection to daemon for pid %d\n",
+          getpid())
+
+        return NameServer_E_RESOURCE;
+    }
+
+    cmd.cmd = LAD_NAMESERVER_DELETE;
+    cmd.clientId = clHandle;
+    cmd.args.delete.handle = *nsHandle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1(
+          "NameServer_delete: sending LAD command failed, status=%d\n",
+          status)
+        return NameServer_E_FAIL;
+    }
+
+    if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("NameServer_delete: no LAD response, status=%d\n", status)
+        return NameServer_E_FAIL;
+    }
+
+    *nsHandle = rsp.delete.handle;
+    status = rsp.status;
+
+    PRINTVERBOSE1("NameServer_delete: got LAD response for client %d\n",
+                   clHandle)
+
+    return status;
+}
diff --git a/linux/src/api/SysLink.c b/linux/src/api/SysLink.c
new file mode 100644 (file)
index 0000000..cbdc80e
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       SysLink.c
+ *
+ *  @brief      Initializes and finalizes user side SysLink
+ *              All setup/destroy APIs on user side will be call from this
+ *              module.
+ *
+ *  @ver        0002
+ *
+ */
+
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <Std.h>
+
+/* Common IPC headers: */
+#include <ti/ipc/NameServer.h>
+
+/* User side headers */
+#include <ladclient.h>
+#include <SysLink.h>
+
+/* IPC startup/shutdown stuff: */
+#include <ti/ipc/MultiProc.h>
+#include <_MessageQ.h>
+#include <_NameServer.h>
+
+static LAD_ClientHandle ladHandle;
+
+static void cleanup(int arg);
+
+/** ============================================================================
+ *  Functions
+ *  ============================================================================
+ */
+/* Function to initialize SysLink. */
+Int SysLink_setup (Void)
+{
+    MessageQ_Config   msgqCfg;
+    Int32             status = 0;
+    LAD_Status        ladStatus;
+    UInt16            rprocId;
+
+    /* Catch ctrl-C, and cleanup: */
+    (void) signal(SIGINT, cleanup);
+
+    ladStatus = LAD_connect(&ladHandle);
+    if (ladStatus != LAD_SUCCESS) {
+        printf("SysLink_setup: LAD_connect() failed: %d\n", ladStatus);
+        status = SysLink_E_RESOURCE;
+        goto exit;
+    }
+
+    status = NameServer_setup();
+    if (status >= 0) {
+        MessageQ_getConfig(&msgqCfg);
+        MessageQ_setup(&msgqCfg);
+
+        /* Now attach to all remote processors, assuming they are up. */
+        for (rprocId = 0;
+             (rprocId < MultiProc_getNumProcessors()) && (status >= 0);
+             rprocId++) {
+           if (0 == rprocId) {
+               /* Skip host, which should always be 0th entry. */
+               continue;
+           }
+           status = MessageQ_attach (rprocId, NULL);
+           if (status < 0) {
+              printf("SysLink_setup: MessageQ_attach(%d) failed: %d\n",
+                     rprocId, status);
+           }
+        }
+    }
+
+exit:
+    return (status);
+}
+
+
+/* Function to finalize SysLink. */
+Void SysLink_destroy (Void)
+{
+    Int32             status = 0;
+    LAD_Status        ladStatus;
+    UInt16            rprocId;
+
+    /* Now detach from all remote processors, assuming they are up. */
+    for (rprocId = 0;
+         (rprocId < MultiProc_getNumProcessors()) && (status >= 0);
+         rprocId++) {
+       if (0 == rprocId) {
+          /* Skip host, which should always be 0th entry. */
+          continue;
+       }
+       status = MessageQ_detach(rprocId);
+       if (status < 0) {
+          printf("SysLink_destroy: MessageQ_detach(%d) failed: %d\n",
+                 rprocId, status);
+       }
+    }
+
+    status = MessageQ_destroy();
+    if (status < 0) {
+       printf("SysLink_destroy: MessageQ_destroy() failed: %d\n", status);
+    }
+
+    status = NameServer_destroy();
+    if (status < 0) {
+       printf("SysLink_destroy: NameServer_destroy() failed: %d\n", status);
+    }
+
+    ladStatus = LAD_disconnect(ladHandle);
+    if (ladStatus != LAD_SUCCESS) {
+        printf("LAD_disconnect() failed: %d\n", ladStatus);
+    }
+}
+
+static void cleanup(int arg)
+{
+    printf("SysLink: Caught SIGINT, calling SysLink_destroy...\n");
+    SysLink_destroy();
+    exit(0);
+}
diff --git a/linux/src/daemon/Makefile.am b/linux/src/daemon/Makefile.am
new file mode 100644 (file)
index 0000000..10348ac
--- /dev/null
@@ -0,0 +1,66 @@
+# linux/src/daemon/Makefile.am
+
+# additional include paths necessary to compile the program
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+
+###############################################################################
+# THE PROGRAMS TO BUILD
+###############################################################################
+
+# the program to build (the names of the final binaries)
+bin_PROGRAMS =
+
+if OMAP4430
+  bin_PROGRAMS += lad_omap4430
+else
+if OMAPL138
+  bin_PROGRAMS += lad_omapl138
+else
+if TCI6614
+  bin_PROGRAMS += lad_tci6614
+else
+if TCI6638
+  bin_PROGRAMS += lad_tci6638
+else
+  bin_PROGRAMS += lad_omap4430 lad_omapl138 lad_tci6614 lad_tci6638
+endif
+endif
+endif
+endif
+
+common_sources = \
+                lad.c \
+                MessageQ_daemon.c \
+                NameServer_daemon.c \
+                $(top_srcdir)/linux/include/Std.h \
+                $(top_srcdir)/linux/include/_NameServerRemoteRpmsg.h \
+                $(top_srcdir)/linux/include/_MessageQ.h \
+                $(top_srcdir)/linux/include/_NameServer.h \
+                $(top_srcdir)/linux/include/_MultiProc.h \
+                $(top_srcdir)/linux/include/_lad.h \
+                $(top_srcdir)/linux/include/SocketFxns.h \
+                $(top_srcdir)/linux/include/ladclient.h \
+                $(top_srcdir)/linux/include/net/rpmsg.h \
+                $(top_srcdir)/packages/ti/ipc/MessageQ.h \
+                $(top_srcdir)/packages/ti/ipc/NameServer.h \
+                $(top_srcdir)/packages/ti/ipc/MultiProc.h
+
+# list of sources for the 'lad' binary and to add to the source distribution
+lad_omap4430_SOURCES = $(common_sources)
+lad_omapl138_SOURCES = $(common_sources)
+lad_tci6614_SOURCES = $(common_sources)
+lad_tci6638_SOURCES = $(common_sources)
+
+common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la $(top_builddir)/linux/src/utils/libtiipcutils.la
+
+# the additional libraries needed to link program
+lad_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+lad_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+lad_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+lad_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+###############################################################################
diff --git a/linux/src/daemon/Makefile.in b/linux/src/daemon/Makefile.in
new file mode 100644 (file)
index 0000000..45992be
--- /dev/null
@@ -0,0 +1,544 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# linux/src/daemon/Makefile.am
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+       $(am__EXEEXT_4) $(am__EXEEXT_5)
+@OMAP4430_TRUE@am__append_1 = lad_omap4430
+@OMAP4430_FALSE@@OMAPL138_TRUE@am__append_2 = lad_omapl138
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_3 = lad_tci6614
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__append_4 = lad_tci6638
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__append_5 = lad_omap4430 lad_omapl138 lad_tci6614 lad_tci6638
+subdir = linux/src/daemon
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+@OMAP4430_TRUE@am__EXEEXT_1 = lad_omap4430$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_TRUE@am__EXEEXT_2 = lad_omapl138$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__EXEEXT_3 = lad_tci6614$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__EXEEXT_4 = lad_tci6638$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__EXEEXT_5 = lad_omap4430$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ lad_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ lad_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ lad_tci6638$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 = lad.$(OBJEXT) MessageQ_daemon.$(OBJEXT) \
+       NameServer_daemon.$(OBJEXT)
+am_lad_omap4430_OBJECTS = $(am__objects_1)
+lad_omap4430_OBJECTS = $(am_lad_omap4430_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/linux/src/api/libtiipc.la \
+       $(top_builddir)/linux/src/utils/libtiipcutils.la
+am__DEPENDENCIES_2 =
+lad_omap4430_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la \
+       $(am__DEPENDENCIES_2)
+am_lad_omapl138_OBJECTS = $(am__objects_1)
+lad_omapl138_OBJECTS = $(am_lad_omapl138_OBJECTS)
+lad_omapl138_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+       $(am__DEPENDENCIES_2)
+am_lad_tci6614_OBJECTS = $(am__objects_1)
+lad_tci6614_OBJECTS = $(am_lad_tci6614_OBJECTS)
+lad_tci6614_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la \
+       $(am__DEPENDENCIES_2)
+am_lad_tci6638_OBJECTS = $(am__objects_1)
+lad_tci6638_OBJECTS = $(am_lad_tci6638_OBJECTS)
+lad_tci6638_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la \
+       $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(lad_omap4430_SOURCES) $(lad_omapl138_SOURCES) \
+       $(lad_tci6614_SOURCES) $(lad_tci6638_SOURCES)
+DIST_SOURCES = $(lad_omap4430_SOURCES) $(lad_omapl138_SOURCES) \
+       $(lad_tci6614_SOURCES) $(lad_tci6638_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+
+# additional include paths necessary to compile the program
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+common_sources = \
+                lad.c \
+                MessageQ_daemon.c \
+                NameServer_daemon.c \
+                $(top_srcdir)/linux/include/Std.h \
+                $(top_srcdir)/linux/include/_NameServerRemoteRpmsg.h \
+                $(top_srcdir)/linux/include/_MessageQ.h \
+                $(top_srcdir)/linux/include/_NameServer.h \
+                $(top_srcdir)/linux/include/_MultiProc.h \
+                $(top_srcdir)/linux/include/_lad.h \
+                $(top_srcdir)/linux/include/SocketFxns.h \
+                $(top_srcdir)/linux/include/ladclient.h \
+                $(top_srcdir)/linux/include/net/rpmsg.h \
+                $(top_srcdir)/packages/ti/ipc/MessageQ.h \
+                $(top_srcdir)/packages/ti/ipc/NameServer.h \
+                $(top_srcdir)/packages/ti/ipc/MultiProc.h
+
+
+# list of sources for the 'lad' binary and to add to the source distribution
+lad_omap4430_SOURCES = $(common_sources)
+lad_omapl138_SOURCES = $(common_sources)
+lad_tci6614_SOURCES = $(common_sources)
+lad_tci6638_SOURCES = $(common_sources)
+common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la $(top_builddir)/linux/src/utils/libtiipcutils.la
+
+# the additional libraries needed to link program
+lad_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+
+lad_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+
+lad_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+
+lad_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  linux/src/daemon/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  linux/src/daemon/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+lad_omap4430$(EXEEXT): $(lad_omap4430_OBJECTS) $(lad_omap4430_DEPENDENCIES) 
+       @rm -f lad_omap4430$(EXEEXT)
+       $(LINK) $(lad_omap4430_LDFLAGS) $(lad_omap4430_OBJECTS) $(lad_omap4430_LDADD) $(LIBS)
+lad_omapl138$(EXEEXT): $(lad_omapl138_OBJECTS) $(lad_omapl138_DEPENDENCIES) 
+       @rm -f lad_omapl138$(EXEEXT)
+       $(LINK) $(lad_omapl138_LDFLAGS) $(lad_omapl138_OBJECTS) $(lad_omapl138_LDADD) $(LIBS)
+lad_tci6614$(EXEEXT): $(lad_tci6614_OBJECTS) $(lad_tci6614_DEPENDENCIES) 
+       @rm -f lad_tci6614$(EXEEXT)
+       $(LINK) $(lad_tci6614_LDFLAGS) $(lad_tci6614_OBJECTS) $(lad_tci6614_LDADD) $(LIBS)
+lad_tci6638$(EXEEXT): $(lad_tci6638_OBJECTS) $(lad_tci6638_DEPENDENCIES) 
+       @rm -f lad_tci6638$(EXEEXT)
+       $(LINK) $(lad_tci6638_LDFLAGS) $(lad_tci6638_OBJECTS) $(lad_tci6638_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQ_daemon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NameServer_daemon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lad.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+       clean-generic clean-libtool ctags distclean distclean-compile \
+       distclean-generic distclean-libtool distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-binPROGRAMS uninstall-info-am
+
+
+###############################################################################
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/linux/src/daemon/MessageQ_daemon.c b/linux/src/daemon/MessageQ_daemon.c
new file mode 100644 (file)
index 0000000..e0ebee5
--- /dev/null
@@ -0,0 +1,583 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       MessageQ.c
+ *  @brief      Prototype Mapping of SysLink MessageQ to Socket ABI
+ *              (SysLink 3).
+ *
+ *  @ver        02.00.00.51_alpha2 (kernel code is basis for this module)
+ *
+ */
+/*============================================================================
+ *  @file   MessageQ.c
+ *
+ *  @brief  MessageQ module "server" implementation
+ *
+ *  This implementation is geared for use in a "client/server" model, whereby
+ *  system-wide data is maintained here as needed and process-specific data
+ *  is handled at the "client" level.  At the moment, LAD is the only "user"
+ *  of this implementation.
+ *
+ *  The MessageQ module supports the structured sending and receiving of
+ *  variable length messages. This module can be used for homogeneous or
+ *  heterogeneous multi-processor messaging.
+ *
+ *  MessageQ provides more sophisticated messaging than other modules. It is
+ *  typically used for complex situations such as multi-processor messaging.
+ *
+ *  The following are key features of the MessageQ module:
+ *  -Writers and readers can be relocated to another processor with no
+ *   runtime code changes.
+ *  -Timeouts are allowed when receiving messages.
+ *  -Readers can determine the writer and reply back.
+ *  -Receiving a message is deterministic when the timeout is zero.
+ *  -Messages can reside on any message queue.
+ *  -Supports zero-copy transfers.
+ *  -Can send and receive from any type of thread.
+ *  -Notification mechanism is specified by application.
+ *  -Allows QoS (quality of service) on message buffer pools. For example,
+ *   using specific buffer pools for specific message queues.
+ *
+ *  Messages are sent and received via a message queue. A reader is a thread
+ *  that gets (reads) messages from a message queue. A writer is a thread that
+ *  puts (writes) a message to a message queue. Each message queue has one
+ *  reader and can have many writers. A thread may read from or write to multiple
+ *  message queues.
+ *
+ *  Conceptually, the reader thread owns a message queue. The reader thread
+ *  creates a message queue. Writer threads  a created message queues to
+ *  get access to them.
+ *
+ *  Message queues are identified by a system-wide unique name. Internally,
+ *  MessageQ uses the NameServermodule for managing
+ *  these names. The names are used for opening a message queue. Using
+ *  names is not required.
+ *
+ *  Messages must be allocated from the MessageQ module. Once a message is
+ *  allocated, it can be sent on any message queue. Once a message is sent, the
+ *  writer loses ownership of the message and should not attempt to modify the
+ *  message. Once the reader receives the message, it owns the message. It
+ *  may either free the message or re-use the message.
+ *
+ *  Messages in a message queue can be of variable length. The only
+ *  requirement is that the first field in the definition of a message must be a
+ *  MsgHeader structure. For example:
+ *  typedef struct MyMsg {
+ *      MessageQ_MsgHeader header;
+ *      ...
+ *  } MyMsg;
+ *
+ *  The MessageQ API uses the MessageQ_MsgHeader internally. Your application
+ *  should not modify or directly access the fields in the MessageQ_MsgHeader.
+ *
+ *  All messages sent via the MessageQ module must be allocated from a
+ *  Heap implementation. The heap can be used for
+ *  other memory allocation not related to MessageQ.
+ *
+ *  An application can use multiple heaps. The purpose of having multiple
+ *  heaps is to allow an application to regulate its message usage. For
+ *  example, an application can allocate critical messages from one heap of fast
+ *  on-chip memory and non-critical messages from another heap of slower
+ *  external memory
+ *
+ *  MessageQ does support the usage of messages that allocated via the
+ *  alloc function. Please refer to the staticMsgInit
+ *  function description for more details.
+ *
+ *  In a multiple processor system, MessageQ communications to other
+ *  processors via MessageQTransport instances. There must be one and
+ *  only one MessageQTransport instance for each processor where communication
+ *  is desired.
+ *  So on a four processor system, each processor must have three
+ *  MessageQTransport instance.
+ *
+ *  The user only needs to create the MessageQTransport instances. The instances
+ *  are responsible for registering themselves with MessageQ.
+ *  This is accomplished via the registerTransport function.
+ *
+ *  ============================================================================
+ */
+
+
+/* Standard headers */
+#include <Std.h>
+
+/* Linux specific header files, replacing OSAL: */
+#include <pthread.h>
+
+/* Socket Headers */
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/eventfd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+
+/* SysLink Socket Protocol Family */
+#include <net/rpmsg.h>
+
+/* Module level headers */
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+#include <_MultiProc.h>
+#include <ti/ipc/MessageQ.h>
+#include <_MessageQ.h>
+
+#include <_lad.h>
+
+/* =============================================================================
+ * Macros/Constants
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  Name of the reserved NameServer used for MessageQ.
+ */
+#define MessageQ_NAMESERVER  "MessageQ"
+
+/* Slot 0 reserved for NameServer messages: */
+#define RESERVED_MSGQ_INDEX  1
+
+/* Define BENCHMARK to quiet key MessageQ APIs: */
+//#define BENCHMARK
+
+/* =============================================================================
+ * Structures & Enums
+ * =============================================================================
+ */
+
+/* structure for MessageQ module state */
+typedef struct MessageQ_ModuleObject {
+    Int                 refCount;
+    /*!< Reference count */
+    NameServer_Handle   nameServer;
+    /*!< Handle to the local NameServer used for storing GP objects */
+    pthread_mutex_t     gate;
+    /*!< Handle of gate to be used for local thread safety */
+    MessageQ_Config     cfg;
+    /*!< Current config values */
+    MessageQ_Config     defaultCfg;
+    /*!< Default config values */
+    MessageQ_Params     defaultInstParams;
+    /*!< Default instance creation parameters */
+    MessageQ_Handle *   queues;
+    /*!< Global array of message queues */
+    UInt16              numQueues;
+    /*!< Initial number of messageQ objects allowed */
+    Bool                canFreeQueues;
+    /*!< Grow option */
+    Bits16              seqNum;
+    /*!< sequence number */
+} MessageQ_ModuleObject;
+
+/*!
+ *  @brief  Structure for the Handle for the MessageQ.
+ */
+typedef struct MessageQ_Object {
+    MessageQ_Params         params;
+    /*! Instance specific creation parameters */
+    MessageQ_QueueId        queue;
+    /* Unique id */
+    Ptr                     nsKey;
+    /* NameServer key */
+    Int                     ownerPid;
+    /* Process ID of owner */
+} MessageQ_Object;
+
+
+/* =============================================================================
+ *  Globals
+ * =============================================================================
+ */
+static MessageQ_ModuleObject MessageQ_state =
+{
+    .refCount               = 0,
+    .nameServer             = NULL,
+    .queues                 = NULL,
+    .numQueues              = 2u,
+    .canFreeQueues          = FALSE,
+    .gate                   = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+    .defaultCfg.traceFlag   = FALSE,
+    .defaultCfg.maxRuntimeEntries = 32u,
+    .defaultCfg.maxNameLen    = 32u,
+};
+
+/*!
+ *  @var    MessageQ_module
+ *
+ *  @brief  Pointer to the MessageQ module state.
+ */
+MessageQ_ModuleObject * MessageQ_module = &MessageQ_state;
+
+
+/* =============================================================================
+ * Forward declarations of internal functions
+ * =============================================================================
+ */
+/* Grow the MessageQ table */
+static UInt16 _MessageQ_grow(MessageQ_Object * obj);
+
+/* =============================================================================
+ * APIS
+ * =============================================================================
+ */
+/* Function to get default configuration for the MessageQ module.
+ *
+ */
+Void MessageQ_getConfig(MessageQ_Config * cfg)
+{
+    assert(cfg != NULL);
+
+    /* If setup has not yet been called... */
+    if (MessageQ_module->refCount < 1) {
+        memcpy(cfg, &MessageQ_module->defaultCfg, sizeof(MessageQ_Config));
+    }
+    else {
+        memcpy(cfg, &MessageQ_module->cfg, sizeof(MessageQ_Config));
+    }
+}
+
+/* Function to setup the MessageQ module. */
+Int MessageQ_setup(const MessageQ_Config * cfg)
+{
+    Int                    status = MessageQ_S_SUCCESS;
+    NameServer_Params      params;
+
+    pthread_mutex_lock(&(MessageQ_module->gate));
+
+    LOG1("MessageQ_setup: entered, refCount=%d\n", MessageQ_module->refCount)
+
+    MessageQ_module->refCount++;
+    if (MessageQ_module->refCount > 1) {
+        status = MessageQ_S_ALREADYSETUP;
+        LOG1("MessageQ module has been already setup, refCount=%d\n", MessageQ_module->refCount)
+
+        goto exitSetup;
+    }
+
+    /* Initialize the parameters */
+    NameServer_Params_init(&params);
+    params.maxValueLen = sizeof(UInt32);
+    params.maxNameLen  = cfg->maxNameLen;
+
+    /* Create the nameserver for modules */
+    MessageQ_module->nameServer = NameServer_create(MessageQ_NAMESERVER,
+                                                    &params);
+
+    memcpy(&MessageQ_module->cfg, (void *)cfg, sizeof(MessageQ_Config));
+
+    MessageQ_module->seqNum = 0;
+    MessageQ_module->numQueues = cfg->maxRuntimeEntries;
+    MessageQ_module->queues = (MessageQ_Handle *)
+        calloc(1, sizeof(MessageQ_Handle) * MessageQ_module->numQueues);
+
+exitSetup:
+    LOG1("MessageQ_setup: exiting, refCount=%d\n", MessageQ_module->refCount)
+
+    pthread_mutex_unlock(&(MessageQ_module->gate));
+
+    return (status);
+}
+
+/*
+ * Function to destroy the MessageQ module.
+ */
+Int MessageQ_destroy(void)
+{
+    Int    status    = MessageQ_S_SUCCESS;
+    UInt32 i;
+
+    pthread_mutex_lock(&(MessageQ_module->gate));
+
+    LOG1("MessageQ_destroy: entered, refCount=%d\n", MessageQ_module->refCount)
+
+    /* Decrease the refCount */
+    MessageQ_module->refCount--;
+    if (MessageQ_module->refCount > 0) {
+        goto exitDestroy;
+    }
+
+    /* Delete any Message Queues that have not been deleted so far. */
+    for (i = 0; i< MessageQ_module->numQueues; i++) {
+        if (MessageQ_module->queues [i] != NULL) {
+            MessageQ_delete(&(MessageQ_module->queues [i]));
+        }
+    }
+
+    if (MessageQ_module->nameServer != NULL) {
+        /* Delete the nameserver for modules */
+        status = NameServer_delete(&MessageQ_module->nameServer);
+    }
+
+    /* Since MessageQ_module->gate was not allocated, no need to delete. */
+
+    if (MessageQ_module->queues != NULL) {
+        free(MessageQ_module->queues);
+        MessageQ_module->queues = NULL;
+    }
+
+    memset(&MessageQ_module->cfg, 0, sizeof(MessageQ_Config));
+    MessageQ_module->numQueues  = 0u;
+    MessageQ_module->canFreeQueues = TRUE;
+
+exitDestroy:
+    LOG1("MessageQ_destroy: exiting, refCount=%d\n", MessageQ_module->refCount)
+
+    pthread_mutex_unlock(&(MessageQ_module->gate));
+
+    return (status);
+}
+
+/* Function to initialize the parameters for the MessageQ instance. */
+Void MessageQ_Params_init(MessageQ_Params * params)
+{
+    memcpy(params, &(MessageQ_module->defaultInstParams),
+           sizeof(MessageQ_Params));
+
+    return;
+}
+
+/*
+ *   Function to create a MessageQ object for receiving.
+ */
+MessageQ_Handle MessageQ_create(String name, const MessageQ_Params * params)
+{
+    Int                 status    = MessageQ_S_SUCCESS;
+    MessageQ_Object   * obj    = NULL;
+    Bool                found  = FALSE;
+    UInt16              count  = 0;
+    UInt16              queueIndex = 0u;
+    UInt16              procId;
+    int                 i;
+
+    LOG1("MessageQ_create: creating '%s'\n", name)
+
+    /* Create the generic obj */
+    obj = (MessageQ_Object *)calloc(1, sizeof(MessageQ_Object));
+
+    pthread_mutex_lock(&(MessageQ_module->gate));
+
+    count = MessageQ_module->numQueues;
+
+    /* Search the dynamic array for any holes */
+    /* We start from 1, as 0 is reserved for binding NameServer: */
+    for (i = RESERVED_MSGQ_INDEX; i < count ; i++) {
+        if (MessageQ_module->queues [i] == NULL) {
+            MessageQ_module->queues [i] = (MessageQ_Handle)obj;
+            queueIndex = i;
+            found = TRUE;
+            break;
+        }
+    }
+
+    if (found == FALSE) {
+        /* Growth is always allowed. */
+        queueIndex = _MessageQ_grow(obj);
+    }
+
+    pthread_mutex_unlock(&(MessageQ_module->gate));
+
+    if (params != NULL) {
+       /* Populate the params member */
+        memcpy((Ptr)&obj->params, (Ptr)params, sizeof(MessageQ_Params));
+    }
+
+    procId = MultiProc_self();
+    /* create globally unique messageQ ID: */
+    obj->queue = (MessageQ_QueueId)(((UInt32)procId << 16) | queueIndex);
+    obj->ownerPid = 0;
+
+    if (name != NULL) {
+        obj->nsKey = NameServer_addUInt32(MessageQ_module->nameServer, name,
+                                          obj->queue);
+    }
+
+    /* Cleanup if fail */
+    if (status < 0) {
+        MessageQ_delete((MessageQ_Handle *)&obj);
+    }
+
+    LOG1("MessageQ_create: returning %p\n", obj)
+
+    return ((MessageQ_Handle)obj);
+}
+
+/*
+ * Function to delete a MessageQ object for a specific slave processor.
+ */
+Int MessageQ_delete(MessageQ_Handle * handlePtr)
+{
+    Int              status = MessageQ_S_SUCCESS;
+    MessageQ_Object *obj;
+    MessageQ_Handle queue;
+
+    obj = (MessageQ_Object *)(*handlePtr);
+
+    LOG1("MessageQ_delete: deleting %p\n", obj)
+
+    queue = MessageQ_module->queues[(MessageQ_QueueIndex)(obj->queue)];
+    if (queue != obj) {
+        LOG1("    ERROR: obj != MessageQ_module->queues[%d]\n", (MessageQ_QueueIndex)(obj->queue))
+    }
+
+    if (obj->nsKey != NULL) {
+        /* Remove from the name server */
+        status = NameServer_removeEntry(MessageQ_module->nameServer,
+                                         obj->nsKey);
+        if (status < 0) {
+            /* Override with a MessageQ status code. */
+            status = MessageQ_E_FAIL;
+        }
+        else {
+            status = MessageQ_S_SUCCESS;
+        }
+    }
+
+    pthread_mutex_lock(&(MessageQ_module->gate));
+
+    /* Clear the MessageQ obj from array. */
+    MessageQ_module->queues[(MessageQ_QueueIndex)(obj->queue)] = NULL;
+
+    /* Release the local lock */
+    pthread_mutex_unlock(&(MessageQ_module->gate));
+
+    /* Now free the obj */
+    free(obj);
+    *handlePtr = NULL;
+
+    LOG1("MessageQ_delete: returning %d\n", status)
+
+    return (status);
+}
+
+/* Returns the MessageQ_QueueId associated with the handle. */
+MessageQ_QueueId MessageQ_getQueueId(MessageQ_Handle handle)
+{
+    MessageQ_Object * obj = (MessageQ_Object *)handle;
+    UInt32            queueId;
+
+    queueId = (obj->queue);
+
+    return queueId;
+}
+
+/*!
+ *  @brief   Grow the MessageQ table
+ *
+ *  @param   obj     Pointer to the MessageQ object.
+ *
+ *  @sa      _MessageQ_grow
+ *
+ */
+static UInt16 _MessageQ_grow(MessageQ_Object * obj)
+{
+    UInt16            queueIndex = MessageQ_module->numQueues;
+    UInt16            oldSize;
+    MessageQ_Handle * queues;
+    MessageQ_Handle * oldQueues;
+
+    /* No parameter validation required since this is an internal function. */
+    oldSize = (MessageQ_module->numQueues) * sizeof(MessageQ_Handle);
+
+    /* Allocate larger table */
+    queues = calloc(1, oldSize + sizeof(MessageQ_Handle));
+
+    /* Copy contents into new table */
+    memcpy(queues, MessageQ_module->queues, oldSize);
+
+    /* Fill in the new entry */
+    queues[queueIndex] = (MessageQ_Handle)obj;
+
+    /* Hook-up new table */
+    oldQueues = MessageQ_module->queues;
+    MessageQ_module->queues = queues;
+    MessageQ_module->numQueues++;
+
+    /* Delete old table if not statically defined */
+    if (MessageQ_module->canFreeQueues == TRUE) {
+        free(oldQueues);
+    }
+    else {
+        MessageQ_module->canFreeQueues = TRUE;
+    }
+
+    LOG1("_MessageQ_grow: queueIndex: 0x%x\n", queueIndex)
+
+    return (queueIndex);
+}
+
+/*
+ * This is a helper function to initialize a message.
+ */
+Void MessageQ_msgInit(MessageQ_Msg msg)
+{
+    msg->reserved0 = 0;  /* We set this to distinguish from NameServerMsg */
+    msg->replyId   = (UInt16)MessageQ_INVALIDMESSAGEQ;
+    msg->msgId     = MessageQ_INVALIDMSGID;
+    msg->dstId     = (UInt16)MessageQ_INVALIDMESSAGEQ;
+    msg->flags     = MessageQ_HEADERVERSION | MessageQ_NORMALPRI;
+    msg->srcProc   = MultiProc_self();
+
+    pthread_mutex_lock(&(MessageQ_module->gate));
+    msg->seqNum  = MessageQ_module->seqNum++;
+    pthread_mutex_unlock(&(MessageQ_module->gate));
+}
+
+NameServer_Handle MessageQ_getNameServerHandle(void)
+{
+    return MessageQ_module->nameServer;
+}
+
+Void MessageQ_setQueueOwner(MessageQ_Handle handle, Int pid)
+{
+    handle->ownerPid = pid;
+
+    return;
+}
+
+Void MessageQ_cleanupOwner(Int pid)
+{
+    MessageQ_Handle queue;
+    Int i;
+
+    for (i = 0; i < MessageQ_module->numQueues; i++) {
+        queue = MessageQ_module->queues[i];
+        if (queue != NULL && queue->ownerPid == pid) {
+            MessageQ_delete(&queue);
+        }
+    }
+}
diff --git a/linux/src/daemon/NameServer_daemon.c b/linux/src/daemon/NameServer_daemon.c
new file mode 100644 (file)
index 0000000..7445bed
--- /dev/null
@@ -0,0 +1,1206 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       NameServer.c
+ *
+ *  @brief      NameServer Manager
+ *
+ */
+
+
+/* Standard headers */
+#include <Std.h>
+
+/* Linux specific header files, replacing OSAL: */
+#include <pthread.h>
+
+/* Socket Headers */
+#include <sys/queue.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/eventfd.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+
+/* SysLink Socket Protocol        Family */
+#include <net/rpmsg.h>
+
+/* Module level headers */
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+#include <_MultiProc.h>
+
+/* Internal stuff: */
+#include <_NameServer.h>
+#include <_NameServerRemoteRpmsg.h>
+
+/* Socket utils: */
+#include <SocketFxns.h>
+
+#include <_lad.h>
+
+#define MESSAGEQ_RPMSG_PORT       61
+#define NAME_SERVER_RPMSG_ADDR    0
+
+#define INVALIDSOCKET     (-1)
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* =============================================================================
+ * Structures & Enums
+ * =============================================================================
+ */
+
+/* Structure of entry in Name/Value table */
+typedef struct NameServer_TableEntry_tag {
+    CIRCLEQ_ENTRY(NameServer_TableEntry_tag) elem;
+    /* List element */
+    UInt32                    hash;
+    /* Hash value */
+    String                    name;
+    /* Name portion of the name/value pair. */
+    UInt                      len;
+    /* Length of the value field. */
+    Ptr                       value;
+    /* Value portion of the name/value entry. */
+    Bool                      collide;
+    /* Does the hash collide? */
+    struct NameServer_TableEntry_tag * next;
+    /* Pointer to the next entry, used incase of collision only */
+} NameServer_TableEntry;
+
+/* Structure defining object for the NameServer */
+struct NameServer_Object {
+    CIRCLEQ_ENTRY(NameServer_Object) elem;
+    CIRCLEQ_HEAD(dummy2, NameServer_TableEntry_tag) nameList;
+    String             name;            /* name of the instance */
+    NameServer_Params  params;          /* the parameter structure */
+    UInt32             count;           /* count of entries */
+    pthread_mutex_t    gate;            /* crit sect gate */
+} NameServer_Object;
+
+/* structure for NameServer module state */
+typedef struct NameServer_ModuleObject {
+    CIRCLEQ_HEAD(dummy1, NameServer_Object) objList;
+    Int32               refCount;
+    int                 sendSock[MultiProc_MAXPROCESSORS];
+    /* Sockets for sending to remote proc nameserver ports: */
+    int                 recvSock[MultiProc_MAXPROCESSORS];
+    /* Sockets for recving from remote proc nameserver ports: */
+    pthread_t           listener;
+    /* Listener thread for NameServer replies and requests. */
+    int                 unblockFd;
+    /* Event to post to exit listener. */
+    int                 waitFd;
+    /* Event to post to NameServer_get. */
+    NameServerMsg       nsMsg;
+    /* NameServer Message cache. */
+    NameServer_Params   defInstParams;
+    /* Default instance paramters */
+    pthread_mutex_t     modGate;
+} NameServer_ModuleObject;
+
+#define CIRCLEQ_destruct(head) { \
+        (head)->cqh_first = NULL; \
+        (head)->cqh_last = NULL; \
+}
+
+#define CIRCLEQ_elemClear(elem) { \
+        (elem)->cqe_next = (elem)->cqe_prev = (Void *)(elem); \
+}
+
+#define CIRCLEQ_traverse(x, y, tag) \
+        for (x = (y)->cqh_first; x != (struct tag *)(y); x = x->elem.cqe_next)
+
+/* =============================================================================
+ *  Globals
+ * =============================================================================
+ */
+/*
+ * NameServer_state
+ *
+ * Make the module gate "recursive" since NameServer_getHandle() needs to
+ * use it and NameServer_create() needs to hold it around its call to
+ * NameServer_getHandle().  Also, use the static initializer instead of a
+ * run-time init call, so we can use this gate immediately in _setup().
+ */
+static NameServer_ModuleObject NameServer_state = {
+    .defInstParams.maxRuntimeEntries = 0u,
+    .defInstParams.tableHeap         = NULL,
+    .defInstParams.checkExisting     = TRUE,
+    .defInstParams.maxValueLen       = 0u,
+    .defInstParams.maxNameLen        = 16u,
+// only _NP (non-portable) type available in CG tools which we're using
+    .modGate                         = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+//    .modGate                         = PTHREAD_RECURSIVE_MUTEX_INITIALIZER,
+    .refCount                        = 0
+};
+
+static NameServer_ModuleObject * NameServer_module = &NameServer_state;
+
+static const UInt32 stringCrcTab[256u] = {
+  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+  0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+  0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
+  0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+  0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+  0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+  0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
+  0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+  0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
+  0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+  0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
+  0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+  0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
+  0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+  0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+  0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+  0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
+  0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+  0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
+  0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+  0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+  0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
+  0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+  0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+  0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+  0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
+  0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+  0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
+  0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+  0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
+  0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+  0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
+  0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+  0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+  0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+  0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
+  0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+  0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
+  0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
+  0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+  0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
+};
+
+static UInt32 stringHash(String s)
+{
+    UInt32 hash = strlen(s);
+    UInt32 i;
+
+    for (i = 0; i < strlen(s); i++) {
+        hash = (hash >> 8u) ^ stringCrcTab[(hash & 0xff)] ^ s[i];
+    }
+
+    return (hash);
+}
+
+static void NameServerRemote_processMessage(NameServerMsg * msg, UInt16 procId)
+{
+    NameServer_Handle handle;
+    Int               status = NameServer_E_FAIL;
+    int               err;
+    uint64_t          buf = 1;
+    int               numBytes;
+    int               waitFd = NameServer_module->waitFd;
+
+    if (msg->request == NAMESERVER_REQUEST) {
+        LOG2("NameServer Request: instanceName: %s, name: %s\n",
+             (String)msg->instanceName, (String)msg->name)
+
+        /*
+         *  Message is a request. Lookup name in NameServer table.
+         *  Send a response message back to source processor.
+         */
+        handle = NameServer_getHandle((String)msg->instanceName);
+
+        if (handle != NULL) {
+            /* Search for the NameServer entry */
+            LOG0("Calling NameServer_getLocalUInt32...\n")
+            status = NameServer_getLocalUInt32(handle,
+                     (String)msg->name, &msg->value);
+        }
+
+        LOG2("NameServer Response: instanceName: %s, name: %s,",
+             (String)msg->instanceName, (String)msg->name)
+        /* set the request status */
+        if (status < 0) {
+            LOG1(" Value not found, status: %d\n", status)
+            msg->requestStatus = 0;
+        }
+        else {
+            msg->requestStatus = 1;
+            LOG1(" Value: 0x%x\n", msg->value)
+        }
+
+        /* specify message as a response */
+        msg->request = NAMESERVER_RESPONSE;
+        msg->reserved = NAMESERVER_MSG_TOKEN;
+
+        /* send response message to remote processor */
+        err = send(NameServer_module->sendSock[procId], msg,
+                   sizeof(NameServerMsg), 0);
+        if (err < 0) {
+            LOG2("NameServer: send failed: %d, %s\n", errno, strerror(errno))
+        }
+    }
+    else {
+        LOG2("NameServer Reply: instanceName: %s, name: %s",
+             (String)msg->instanceName, (String)msg->name)
+        LOG1(", value: 0x%x\n", msg->value)
+
+        /* Save the response message.  */
+        memcpy(&NameServer_module->nsMsg, msg, sizeof(NameServerMsg));
+
+        /* Post the eventfd upon which NameServer_get() is waiting */
+        numBytes = write(waitFd, &buf, sizeof(uint64_t));
+    }
+}
+
+
+static void *listener_cb(void *arg)
+{
+    fd_set rfds;
+    int ret = 0, maxfd;
+    UInt16 procId;
+    struct  sockaddr_rpmsg  fromAddr;
+    unsigned int len;
+    NameServerMsg msg;
+    int     byteCount;
+    UInt16  numProcs = MultiProc_getNumProcessors();
+    int     sock;
+
+    LOG0("listener_cb: Entered Listener thread.\n")
+
+    do {
+        /* Wait for NameServer messages or unblockFd notification */
+        FD_ZERO(&rfds);
+        FD_SET(NameServer_module->unblockFd, &rfds);
+        maxfd = NameServer_module->unblockFd;
+        for (procId = 0; procId < numProcs; procId++) {
+            if (procId == MultiProc_self() ||
+                NameServer_module->recvSock[procId] == INVALIDSOCKET) {
+                continue;
+            }
+            sock = NameServer_module->recvSock[procId];
+            FD_SET(sock, &rfds);
+            maxfd = MAX(sock, maxfd);
+        }
+
+        maxfd = maxfd + 1;
+        LOG2("NameServer: waiting for unblockFd: %d, and socks: maxfd: %d\n",
+             NameServer_module->unblockFd, maxfd)
+        ret = select(maxfd, &rfds, NULL, NULL, NULL);
+        if (ret == -1) {
+            LOG0("listener_cb: select failed.")
+            break;
+        }
+        LOG0("NameServer: back from select()\n")
+
+        for (procId = 0; procId < numProcs; procId++) {
+            if (procId == MultiProc_self() ||
+                NameServer_module->recvSock[procId] == INVALIDSOCKET) {
+                continue;
+            }
+            sock = NameServer_module->recvSock[procId];
+            if (FD_ISSET(sock, &rfds)) {
+                LOG1("NameServer: Listener got NameServer message "
+                     "from sock: %d!\n", sock);
+                /* Get NameServer message and process: */
+                memset(&fromAddr, 0, sizeof(fromAddr));
+                len = sizeof(fromAddr);
+
+                byteCount = recvfrom(sock, &msg, sizeof(NameServerMsg), 0,
+                                (struct sockaddr *)&fromAddr, &len);
+                if (len != sizeof(fromAddr)) {
+                    LOG1("recvfrom: got bad addr len (%d)\n", len)
+                    break;
+                }
+                if (byteCount < 0) {
+                    LOG2("recvfrom failed: %s (%d)\n", strerror(errno), errno)
+                    break;
+                }
+                else {
+                    LOG1("listener_cb: recvfrom socket: fd: %d\n", sock)
+                    LOG2("\tReceived ns msg: byteCount: %d, from addr: %d, ",
+                         byteCount, fromAddr.addr)
+                    LOG1("from vproc: %d\n", fromAddr.vproc_id)
+                    NameServerRemote_processMessage(&msg, procId);
+                }
+            }
+        }
+        if (FD_ISSET(NameServer_module->unblockFd, &rfds)) {
+            /* We are told to unblock and exit: */
+            LOG0("NameServer: Listener thread exiting\n")
+            break;
+        }
+    } while (1);
+
+    return ((void *)ret);
+}
+
+/* =============================================================================
+ * APIS
+ * =============================================================================
+ */
+
+/* Function to setup the nameserver module. */
+Int NameServer_setup(Void)
+{
+    Int    status = NameServer_S_SUCCESS;
+    int    err;
+    int    sock;
+    int    ret;
+    UInt16 procId;
+    UInt16 numProcs;
+
+    pthread_mutex_lock(&NameServer_module->modGate);
+
+    LOG1("NameServer_setup: entered, refCount=%d\n", NameServer_module->refCount)
+
+    NameServer_module->refCount++;
+
+    if (NameServer_module->refCount > 1) {
+        LOG0("NameServer_setup: already setup\n")
+        status = NameServer_S_ALREADYSETUP;
+        goto exit;
+    }
+
+    numProcs = MultiProc_getNumProcessors();
+
+    NameServer_module->unblockFd = eventfd(0, 0);
+    if (NameServer_module->unblockFd < 0) {
+        status = NameServer_E_FAIL;
+        LOG0("NameServer_setup: failed to create unblockFd.\n")
+        goto exit;
+    }
+
+    NameServer_module->waitFd = eventfd(0, 0);
+    if (NameServer_module->waitFd < 0) {
+        status = NameServer_E_FAIL;
+        LOG0("NameServer_setup: failed to create waitFd.\n")
+        goto exit;
+    }
+
+    for (procId = 0; procId < numProcs; procId++) {
+        NameServer_module->sendSock[procId] = INVALIDSOCKET;
+        NameServer_module->recvSock[procId] = INVALIDSOCKET;
+
+        /* Only support NameServer to remote procs: */
+        if (procId == MultiProc_self()) {
+            continue;
+        }
+
+        /* Create the socket for sending messages to each remote proc: */
+        sock = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
+        if (sock < 0) {
+            status = NameServer_E_FAIL;
+            LOG2("NameServer_setup: socket failed: %d, %s\n",
+                 errno, strerror(errno))
+        }
+        else  {
+            LOG1("NameServer_setup: created send socket: %d\n", sock)
+            err = ConnectSocket(sock, procId, MESSAGEQ_RPMSG_PORT);
+            if (err < 0) {
+                status = NameServer_E_FAIL;
+                LOG2("NameServer_setup: connect failed: %d, %s\n",
+                     errno, strerror(errno))
+
+                LOG1("    closing send socket: %d\n", sock)
+                close(sock);
+            }
+            else {
+                NameServer_module->sendSock[procId] = sock;
+            }
+        }
+
+        /* Create the socket for recving messages from each remote proc: */
+        sock = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
+        if (sock < 0) {
+            status = NameServer_E_FAIL;
+            LOG2("NameServer_setup: socket failed: %d, %s\n",
+                 errno, strerror(errno))
+        }
+        else  {
+            LOG1("NameServer_setup: created recv socket: %d\n", sock)
+
+            err = SocketBindAddr(sock, procId, NAME_SERVER_RPMSG_ADDR);
+            if (err < 0) {
+               status = NameServer_E_FAIL;
+               LOG2("NameServer_setup: bind failed: %d, %s\n",
+                    errno, strerror(errno))
+
+                LOG1("    closing recv socket: %d\n", sock)
+                close(sock);
+            }
+            else {
+               NameServer_module->recvSock[procId] = sock;
+            }
+        }
+    }
+
+    /* Construct the list object */
+    CIRCLEQ_INIT(&NameServer_module->objList);
+
+    /* Create the listener thread: */
+    LOG0("NameServer_setup: creating listener thread\n")
+    ret = pthread_create(&NameServer_module->listener, NULL, listener_cb, NULL);
+    if (ret) {
+        LOG1("NameServer_setup: can't spawn thread: %s\n", strerror(ret))
+        LOG0("NameServer_setup: eventfd failed");
+
+        status = NameServer_E_FAIL;
+    }
+
+exit:
+    LOG1("NameServer_setup: exiting, refCount=%d\n", NameServer_module->refCount)
+
+    pthread_mutex_unlock(&NameServer_module->modGate);
+
+    return (status);
+}
+
+/*! Function to destroy the nameserver module. */
+Int NameServer_destroy(void)
+{
+    Int      status    = NameServer_S_SUCCESS;
+    UInt16   numProcs = MultiProc_getNumProcessors();
+    UInt16   procId;
+    int      sock;
+    uint64_t buf = 1;
+    int      numBytes;
+
+    pthread_mutex_lock(&NameServer_module->modGate);
+
+    LOG1("NameServer_destroy: entered, refCount=%d\n", NameServer_module->refCount)
+
+    NameServer_module->refCount--;
+
+    if (NameServer_module->refCount > 0) {
+        LOG1("NameServer_destroy(): refCount(%d) > 0, exiting\n", NameServer_module->refCount)
+        status = NameServer_S_SUCCESS;
+
+        goto exit;
+    }
+
+    for (procId = 0; procId < numProcs; procId++) {
+        /* Only support NameServer to remote procs: */
+        if (procId == MultiProc_self()) {
+            continue;
+        }
+
+        /* Close the socket: */
+        sock = NameServer_module->sendSock[procId];
+        if (sock != INVALIDSOCKET) {
+            LOG1("NameServer_destroy: closing socket: %d\n", sock)
+            close(sock);
+            NameServer_module->sendSock[procId] = INVALIDSOCKET;
+        }
+        /* Close the socket: */
+        sock = NameServer_module->recvSock[procId];
+        if (sock != INVALIDSOCKET) {
+            LOG1("NameServer_destroy: closing socket: %d\n", sock)
+            close(sock);
+            NameServer_module->recvSock[procId] = INVALIDSOCKET;
+        }
+    }
+
+    CIRCLEQ_destruct(&NameServer_module->objList);
+
+    /* Unblock the NameServer listener thread: */
+    LOG0("NameServer_destroy: unblocking listener...\n")
+    numBytes = write(NameServer_module->unblockFd, &buf, sizeof(uint64_t));
+
+    /* Join: */
+    LOG0("NameServer_destroy: joining listener thread...\n")
+    pthread_join(NameServer_module->listener, NULL);
+
+    close(NameServer_module->unblockFd);
+    close(NameServer_module->waitFd);
+
+exit:
+    LOG1("NameServer_destroy: exiting, refCount=%d\n", NameServer_module->refCount)
+
+    pthread_mutex_unlock(&NameServer_module->modGate);
+
+    return (status);
+}
+
+/* Function to retrieve a NameServer handle from name. */
+NameServer_Handle NameServer_getHandle(String name)
+{
+    NameServer_Handle handle = NULL;
+    Bool              found = FALSE;
+    struct NameServer_Object * elem;
+
+    assert(name != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    pthread_mutex_lock(&NameServer_module->modGate);
+
+    /* Lookup handle from name: */
+    CIRCLEQ_traverse(elem, &NameServer_module->objList, NameServer_Object) {
+        handle = (NameServer_Handle) elem;
+        if (strcmp(handle->name, name) == 0) {
+            found = TRUE;
+            break;
+        }
+    }
+
+    if (found == FALSE) {
+        handle = NULL;
+    }
+
+    pthread_mutex_unlock(&NameServer_module->modGate);
+
+    return (handle);
+}
+
+
+/* Function to create a name server. */
+NameServer_Handle NameServer_create(String name,
+                                    const NameServer_Params * params)
+{
+    NameServer_Handle handle = NULL;
+    pthread_mutexattr_t mutex_attr;
+
+    assert(params != NULL);
+    assert(name != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    LOG1("NameServer_create(): '%s'\n", name)
+
+    pthread_mutex_lock(&NameServer_module->modGate);
+
+    if (params->maxValueLen > sizeof(UInt32)) {
+        LOG1("NameServer_create: params->maxValueLen (%d) too big for now\n", params->maxValueLen)
+       /* Can't handle more than UInt32 at this time: */
+       goto leave;
+    }
+
+    /* check if the name is already created or not */
+    if (NameServer_getHandle(name)) {
+        LOG0("NameServer_create NameServer_E_INVALIDARG Name is in use!\n")
+        handle = NULL;
+        goto leave;
+    }
+    else {
+        handle = (NameServer_Handle)calloc(1, sizeof(NameServer_Object));
+    }
+
+    if (!handle) {
+        LOG0("NameServer_create: NameServer_Handle alloc failed\n")
+        goto leave;
+    }
+
+    handle->name = (String)malloc(strlen(name) + 1u);
+    if (!handle->name) {
+        LOG0("NameServer_create: instance name alloc failed\n")
+        goto cleanup;
+    }
+    strncpy(handle->name, name, strlen (name) + 1u);
+    memcpy((Ptr) &handle->params, (Ptr) params, sizeof(NameServer_Params));
+
+    if (params->maxValueLen < sizeof(UInt32)) {
+        handle->params.maxValueLen = sizeof(UInt32);
+    }
+    else {
+        handle->params.maxValueLen = params->maxValueLen;
+    }
+
+    CIRCLEQ_INIT(&handle->nameList);
+    handle->count = 0u;
+
+    /* Put in the local list */
+    CIRCLEQ_elemClear(&handle->elem);
+    CIRCLEQ_INSERT_HEAD(&NameServer_module->objList, handle, elem);
+
+    /*
+     * NameServer_removeEntry() enters gate and is called by
+     * NameServer_remove() while holding the gate.
+     */
+    pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
+    pthread_mutex_init(&handle->gate, &mutex_attr);
+
+    goto leave;
+
+cleanup:
+    free(handle);
+    handle = NULL;
+
+leave:
+    pthread_mutex_unlock(&NameServer_module->modGate);
+
+    return (handle);
+}
+
+
+/* Function to delete a name server. */
+Int NameServer_delete(NameServer_Handle * handle)
+{
+    Int status = NameServer_S_SUCCESS;
+
+    assert(handle != NULL);
+    assert(*handle != NULL);
+    assert((*handle)->count == 0);
+    assert(NameServer_module->refCount != 0);
+
+    pthread_mutex_lock(&NameServer_module->modGate);
+
+    if ((*handle)->count == 0) {
+        CIRCLEQ_REMOVE(&NameServer_module->objList, *handle, elem);
+
+        if ((*handle)->name != NULL) {
+            free((*handle)->name);
+            (*handle)->name = NULL;
+        }
+
+        CIRCLEQ_destruct(&(*handle)->nameList);
+
+        free((*handle));
+        (*handle) = NULL;
+    }
+
+    pthread_mutex_unlock(&NameServer_module->modGate);
+
+    return (status);
+}
+
+/* Adds a variable length value into the local NameServer table */
+Ptr NameServer_add(NameServer_Handle handle, String name, Ptr buf, UInt len)
+{
+    Int                 status = NameServer_S_SUCCESS;
+    NameServer_TableEntry * node = NULL;
+    NameServer_TableEntry * new_node = NULL;
+    Bool                found = FALSE;
+    UInt32              hash;
+
+    assert(handle != NULL);
+    assert(name     != NULL);
+    assert(buf      != NULL);
+    assert(len      != 0);
+    assert(NameServer_module->refCount != 0);
+
+    /* Calculate the hash */
+    hash = stringHash(name);
+
+    pthread_mutex_lock(&handle->gate);
+
+    /* Traverse the list to find duplicate check */
+    CIRCLEQ_traverse(node, &handle->nameList, NameServer_TableEntry_tag) {
+        /* Hash matches */
+        if (node->hash == hash) {
+            /* If the name matches, incase hash is duplicate */
+            if (strcmp(node->name, name) == 0) {
+                if (handle->params.checkExisting == TRUE) {
+                    status = NameServer_E_INVALIDARG;
+                    LOG1("NameServer_add: '%s' - duplicate entry found!\n", name)
+                    break;
+                }
+            }
+            else {
+                found = TRUE;
+                break;
+            } /* name does not match */
+        } /* hash does not match */
+    } /* CIRCLEQ_traverse */
+
+    if (status != NameServer_S_SUCCESS) {
+        new_node = NULL;
+        goto exit;
+    }
+
+    /* Now add the new entry. */
+    new_node = (NameServer_TableEntry *)malloc(sizeof(NameServer_TableEntry));
+    if (new_node == NULL) {
+        status = NameServer_E_MEMORY;
+        LOG1("NameServer_add: %d - malloc new_node failed!\n", status)
+
+        goto exit;
+    }
+
+    new_node->hash    = hash;
+    new_node->collide = found; /* Indicate if there is a collision*/
+    new_node->len     = len;
+    new_node->next    = NULL;
+    new_node->name = (String)malloc(strlen(name) + 1u);
+    new_node->value  = (Ptr)malloc(len);
+    strncpy(new_node->name, name, strlen(name) + 1u);
+    memcpy((Ptr)new_node->value, (Ptr)buf, len);
+
+    if (found == TRUE) {
+        /* If hash is found, need to stitch the list to link the
+         * new node to the existing node with the same hash.
+         */
+        new_node->next = node->next;
+        node->next = new_node;
+    }
+    else {
+        /* put the new node into the list */
+        CIRCLEQ_INSERT_HEAD(&handle->nameList, new_node, elem);
+    }
+
+    handle->count++;
+
+    LOG2("NameServer_add: Entered key: '%s', data: 0x%x\n",
+         name, *(UInt32 *)buf)
+
+exit:
+    pthread_mutex_unlock(&handle->gate);
+
+    return (new_node);
+}
+
+
+/* Function to add a UInt32 value into a name server. */
+Ptr NameServer_addUInt32(NameServer_Handle handle, String name, UInt32 value)
+{
+    Ptr entry = NULL;
+
+    assert(handle != NULL);
+    assert(name   != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    entry = NameServer_add(handle, name, &value, sizeof(UInt32));
+
+    return (entry);
+}
+
+/* Function to remove a name/value pair from a name server. */
+Int NameServer_remove(NameServer_Handle handle, String name)
+{
+    Int                 status = NameServer_S_SUCCESS;
+    NameServer_TableEntry *prev = NULL;
+    NameServer_TableEntry *temp = NULL;
+    NameServer_TableEntry *node = NULL;
+    Bool                done   = FALSE;
+    UInt32              hash;
+
+    assert(handle != NULL);
+    assert(name   != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    /* Calculate the hash */
+    hash = stringHash(name);
+
+    pthread_mutex_lock(&handle->gate);
+
+    /* Traverse the list to find duplicate check */
+    CIRCLEQ_traverse(node, &handle->nameList, NameServer_TableEntry_tag) {
+        /* Hash matchs */
+        if (node->hash == hash) {
+            if (node->collide == TRUE) {
+                if (strcmp(node->name, name) == 0){
+                    free(node->value);
+                    free(node->name);
+                    memcpy((Ptr)node, (Ptr) node->next,
+                           sizeof(NameServer_TableEntry));
+                    node->next = node->next->next;
+                    free(node->next);
+                    handle->count--;
+                    done = TRUE;
+                    break;
+                }
+                else {
+                    prev = node;
+                    temp = node->next;
+                    while (temp) {
+                        if (strcmp(temp->name, name) == 0){
+                            free(temp->value);
+                            free(temp->name);
+                            prev->next = temp->next;
+                            free(temp);
+                            handle->count--;
+                            done = TRUE;
+                            break;
+                        }
+                        temp = temp->next;
+                    }
+                    break;
+                }
+            }
+            else {
+                NameServer_removeEntry(handle, (Ptr)node);
+
+                done = TRUE;
+                break;
+            }
+        }
+    }
+
+    if (done == FALSE) {
+        status = NameServer_E_INVALIDARG;
+        LOG1("NameServer_remove %d Entry not found!\n", status)
+    }
+
+    pthread_mutex_unlock(&handle->gate);
+
+    return (status);
+}
+
+/* Function to remove a name/value pair from a name server. */
+Int NameServer_removeEntry(NameServer_Handle handle, Ptr entry)
+{
+    Int  status = NameServer_S_SUCCESS;
+    NameServer_TableEntry * node;
+
+    assert(handle != NULL);
+    assert(entry  != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    pthread_mutex_lock(&handle->gate);
+
+    node = (NameServer_TableEntry *)entry;
+
+    free(node->value);
+    free(node->name);
+    CIRCLEQ_REMOVE(&handle->nameList, node, elem);
+    free(node);
+    handle->count--;
+
+    pthread_mutex_unlock(&handle->gate);
+
+    return (status);
+}
+
+
+/* Initialize this config-params structure with supplier-specified
+ * defaults before instance creation.
+ */
+Void NameServer_Params_init(NameServer_Params * params)
+{
+    assert(params != NULL);
+
+    memcpy(params, &(NameServer_module->defInstParams),
+           sizeof (NameServer_Params));
+}
+
+
+Int NameServer_getRemote(NameServer_Handle handle,
+                     String            name,
+                     Ptr               value,
+                     UInt32 *          len,
+                     UInt16            procId)
+{
+    Int status = NameServer_S_SUCCESS;
+    struct NameServer_Object *obj = (struct NameServer_Object *)(handle);
+    NameServerMsg nsMsg;
+    NameServerMsg *replyMsg;
+    fd_set rfds;
+    int ret = 0, sock, maxfd, waitFd;
+    struct timeval tv;
+    uint64_t buf = 1;
+    int numBytes;
+    int err;
+
+    /* Set Timeout to wait: */
+    tv.tv_sec = NAMESERVER_GET_TIMEOUT;
+    tv.tv_usec = 0;
+
+    /* Create request message and send to remote: */
+    sock = NameServer_module->sendSock[procId];
+    LOG1("NameServer_getRemote: Sending request via sock: %d\n", sock)
+
+    /* Create request message and send to remote processor: */
+    nsMsg.reserved = NAMESERVER_MSG_TOKEN;
+    nsMsg.request = NAMESERVER_REQUEST;
+    nsMsg.requestStatus = 0;
+
+    strncpy((char *)nsMsg.instanceName, obj->name, strlen(obj->name) + 1);
+    strncpy((char *)nsMsg.name, name, strlen(name) + 1);
+
+    LOG2("NameServer_getRemote: Requesting from procId %d, %s:",
+           procId, (String)nsMsg.instanceName)
+    LOG1("%s...\n", (String)nsMsg.name)
+
+    err = send(sock, &nsMsg, sizeof(NameServerMsg), 0);
+    if (err < 0) {
+        LOG2("NameServer_getRemote: send failed: %d, %s\n",
+             errno, strerror(errno))
+        status = NameServer_E_FAIL;
+        goto exit;
+    }
+
+    /* Block on waitFd for signal from listener thread: */
+    waitFd = NameServer_module->waitFd;
+    FD_ZERO(&rfds);
+    FD_SET(waitFd, &rfds);
+    maxfd = waitFd + 1;
+    LOG1("NameServer_getRemote: pending on waitFd: %d\n", waitFd)
+    ret = select(maxfd, &rfds, NULL, NULL, &tv);
+    if (ret == -1) {
+        LOG0("NameServer_getRemote: select failed.")
+        status = NameServer_E_FAIL;
+        goto exit;
+    }
+    else if (!ret) {
+        LOG0("NameServer_getRemote: select timed out.\n")
+        status = NameServer_E_TIMEOUT;
+        goto exit;
+    }
+
+    if (FD_ISSET(waitFd, &rfds)) {
+        /* Read, just to balance the write: */
+        numBytes = read(waitFd, &buf, sizeof(uint64_t));
+
+        /* Process response: */
+        replyMsg = &NameServer_module->nsMsg;
+
+        if (replyMsg->requestStatus) {
+            /* name is found */
+            /* set the contents of value */
+            *(UInt32 *)value = (UInt32)replyMsg->value;
+
+            LOG2("NameServer_getRemote: Reply from: %d, %s:",
+                 procId, (String)replyMsg->instanceName)
+            LOG2("%s, value: 0x%x...\n",
+                 (String)replyMsg->name, *(UInt32 *)value)
+            goto exit;
+        }
+        else {
+            /* name is not found */
+            LOG2("NameServer_getRemote: value for %s:%s not found.\n",
+                 (String)replyMsg->instanceName, (String)replyMsg->name)
+
+            /* set status to not found */
+            status = NameServer_E_NOTFOUND;
+        }
+    }
+
+exit:
+    return (status);
+}
+
+/* Function to retrieve the value portion of a name/value pair from
+ * local table.
+ */
+Int NameServer_get(NameServer_Handle handle,
+               String            name,
+               Ptr               value,
+               UInt32 *          len,
+               UInt16            procId[])
+{
+    Int status = NameServer_S_SUCCESS;
+    UInt16 numProcs = MultiProc_getNumProcessors();
+    UInt32 i;
+
+    /*
+     * BIOS side uses a gate (mutex) to protect NameServer_module->nsMsg, but
+     * since this goes in a daemon, it will not be necessary.
+     */
+
+    if (procId == NULL) {
+        status = NameServer_getLocal(handle, name, value, len);
+        if (status == NameServer_E_NOTFOUND) {
+            for (i = 0; i < numProcs; i++) {
+                /* getLocal call already covers "self", keep going */
+                if (i == MultiProc_self()) {
+                    continue;
+                }
+
+                status = NameServer_getRemote(handle, name, value, len, i);
+
+                if ((status >= 0) ||
+                    ((status < 0) && (status != NameServer_E_NOTFOUND))) {
+                    break;
+                }
+            }
+        }
+    }
+    else {
+        /*
+         *  Search the query list. It might contain the local proc
+         *  somewhere in the list.
+         */
+        i = 0;
+        while (procId[i] != MultiProc_INVALIDID) {
+            if (procId[i] == MultiProc_self()) {
+                status = NameServer_getLocal(handle, name, value, len);
+            }
+            else {
+                status = NameServer_getRemote(handle, name, value, len, i);
+            }
+
+            if ((status >= 0) ||
+                ((status < 0) && (status != NameServer_E_NOTFOUND))) {
+                break;
+            }
+
+            i++;
+        }
+    }
+
+    return (status);
+}
+
+/* Gets a 32-bit value by name */
+Int NameServer_getUInt32(NameServer_Handle handle,
+                     String            name,
+                     Ptr               value,
+                     UInt16            procId[])
+{
+    Int  status;
+    UInt32 len = sizeof(UInt32);
+
+    assert(handle != NULL);
+    assert(name   != NULL);
+    assert(value  != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    status = NameServer_get(handle, name, value, &len, procId);
+
+    return (status);
+}
+
+/* Function to Retrieve the value portion of a name/value pair from
+ * local table.
+ */
+Int NameServer_getLocal(NameServer_Handle handle,
+                    String            name,
+                    Ptr               value,
+                    UInt32 *          len)
+{
+    Int status = NameServer_E_NOTFOUND;
+    NameServer_TableEntry * node = NULL;
+    NameServer_TableEntry * temp = NULL;
+    Bool done   = FALSE;
+    UInt32 length;
+    UInt32 hash;
+
+    assert(handle != NULL);
+    assert(name   != NULL);
+    assert(value  != NULL);
+    assert(len    != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    length = *len;
+
+    /* Calculate the hash */
+    hash = stringHash(name);
+
+    pthread_mutex_lock(&handle->gate);
+
+    /* Traverse the list to find duplicate check */
+    CIRCLEQ_traverse(node, &handle->nameList, NameServer_TableEntry_tag) {
+        if (node->hash == hash) {
+            if (node->collide == TRUE) {
+                temp = node;
+                while (temp) {
+                    if (strcmp(temp->name, name) == 0u){
+                        if (length <= node->len) {
+                            memcpy(value, node->value, length);
+                            *len = length;
+                        }
+                        else {
+                            memcpy(value, node->value, node->len);
+                            *len = node->len;
+                        }
+                        done = TRUE;
+                        break;
+                    }
+                    temp = temp->next;
+                }
+                break;
+            }
+            else {
+                if (length <= node->len) {
+                    memcpy(value, node->value, length);
+                    *len = length;
+                }
+                else {
+                    memcpy(value, node->value, node->len);
+                    *len = node->len;
+                }
+                done = TRUE;
+                break;
+            }
+        }
+    }
+
+    pthread_mutex_unlock(&handle->gate);
+
+    if (done == FALSE) {
+        LOG1("NameServer_getLocal: entry key: '%s' not found!\n", name)
+    }
+    else {
+        LOG2("NameServer_getLocal: Found entry key: '%s', data: 0x%x\n",
+             node->name, (UInt32)node->value)
+        status = NameServer_S_SUCCESS;
+    }
+
+    return (status);
+}
+
+/*
+ *  Gets a 32-bit value by name from the local table
+ *
+ *  If the name is found, the 32-bit value is copied into the value
+ *  argument and a success status is returned.
+ *
+ *  If the name is not found, zero is returned in len and the contents
+ *  of value are not modified. Not finding a name is not considered
+ *  an error.
+ *
+ *  This function only searches the local name/value table.
+ *
+ */
+Int NameServer_getLocalUInt32(NameServer_Handle handle, String name, Ptr value)
+{
+    Int                 status;
+    UInt32              len    = sizeof(UInt32);
+
+    assert(handle != NULL);
+    assert(name   != NULL);
+    assert(value  != NULL);
+    assert(NameServer_module->refCount != 0);
+
+    LOG0("NameServer_getLocalUInt32: calling NameServer_getLocal()...\n")
+    status = NameServer_getLocal(handle, name, value, &len);
+
+    return (status);
+}
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
diff --git a/linux/src/daemon/lad.c b/linux/src/daemon/lad.c
new file mode 100644 (file)
index 0000000..47c2083
--- /dev/null
@@ -0,0 +1,730 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== lad.c ========
+ */
+
+#include <Std.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <unistd.h>
+
+#include <ti/ipc/MessageQ.h>
+#include <_MessageQ.h>
+#include <ti/ipc/NameServer.h>
+#include <_NameServer.h>
+
+#include <ladclient.h>
+#include <_lad.h>
+
+#define DAEMON        1           /* 1 = run as a daemon; 0 = run as app */
+
+Bool logFile = FALSE;
+FILE *logPtr = NULL;
+
+static String commandFIFOFile = LAD_COMMANDFIFO;
+static FILE *commandFIFOFilePtr = NULL;
+static String serverDir;
+
+/* LAD client info arrays */
+static Bool clientConnected[LAD_MAXNUMCLIENTS];
+static UInt clientPID[LAD_MAXNUMCLIENTS];
+static Char clientFIFOName[LAD_MAXNUMCLIENTS][LAD_MAXLENGTHFIFONAME];
+static FILE * responseFIFOFilePtr[LAD_MAXNUMCLIENTS];
+
+/* local internal routines */
+static LAD_ClientHandle assignClientId(Void);
+static Void cleanupDepartedClients(Void);
+static Int connectToLAD(String clientName, Int pid, String clientProto, Int *clientIdPtr);
+static Void disconnectFromLAD(Int clientId);
+static Void doDisconnect(Int clientId);
+
+struct LAD_CommandObj cmd;
+union LAD_ResponseObj rsp;
+
+
+
+/*
+ *  ======== main ========
+ */
+int main(int argc, char * argv[])
+{
+    MessageQ_Handle handle;
+    UInt16 *procIdPtr;
+    Int statusIO;
+    Int clientId;
+    Int command;
+    Int flags;
+    Int i;
+    Int n;
+#if DAEMON
+    pid_t pid;
+    pid_t sid;
+#endif
+
+    /* if more than two args: turn "ON" launch status printfs */
+    if (argc > 2) {
+        printf("\nLAD starting up...");
+    }
+
+    /* check for env variable indicating server exe repository */
+    serverDir = getenv("LAD_SERVERPATH");
+    if (argc > 2) {
+        if (serverDir != NULL) {
+            printf("\nLAD_SERVERPATH = %s\n", serverDir);
+        }
+        else {
+            printf("\nLAD_SERVERPATH = <NULL>\n");
+        }
+    }
+
+    /* change to LAD's working directory */
+    if ((chdir(LAD_WORKINGDIR)) < 0) {
+
+        /* if can't change directory assume it needs to be created, do it */
+        if ((mkdir(LAD_WORKINGDIR, 0666)) < 0) {
+            printf("\nERROR: Failed to create LAD's working directory!\n");
+            exit(EXIT_FAILURE);
+        }
+        /* now change to the new directory */
+        if ((chdir(LAD_WORKINGDIR)) < 0) {
+            printf("\nERROR: Failed to change to LAD's working directory!\n");
+            exit(EXIT_FAILURE);
+        }
+    }
+
+    /* process command line args */
+    if (argc > 1) {
+        logPtr = fopen(argv[1], "w");
+        if (logPtr == NULL) {
+            printf("\nERROR: unable to open log file %s\n", argv[1]);
+            exit(EXIT_FAILURE);
+        }
+        else {
+            logFile = TRUE;
+            if (argc > 2) {
+                printf("\nOpened log file: %s", argv[1]);
+            }
+            /* close log file upon LAD termination */
+            flags = fcntl(fileno(logPtr), F_GETFD);
+            if (flags != -1) {
+                fcntl(fileno(logPtr), F_SETFD, flags | FD_CLOEXEC);
+            }
+        }
+    }
+
+#if DAEMON
+    /* fork off a child process */
+    pid = fork();
+
+    /* if fork of child failed then exit immediately; no child created */
+    if (pid < 0) {
+        printf("\nERROR: Failed to fork child process!");
+        exit(EXIT_FAILURE);
+    }
+
+    /* if pid > 0 this is the parent; time to die ... */
+    if (pid > 0) {
+        if (argc > 2) {
+            printf("\nSpawned daemon: %s\n\n", argv[0]);
+        }
+        exit(EXIT_SUCCESS);
+    }
+
+    /* child continues from here (pid == 0) ... */
+
+    /* change file mode mask */
+    umask(0);
+
+    /* create new session ID for the child */
+    sid = setsid();
+
+    /* exit with failure code if failed to get session ID... */
+    if (sid < 0) {
+        printf("\nERROR: Failed to acquire new session ID!");
+        exit(EXIT_FAILURE);
+    }
+
+    /* disassociate from the standard file descriptors */
+    close(STDIN_FILENO);
+    close(STDOUT_FILENO);
+    close(STDERR_FILENO);
+
+#endif
+
+    LOG0("\nInitializing LAD... ")
+
+    /* TODO:L make sure LAD is not already running? */
+
+    /* initialize client info arrays */
+    for (i = 0; i < LAD_MAXNUMCLIENTS; i++) {
+        clientConnected[i] = FALSE;
+        responseFIFOFilePtr[i] = NULL;
+    }
+
+    /* if command FIFO exists from previous LAD session delete it now */
+    unlink(commandFIFOFile);
+
+    /* create command FIFO */
+    statusIO = mkfifo(commandFIFOFile, 0777);
+    if (statusIO != 0) {
+        LOG2("\nERROR: unable to create %s, errno = %x\n", commandFIFOFile,
+            errno)
+        return(0);
+    }
+
+    /* set FIFO permissions to read/write */
+    chmod(commandFIFOFile, 0666);
+
+opencommandFIFO:
+
+    /* now open file for FIFO - will block until writer arrives... */
+    LOG1("\n    opening FIFO: %s\n", commandFIFOFile)
+    commandFIFOFilePtr = fopen(commandFIFOFile, "r");
+    if (commandFIFOFilePtr == NULL) {
+        LOG0("\nERROR: unable to open command FIFO\n")
+        unlink(commandFIFOFile);
+        return(0);
+    }
+
+    /* COMMAND PROCESSING LOOP */
+    while (1) {
+        LOG0("Retrieving command...\n")
+
+        /* read the next command packet */
+        n = fread(&cmd, LAD_COMMANDLENGTH, 1, commandFIFOFilePtr);
+
+        /*
+         * if last client closes FIFO then it must be closed and reopened ...
+         */
+        if (!n) {
+            LOG1("    EOF detected on FIFO, closing FIFO: %s\n", commandFIFOFile)
+            fclose(commandFIFOFilePtr);
+
+            goto opencommandFIFO;
+        }
+
+        /* cleanup for any connected/started clients that have departed */
+        cleanupDepartedClients();
+
+        command = cmd.cmd;
+        clientId = cmd.clientId;
+
+        /* process individual commands */
+        switch (command) {
+          /*
+           * Since cmd is a union of rcv and snd structs, don't write
+           * any snd elements before all rcv elements have been referenced
+           * (either saved in separate variables or passed to a function).
+           *
+           * cmd.cmd has already been saved in 'command'
+           * cmd.clientId has already been saved in 'clientId'
+           */
+          case LAD_CONNECT:
+            connectToLAD(cmd.args.connect.name, cmd.args.connect.pid,
+                         cmd.args.connect.protocol, NULL);
+
+            break;
+
+          case LAD_DISCONNECT:
+            disconnectFromLAD(clientId);
+
+            break;
+
+          case LAD_NAMESERVER_SETUP:
+            LOG0("LAD_NAMESERVER_SETUP: calling NameServer_setup()...\n")
+
+            rsp.status = NameServer_setup();
+
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_DESTROY:
+            LOG0("LAD_NAMESERVER_DESTROY: calling NameServer_destroy()...\n")
+
+            rsp.status = NameServer_destroy();
+
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_PARAMS_INIT:
+            LOG0("LAD_NAMESERVER_PARAMS_INIT: calling NameServer_Params_init()...\n")
+
+            NameServer_Params_init(&rsp.params);
+
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_CREATE:
+            LOG1("LAD_NAMESERVER_CREATE: calling NameServer_create('%s')...\n", cmd.args.create.name)
+
+            rsp.handle = NameServer_create(cmd.args.create.name,
+                                               &cmd.args.create.params);
+
+            LOG1("    handle = %p\n", rsp.handle)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_DELETE:
+            LOG1("LAD_NAMESERVER_DELETE: calling NameServer_delete(%p)...\n", cmd.args.delete.handle)
+
+            rsp.delete.handle = cmd.args.delete.handle;
+            rsp.delete.status = NameServer_delete(&rsp.delete.handle);
+
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_ADDUINT32:
+            LOG1("LAD_NAMESERVER_ADDUINT32: calling NameServer_addUInt32(%p, ", cmd.args.addUInt32.handle)
+            LOG2("'%s', 0x%x)...\n", cmd.args.addUInt32.name, cmd.args.addUInt32.val)
+
+            rsp.entryPtr = NameServer_addUInt32(
+                cmd.args.addUInt32.handle,
+                cmd.args.addUInt32.name,
+                cmd.args.addUInt32.val);
+
+            LOG1("    entryPtr = %p\n", rsp.entryPtr)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_GETUINT32:
+            LOG2("LAD_NAMESERVER_GETUINT32: calling NameServer_getUInt32(%p, '%s')...\n", cmd.args.getUInt32.handle, cmd.args.getUInt32.name)
+
+            if (cmd.args.getUInt32.procId[0] == (UInt16)-1) {
+                procIdPtr = NULL;
+            }
+            else {
+                procIdPtr = cmd.args.getUInt32.procId;
+            }
+            rsp.status = NameServer_getUInt32(
+                cmd.args.getUInt32.handle,
+                cmd.args.getUInt32.name,
+                &rsp.getUInt32.val,
+                procIdPtr);
+
+            LOG1("    value = 0x%x\n", rsp.getUInt32.val)
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_REMOVE:
+            LOG2("LAD_NAMESERVER_REMOVE: calling NameServer_remove(%p, '%s')...\n", cmd.args.remove.handle, cmd.args.remove.name)
+
+            rsp.status = NameServer_remove(cmd.args.remove.handle,
+                                               cmd.args.remove.name);
+
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_NAMESERVER_REMOVEENTRY:
+            LOG2("LAD_NAMESERVER_REMOVEENTRY: calling NameServer_removeEntry(%p, %p)...\n", cmd.args.removeEntry.handle, cmd.args.removeEntry.entryPtr)
+
+            rsp.status = NameServer_removeEntry(
+                cmd.args.removeEntry.handle,
+                cmd.args.removeEntry.entryPtr);
+
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_MESSAGEQ_GETCONFIG:
+            LOG0("LAD_MESSAGEQ_GETCONFIG: calling MessageQ_getConfig()...\n")
+
+            MessageQ_getConfig(&rsp.messageQGetConfig.cfg);
+            rsp.messageQGetConfig.status = 0;
+
+            LOG1("    status = %d\n", rsp.messageQGetConfig.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_MESSAGEQ_SETUP:
+            LOG0("LAD_MESSAGEQ_SETUP: calling MessageQ_setup()...\n")
+
+            rsp.setup.status = MessageQ_setup(&cmd.args.messageQSetup.cfg);
+            rsp.setup.nameServerHandle = MessageQ_getNameServerHandle();
+
+            LOG1("    status = %d\n", rsp.setup.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_MESSAGEQ_DESTROY:
+            LOG0("LAD_MESSAGEQ_DESTROY: calling MessageQ_destroy()...\n")
+
+            rsp.status = MessageQ_destroy();
+
+            LOG1("    status = %d\n", rsp.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_MESSAGEQ_CREATE:
+            LOG2("LAD_MESSAGEQ_CREATE: calling MessageQ_create(%p, %p)...\n", cmd.args.messageQCreate.name, &cmd.args.messageQCreate.params)
+
+            handle = MessageQ_create(cmd.args.messageQCreate.name,
+                &cmd.args.messageQCreate.params);
+            rsp.messageQCreate.serverHandle = handle;
+
+            if (handle) {
+                rsp.messageQCreate.queueId = MessageQ_getQueueId(handle);
+                MessageQ_setQueueOwner(handle, clientPID[clientId]);
+                rsp.messageQCreate.status = 0;
+            }
+            else {
+                rsp.messageQCreate.status = -1;
+            }
+
+            LOG1("    status = %d\n", rsp.messageQCreate.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_MESSAGEQ_DELETE:
+            LOG1("LAD_MESSAGEQ_DELETE: calling MessageQ_delete(%p)...\n", cmd.args.messageQDelete.serverHandle)
+
+            rsp.messageQDelete.status =
+                MessageQ_delete((MessageQ_Handle *)&cmd.args.messageQDelete.serverHandle);
+
+            LOG1("    status = %d\n", rsp.messageQDelete.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_MESSAGEQ_MSGINIT:
+            LOG1("LAD_MESSAGEQ_MSGINIT: calling MessageQ_msgInit(%p)...\n", &rsp.msgInit.msg);
+
+            MessageQ_msgInit(&rsp.msgInit.msg);
+            rsp.msgInit.status = 0;
+
+            LOG1("    status = %d\n", rsp.msgInit.status)
+            LOG0("DONE\n")
+
+            break;
+
+          case LAD_EXIT:
+            goto exitNow;
+
+            break;
+
+          default:
+            LOG1("\nUnrecognized command: 0x%x\n", command)
+
+            break;
+        }
+
+        switch (command) {
+          case LAD_CONNECT:
+          case LAD_DISCONNECT:
+            break;
+
+          case LAD_NAMESERVER_SETUP:
+          case LAD_NAMESERVER_DESTROY:
+          case LAD_NAMESERVER_PARAMS_INIT:
+          case LAD_NAMESERVER_CREATE:
+          case LAD_NAMESERVER_DELETE:
+          case LAD_NAMESERVER_ADDUINT32:
+          case LAD_NAMESERVER_GETUINT32:
+          case LAD_NAMESERVER_REMOVE:
+          case LAD_NAMESERVER_REMOVEENTRY:
+          case LAD_MESSAGEQ_GETCONFIG:
+          case LAD_MESSAGEQ_SETUP:
+          case LAD_MESSAGEQ_DESTROY:
+          case LAD_MESSAGEQ_CREATE:
+          case LAD_MESSAGEQ_DELETE:
+          case LAD_MESSAGEQ_MSGINIT:
+            LOG0("Sending response...\n");
+
+            fwrite(&rsp, LAD_RESPONSELENGTH, 1, responseFIFOFilePtr[clientId]);
+            fflush(responseFIFOFilePtr[clientId]);
+
+            break;
+
+          default:
+            break;
+        }
+    }
+
+exitNow:
+    if (logFile) {
+        LOG0("\n\nLAD IS SELF TERMINATING...\n\n")
+        fclose(logPtr);
+    }
+    unlink(commandFIFOFile);
+
+    return(0);
+
+}
+
+
+/*
+ *  ======== assignClientId ========
+ */
+static LAD_ClientHandle assignClientId(Void)
+{
+    Int clientId = -1;
+    Int i;
+
+    /* scan connection status flags to acquire a clientId */
+    for (i = 0; i < LAD_MAXNUMCLIENTS; i++) {
+        /* if slot open then provisionally select this clientId */
+        if (clientConnected[i] == FALSE) {
+             clientId = i;
+             break;
+        }
+    }
+
+    return(clientId);
+}
+
+
+/*
+ *  ======== cleanupDepartedClients ========
+ */
+static Void cleanupDepartedClients(Void)
+{
+    Int killStat;
+    Int i;
+
+    /* scan all connections to verify client processes still exist... */
+    for (i = 0; i < LAD_MAXNUMCLIENTS; i++) {
+
+        /* if connected... */
+        if (clientConnected[i] == TRUE) {
+
+            /* check if the client process (PID) still exists */
+            /*
+             * NOTE - calling kill with signal value of 0 will perform
+             * error checking, but not actually send a signal.  Will use this
+             * error check to see if PID still exists.  An alternative was
+             * to call getpgid.  This worked, but is apparently limited to
+             * USE_XOPEN_EXTENDED configurations.
+             */
+            killStat = kill(clientPID[i], 0);
+            if ((killStat == -1) && (errno == ESRCH)) {
+
+                LOG1("\nDETECTED CONNECTED CLIENT #%d HAS DEPARTED!", i)
+
+                /* will always need to do the disconnect... */
+                LOG0("\nDoing DISCONNECT on behalf of client...")
+                doDisconnect(i);
+
+                MessageQ_cleanupOwner(clientPID[i]);
+//                NameServer_cleanupOwner(clientPID[i]);
+
+                LOG0("DONE\n")
+            }
+        }
+    }
+}
+
+
+/*
+ *  ======== connectToLAD ========
+ */
+static Int connectToLAD(String clientName, Int pid, String clientProto, Int *clientIdPtr)
+{
+    Int clientId = -1;
+    Bool connectDenied = FALSE;
+    Int status = LAD_SUCCESS;
+    FILE * filePtr;
+    Int statusIO;
+
+    /*
+     * TODO:L here, and everywhere parse FIFO strings: should
+     * add full error checking for incomplete or corrupted
+     * strings? Since LAD to ladclient comms are "closed", and
+     * tested, the likelihood of problems seems very low.
+     * But should still consider doing full error checking
+     * and, hopefully, recovery.
+     */
+    LOG0("\nLAD_CONNECT: \n")
+    LOG1("    client FIFO name = %s\n", clientName)
+    LOG1("    client PID = %d\n", pid)
+
+    /* first check for proper communication protocol */
+    if (strcmp(clientProto, LAD_PROTOCOLVERSION) != 0) {
+
+        /* if no match then reject the request */
+        LOG0("    ERROR: mismatch in communication protocol!\n")
+        LOG1("        LAD protocol = %s\n", LAD_PROTOCOLVERSION)
+        LOG1("        client protocol = %s\n", clientProto)
+        status = LAD_INVALIDVERSION;
+
+        /* set flag so know to close FIFO after response */
+        connectDenied = TRUE;
+
+        /* now jump forward a bit to send response */
+        goto openResponseFIFO;
+    }
+
+    /* determine this client's ID */
+    clientId = assignClientId();
+
+    /* if failed to acquire an ID then exit early */
+    if (clientId == -1) {
+        LOG0("    no free handle; too many connections!\n")
+        status = LAD_ACCESSDENIED;
+
+        /* set flag so know to close FIFO after response */
+        connectDenied = TRUE;
+    }
+    else {
+        LOG1("    assigned client handle = %d\n", clientId)
+
+        /* save the client's FIFO name for when disconnect */
+        strcpy(clientFIFOName[clientId], clientName);
+    }
+
+openResponseFIFO:
+
+    /* create the dedicated response FIFO to the client */
+    statusIO = mkfifo(clientName, 0777);
+    if (statusIO != 0) {
+
+        LOG2("\nERROR: unable to mkfifo %s, errno = %x\n", clientName, errno)
+
+        status = LAD_IOFAILURE;
+
+        /* send no response; connection request will timeout */
+        goto doneconnect;
+    }
+
+    LOG1("    FIFO %s created\n", clientName)
+
+    /* set FIFO permissions to read/write */
+    chmod(clientName, 0666);
+
+    filePtr = fopen(clientName, "w");
+    if (filePtr == NULL) {
+        LOG1("\nERROR: unable to open response FIFO %s\n", clientName)
+
+        /* if failed open, still need to delete the FIFO */
+        unlink(clientName);
+
+        status = LAD_IOFAILURE;
+
+        /* send no response; connection request will timeout */
+        goto doneconnect;
+    }
+
+    LOG1("    FIFO %s opened for writing\n", clientName)
+
+    /*
+     * set "this client is connected" flag; this client ID is now "owned", and
+     * is no longer provisional
+     */
+    if (connectDenied == FALSE) {
+        responseFIFOFilePtr[clientId] = filePtr;
+        clientPID[clientId] = pid;
+        clientConnected[clientId] = TRUE;
+    }
+
+    rsp.connect.assignedId = clientId;
+    rsp.status = status;
+
+    /* put response to FIFO */
+    fwrite(&rsp, LAD_RESPONSELENGTH, 1, filePtr);
+    fflush(filePtr);
+
+    LOG0("    sent response\n")
+
+    /* if connection was denied, must now close FIFO */
+    if (connectDenied == TRUE) {
+        LOG1("    connect denied; closing FIFO %s\n", clientName)
+        fclose(filePtr);
+        unlink(clientName);
+    }
+
+    LOG0("DONE\n")
+
+doneconnect:
+    if (clientIdPtr != NULL) {
+        *clientIdPtr = clientId;
+    }
+
+    return(status);
+}
+
+
+/*
+ *  ======== disconnectFromLAD ========
+ */
+static Void disconnectFromLAD(Int clientId)
+{
+    LOG0("\nLAD_DISCONNECT: ")
+
+    LOG1("\n    client handle = %x", clientId)
+    doDisconnect(clientId);
+
+    LOG0("DONE\n")
+
+    return;
+}
+
+
+/*
+ *  ======== doDisconnect ========
+ */
+static Void doDisconnect(Int clientId)
+{
+    /* set "this client is not connected" flag */
+    clientConnected[clientId] = FALSE;
+
+    /* close and remove the response FIFO */
+    LOG2("\n    closing FIFO %s (filePtr=%p)\n",
+        clientFIFOName[clientId], responseFIFOFilePtr[clientId])
+    fclose(responseFIFOFilePtr[clientId]);
+
+    LOG1("    done, unlinking %s\n", clientFIFOName[clientId]);
+    unlink(clientFIFOName[clientId]);
+}
diff --git a/linux/src/family/Makefile.am b/linux/src/family/Makefile.am
new file mode 100644 (file)
index 0000000..ecc0297
--- /dev/null
@@ -0,0 +1,83 @@
+# src/family/Makefile.am
+
+# additional include paths necessary to compile the library
+AM_CFLAGS = -I$(top_srcdir)/linux/include -D_GNU_SOURCE -Wall @AM_CFLAGS@
+
+###############################################################################
+# THE LIBRARIES TO BUILD
+###############################################################################
+
+# the library names to build (note we are building shared libs)
+lib_LTLIBRARIES =
+
+if OMAP4430
+  lib_LTLIBRARIES += libtiipccfg_omap4430.la
+else 
+if OMAPL138
+  lib_LTLIBRARIES += libtiipccfg_omapl138.la
+else 
+if TCI6614
+  lib_LTLIBRARIES += libtiipccfg_tci6614.la
+else 
+if TCI6638
+  lib_LTLIBRARIES += libtiipccfg_tci6638.la
+else 
+  lib_LTLIBRARIES += \
+                libtiipccfg_omap4430.la libtiipccfg_omapl138.la \
+                libtiipccfg_tci6614.la libtiipccfg_tci6638.la
+endif
+endif
+endif
+endif
+
+common_install_headers = $(top_srcdir)/linux/include/Std.h
+
+common_sources = $(top_srcdir)/linux/include/_MultiProc.h
+
+# where to install the headers on the system
+libtiipccfg_omap4430_ladir = $(includedir)
+libtiipccfg_omapl138_ladir = $(includedir)
+libtiipccfg_tci6614_ladir = $(includedir)
+libtiipccfg_tci6638_ladir = $(includedir)
+
+# the list of header files that belong to the library (to be installed later)
+libtiipccfg_omap4430_la_HEADERS =      \
+                        $(common_install_headers)
+
+libtiipccfg_omapl138_la_HEADERS =      \
+                        $(common_install_headers)
+
+libtiipccfg_tci6614_la_HEADERS =       \
+                        $(common_install_headers)
+
+libtiipccfg_tci6638_la_HEADERS =       \
+                        $(common_install_headers)
+
+# the sources to add to the library and to add to the source distribution
+libtiipccfg_omap4430_la_SOURCES =      \
+                        $(libtiipccfg_omap4430_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_omap4430.c
+
+libtiipccfg_omapl138_la_SOURCES =      \
+                        $(libtiipccfg_omapl138_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_omapl138.c
+
+libtiipccfg_tci6614_la_SOURCES =       \
+                        $(libtiipccfg_tci6614_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_tci6614.c
+
+libtiipccfg_tci6638_la_SOURCES =       \
+                        $(libtiipccfg_tci6638_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_tci6638.c
+
+# Add version info to the shared library
+libtiipccfg_omap4430_la_LDFLAGS = -version-info 1:0:0
+libtiipccfg_omapl138_la_LDFLAGS = -version-info 1:0:0
+libtiipccfg_tci6614_la_LDFLAGS = -version-info 1:0:0
+libtiipccfg_tci6638_la_LDFLAGS = -version-info 1:0:0
+
+###############################################################################
diff --git a/linux/src/family/Makefile.in b/linux/src/family/Makefile.in
new file mode 100644 (file)
index 0000000..3933064
--- /dev/null
@@ -0,0 +1,675 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# src/family/Makefile.am
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@OMAP4430_TRUE@am__append_1 = libtiipccfg_omap4430.la
+@OMAP4430_FALSE@@OMAPL138_TRUE@am__append_2 = libtiipccfg_omapl138.la
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_3 = libtiipccfg_tci6614.la
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__append_4 = libtiipccfg_tci6638.la
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__append_5 = \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                libtiipccfg_omap4430.la libtiipccfg_omapl138.la \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                libtiipccfg_tci6614.la libtiipccfg_tci6638.la
+
+subdir = linux/src/family
+DIST_COMMON = $(libtiipccfg_omap4430_la_HEADERS) \
+       $(libtiipccfg_omapl138_la_HEADERS) \
+       $(libtiipccfg_tci6614_la_HEADERS) \
+       $(libtiipccfg_tci6638_la_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" \
+       "$(DESTDIR)$(libtiipccfg_omap4430_ladir)" \
+       "$(DESTDIR)$(libtiipccfg_omapl138_ladir)" \
+       "$(DESTDIR)$(libtiipccfg_tci6614_ladir)" \
+       "$(DESTDIR)$(libtiipccfg_tci6638_ladir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libtiipccfg_omap4430_la_LIBADD =
+am__objects_1 =
+am__objects_2 = $(am__objects_1)
+am_libtiipccfg_omap4430_la_OBJECTS = $(am__objects_2) $(am__objects_1) \
+       SystemCfg_omap4430.lo
+libtiipccfg_omap4430_la_OBJECTS =  \
+       $(am_libtiipccfg_omap4430_la_OBJECTS)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am_libtiipccfg_omap4430_la_rpath = -rpath \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ $(libdir)
+@OMAP4430_TRUE@am_libtiipccfg_omap4430_la_rpath = -rpath $(libdir)
+libtiipccfg_omapl138_la_LIBADD =
+am_libtiipccfg_omapl138_la_OBJECTS = $(am__objects_2) $(am__objects_1) \
+       SystemCfg_omapl138.lo
+libtiipccfg_omapl138_la_OBJECTS =  \
+       $(am_libtiipccfg_omapl138_la_OBJECTS)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am_libtiipccfg_omapl138_la_rpath = -rpath \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ $(libdir)
+@OMAP4430_FALSE@@OMAPL138_TRUE@am_libtiipccfg_omapl138_la_rpath =  \
+@OMAP4430_FALSE@@OMAPL138_TRUE@        -rpath $(libdir)
+libtiipccfg_tci6614_la_LIBADD =
+am_libtiipccfg_tci6614_la_OBJECTS = $(am__objects_2) $(am__objects_1) \
+       SystemCfg_tci6614.lo
+libtiipccfg_tci6614_la_OBJECTS = $(am_libtiipccfg_tci6614_la_OBJECTS)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am_libtiipccfg_tci6614_la_rpath = -rpath \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ $(libdir)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am_libtiipccfg_tci6614_la_rpath =  \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@ -rpath $(libdir)
+libtiipccfg_tci6638_la_LIBADD =
+am_libtiipccfg_tci6638_la_OBJECTS = $(am__objects_2) $(am__objects_1) \
+       SystemCfg_tci6638.lo
+libtiipccfg_tci6638_la_OBJECTS = $(am_libtiipccfg_tci6638_la_OBJECTS)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am_libtiipccfg_tci6638_la_rpath = -rpath \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ $(libdir)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am_libtiipccfg_tci6638_la_rpath = -rpath \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@  $(libdir)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libtiipccfg_omap4430_la_SOURCES) \
+       $(libtiipccfg_omapl138_la_SOURCES) \
+       $(libtiipccfg_tci6614_la_SOURCES) \
+       $(libtiipccfg_tci6638_la_SOURCES)
+DIST_SOURCES = $(libtiipccfg_omap4430_la_SOURCES) \
+       $(libtiipccfg_omapl138_la_SOURCES) \
+       $(libtiipccfg_tci6614_la_SOURCES) \
+       $(libtiipccfg_tci6638_la_SOURCES)
+libtiipccfg_omap4430_laHEADERS_INSTALL = $(INSTALL_HEADER)
+libtiipccfg_omapl138_laHEADERS_INSTALL = $(INSTALL_HEADER)
+libtiipccfg_tci6614_laHEADERS_INSTALL = $(INSTALL_HEADER)
+libtiipccfg_tci6638_laHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libtiipccfg_omap4430_la_HEADERS) \
+       $(libtiipccfg_omapl138_la_HEADERS) \
+       $(libtiipccfg_tci6614_la_HEADERS) \
+       $(libtiipccfg_tci6638_la_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+
+# additional include paths necessary to compile the library
+AM_CFLAGS = -I$(top_srcdir)/linux/include -D_GNU_SOURCE -Wall @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+###############################################################################
+# THE LIBRARIES TO BUILD
+###############################################################################
+
+# the library names to build (note we are building shared libs)
+lib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3) \
+       $(am__append_4) $(am__append_5)
+common_install_headers = $(top_srcdir)/linux/include/Std.h
+common_sources = $(top_srcdir)/linux/include/_MultiProc.h
+
+# where to install the headers on the system
+libtiipccfg_omap4430_ladir = $(includedir)
+libtiipccfg_omapl138_ladir = $(includedir)
+libtiipccfg_tci6614_ladir = $(includedir)
+libtiipccfg_tci6638_ladir = $(includedir)
+
+# the list of header files that belong to the library (to be installed later)
+libtiipccfg_omap4430_la_HEADERS = \
+                        $(common_install_headers)
+
+libtiipccfg_omapl138_la_HEADERS = \
+                        $(common_install_headers)
+
+libtiipccfg_tci6614_la_HEADERS = \
+                        $(common_install_headers)
+
+libtiipccfg_tci6638_la_HEADERS = \
+                        $(common_install_headers)
+
+
+# the sources to add to the library and to add to the source distribution
+libtiipccfg_omap4430_la_SOURCES = \
+                        $(libtiipccfg_omap4430_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_omap4430.c
+
+libtiipccfg_omapl138_la_SOURCES = \
+                        $(libtiipccfg_omapl138_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_omapl138.c
+
+libtiipccfg_tci6614_la_SOURCES = \
+                        $(libtiipccfg_tci6614_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_tci6614.c
+
+libtiipccfg_tci6638_la_SOURCES = \
+                        $(libtiipccfg_tci6638_la_HEADERS) \
+                        $(common_sources) \
+                        SystemCfg_tci6638.c
+
+
+# Add version info to the shared library
+libtiipccfg_omap4430_la_LDFLAGS = -version-info 1:0:0
+libtiipccfg_omapl138_la_LDFLAGS = -version-info 1:0:0
+libtiipccfg_tci6614_la_LDFLAGS = -version-info 1:0:0
+libtiipccfg_tci6638_la_LDFLAGS = -version-info 1:0:0
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  linux/src/family/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  linux/src/family/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libtiipccfg_omap4430.la: $(libtiipccfg_omap4430_la_OBJECTS) $(libtiipccfg_omap4430_la_DEPENDENCIES) 
+       $(LINK) $(am_libtiipccfg_omap4430_la_rpath) $(libtiipccfg_omap4430_la_LDFLAGS) $(libtiipccfg_omap4430_la_OBJECTS) $(libtiipccfg_omap4430_la_LIBADD) $(LIBS)
+libtiipccfg_omapl138.la: $(libtiipccfg_omapl138_la_OBJECTS) $(libtiipccfg_omapl138_la_DEPENDENCIES) 
+       $(LINK) $(am_libtiipccfg_omapl138_la_rpath) $(libtiipccfg_omapl138_la_LDFLAGS) $(libtiipccfg_omapl138_la_OBJECTS) $(libtiipccfg_omapl138_la_LIBADD) $(LIBS)
+libtiipccfg_tci6614.la: $(libtiipccfg_tci6614_la_OBJECTS) $(libtiipccfg_tci6614_la_DEPENDENCIES) 
+       $(LINK) $(am_libtiipccfg_tci6614_la_rpath) $(libtiipccfg_tci6614_la_LDFLAGS) $(libtiipccfg_tci6614_la_OBJECTS) $(libtiipccfg_tci6614_la_LIBADD) $(LIBS)
+libtiipccfg_tci6638.la: $(libtiipccfg_tci6638_la_OBJECTS) $(libtiipccfg_tci6638_la_DEPENDENCIES) 
+       $(LINK) $(am_libtiipccfg_tci6638_la_rpath) $(libtiipccfg_tci6638_la_LDFLAGS) $(libtiipccfg_tci6638_la_OBJECTS) $(libtiipccfg_tci6638_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemCfg_omap4430.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemCfg_omapl138.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemCfg_tci6614.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemCfg_tci6638.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-libtiipccfg_omap4430_laHEADERS: $(libtiipccfg_omap4430_la_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(libtiipccfg_omap4430_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipccfg_omap4430_ladir)"
+       @list='$(libtiipccfg_omap4430_la_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libtiipccfg_omap4430_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipccfg_omap4430_ladir)/$$f'"; \
+         $(libtiipccfg_omap4430_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipccfg_omap4430_ladir)/$$f"; \
+       done
+
+uninstall-libtiipccfg_omap4430_laHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libtiipccfg_omap4430_la_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libtiipccfg_omap4430_ladir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libtiipccfg_omap4430_ladir)/$$f"; \
+       done
+install-libtiipccfg_omapl138_laHEADERS: $(libtiipccfg_omapl138_la_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(libtiipccfg_omapl138_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipccfg_omapl138_ladir)"
+       @list='$(libtiipccfg_omapl138_la_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libtiipccfg_omapl138_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipccfg_omapl138_ladir)/$$f'"; \
+         $(libtiipccfg_omapl138_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipccfg_omapl138_ladir)/$$f"; \
+       done
+
+uninstall-libtiipccfg_omapl138_laHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libtiipccfg_omapl138_la_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libtiipccfg_omapl138_ladir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libtiipccfg_omapl138_ladir)/$$f"; \
+       done
+install-libtiipccfg_tci6614_laHEADERS: $(libtiipccfg_tci6614_la_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(libtiipccfg_tci6614_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipccfg_tci6614_ladir)"
+       @list='$(libtiipccfg_tci6614_la_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libtiipccfg_tci6614_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipccfg_tci6614_ladir)/$$f'"; \
+         $(libtiipccfg_tci6614_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipccfg_tci6614_ladir)/$$f"; \
+       done
+
+uninstall-libtiipccfg_tci6614_laHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libtiipccfg_tci6614_la_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libtiipccfg_tci6614_ladir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libtiipccfg_tci6614_ladir)/$$f"; \
+       done
+install-libtiipccfg_tci6638_laHEADERS: $(libtiipccfg_tci6638_la_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(libtiipccfg_tci6638_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipccfg_tci6638_ladir)"
+       @list='$(libtiipccfg_tci6638_la_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libtiipccfg_tci6638_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipccfg_tci6638_ladir)/$$f'"; \
+         $(libtiipccfg_tci6638_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipccfg_tci6638_ladir)/$$f"; \
+       done
+
+uninstall-libtiipccfg_tci6638_laHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libtiipccfg_tci6638_la_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libtiipccfg_tci6638_ladir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libtiipccfg_tci6638_ladir)/$$f"; \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/../../../linux/include
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiipccfg_omap4430_ladir)" "$(DESTDIR)$(libtiipccfg_omapl138_ladir)" "$(DESTDIR)$(libtiipccfg_tci6614_ladir)" "$(DESTDIR)$(libtiipccfg_tci6638_ladir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libtiipccfg_omap4430_laHEADERS \
+       install-libtiipccfg_omapl138_laHEADERS \
+       install-libtiipccfg_tci6614_laHEADERS \
+       install-libtiipccfg_tci6638_laHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
+       uninstall-libtiipccfg_omap4430_laHEADERS \
+       uninstall-libtiipccfg_omapl138_laHEADERS \
+       uninstall-libtiipccfg_tci6614_laHEADERS \
+       uninstall-libtiipccfg_tci6638_laHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am \
+       install-libLTLIBRARIES install-libtiipccfg_omap4430_laHEADERS \
+       install-libtiipccfg_omapl138_laHEADERS \
+       install-libtiipccfg_tci6614_laHEADERS \
+       install-libtiipccfg_tci6638_laHEADERS install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-info-am uninstall-libLTLIBRARIES \
+       uninstall-libtiipccfg_omap4430_laHEADERS \
+       uninstall-libtiipccfg_omapl138_laHEADERS \
+       uninstall-libtiipccfg_tci6614_laHEADERS \
+       uninstall-libtiipccfg_tci6638_laHEADERS
+
+
+###############################################################################
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/linux/src/family/SystemCfg_omap4430.c b/linux/src/family/SystemCfg_omap4430.c
new file mode 100644 (file)
index 0000000..f013e19
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * ========SystemCfg.c ========
+ * System-wide configuration
+ */
+
+/* Standard headers */
+#include <Std.h>
+
+/* For Backplane IPC startup/shutdown stuff: */
+#include <_MultiProc.h>
+
+/* This must match BIOS side MultiProc configuration for given platform!: */
+MultiProc_Config _MultiProc_cfg =  {
+   .numProcessors = 2,
+   .nameList[0] = "HOST",
+   .nameList[1] = "CORE0",
+   .id = 0,                 /* The host is always zero */
+};
diff --git a/linux/src/family/SystemCfg_omapl138.c b/linux/src/family/SystemCfg_omapl138.c
new file mode 100644 (file)
index 0000000..65f89c5
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * ========SystemCfg.c ========
+ * System-wide configuration
+ */
+
+/* Standard headers */
+#include <Std.h>
+
+/* For Backplane IPC startup/shutdown stuff: */
+#include <_MultiProc.h>
+
+/* This must match BIOS side MultiProc configuration for given platform!: */
+MultiProc_Config _MultiProc_cfg =  {
+   .numProcessors = 2,
+   .nameList[0] = "HOST",
+   .nameList[1] = "DSP",
+   .id = 0,                 /* The host is always zero */
+};
diff --git a/linux/src/family/SystemCfg_tci6614.c b/linux/src/family/SystemCfg_tci6614.c
new file mode 100644 (file)
index 0000000..cf43919
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * ========SystemCfg.c ========
+ * System-wide configuration
+ */
+
+/* Standard headers */
+#include <Std.h>
+
+/* For Backplane IPC startup/shutdown stuff: */
+#include <_MultiProc.h>
+
+/* This must match BIOS side MultiProc configuration for given platform!: */
+MultiProc_Config _MultiProc_cfg =  {
+   .numProcessors = 5,
+   .nameList[0] = "HOST",
+   .nameList[1] = "CORE0",
+   .nameList[2] = "CORE1",
+   .nameList[3] = "CORE2",
+   .nameList[4] = "CORE3",
+   .id = 0,                 /* The host is always zero */
+};
diff --git a/linux/src/family/SystemCfg_tci6638.c b/linux/src/family/SystemCfg_tci6638.c
new file mode 100644 (file)
index 0000000..1e4459e
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * ========SystemCfg.c ========
+ * System-wide configuration for Kepler
+ */
+
+/* Standard headers */
+#include <Std.h>
+
+/* For Backplane IPC startup/shutdown stuff: */
+#include <_MultiProc.h>
+
+/* This must match BIOS side MultiProc configuration for given platform!: */
+MultiProc_Config _MultiProc_cfg =  {
+   .numProcessors = 9,
+   .nameList[0] = "HOST",
+   .nameList[1] = "CORE0",
+   .nameList[2] = "CORE1",
+   .nameList[3] = "CORE2",
+   .nameList[4] = "CORE3",
+   .nameList[5] = "CORE4",
+   .nameList[6] = "CORE5",
+   .nameList[7] = "CORE6",
+   .nameList[8] = "CORE7",
+   .id = 0,                 /* The host is always zero */
+};
diff --git a/linux/src/tests/Makefile.am b/linux/src/tests/Makefile.am
new file mode 100644 (file)
index 0000000..9d25908
--- /dev/null
@@ -0,0 +1,136 @@
+# src/test/Makefile.am
+
+# additional include paths necessary to compile the program
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -I$(CMEM_INSTALL_DIR)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+
+###############################################################################
+# THE PROGRAMS TO BUILD
+###############################################################################
+
+# the program to build (the names of the final binaries)
+bin_PROGRAMS =
+
+if OMAP4430
+  bin_PROGRAMS += MessageQApp_omap4430 MessageQBench_omap4430 MessageQMulti_omap4430 \
+                    NameServerApp_omap4430
+else
+if OMAPL138
+  bin_PROGRAMS += MessageQApp_omapl138 MessageQBench_omapl138 MessageQMulti_omapl138 \
+                    NameServerApp_omapl138
+if CMEM
+  bin_PROGRAMS += nano_test_omapl138
+endif
+else
+if TCI6614
+  bin_PROGRAMS += MessageQApp_tci6614 MessageQBench_tci6614 MessageQMulti_tci6614 \
+                    NameServerApp_tci6614
+else
+if TCI6638
+  bin_PROGRAMS += MessageQApp_tci6638 MessageQBench_tci6638 MessageQMulti_tci6638 \
+                    NameServerApp_tci6638
+else
+  bin_PROGRAMS += MessageQApp_omap4430 MessageQBench_omap4430 MessageQMulti_omap4430 \
+                  NameServerApp_omap4430 \
+                  MessageQApp_omapl138 MessageQBench_omapl138 MessageQMulti_omapl138 \
+                  NameServerApp_omapl138 \
+                  MessageQApp_tci6614 MessageQBench_tci6614 MessageQMulti_tci6614 \
+                  NameServerApp_tci6614 \
+                  MessageQApp_tci6638 MessageQBench_tci6638 MessageQMulti_tci6638 \
+                  NameServerApp_tci6638
+if CMEM
+  bin_PROGRAMS += nano_test_omapl138
+endif
+endif
+endif
+endif
+endif
+
+common_sources = \
+                $(top_srcdir)/linux/include/Std.h \
+                $(top_srcdir)/linux/include/SysLink.h \
+                $(top_srcdir)/packages/ti/ipc/MessageQ.h
+
+nameServer_common_sources = \
+                $(top_srcdir)/linux/include/Std.h\
+                $(top_srcdir)/linux/include/ladclient.h \
+                $(top_srcdir)/linux/include/_NameServer.h \
+                $(top_srcdir)/packages/ti/ipc/NameServer.h \
+                NameServerApp.c
+
+# list of sources for the 'MessageQApp' binary
+MessageQApp_omap4430_SOURCES = $(common_sources) MessageQApp.c
+MessageQApp_omapl138_SOURCES = $(common_sources) MessageQApp.c
+MessageQApp_tci6614_SOURCES = $(common_sources) MessageQApp.c
+MessageQApp_tci6638_SOURCES = $(common_sources) MessageQApp.c
+
+# list of sources for the 'MessageQBench' binary
+MessageQBench_omap4430_SOURCES = $(common_sources) MessageQBench.c
+MessageQBench_omapl138_SOURCES = $(common_sources) MessageQBench.c
+MessageQBench_tci6614_SOURCES  = $(common_sources) MessageQBench.c
+MessageQBench_tci6638_SOURCES  = $(common_sources) MessageQBench.c
+
+# list of sources for the 'MessageQMulti' binary
+MessageQMulti_omap4430_SOURCES = $(common_sources) MessageQMulti.c
+MessageQMulti_omapl138_SOURCES = $(common_sources) MessageQMulti.c
+MessageQMulti_tci6614_SOURCES  = $(common_sources) MessageQMulti.c
+MessageQMulti_tci6638_SOURCES  = $(common_sources) MessageQMulti.c
+
+# list of sources for the 'NameServerApp' binary
+NameServerApp_omap4430_SOURCES = $(nameServer_common_sources)
+NameServerApp_omapl138_SOURCES = $(nameServer_common_sources)
+NameServerApp_tci6614_SOURCES  = $(nameServer_common_sources)
+NameServerApp_tci6638_SOURCES  = $(nameServer_common_sources)
+
+# list of sources for the 'nano_test' binary
+nano_test_omapl138_SOURCES = $(common_sources) nano_test.c
+
+common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
+                $(top_builddir)/linux/src/utils/libtiipcutils.la
+
+# the additional libraries needed to link MessageQApp
+MessageQApp_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+MessageQApp_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+MessageQApp_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+MessageQApp_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+# the additional libraries needed to link MessageQBench
+MessageQBench_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la -lrt $(AM_LDFLAGS)
+MessageQBench_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la -lrt $(AM_LDFLAGS)
+MessageQBench_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la -lrt $(AM_LDFLAGS)
+MessageQBench_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la -lrt $(AM_LDFLAGS)
+
+# the additional libraries needed to link MessageQMulti
+MessageQMulti_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+MessageQMulti_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+MessageQMulti_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+MessageQMulti_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+# the additional libraries needed to link NameServerApp
+NameServerApp_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+NameServerApp_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+NameServerApp_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+NameServerApp_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+# the additional libraries needed to link nano_test
+nano_test_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+                $(CMEM_INSTALL_DIR)/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV \
+                $(AM_LDFLAGS)
+
+###############################################################################
diff --git a/linux/src/tests/Makefile.in b/linux/src/tests/Makefile.in
new file mode 100644 (file)
index 0000000..0449c21
--- /dev/null
@@ -0,0 +1,802 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# src/test/Makefile.am
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+       $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
+       $(am__EXEEXT_7)
+@OMAP4430_TRUE@am__append_1 = MessageQApp_omap4430 MessageQBench_omap4430 MessageQMulti_omap4430 \
+@OMAP4430_TRUE@                    NameServerApp_omap4430
+
+@OMAP4430_FALSE@@OMAPL138_TRUE@am__append_2 = MessageQApp_omapl138 MessageQBench_omapl138 MessageQMulti_omapl138 \
+@OMAP4430_FALSE@@OMAPL138_TRUE@                    NameServerApp_omapl138
+
+@CMEM_TRUE@@OMAP4430_FALSE@@OMAPL138_TRUE@am__append_3 = nano_test_omapl138
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_4 = MessageQApp_tci6614 MessageQBench_tci6614 MessageQMulti_tci6614 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@                    NameServerApp_tci6614
+
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__append_5 = MessageQApp_tci6638 MessageQBench_tci6638 MessageQMulti_tci6638 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@                    NameServerApp_tci6638
+
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__append_6 = MessageQApp_omap4430 MessageQBench_omap4430 MessageQMulti_omap4430 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  NameServerApp_omap4430 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  MessageQApp_omapl138 MessageQBench_omapl138 MessageQMulti_omapl138 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  NameServerApp_omapl138 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  MessageQApp_tci6614 MessageQBench_tci6614 MessageQMulti_tci6614 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  NameServerApp_tci6614 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  MessageQApp_tci6638 MessageQBench_tci6638 MessageQMulti_tci6638 \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@                  NameServerApp_tci6638
+
+@CMEM_TRUE@@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__append_7 = nano_test_omapl138
+subdir = linux/src/tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+@OMAP4430_TRUE@am__EXEEXT_1 = MessageQApp_omap4430$(EXEEXT) \
+@OMAP4430_TRUE@        MessageQBench_omap4430$(EXEEXT) \
+@OMAP4430_TRUE@        MessageQMulti_omap4430$(EXEEXT) \
+@OMAP4430_TRUE@        NameServerApp_omap4430$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_TRUE@am__EXEEXT_2 =  \
+@OMAP4430_FALSE@@OMAPL138_TRUE@        MessageQApp_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_TRUE@        MessageQBench_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_TRUE@        MessageQMulti_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_TRUE@        NameServerApp_omapl138$(EXEEXT)
+@CMEM_TRUE@@OMAP4430_FALSE@@OMAPL138_TRUE@am__EXEEXT_3 = nano_test_omapl138$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__EXEEXT_4 = MessageQApp_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@ MessageQBench_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@ MessageQMulti_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@ NameServerApp_tci6614$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__EXEEXT_5 = MessageQApp_tci6638$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@  MessageQBench_tci6638$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@  MessageQMulti_tci6638$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@  NameServerApp_tci6638$(EXEEXT)
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__EXEEXT_6 = MessageQApp_omap4430$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQBench_omap4430$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQMulti_omap4430$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ NameServerApp_omap4430$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQApp_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQBench_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQMulti_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ NameServerApp_omapl138$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQApp_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQBench_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQMulti_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ NameServerApp_tci6614$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQApp_tci6638$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQBench_tci6638$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ MessageQMulti_tci6638$(EXEEXT) \
+@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@ NameServerApp_tci6638$(EXEEXT)
+@CMEM_TRUE@@OMAP4430_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_FALSE@am__EXEEXT_7 = nano_test_omapl138$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 =
+am_MessageQApp_omap4430_OBJECTS = $(am__objects_1) \
+       MessageQApp.$(OBJEXT)
+MessageQApp_omap4430_OBJECTS = $(am_MessageQApp_omap4430_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/linux/src/api/libtiipc.la \
+       $(top_builddir)/linux/src/utils/libtiipcutils.la
+am__DEPENDENCIES_2 =
+MessageQApp_omap4430_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQApp_omapl138_OBJECTS = $(am__objects_1) \
+       MessageQApp.$(OBJEXT)
+MessageQApp_omapl138_OBJECTS = $(am_MessageQApp_omapl138_OBJECTS)
+MessageQApp_omapl138_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQApp_tci6614_OBJECTS = $(am__objects_1) \
+       MessageQApp.$(OBJEXT)
+MessageQApp_tci6614_OBJECTS = $(am_MessageQApp_tci6614_OBJECTS)
+MessageQApp_tci6614_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQApp_tci6638_OBJECTS = $(am__objects_1) \
+       MessageQApp.$(OBJEXT)
+MessageQApp_tci6638_OBJECTS = $(am_MessageQApp_tci6638_OBJECTS)
+MessageQApp_tci6638_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQBench_omap4430_OBJECTS = $(am__objects_1) \
+       MessageQBench.$(OBJEXT)
+MessageQBench_omap4430_OBJECTS = $(am_MessageQBench_omap4430_OBJECTS)
+MessageQBench_omap4430_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQBench_omapl138_OBJECTS = $(am__objects_1) \
+       MessageQBench.$(OBJEXT)
+MessageQBench_omapl138_OBJECTS = $(am_MessageQBench_omapl138_OBJECTS)
+MessageQBench_omapl138_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQBench_tci6614_OBJECTS = $(am__objects_1) \
+       MessageQBench.$(OBJEXT)
+MessageQBench_tci6614_OBJECTS = $(am_MessageQBench_tci6614_OBJECTS)
+MessageQBench_tci6614_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQBench_tci6638_OBJECTS = $(am__objects_1) \
+       MessageQBench.$(OBJEXT)
+MessageQBench_tci6638_OBJECTS = $(am_MessageQBench_tci6638_OBJECTS)
+MessageQBench_tci6638_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQMulti_omap4430_OBJECTS = $(am__objects_1) \
+       MessageQMulti.$(OBJEXT)
+MessageQMulti_omap4430_OBJECTS = $(am_MessageQMulti_omap4430_OBJECTS)
+MessageQMulti_omap4430_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQMulti_omapl138_OBJECTS = $(am__objects_1) \
+       MessageQMulti.$(OBJEXT)
+MessageQMulti_omapl138_OBJECTS = $(am_MessageQMulti_omapl138_OBJECTS)
+MessageQMulti_omapl138_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQMulti_tci6614_OBJECTS = $(am__objects_1) \
+       MessageQMulti.$(OBJEXT)
+MessageQMulti_tci6614_OBJECTS = $(am_MessageQMulti_tci6614_OBJECTS)
+MessageQMulti_tci6614_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la \
+       $(am__DEPENDENCIES_2)
+am_MessageQMulti_tci6638_OBJECTS = $(am__objects_1) \
+       MessageQMulti.$(OBJEXT)
+MessageQMulti_tci6638_OBJECTS = $(am_MessageQMulti_tci6638_OBJECTS)
+MessageQMulti_tci6638_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la \
+       $(am__DEPENDENCIES_2)
+am__objects_2 = NameServerApp.$(OBJEXT)
+am_NameServerApp_omap4430_OBJECTS = $(am__objects_2)
+NameServerApp_omap4430_OBJECTS = $(am_NameServerApp_omap4430_OBJECTS)
+NameServerApp_omap4430_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la \
+       $(am__DEPENDENCIES_2)
+am_NameServerApp_omapl138_OBJECTS = $(am__objects_2)
+NameServerApp_omapl138_OBJECTS = $(am_NameServerApp_omapl138_OBJECTS)
+NameServerApp_omapl138_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+       $(am__DEPENDENCIES_2)
+am_NameServerApp_tci6614_OBJECTS = $(am__objects_2)
+NameServerApp_tci6614_OBJECTS = $(am_NameServerApp_tci6614_OBJECTS)
+NameServerApp_tci6614_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la \
+       $(am__DEPENDENCIES_2)
+am_NameServerApp_tci6638_OBJECTS = $(am__objects_2)
+NameServerApp_tci6638_OBJECTS = $(am_NameServerApp_tci6638_OBJECTS)
+NameServerApp_tci6638_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la \
+       $(am__DEPENDENCIES_2)
+am_nano_test_omapl138_OBJECTS = $(am__objects_1) nano_test.$(OBJEXT)
+nano_test_omapl138_OBJECTS = $(am_nano_test_omapl138_OBJECTS)
+nano_test_omapl138_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+       $(CMEM_INSTALL_DIR)/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV \
+       $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(MessageQApp_omap4430_SOURCES) \
+       $(MessageQApp_omapl138_SOURCES) $(MessageQApp_tci6614_SOURCES) \
+       $(MessageQApp_tci6638_SOURCES) \
+       $(MessageQBench_omap4430_SOURCES) \
+       $(MessageQBench_omapl138_SOURCES) \
+       $(MessageQBench_tci6614_SOURCES) \
+       $(MessageQBench_tci6638_SOURCES) \
+       $(MessageQMulti_omap4430_SOURCES) \
+       $(MessageQMulti_omapl138_SOURCES) \
+       $(MessageQMulti_tci6614_SOURCES) \
+       $(MessageQMulti_tci6638_SOURCES) \
+       $(NameServerApp_omap4430_SOURCES) \
+       $(NameServerApp_omapl138_SOURCES) \
+       $(NameServerApp_tci6614_SOURCES) \
+       $(NameServerApp_tci6638_SOURCES) $(nano_test_omapl138_SOURCES)
+DIST_SOURCES = $(MessageQApp_omap4430_SOURCES) \
+       $(MessageQApp_omapl138_SOURCES) $(MessageQApp_tci6614_SOURCES) \
+       $(MessageQApp_tci6638_SOURCES) \
+       $(MessageQBench_omap4430_SOURCES) \
+       $(MessageQBench_omapl138_SOURCES) \
+       $(MessageQBench_tci6614_SOURCES) \
+       $(MessageQBench_tci6638_SOURCES) \
+       $(MessageQMulti_omap4430_SOURCES) \
+       $(MessageQMulti_omapl138_SOURCES) \
+       $(MessageQMulti_tci6614_SOURCES) \
+       $(MessageQMulti_tci6638_SOURCES) \
+       $(NameServerApp_omap4430_SOURCES) \
+       $(NameServerApp_omapl138_SOURCES) \
+       $(NameServerApp_tci6614_SOURCES) \
+       $(NameServerApp_tci6638_SOURCES) $(nano_test_omapl138_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+
+# additional include paths necessary to compile the program
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -I$(CMEM_INSTALL_DIR)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+common_sources = \
+                $(top_srcdir)/linux/include/Std.h \
+                $(top_srcdir)/linux/include/SysLink.h \
+                $(top_srcdir)/packages/ti/ipc/MessageQ.h
+
+nameServer_common_sources = \
+                $(top_srcdir)/linux/include/Std.h\
+                $(top_srcdir)/linux/include/ladclient.h \
+                $(top_srcdir)/linux/include/_NameServer.h \
+                $(top_srcdir)/packages/ti/ipc/NameServer.h \
+                NameServerApp.c
+
+
+# list of sources for the 'MessageQApp' binary
+MessageQApp_omap4430_SOURCES = $(common_sources) MessageQApp.c
+MessageQApp_omapl138_SOURCES = $(common_sources) MessageQApp.c
+MessageQApp_tci6614_SOURCES = $(common_sources) MessageQApp.c
+MessageQApp_tci6638_SOURCES = $(common_sources) MessageQApp.c
+
+# list of sources for the 'MessageQBench' binary
+MessageQBench_omap4430_SOURCES = $(common_sources) MessageQBench.c
+MessageQBench_omapl138_SOURCES = $(common_sources) MessageQBench.c
+MessageQBench_tci6614_SOURCES = $(common_sources) MessageQBench.c
+MessageQBench_tci6638_SOURCES = $(common_sources) MessageQBench.c
+
+# list of sources for the 'MessageQMulti' binary
+MessageQMulti_omap4430_SOURCES = $(common_sources) MessageQMulti.c
+MessageQMulti_omapl138_SOURCES = $(common_sources) MessageQMulti.c
+MessageQMulti_tci6614_SOURCES = $(common_sources) MessageQMulti.c
+MessageQMulti_tci6638_SOURCES = $(common_sources) MessageQMulti.c
+
+# list of sources for the 'NameServerApp' binary
+NameServerApp_omap4430_SOURCES = $(nameServer_common_sources)
+NameServerApp_omapl138_SOURCES = $(nameServer_common_sources)
+NameServerApp_tci6614_SOURCES = $(nameServer_common_sources)
+NameServerApp_tci6638_SOURCES = $(nameServer_common_sources)
+
+# list of sources for the 'nano_test' binary
+nano_test_omapl138_SOURCES = $(common_sources) nano_test.c
+common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
+                $(top_builddir)/linux/src/utils/libtiipcutils.la
+
+
+# the additional libraries needed to link MessageQApp
+MessageQApp_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+
+MessageQApp_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+
+MessageQApp_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+
+MessageQApp_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+
+# the additional libraries needed to link MessageQBench
+MessageQBench_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la -lrt $(AM_LDFLAGS)
+
+MessageQBench_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la -lrt $(AM_LDFLAGS)
+
+MessageQBench_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la -lrt $(AM_LDFLAGS)
+
+MessageQBench_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la -lrt $(AM_LDFLAGS)
+
+
+# the additional libraries needed to link MessageQMulti
+MessageQMulti_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+
+MessageQMulti_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+
+MessageQMulti_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+
+MessageQMulti_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+
+# the additional libraries needed to link NameServerApp
+NameServerApp_omap4430_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omap4430.la $(AM_LDFLAGS)
+
+NameServerApp_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la $(AM_LDFLAGS)
+
+NameServerApp_tci6614_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6614.la $(AM_LDFLAGS)
+
+NameServerApp_tci6638_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la $(AM_LDFLAGS)
+
+
+# the additional libraries needed to link nano_test
+nano_test_omapl138_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/family/libtiipccfg_omapl138.la \
+                $(CMEM_INSTALL_DIR)/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV \
+                $(AM_LDFLAGS)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  linux/src/tests/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  linux/src/tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+MessageQApp_omap4430$(EXEEXT): $(MessageQApp_omap4430_OBJECTS) $(MessageQApp_omap4430_DEPENDENCIES) 
+       @rm -f MessageQApp_omap4430$(EXEEXT)
+       $(LINK) $(MessageQApp_omap4430_LDFLAGS) $(MessageQApp_omap4430_OBJECTS) $(MessageQApp_omap4430_LDADD) $(LIBS)
+MessageQApp_omapl138$(EXEEXT): $(MessageQApp_omapl138_OBJECTS) $(MessageQApp_omapl138_DEPENDENCIES) 
+       @rm -f MessageQApp_omapl138$(EXEEXT)
+       $(LINK) $(MessageQApp_omapl138_LDFLAGS) $(MessageQApp_omapl138_OBJECTS) $(MessageQApp_omapl138_LDADD) $(LIBS)
+MessageQApp_tci6614$(EXEEXT): $(MessageQApp_tci6614_OBJECTS) $(MessageQApp_tci6614_DEPENDENCIES) 
+       @rm -f MessageQApp_tci6614$(EXEEXT)
+       $(LINK) $(MessageQApp_tci6614_LDFLAGS) $(MessageQApp_tci6614_OBJECTS) $(MessageQApp_tci6614_LDADD) $(LIBS)
+MessageQApp_tci6638$(EXEEXT): $(MessageQApp_tci6638_OBJECTS) $(MessageQApp_tci6638_DEPENDENCIES) 
+       @rm -f MessageQApp_tci6638$(EXEEXT)
+       $(LINK) $(MessageQApp_tci6638_LDFLAGS) $(MessageQApp_tci6638_OBJECTS) $(MessageQApp_tci6638_LDADD) $(LIBS)
+MessageQBench_omap4430$(EXEEXT): $(MessageQBench_omap4430_OBJECTS) $(MessageQBench_omap4430_DEPENDENCIES) 
+       @rm -f MessageQBench_omap4430$(EXEEXT)
+       $(LINK) $(MessageQBench_omap4430_LDFLAGS) $(MessageQBench_omap4430_OBJECTS) $(MessageQBench_omap4430_LDADD) $(LIBS)
+MessageQBench_omapl138$(EXEEXT): $(MessageQBench_omapl138_OBJECTS) $(MessageQBench_omapl138_DEPENDENCIES) 
+       @rm -f MessageQBench_omapl138$(EXEEXT)
+       $(LINK) $(MessageQBench_omapl138_LDFLAGS) $(MessageQBench_omapl138_OBJECTS) $(MessageQBench_omapl138_LDADD) $(LIBS)
+MessageQBench_tci6614$(EXEEXT): $(MessageQBench_tci6614_OBJECTS) $(MessageQBench_tci6614_DEPENDENCIES) 
+       @rm -f MessageQBench_tci6614$(EXEEXT)
+       $(LINK) $(MessageQBench_tci6614_LDFLAGS) $(MessageQBench_tci6614_OBJECTS) $(MessageQBench_tci6614_LDADD) $(LIBS)
+MessageQBench_tci6638$(EXEEXT): $(MessageQBench_tci6638_OBJECTS) $(MessageQBench_tci6638_DEPENDENCIES) 
+       @rm -f MessageQBench_tci6638$(EXEEXT)
+       $(LINK) $(MessageQBench_tci6638_LDFLAGS) $(MessageQBench_tci6638_OBJECTS) $(MessageQBench_tci6638_LDADD) $(LIBS)
+MessageQMulti_omap4430$(EXEEXT): $(MessageQMulti_omap4430_OBJECTS) $(MessageQMulti_omap4430_DEPENDENCIES) 
+       @rm -f MessageQMulti_omap4430$(EXEEXT)
+       $(LINK) $(MessageQMulti_omap4430_LDFLAGS) $(MessageQMulti_omap4430_OBJECTS) $(MessageQMulti_omap4430_LDADD) $(LIBS)
+MessageQMulti_omapl138$(EXEEXT): $(MessageQMulti_omapl138_OBJECTS) $(MessageQMulti_omapl138_DEPENDENCIES) 
+       @rm -f MessageQMulti_omapl138$(EXEEXT)
+       $(LINK) $(MessageQMulti_omapl138_LDFLAGS) $(MessageQMulti_omapl138_OBJECTS) $(MessageQMulti_omapl138_LDADD) $(LIBS)
+MessageQMulti_tci6614$(EXEEXT): $(MessageQMulti_tci6614_OBJECTS) $(MessageQMulti_tci6614_DEPENDENCIES) 
+       @rm -f MessageQMulti_tci6614$(EXEEXT)
+       $(LINK) $(MessageQMulti_tci6614_LDFLAGS) $(MessageQMulti_tci6614_OBJECTS) $(MessageQMulti_tci6614_LDADD) $(LIBS)
+MessageQMulti_tci6638$(EXEEXT): $(MessageQMulti_tci6638_OBJECTS) $(MessageQMulti_tci6638_DEPENDENCIES) 
+       @rm -f MessageQMulti_tci6638$(EXEEXT)
+       $(LINK) $(MessageQMulti_tci6638_LDFLAGS) $(MessageQMulti_tci6638_OBJECTS) $(MessageQMulti_tci6638_LDADD) $(LIBS)
+NameServerApp_omap4430$(EXEEXT): $(NameServerApp_omap4430_OBJECTS) $(NameServerApp_omap4430_DEPENDENCIES) 
+       @rm -f NameServerApp_omap4430$(EXEEXT)
+       $(LINK) $(NameServerApp_omap4430_LDFLAGS) $(NameServerApp_omap4430_OBJECTS) $(NameServerApp_omap4430_LDADD) $(LIBS)
+NameServerApp_omapl138$(EXEEXT): $(NameServerApp_omapl138_OBJECTS) $(NameServerApp_omapl138_DEPENDENCIES) 
+       @rm -f NameServerApp_omapl138$(EXEEXT)
+       $(LINK) $(NameServerApp_omapl138_LDFLAGS) $(NameServerApp_omapl138_OBJECTS) $(NameServerApp_omapl138_LDADD) $(LIBS)
+NameServerApp_tci6614$(EXEEXT): $(NameServerApp_tci6614_OBJECTS) $(NameServerApp_tci6614_DEPENDENCIES) 
+       @rm -f NameServerApp_tci6614$(EXEEXT)
+       $(LINK) $(NameServerApp_tci6614_LDFLAGS) $(NameServerApp_tci6614_OBJECTS) $(NameServerApp_tci6614_LDADD) $(LIBS)
+NameServerApp_tci6638$(EXEEXT): $(NameServerApp_tci6638_OBJECTS) $(NameServerApp_tci6638_DEPENDENCIES) 
+       @rm -f NameServerApp_tci6638$(EXEEXT)
+       $(LINK) $(NameServerApp_tci6638_LDFLAGS) $(NameServerApp_tci6638_OBJECTS) $(NameServerApp_tci6638_LDADD) $(LIBS)
+nano_test_omapl138$(EXEEXT): $(nano_test_omapl138_OBJECTS) $(nano_test_omapl138_DEPENDENCIES) 
+       @rm -f nano_test_omapl138$(EXEEXT)
+       $(LINK) $(nano_test_omapl138_LDFLAGS) $(nano_test_omapl138_OBJECTS) $(nano_test_omapl138_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQApp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQBench.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQMulti.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NameServerApp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nano_test.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+       clean-generic clean-libtool ctags distclean distclean-compile \
+       distclean-generic distclean-libtool distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-binPROGRAMS uninstall-info-am
+
+
+###############################################################################
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/linux/src/tests/MessageQApp.c b/linux/src/tests/MessageQApp.c
new file mode 100644 (file)
index 0000000..81639d6
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   MessageQApp.c
+ *
+ *  @brief  Sample application for MessageQ module between MPU and Remote Proc
+ *
+ *  ============================================================================
+ */
+
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* SysLink/IPC Headers: */
+#include <Std.h>
+#include <SysLink.h>
+#include <ti/ipc/MessageQ.h>
+
+/* App defines:  Must match on remote proc side: */
+#define HEAPID              0u
+#define SLAVE_MESSAGEQNAME  "SLAVE"
+#define MPU_MESSAGEQNAME    "HOST"
+
+#define PROC_ID_DFLT        1     /* Host is zero, remote cores start at 1 */
+#define NUM_LOOPS_DFLT   100
+
+typedef struct SyncMsg {
+    MessageQ_MsgHeader header;
+    unsigned long numLoops;
+    unsigned long print;
+} SyncMsg ;
+
+Int MessageQApp_execute(UInt32 numLoops, UInt16 procId)
+{
+    Int32                    status = 0;
+    MessageQ_Msg             msg = NULL;
+    MessageQ_Params          msgParams;
+    UInt16                   i;
+    MessageQ_QueueId         queueId = MessageQ_INVALIDMESSAGEQ;
+    MessageQ_Handle          msgqHandle;
+    char                     remoteQueueName[64];
+
+    printf("Entered MessageQApp_execute\n");
+
+    /* Create the local Message Queue for receiving. */
+    MessageQ_Params_init(&msgParams);
+    msgqHandle = MessageQ_create(MPU_MESSAGEQNAME, &msgParams);
+    if (msgqHandle == NULL) {
+        printf("Error in MessageQ_create\n");
+        goto exit;
+    }
+    else {
+        printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+    }
+
+    sprintf(remoteQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
+             MultiProc_getName(procId));
+
+    /* Poll until remote side has it's messageQ created before we send: */
+    do {
+        status = MessageQ_open(remoteQueueName, &queueId);
+        sleep (1);
+    } while (status == MessageQ_E_NOTFOUND);
+
+    if (status < 0) {
+        printf("Error in MessageQ_open [%d]\n", status);
+        goto cleanup;
+    }
+    else {
+        printf("Remote queueId  [0x%x]\n", queueId);
+    }
+
+    msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg));
+    if (msg == NULL) {
+        printf("Error in MessageQ_alloc\n");
+        MessageQ_close(&queueId);
+        goto cleanup;
+    }
+
+    /* handshake with remote to set the number of loops */
+    MessageQ_setReplyQueue(msgqHandle, msg);
+    ((SyncMsg *)msg)->numLoops = numLoops;
+    ((SyncMsg *)msg)->print = TRUE;
+    MessageQ_put(queueId, msg);
+    MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+
+    printf("Exchanging %d messages with remote processor %s...\n",
+           numLoops, MultiProc_getName(procId));
+
+    for (i = 0 ; i < numLoops; i++) {
+        MessageQ_setMsgId(msg, i);
+
+        /* Have the remote proc reply to this message queue */
+        MessageQ_setReplyQueue(msgqHandle, msg);
+
+        status = MessageQ_put(queueId, msg);
+        if (status < 0) {
+            printf("Error in MessageQ_put [%d]\n", status);
+            break;
+        }
+
+        status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+        if (status < 0) {
+            printf("Error in MessageQ_get [%d]\n", status);
+            break;
+        }
+        else {
+            printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
+
+            /* Validate the returned message. */
+            if ((msg != NULL) && (MessageQ_getMsgId (msg) != i)) {
+                printf("Data integrity failure!\n"
+                        "    Expected %d\n"
+                        "    Received %d\n",
+                        i, MessageQ_getMsgId(msg));
+                break;
+            }
+        }
+
+        printf("Exchanged %d messages with remote processor %s\n",
+            (i+1), MultiProc_getName(procId));
+    }
+
+    if (status >= 0) {
+       printf("Sample application successfully completed!\n");
+    }
+
+    MessageQ_free(msg);
+    MessageQ_close(&queueId);
+
+cleanup:
+    /* Clean-up */
+    status = MessageQ_delete(&msgqHandle);
+    if (status < 0) {
+        printf("Error in MessageQ_delete [%d]\n", status);
+    }
+
+exit:
+    printf("Leaving MessageQApp_execute\n\n");
+
+    return (status);
+}
+
+int main (int argc, char ** argv)
+{
+    Int32 status = 0;
+    UInt32 numLoops = NUM_LOOPS_DFLT;
+    UInt16 procId = PROC_ID_DFLT;
+
+    /* Parse Args: */
+    switch (argc) {
+        case 1:
+           /* use defaults */
+           break;
+        case 2:
+           numLoops   = atoi(argv[1]);
+           break;
+        case 3:
+           numLoops   = atoi(argv[1]);
+           procId     = atoi(argv[2]);
+           break;
+        default:
+           printf("Usage: %s [<numLoops>] [<ProcId>]\n", argv[0]);
+           printf("\tDefaults: numLoops: %d; ProcId: %d\n",
+                   NUM_LOOPS_DFLT, PROC_ID_DFLT);
+           exit(0);
+    }
+    if (procId >= MultiProc_getNumProcessors()) {
+        printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
+        exit(0);
+    }
+    printf("Using numLoops: %d; procId : %d\n", numLoops, procId);
+
+    status = SysLink_setup();
+
+    if (status >= 0) {
+        MessageQApp_execute(numLoops, procId);
+        SysLink_destroy();
+    }
+    else {
+        printf("SysLink_setup failed: status = %d\n", status);
+    }
+
+    return(0);
+}
diff --git a/linux/src/tests/MessageQBench.c b/linux/src/tests/MessageQBench.c
new file mode 100644 (file)
index 0000000..2c6ac8e
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   MessageQBench.c
+ *
+ *  @brief  Benchmark application for MessageQ module between MPU/Remote Proc
+ *
+ *  ============================================================================
+ */
+
+/*
+ * opkg --tmp-dir ~/tmp install util-linux-ng
+ * chrt -f ./MessageQBench
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/param.h>
+
+#include <Std.h>
+#include <SysLink.h>
+#include <ti/ipc/MessageQ.h>
+
+#define MessageQ_payload(m) ((void *)((char *)(m) + sizeof(MessageQ_MsgHeader)))
+#define MINPAYLOADSIZE      (2 * sizeof(UInt32))
+
+/* App defines: Must match on remote proc side: */
+#define NUM_LOOPS_DFLT           1000  /* Number of transfers to be tested. */
+#define HEAPID              0u
+#define PROC_ID_DFLT        1     /* Host is zero, remote cores start at 1 */
+#define SLAVE_MESSAGEQNAME  "SLAVE"
+#define MPU_MESSAGEQNAME    "HOST"
+
+
+long diff(struct timespec start, struct timespec end)
+{
+    struct timespec temp;
+
+    if ((end.tv_nsec - start.tv_nsec) < 0) {
+        temp.tv_sec = end.tv_sec - start.tv_sec-1;
+        temp.tv_nsec = 1000000000UL + end.tv_nsec - start.tv_nsec;
+    } else {
+        temp.tv_sec = end.tv_sec - start.tv_sec;
+        temp.tv_nsec = end.tv_nsec - start.tv_nsec;
+    }
+
+    return (temp.tv_sec * 1000000UL + temp.tv_nsec / 1000);
+}
+
+Int MessageQApp_execute(UInt32 numLoops, UInt32 payloadSize, UInt16 procId)
+{
+    Int32                    status     = 0;
+    MessageQ_Msg             msg        = NULL;
+    MessageQ_Params          msgParams;
+    UInt16                   i;
+    MessageQ_QueueId         queueId = MessageQ_INVALIDMESSAGEQ;
+    MessageQ_Handle          msgqHandle;
+    char                     remoteQueueName[64];
+    struct timespec          start, end;
+    long                     elapsed;
+    UInt32 *params;
+
+    printf ("Entered MessageQApp_execute\n");
+
+    /* Create the local Message Queue for receiving. */
+    MessageQ_Params_init(&msgParams);
+    msgqHandle = MessageQ_create(MPU_MESSAGEQNAME, &msgParams);
+    if (msgqHandle == NULL) {
+        printf ("Error in MessageQ_create\n");
+        goto exit;
+    }
+    else {
+        printf ("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+    }
+
+    sprintf(remoteQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
+             MultiProc_getName(procId));
+
+    /* Poll until remote side has its messageQ created before we send: */
+    do {
+        status = MessageQ_open(remoteQueueName, &queueId);
+        sleep (1);
+    } while (status == MessageQ_E_NOTFOUND);
+
+    if (status < 0) {
+        printf("Error in MessageQ_open [%d]\n", status);
+        goto cleanup;
+    }
+
+    printf("Remote queueId  [0x%x]\n", queueId);
+
+    msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader) + payloadSize);
+    if (msg == NULL) {
+        printf("Error in MessageQ_alloc\n");
+        MessageQ_close(&queueId);
+        goto cleanup;
+    }
+
+    /* handshake with remote to set the number of loops */
+    MessageQ_setReplyQueue(msgqHandle, msg);
+    params = MessageQ_payload(msg);
+    params[0] = numLoops;
+    params[1] = FALSE;
+    MessageQ_put(queueId, msg);
+    MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+
+    printf("Exchanging %d messages with remote processor %s...\n",
+           numLoops, MultiProc_getName(procId));
+
+    clock_gettime(CLOCK_REALTIME, &start);
+
+    for (i = 0; i < numLoops; i++) {
+        MessageQ_setMsgId(msg, i);
+
+        /* Have the remote proc reply to this message queue */
+        MessageQ_setReplyQueue(msgqHandle, msg);
+
+        status = MessageQ_put(queueId, msg);
+        if (status < 0) {
+            printf("Error in MessageQ_put [%d]\n", status);
+            break;
+        }
+
+        status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+        if (status < 0) {
+            printf("Error in MessageQ_get [%d]\n", status);
+            break;
+        }
+        else {
+            /* Validate the returned message. */
+            if ((msg != NULL) && (MessageQ_getMsgId(msg) != i)) {
+                printf ("Data integrity failure!\n"
+                        "    Expected %d\n"
+                        "    Received %d\n",
+                        i, MessageQ_getMsgId (msg));
+                break;
+            }
+        }
+    }
+
+    clock_gettime(CLOCK_REALTIME, &end);
+    elapsed = diff(start, end);
+
+    if (numLoops > 0) {
+        printf("%s: Avg round trip time: %ld usecs\n",
+               MultiProc_getName(procId), elapsed / numLoops);
+    }
+
+    MessageQ_free(msg);
+    MessageQ_close(&queueId);
+
+cleanup:
+    status = MessageQ_delete(&msgqHandle);
+    if (status < 0) {
+        printf ("Error in MessageQ_delete [%d]\n", status);
+    }
+
+exit:
+    printf("Leaving MessageQApp_execute\n\n");
+
+    return (status);
+}
+
+int main (int argc, char * argv[])
+{
+    Int32 status = 0;
+    UInt32 numLoops = NUM_LOOPS_DFLT;
+    UInt32 payloadSize = MINPAYLOADSIZE;
+    UInt16 procId = PROC_ID_DFLT;
+
+    /* Parse args: */
+    if (argc > 1) {
+        numLoops = strtoul(argv[1], NULL, 0);
+    }
+
+    if (argc > 2) {
+        payloadSize = MAX(strtoul(argv[2], NULL, 0), MINPAYLOADSIZE);
+    }
+
+    if (argc > 3) {
+        procId  = atoi(argv[3]);
+    }
+
+    if (argc > 4) {
+        printf("Usage: %s [<numLoops>] [<payloadSize>] [<ProcId>]\n", argv[0]);
+        printf("\tDefaults: numLoops: %d; payloadSize: %d, ProcId: %d\n",
+                   NUM_LOOPS_DFLT, MINPAYLOADSIZE, PROC_ID_DFLT);
+        exit(0);
+    }
+    if (procId >= MultiProc_getNumProcessors()) {
+        printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
+        exit(0);
+    }
+    printf("Using numLoops: %d; payloadSize: %d, procId : %d\n",
+            numLoops, payloadSize, procId);
+
+    status = SysLink_setup();
+
+    if (status >= 0) {
+        MessageQApp_execute(numLoops, payloadSize, procId);
+        SysLink_destroy();
+    }
+    else {
+        fprintf(stderr, "SysLink_setup failed: status = %d\n", status);
+    }
+
+    return (status);
+}
diff --git a/linux/src/tests/MessageQMulti.c b/linux/src/tests/MessageQMulti.c
new file mode 100644 (file)
index 0000000..475b3cf
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   MessageQApp.c
+ *
+ *  @brief  Sample application for MessageQ module between MPU and Remote Proc
+ *
+ *  ============================================================================
+ */
+
+/* Standard headers */
+#include <pthread.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* SysLink/IPC Headers: */
+#include <Std.h>
+#include <SysLink.h>
+#include <ti/ipc/MessageQ.h>
+
+/* App defines: Must match on remote proc side: */
+#define MSGSIZE                     64u
+#define HEAPID                      0u
+#define SLAVE_MESSAGEQNAME          "SLAVE"
+#define HOST_MESSAGEQNAME           "HOST"
+
+/** ============================================================================
+ *  Macros and types
+ *  ============================================================================
+ */
+
+#define  NUM_LOOPS_DFLT   1000
+#define  NUM_THREADS_DFLT 10
+#define  MAX_NUM_THREADS  50
+#define  ONE_PROCESS_ONLY (-1)
+
+/** ============================================================================
+ *  Globals
+ *  ============================================================================
+ */
+static Int     numLoops, numThreads, procNum;
+
+struct thread_info {    /* Used as argument to thread_start() */
+    pthread_t thread_id;        /* ID returned by pthread_create() */
+    int       thread_num;       /* Application-defined thread # */
+};
+
+static void * pingThreadFxn(void *arg);
+
+/** ============================================================================
+ *  Functions
+ *  ============================================================================
+ */
+
+static Void * pingThreadFxn(void *arg)
+{
+    Int                      threadNum = *(int *)arg;
+    Int32                    status     = 0;
+    MessageQ_Msg             msg        = NULL;
+    MessageQ_Params          msgParams;
+    UInt16                   i;
+    MessageQ_Handle          handle;
+    MessageQ_QueueId         queueId = MessageQ_INVALIDMESSAGEQ;
+
+    char             remoteQueueName[64];
+    char             hostQueueName[64];
+
+    printf ("Entered pingThreadFxn: %d\n", threadNum);
+
+    sprintf(remoteQueueName, "%s_%d", SLAVE_MESSAGEQNAME, threadNum );
+    sprintf(hostQueueName,   "%s_%d", HOST_MESSAGEQNAME,  threadNum );
+
+    /* Create the local Message Queue for receiving. */
+    MessageQ_Params_init (&msgParams);
+    handle = MessageQ_create (hostQueueName, &msgParams);
+    if (handle == NULL) {
+        printf ("Error in MessageQ_create\n");
+        goto exit;
+    }
+    else {
+        printf ("thread: %d, Local Message: %s, QId: 0x%x\n",
+            threadNum, hostQueueName, MessageQ_getQueueId(handle));
+    }
+
+    /* Poll until remote side has it's messageQ created before we send: */
+    do {
+        status = MessageQ_open (remoteQueueName, &queueId);
+        sleep (1);
+    } while (status == MessageQ_E_NOTFOUND);
+    if (status < 0) {
+        printf ("Error in MessageQ_open [0x%x]\n", status);
+        goto cleanup;
+    }
+    else {
+        printf ("thread: %d, Remote queue: %s, QId: 0x%x\n",
+                 threadNum, remoteQueueName, queueId);
+    }
+
+    printf ("\nthread: %d: Exchanging messages with remote processor...\n",
+            threadNum);
+    for (i = 0 ; i < numLoops ; i++) {
+        /* Allocate message. */
+        msg = MessageQ_alloc (HEAPID, MSGSIZE);
+        if (msg == NULL) {
+            printf ("Error in MessageQ_alloc\n");
+            break;
+        }
+
+        MessageQ_setMsgId (msg, i);
+
+        /* Have the remote proc reply to this message queue */
+        MessageQ_setReplyQueue (handle, msg);
+
+        status = MessageQ_put (queueId, msg);
+        if (status < 0) {
+            printf ("Error in MessageQ_put [0x%x]\n", status);
+            break;
+        }
+
+        status = MessageQ_get(handle, &msg, MessageQ_FOREVER);
+        if (status < 0) {
+            printf ("Error in MessageQ_get [0x%x]\n", status);
+            break;
+        }
+        else {
+            /* Validate the returned message. */
+            if ((msg != NULL) && (MessageQ_getMsgId (msg) != i)) {
+                printf ("Data integrity failure!\n"
+                        "    Expected %d\n"
+                        "    Received %d\n",
+                        i, MessageQ_getMsgId (msg));
+                break;
+            }
+
+            status = MessageQ_free (msg);
+        }
+
+        printf ("thread: %d: Exchanged %d msgs\n", threadNum, (i+1));
+    }
+
+    printf ("thread: %d: pingThreadFxn successfully completed!\n", threadNum);
+
+    MessageQ_close (&queueId);
+
+cleanup:
+    /* Clean-up */
+    status = MessageQ_delete (&handle);
+    if (status < 0) {
+        printf ("Error in MessageQ_delete [0x%x]\n", status);
+    }
+
+exit:
+
+    return ((void *)status);
+}
+
+int main (int argc, char ** argv)
+{
+    struct thread_info threads[MAX_NUM_THREADS];
+    int ret,i;
+    void *res;
+    Int32   status = 0;
+
+    /* Parse Args: */
+    numLoops = NUM_LOOPS_DFLT;
+    numThreads = NUM_THREADS_DFLT;
+    procNum = ONE_PROCESS_ONLY;
+    switch (argc) {
+        case 1:
+           /* use defaults */
+           break;
+        case 2:
+           numThreads = atoi(argv[1]);
+           break;
+        case 3:
+           numThreads = atoi(argv[1]);
+           numLoops   = atoi(argv[2]);
+           break;
+        case 4:
+           /* We force numThreads = 1 if doing a multiProcess test: */
+           numThreads = 1;
+           numLoops   = atoi(argv[2]);
+           procNum = atoi(argv[3]);
+           break;
+        default:
+           printf("Usage: %s [<numThreads>] [<numLoops>] [<Process #]>\n",
+                   argv[0]);
+           printf("\tDefaults: numThreads: 10, numLoops: 100\n");
+           printf("\tMax Threads: 100\n");
+           exit(0);
+    }
+    printf("Using numThreads: %d, numLoops: %d\n", numThreads, numLoops);
+    if (procNum != ONE_PROCESS_ONLY) {
+        printf("ProcNum: %d\n", procNum);
+    }
+
+    status = SysLink_setup();
+    if (status < 0) {
+        printf ("SysLink_setup failed: status = 0x%x\n", status);
+        goto exit;
+    }
+
+    /* Launch multiple threads: */
+    for (i = 0; i < numThreads; i++) {
+        /* Create the test thread: */
+        printf ("creating pingThreadFxn: %d\n", i);
+        threads[i].thread_num = (procNum == ONE_PROCESS_ONLY)? i: procNum;
+        ret = pthread_create(&threads[i].thread_id, NULL, &pingThreadFxn,
+                           &(threads[i].thread_num));
+        if (ret) {
+            printf("MessageQMulti: can't spawn thread: %d, %s\n",
+                    i, strerror(ret));
+        }
+    }
+
+    /* Join all threads: */
+    for (i = 0; i < numThreads; i++) {
+        ret = pthread_join(threads[i].thread_id, &res);
+        if (ret != 0) {
+            printf("MessageQMulti: failed to join thread: %d, %s\n",
+                    i, strerror(ret));
+        }
+        printf("MessageQMulti: Joined with thread %d; returned value was %s\n",
+                threads[i].thread_num, (char *) res);
+        free(res);      /* Free memory allocated by thread */
+    }
+
+    SysLink_destroy();
+
+exit:
+
+    return (0);
+}
diff --git a/linux/src/tests/NameServerApp.c b/linux/src/tests/NameServerApp.c
new file mode 100644 (file)
index 0000000..88220a5
--- /dev/null
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   NameServerApp.c
+ *
+ *  @brief  Sample application for NameServer module between MPU and Remote Proc
+ *
+ *  ============================================================================
+ */
+
+#define USE_NSD
+
+/* Standard headers */
+#include <stdio.h>
+
+/* SysLink Standard Header: */
+#include <Std.h>
+
+#include <_NameServer.h>
+#ifdef USE_NSD
+#include <ladclient.h>
+#endif
+
+/* Module level headers */
+#include <ti/ipc/NameServer.h>
+
+
+/** ============================================================================
+ *  Macros and types
+ *  ============================================================================
+ */
+#define NSNAME "MessageQ"
+#define NSNAME2 "MessageQ2"
+
+/** ============================================================================
+ *  Globals
+ *  ============================================================================
+ */
+
+Int testNS(NameServer_Handle nsHandle, String name)
+{
+    Int32 status = 0;
+    Ptr ptr;
+    UInt32 val;
+    char key[16];
+    Int i;
+
+    ptr = NameServer_addUInt32(nsHandle, name, 0xdeadbeef);
+    if (ptr == NULL) {
+        printf("Failed to NameServer_addUInt32()\n");
+        return -1;
+    }
+    else {
+        printf("NameServer_addUInt32() returned %p\n", ptr);
+    }
+
+    printf("Trying to add same key (should fail)...\n");
+    ptr = NameServer_addUInt32(nsHandle, name, 0xdeadc0de);
+    if (ptr == NULL) {
+        printf("    ...got expected Failure from NameServer_addUInt32()\n");
+    }
+    else {
+        printf("    Error: NameServer_addUInt32() returned non-NULL %p (but was expected to fail)\n", ptr);
+        return -1;
+    }
+
+    val = 0x00c0ffee;
+    status = NameServer_getUInt32(nsHandle, name, &val, NULL);
+    printf("NameServer_getUInt32() returned %d, val=0x%x (was 0x00c0ffee)\n", status, val);
+
+    printf("Removing 0xdeadbeef w/ NameServer_remove()...\n");
+    status = NameServer_remove(nsHandle, name);
+    if (status < 0) {
+        printf("NameServer_remove() failed: %d\n", status);
+        return -1;
+    }
+
+    ptr = NameServer_addUInt32(nsHandle, name, 0xdeadc0de);
+    if (ptr == NULL) {
+        printf("Error: NameServer_addUInt32() failed\n");
+        return -1;
+    }
+    else {
+        printf("NameServer_addUInt32(0xdeadc0de) succeeded\n");
+    }
+
+    val = 0x00c0ffee;
+    status = NameServer_getUInt32(nsHandle, name, &val, NULL);
+    printf("NameServer_getUInt32() returned %d, val=0x%x (was 0x00c0ffee)\n", status, val);
+
+    printf("Removing 0xdeadc0de w/ NameServer_removeEntry()...\n");
+    status = NameServer_removeEntry(nsHandle, ptr);
+    if (status < 0) {
+        printf("NameServer_remove() failed: %d\n", status);
+        return -1;
+    }
+
+    ptr = NameServer_addUInt32(nsHandle, name, 0x0badc0de);
+    if (ptr == NULL) {
+        printf("Error: NameServer_addUInt32() failed\n");
+        return -1;
+    }
+    else {
+        printf("NameServer_addUInt32(0x0badc0de) succeeded\n");
+    }
+
+    val = 0x00c0ffee;
+    status = NameServer_getUInt32(nsHandle, name, &val, NULL);
+    printf("NameServer_getUInt32() returned %d, val=0x%x (was 0x00c0ffee)\n", status, val);
+
+    status = NameServer_remove(nsHandle, name);
+    if (status < 0) {
+        printf("Error: NameServer_remove() failed\n");
+        return -1;
+    }
+    else {
+        printf("NameServer_remove(%s) succeeded\n", name);
+    }
+
+    for (i = 0; i < 10; i++) {
+        sprintf(key, "foobar%d", i);
+
+        ptr = NameServer_addUInt32(nsHandle, key, 0x0badc0de + i);
+        if (ptr == NULL) {
+            printf("Error: NameServer_addUInt32() failed\n");
+            return -1;
+        }
+        else {
+            printf("NameServer_addUInt32(%s, 0x%x) succeeded\n", key, 0x0badc0de + i);
+        }
+
+        val = 0x00c0ffee;
+        status = NameServer_getUInt32(nsHandle, key, &val, NULL);
+        printf("NameServer_getUInt32(%s) returned %d, val=0x%x (was 0x00c0ffee)\n", key, status, val);
+
+        if (val != (0x0badc0de + i)) {
+            printf("get val (0x%x) != add val (0x%x)!\n", val, 0x0badc0de + i);
+        }
+    }
+
+    for (i = 0; i < 10; i++) {
+        sprintf(key, "foobar%d", i);
+
+        status = NameServer_remove(nsHandle, key);
+        if (status < 0) {
+            printf("Error: NameServer_remove() failed\n");
+            return -1;
+        }
+        else {
+            printf("NameServer_remove(%s) succeeded\n", key);
+        }
+    }
+
+    return 0;
+}
+
+/** ============================================================================
+ *  Functions
+ *  ============================================================================
+ */
+Int
+NameServerApp_startup()
+{
+    Int32 status = 0;
+    NameServer_Params params;
+    NameServer_Handle nsHandle;
+    NameServer_Handle nsHandle2;
+    Int iteration = 0;
+#ifdef USE_NSD
+    LAD_ClientHandle ladHandle;
+    LAD_Status ladStatus;
+#endif
+
+    printf ("Entered NameServerApp_startup\n");
+
+#ifdef USE_NSD
+    ladStatus = LAD_connect(&ladHandle);
+    if (ladStatus != LAD_SUCCESS) {
+        printf("LAD_connect() failed: %d\n", ladStatus);
+        return -1;
+    }
+    else {
+        printf("LAD_connect() succeeded: ladHandle=%d\n", ladHandle);
+    }
+#endif
+
+    printf("Calling NameServer_setup()...\n");
+    NameServer_setup();
+
+again:
+    NameServer_Params_init(&params);
+    printf("params.maxValueLen=%d\n", params.maxValueLen);
+    printf("params.maxNameLen=%d\n", params.maxNameLen);
+    printf("params.checkExisting=%d\n", params.checkExisting);
+
+    params.maxValueLen = sizeof(UInt32);
+    params.maxNameLen = 32;
+    nsHandle = NameServer_create(NSNAME, &params);
+    if (nsHandle == NULL) {
+        printf("Failed to create NameServer '%s'\n", NSNAME);
+        return -1;
+    }
+    else {
+        printf("Created NameServer '%s'\n", NSNAME);
+    }
+
+    NameServer_Params_init(&params);
+
+    params.maxValueLen = sizeof(UInt32);
+    params.maxNameLen = 32;
+    nsHandle2 = NameServer_create(NSNAME2, &params);
+    if (nsHandle2 == NULL) {
+        printf("Failed to create NameServer '%s'\n", NSNAME2);
+        return -1;
+    }
+    else {
+        printf("Created NameServer '%s'\n", NSNAME2);
+    }
+
+    status = testNS(nsHandle, "Key");
+    status = testNS(nsHandle2, "Key");
+
+    printf("Deleting nsHandle and nsHandle2...\n");
+    NameServer_delete(&nsHandle);
+    NameServer_delete(&nsHandle2);
+
+    iteration++;
+    if (iteration < 2) {
+        goto again;
+    }
+
+    printf("Calling NameServer_destroy()...\n");
+    NameServer_destroy();
+
+#ifdef USE_NSD
+    ladStatus = LAD_disconnect(ladHandle);
+    if (ladStatus != LAD_SUCCESS) {
+        printf("LAD_disconnect() failed: %d\n", ladStatus);
+        return -1;
+    }
+    else {
+        printf("LAD_disconnect() succeeded\n");
+    }
+#endif
+
+    printf ("Leaving NameServerApp_startup: status = 0x%x\n", status);
+
+    return status;
+}
+
+
+Int
+NameServerApp_execute()
+{
+    Int32 status = 0;
+
+    printf ("Entered NameServerApp_execute\n");
+
+    printf ("Leaving NameServerApp_execute\n\n");
+
+    return status;
+}
+
+Int
+NameServerApp_shutdown()
+{
+    Int32 status = 0;
+
+    printf ("Entered NameServerApp_shutdown()\n");
+
+    printf ("Leave NameServerApp_shutdown()\n");
+
+    return status;
+}
+
+int
+main (int argc, char ** argv)
+{
+    NameServerApp_startup();
+    NameServerApp_execute();
+    NameServerApp_shutdown();
+
+    return(0);
+}
diff --git a/linux/src/tests/multi_process.sh b/linux/src/tests/multi_process.sh
new file mode 100644 (file)
index 0000000..2f2c965
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Run MessageQMulti in parallel processes
+#
+if [ $# -ne 2 ]
+then
+    echo "Usage: multi_process <num_processes> <iterations_per_process>"
+    exit
+fi
+
+for i in `seq 0 $(( $1 - 1))`
+do
+       echo "MessageQMulti Test #" $i
+       # This calls MessageQMulti with One Thread, a process #, and
+       # number of iterations per thread.
+       MessageQMulti 1 $2 $i &
+done
diff --git a/linux/src/tests/nano_test.c b/linux/src/tests/nano_test.c
new file mode 100644 (file)
index 0000000..180a2cc
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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   nano_test.c
+ *
+ *  @brief  Customer use case test application.
+ *
+ *  Usage:  See etc/omapl138/nano_test.sh
+ *
+ *  Notes:  There is an overrun reported by arecord in the very begining of
+ *          the test.  This does not appear to be due to DSP communication,
+ *          as there are no overruns once the test gets past initialization.
+ *          One possible cause is a startup effect of using the shell
+ *          pipe command.
+ *
+ *  ============================================================================
+ */
+
+/* Standard headers */
+#include <stdio.h>
+
+/* SysLink/IPC Headers: */
+#include <Std.h>
+#include <SysLink.h>
+#include <ti/ipc/MessageQ.h>
+
+#include <ti/sdo/linuxutils/cmem/include/cmem.h>
+
+typedef struct MyMsg {
+    MessageQ_MsgHeader header;
+    unsigned long bufPhys;
+} MyMsg;
+
+#define VERBOSE 0
+
+/* App defines:  Must match on remote proc side: */
+#define NUM_SLAVE_MSGS_PER_HOST_MSG   4
+#define PAYLOADSIZE         (8192)
+
+#define MSGSIZE             (sizeof(MyMsg))
+
+#define HEAPID              0u
+#define CORE0_MESSAGEQNAME  "SLAVE"
+#define MPU_MESSAGEQNAME    "HOST"
+
+Int
+Nanotest_execute ()
+{
+    Int32                    status     = 0;
+    MessageQ_Msg             msg        = NULL;
+    MessageQ_Params          msgParams;
+    MessageQ_QueueId         queueId = MessageQ_INVALIDMESSAGEQ;
+    MessageQ_Handle          msgqHandle;
+    int                      i, j;
+    int                      ret;
+    void                     *payload;
+    unsigned long            payloadPhys;
+    CMEM_AllocParams         cmemAttrs;
+    MyMsg                    *myMsgPtr;
+
+    printf ("Entered Nanotest_execute\n");
+
+    /* Create the local Message Queue for receiving. */
+    MessageQ_Params_init (&msgParams);
+    msgqHandle = MessageQ_create (MPU_MESSAGEQNAME, &msgParams);
+    if (msgqHandle == NULL) {
+        printf ("Error in MessageQ_create\n");
+        goto exit;
+    }
+    else {
+        printf ("Local MessageQId: 0x%x\n",
+            MessageQ_getQueueId(msgqHandle));
+    }
+
+    /* Poll until remote side has it's messageQ created before we send: */
+    do {
+        status = MessageQ_open (CORE0_MESSAGEQNAME, &queueId);
+        sleep (1);
+    } while (status == MessageQ_E_NOTFOUND);
+    if (status < 0) {
+        printf ("Error in MessageQ_open [%d]\n", status);
+        goto cleanup_create;
+    }
+    else {
+        printf ("Remote queueId  [0x%x]\n", queueId);
+    }
+
+    cmemAttrs.type = CMEM_HEAP;
+    cmemAttrs.flags = CMEM_NONCACHED;
+    cmemAttrs.alignment = 0;
+    payload = CMEM_alloc(PAYLOADSIZE, &cmemAttrs);
+    if (payload == NULL) {
+        printf("CMEM_alloc() failed (returned NULL)\n");
+        goto cleanup_close;
+    }
+    payloadPhys = CMEM_getPhys(payload);
+
+    printf ("\nExchanging messages with remote processor...\n");
+    for (i = 0 ; ; i++) {
+
+        /* read a block of data from stdin */
+        ret = fread(payload, 1, PAYLOADSIZE, stdin);
+        if (ret < PAYLOADSIZE) {
+            printf ("EOS: Exiting without sending remaining %d bytes\n", ret);
+            break;
+        }
+
+        /* Allocate message. */
+        msg = MessageQ_alloc (HEAPID, MSGSIZE);
+        if (msg == NULL) {
+            printf ("Error in MessageQ_alloc\n");
+            goto cleanup_cmem;
+        }
+
+        MessageQ_setMsgId (msg, i);
+
+        /* Have the remote proc reply to this message queue */
+        MessageQ_setReplyQueue (msgqHandle, msg);
+
+        myMsgPtr = (MyMsg *)msg;
+        myMsgPtr->bufPhys = payloadPhys;
+
+        printf("Sending msgId: %d, size: %d, *msg: 0x%lx\n", i,
+               MessageQ_getMsgSize(msg), myMsgPtr->bufPhys);
+
+        status = MessageQ_put(queueId, msg);
+        if (status < 0) {
+            printf ("Error in MessageQ_put [%d]\n", status);
+            break;
+        }
+
+        for (j = 0 ; j < NUM_SLAVE_MSGS_PER_HOST_MSG; j++) {
+           status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+           if (status < 0) {
+               printf ("Error in MessageQ_get [%d]\n", status);
+               status = MessageQ_free(msg);
+               goto cleanup_close;
+           }
+           else {
+               myMsgPtr = (MyMsg *)msg;
+#if  VERBOSE
+               printf ("Received msgId: %d, size: %d, *msg: 0x%lx\n",
+                       MessageQ_getMsgId(msg), MessageQ_getMsgSize(msg),
+                       myMsgPtr->bufPhys);
+#endif
+
+               /* Validate the returned message. */
+               if ((msg != NULL) && (MessageQ_getMsgId(msg) != j)) {
+                   printf ("Data integrity failure:\n"
+                        "    Expected %d\n"
+                        "    Received %d\n",
+                        j, MessageQ_getMsgId (msg));
+                   MessageQ_free(msg);
+                   goto cleanup_close;
+               }
+               status = MessageQ_free(msg);
+               if (status < 0) {
+                   printf ("Error in MessageQ_free [%d]\n", status);
+               }
+           }
+        }
+    }
+
+    printf ("Exchanged messages: tx %d, rx %d\n",
+             i, i*NUM_SLAVE_MSGS_PER_HOST_MSG);
+    printf ("Transferred %d KB\n", (i * PAYLOADSIZE) / 1024);
+
+    if (status >= 0) {
+        printf ("Sample application successfully completed!\n");
+    }
+
+cleanup_cmem:
+    CMEM_free(payload, &cmemAttrs);
+
+cleanup_close:
+    MessageQ_close (&queueId);
+
+cleanup_create:
+    /* Clean-up */
+    status = MessageQ_delete (&msgqHandle);
+    if (status < 0) {
+        printf ("Error in MessageQ_delete [%d]\n", status);
+    }
+
+exit:
+    printf ("Leaving Nanotest_execute\n\n");
+
+    return (status);
+}
+
+int main (int argc, char ** argv)
+{
+    Int32   status = 0;
+
+    if (CMEM_init() < 0) {
+        printf("CMEM_init failed\n");
+
+        return(-1);
+    }
+
+    status = SysLink_setup();
+
+    if (status >= 0) {
+        Nanotest_execute();
+        SysLink_destroy();
+    }
+    else {
+        printf ("SysLink_setup failed: status = 0x%x\n", status);
+    }
+
+    return(0);
+}
diff --git a/linux/src/utils/LAD_client.c b/linux/src/utils/LAD_client.c
new file mode 100644 (file)
index 0000000..c8b1eb9
--- /dev/null
@@ -0,0 +1,386 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== LAD_client.c ========
+ */
+#include <Std.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+#include <pthread.h>
+
+#include <ladclient.h>
+#include <_lad.h>
+
+static Bool verbose = FALSE;
+
+typedef struct _LAD_ClientInfo {
+    Bool connectedToLAD;               /* connection status */
+    UInt PID;                                     /* client's process ID */
+    Char responseFIFOName[LAD_MAXLENGTHFIFONAME]; /* response FIFO name */
+    FILE *responseFIFOFilePtr;                    /* FIFO file pointer */
+} _LAD_ClientInfo;
+
+static Bool initialized = FALSE;
+static String commandFIFOFileName = LAD_COMMANDFIFO;
+static FILE *commandFIFOFilePtr = NULL;
+static _LAD_ClientInfo clientInfo[LAD_MAXNUMCLIENTS];
+
+static LAD_Status initWrappers(Void);
+static Bool openCommandFIFO(Void);
+// only _NP (non-portable) type available in CG tools which we're using
+static pthread_mutex_t modGate  = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+// static pthread_mutex_t modGate  = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
+
+
+/*
+ * LAD_findHandle() - finds the LAD_ClientHandle for the calling pid (process ID).
+ *
+ * Assumes that there is only one client per process, which has to be the
+ * case since the pid is used to construct the responseFIFOFileName.
+ *
+ * Multiple threads within a process can all connect since each thread gets
+ * its own pid (which might be an OS-specific thing, some OSes (even some
+ * Linux implementations) use the same process pid for every thread within
+ * a process).
+ *
+ * Returns either the found "handle", or LAD_MAXNUMCLIENTS if the handle
+ * can't be found.
+ */
+LAD_ClientHandle LAD_findHandle(Void)
+{
+    Int i;
+    Int pid;
+
+    pid = getpid();
+
+    for (i = 0; i < LAD_MAXNUMCLIENTS; i++) {
+        if (clientInfo[i].PID == pid &&
+            clientInfo[i].connectedToLAD == TRUE) {
+            break;
+        }
+    }
+
+    return i;
+}
+
+/*
+ *  ======== LAD_connect ========
+ */
+LAD_Status LAD_connect(LAD_ClientHandle * handle)
+{
+    Char responseFIFOName[LAD_MAXLENGTHFIFONAME];
+    LAD_Status status = LAD_SUCCESS;
+    time_t currentTime;
+    time_t startTime;
+    struct stat statBuf;
+    double delta;
+    Int assignedId;
+    FILE * filePtr;
+    Int n;
+    Int pid;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+
+    /* sanity check arg */
+    if (handle == NULL) {
+        return(LAD_INVALIDARG);
+    }
+
+    /* check and initialize on first connect request */
+    if (initialized == FALSE) {
+
+        /* TODO:M does this need to be atomized? */
+        status = initWrappers();
+        if (status != LAD_SUCCESS) {
+            return(status);
+        }
+        initialized = TRUE;
+    }
+
+    /* get caller's process ID */
+    pid = getpid();
+
+    /* form name for dedicated response FIFO */
+    sprintf(responseFIFOName, "%s%d", LAD_RESPONSEFIFOPATH, pid);
+
+    PRINTVERBOSE2("\nLAD_connect: PID = %d, fifoName = %s\n", pid,
+        responseFIFOName)
+
+    /* check if FIFO already exists; if yes, reject the request */
+    if (stat(responseFIFOName, &statBuf) == 0) {
+        PRINTVERBOSE0("\nLAD_connect: already connected; request denied!\n")
+        return(LAD_ACCESSDENIED);
+    }
+
+    cmd.cmd = LAD_CONNECT;
+    strcpy(cmd.args.connect.name, responseFIFOName);
+    strcpy(cmd.args.connect.protocol, LAD_PROTOCOLVERSION);
+    cmd.args.connect.pid = pid;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        return(status);
+    }
+
+    /* now open the dedicated response FIFO for this client */
+    startTime = time ((time_t *) 0);
+    while ((filePtr = fopen(responseFIFOName, "r")) == NULL) {
+        /* insert wait to yield, so LAD can process connect command sooner */
+        usleep(100);
+        currentTime = time ((time_t *) 0);
+        delta = difftime(currentTime, startTime);
+        if (delta > LAD_CONNECTTIMEOUT) {
+            pthread_mutex_unlock(&modGate);
+
+            return(LAD_IOFAILURE);
+        }
+    }
+
+    /* now get LAD's response to the connection request */
+    n = fread(&rsp, LAD_RESPONSELENGTH, 1, filePtr);
+
+    /* need to unlock mutex obtained by LAD_putCommand() */
+    pthread_mutex_unlock(&modGate);
+
+    if (n) {
+        PRINTVERBOSE0("\nLAD_connect: got response\n")
+
+        /* extract LAD's response code and the client ID */
+        status = rsp.connect.status;
+
+        /* if a successful connect ... */
+        if (status == LAD_SUCCESS) {
+            assignedId = rsp.connect.assignedId;
+            *handle = assignedId;
+
+            /* setup client info */
+            clientInfo[assignedId].PID = pid;
+            clientInfo[assignedId].responseFIFOFilePtr = filePtr;
+            strcpy(clientInfo[assignedId].responseFIFOName, responseFIFOName);
+            clientInfo[assignedId].connectedToLAD = TRUE;
+
+            PRINTVERBOSE1("    status == LAD_SUCCESS, assignedId=%d\n",
+                          assignedId);
+        }
+        else {
+            PRINTVERBOSE1("    status != LAD_SUCCESS (status=%d)\n", status);
+        }
+    }
+    else {
+        PRINTVERBOSE0(
+          "\nLAD_connect: 0 bytes read when getting LAD response!\n")
+        status = LAD_IOFAILURE;
+    }
+
+    /* if connect failed, close client side of FIFO (LAD closes its side) */
+    if (status != LAD_SUCCESS) {
+        PRINTVERBOSE0("\nLAD_connect failed: closing client-side of FIFO...\n")
+        fclose(filePtr);
+    }
+
+    return(status);
+}
+
+
+/*
+ *  ======== LAD_disconnect ========
+ */
+LAD_Status LAD_disconnect(LAD_ClientHandle handle)
+{
+    LAD_Status status = LAD_SUCCESS;
+    Bool waiting = TRUE;
+    struct stat statBuf;
+    time_t currentTime;
+    time_t startTime;
+    double delta;
+    struct LAD_CommandObj cmd;
+
+    /* sanity check args */
+    if (handle >= LAD_MAXNUMCLIENTS) {
+        return (LAD_INVALIDARG);
+    }
+
+    /* check for initialization and connection */
+    if ((initialized == FALSE) ||
+        (clientInfo[handle].connectedToLAD == FALSE)) {
+        return (LAD_NOTCONNECTED);
+    }
+
+    cmd.cmd = LAD_DISCONNECT;
+    cmd.clientId = handle;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        return(status);
+    }
+
+    /* on success, close the dedicated response FIFO */
+    fclose(clientInfo[handle].responseFIFOFilePtr);
+
+    /* need to unlock mutex obtained by LAD_putCommand() */
+    pthread_mutex_unlock(&modGate);
+
+    /* now wait for LAD to close the connection ... */
+    startTime = time ((time_t *) 0);
+    while (waiting == TRUE) {
+
+        /* do a minimal wait, to yield, so LAD can disconnect */
+        usleep(1);
+        currentTime = time ((time_t *) 0);
+
+        /* check to see if LAD has shutdown FIFO yet... */
+        if (stat(clientInfo[handle].responseFIFOName, &statBuf) != 0) {
+            waiting = FALSE;            /* yes, so done */
+        }
+        /* if not, check for timeout */
+        else {
+            delta = difftime(currentTime, startTime);
+            if (delta > LAD_DISCONNECTTIMEOUT) {
+                PRINTVERBOSE0("\nLAD_disconnect: timeout waiting for LAD!\n")
+                return(LAD_IOFAILURE);
+            }
+        }
+    }
+
+    /* reset connection status flag */
+    clientInfo[handle].connectedToLAD = FALSE;
+
+    return(status);
+}
+
+/*
+ *  ======== LAD_getResponse ========
+ */
+LAD_Status LAD_getResponse(LAD_ClientHandle handle, union LAD_ResponseObj *rsp)
+{
+    LAD_Status status = LAD_SUCCESS;
+    Int n;
+
+    PRINTVERBOSE1("LAD_getResponse: client = %d\n", handle)
+
+    n = fread(rsp, LAD_RESPONSELENGTH, 1,
+             clientInfo[handle].responseFIFOFilePtr);
+
+    pthread_mutex_unlock(&modGate);
+
+    if (n == 0) {
+        PRINTVERBOSE0("LAD_getResponse: n = 0!\n")
+        status = LAD_IOFAILURE;
+    }
+    else {
+        PRINTVERBOSE0("LAD_getResponse: got response\n")
+    }
+
+    return(status);
+}
+
+/*
+ *  ======== LAD_putCommand ========
+ */
+LAD_Status LAD_putCommand(struct LAD_CommandObj *cmd)
+{
+    LAD_Status status = LAD_SUCCESS;
+    Int stat;
+    Int n;
+
+    PRINTVERBOSE1("\nLAD_putCommand: cmd = %d\n", cmd->cmd);
+
+    pthread_mutex_lock(&modGate);
+
+    n = fwrite(cmd, LAD_COMMANDLENGTH, 1, commandFIFOFilePtr);
+
+    if (n == 0) {
+        PRINTVERBOSE0("\nLAD_putCommand: fwrite returned 0!\n")
+        status = LAD_IOFAILURE;
+    }
+    else {
+        stat = fflush(commandFIFOFilePtr);
+
+        if (stat == (Int) EOF) {
+            PRINTVERBOSE0("\nLAD_putCommand: stat for fflush = EOF!\n")
+            status = LAD_IOFAILURE;
+        }
+    }
+
+    if (status != LAD_SUCCESS) {
+        pthread_mutex_unlock(&modGate);
+    }
+
+    PRINTVERBOSE1("LAD_putCommand: status = %d\n", status)
+
+    return(status);
+}
+
+
+/*
+ *  ======== initWrappers ========
+ */
+static LAD_Status initWrappers(Void)
+{
+    Int i;
+
+    /* initialize the client info structures */
+    for (i = 0; i < LAD_MAXNUMCLIENTS; i++) {
+        clientInfo[i].connectedToLAD = FALSE;
+        clientInfo[i].responseFIFOFilePtr = NULL;
+    }
+
+    /* now open LAD's command FIFO */
+    if (openCommandFIFO() == FALSE) {
+        return(LAD_IOFAILURE);
+    }
+    else {
+        return(LAD_SUCCESS);
+    }
+}
+
+/*
+ *  ======== openCommandFIFO ========
+ */
+static Bool openCommandFIFO(Void)
+{
+    /* open a file for writing to FIFO */
+    commandFIFOFilePtr = fopen(commandFIFOFileName, "w");
+
+    if (commandFIFOFilePtr == NULL) {
+        PRINTVERBOSE2("\nERROR: failed to open %s, errno = %x\n",
+            commandFIFOFileName, errno)
+        return(FALSE);
+    }
+
+    return(TRUE);
+}
diff --git a/linux/src/utils/Makefile.am b/linux/src/utils/Makefile.am
new file mode 100644 (file)
index 0000000..1d09639
--- /dev/null
@@ -0,0 +1,35 @@
+# src/utils/Makefile.am
+
+# additional include paths necessary to compile the library
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+
+###############################################################################
+# THE LIBRARIES TO BUILD
+###############################################################################
+
+# the library names to build (note we are building shared libs)
+lib_LTLIBRARIES = libtiipcutils.la
+
+# where to install the headers on the system
+libtiipcutils_ladir = $(includedir)
+
+# the list of header files that belong to the library (to be installed later)
+libtiipcutils_la_HEADERS =    \
+                        $(top_srcdir)/linux/include/Std.h
+
+# the sources to add to the library and to add to the source distribution
+libtiipcutils_la_SOURCES =    \
+                        $(libtiipcutils_la_HEADERS) \
+                        $(top_srcdir)/linux/include/ladclient.h \
+                        $(top_srcdir)/linux/include/_lad.h \
+                        $(top_srcdir)/linux/include/_MultiProc.h \
+                        $(top_srcdir)/linux/include/net/rpmsg.h \
+                        $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+                        LAD_client.c \
+                        MultiProc.c \
+                        SocketFxns.c
+
+# Add version info to the shared library
+libtiipcutils_la_LDFLAGS = -version-info 1:0:0
+
+###############################################################################
diff --git a/linux/src/utils/Makefile.in b/linux/src/utils/Makefile.in
new file mode 100644 (file)
index 0000000..6408e75
--- /dev/null
@@ -0,0 +1,522 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# src/utils/Makefile.am
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = linux/src/utils
+DIST_COMMON = $(libtiipcutils_la_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" \
+       "$(DESTDIR)$(libtiipcutils_ladir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libtiipcutils_la_LIBADD =
+am__objects_1 =
+am_libtiipcutils_la_OBJECTS = $(am__objects_1) LAD_client.lo \
+       MultiProc.lo SocketFxns.lo
+libtiipcutils_la_OBJECTS = $(am_libtiipcutils_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libtiipcutils_la_SOURCES)
+DIST_SOURCES = $(libtiipcutils_la_SOURCES)
+libtiipcutils_laHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libtiipcutils_la_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+
+# additional include paths necessary to compile the library
+AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/packages -D_GNU_SOURCE -Wall @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CMEM_FALSE = @CMEM_FALSE@
+CMEM_INSTALL_DIR = @CMEM_INSTALL_DIR@
+CMEM_TRUE = @CMEM_TRUE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OMAP4430_FALSE = @OMAP4430_FALSE@
+OMAP4430_TRUE = @OMAP4430_TRUE@
+OMAPL138_FALSE = @OMAPL138_FALSE@
+OMAPL138_TRUE = @OMAPL138_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PLATFORM = @PLATFORM@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCI6614_FALSE = @TCI6614_FALSE@
+TCI6614_TRUE = @TCI6614_TRUE@
+TCI6638_FALSE = @TCI6638_FALSE@
+TCI6638_TRUE = @TCI6638_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+###############################################################################
+# THE LIBRARIES TO BUILD
+###############################################################################
+
+# the library names to build (note we are building shared libs)
+lib_LTLIBRARIES = libtiipcutils.la
+
+# where to install the headers on the system
+libtiipcutils_ladir = $(includedir)
+
+# the list of header files that belong to the library (to be installed later)
+libtiipcutils_la_HEADERS = \
+                        $(top_srcdir)/linux/include/Std.h
+
+
+# the sources to add to the library and to add to the source distribution
+libtiipcutils_la_SOURCES = \
+                        $(libtiipcutils_la_HEADERS) \
+                        $(top_srcdir)/linux/include/ladclient.h \
+                        $(top_srcdir)/linux/include/_lad.h \
+                        $(top_srcdir)/linux/include/_MultiProc.h \
+                        $(top_srcdir)/linux/include/net/rpmsg.h \
+                        $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+                        LAD_client.c \
+                        MultiProc.c \
+                        SocketFxns.c
+
+
+# Add version info to the shared library
+libtiipcutils_la_LDFLAGS = -version-info 1:0:0
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  linux/src/utils/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  linux/src/utils/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libtiipcutils.la: $(libtiipcutils_la_OBJECTS) $(libtiipcutils_la_DEPENDENCIES) 
+       $(LINK) -rpath $(libdir) $(libtiipcutils_la_LDFLAGS) $(libtiipcutils_la_OBJECTS) $(libtiipcutils_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LAD_client.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SocketFxns.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-libtiipcutils_laHEADERS: $(libtiipcutils_la_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(libtiipcutils_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipcutils_ladir)"
+       @list='$(libtiipcutils_la_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(libtiipcutils_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipcutils_ladir)/$$f'"; \
+         $(libtiipcutils_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipcutils_ladir)/$$f"; \
+       done
+
+uninstall-libtiipcutils_laHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libtiipcutils_la_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libtiipcutils_ladir)/$$f'"; \
+         rm -f "$(DESTDIR)$(libtiipcutils_ladir)/$$f"; \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/../../../linux/include
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiipcutils_ladir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libtiipcutils_laHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
+       uninstall-libtiipcutils_laHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am \
+       install-libLTLIBRARIES install-libtiipcutils_laHEADERS \
+       install-man install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-info-am uninstall-libLTLIBRARIES \
+       uninstall-libtiipcutils_laHEADERS
+
+
+###############################################################################
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/linux/src/utils/MultiProc.c b/linux/src/utils/MultiProc.c
new file mode 100644 (file)
index 0000000..1bc5157
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProc.c ========
+ *
+ *  Implementation of functions to access processor IDs configured on BIOS side.
+ */
+
+#include <Std.h>
+
+#include <assert.h>
+#include <string.h>
+
+#include <ti/ipc/MultiProc.h>
+#include <_MultiProc.h>
+
+/*
+ *  ======== MultiProc_getId ========
+ */
+UInt16 MultiProc_getId(String name)
+{
+    Int    i;
+    UInt16 id;
+
+    assert(name != NULL);
+
+    id = MultiProc_INVALIDID;
+    for (i = 0; i < _MultiProc_cfg.numProcessors; i++) {
+        if ((_MultiProc_cfg.nameList[i] != NULL) &&
+                (strcmp(name, _MultiProc_cfg.nameList[i]) == 0)) {
+            id = i;
+        }
+    }
+    return (id);
+}
+
+/*
+ *  ======== MultiProc_getName ========
+ */
+String MultiProc_getName(UInt16 id)
+{
+    assert(id < _MultiProc_cfg.numProcessors);
+
+    return (_MultiProc_cfg.nameList[id]);
+}
+
+/*
+ *  ======== MultiProc_getNumProcessors ========
+ */
+UInt16 MultiProc_getNumProcessors()
+{
+    return (_MultiProc_cfg.numProcessors);
+}
+
+
+/*
+ *  ======== MultiProc_self ========
+ */
+UInt16 MultiProc_self()
+{
+    return (_MultiProc_cfg.id);
+}
+
+/*
+ *  ======== MultiProc_setLocalId ========
+ */
+Int MultiProc_setLocalId(UInt16 id)
+{
+    /* id must be less than the number of processors */
+    assert(id < _MultiProc_cfg.numProcessors);
+
+    /*
+     *  Check the following
+     *  1. Make sure the statically configured constant was invalid.
+     *     To call setLocalId, the id must have been set to invalid.
+     *  2. Make sure the call is made before module startup
+     */
+    if ((_MultiProc_cfg.id == MultiProc_INVALIDID) /* &&
+        (Startup_rtsDone() == FALSE) */  )  {
+        /* It is ok to set the id */
+        _MultiProc_cfg.id = id;
+        return (MultiProc_S_SUCCESS);
+    }
+
+    return (MultiProc_E_FAIL);
+}
diff --git a/linux/src/utils/SocketFxns.c b/linux/src/utils/SocketFxns.c
new file mode 100644 (file)
index 0000000..367fec5
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       SocketFxns.c
+ *  @brief      Shared socket functions.
+ *
+ */
+
+/* Standard headers */
+#include <Std.h>
+
+/* Socket Headers */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* SysLink Socket Protocol Family */
+#include <net/rpmsg.h>
+
+/* For PRINTVERBOSE* */
+#include <_lad.h>
+
+static Bool verbose = FALSE;
+
+int ConnectSocket(int sock, UInt16 procId, int dst)
+{
+    int                   err;
+    struct sockaddr_rpmsg srcAddr, dstAddr;
+    socklen_t             len;
+
+    /* connect to remote service */
+    memset(&dstAddr, 0, sizeof(dstAddr));
+    dstAddr.family     = AF_RPMSG;
+     /* rpmsg "vproc_id" is one less than the MultiProc ID: */
+    dstAddr.vproc_id   = procId - 1;
+    dstAddr.addr       = dst;
+
+    len = sizeof(struct sockaddr_rpmsg);
+    err = connect(sock, (struct sockaddr *)&dstAddr, len);
+    if (err < 0) {
+         printf("connect failed: %s (%d)\n", strerror(errno), errno);
+         return (-1);
+    }
+
+    /* let's see what local address we got */
+    err = getsockname(sock, (struct sockaddr *)&srcAddr, &len);
+    if (err < 0) {
+         printf("getpeername failed: %s (%d)\n", strerror(errno), errno);
+         return (-1);
+    }
+
+    PRINTVERBOSE3("Connected over sock: %d\n\tdst vproc_id: %d, dst addr: %d\n",
+                  sock, dstAddr.vproc_id, dstAddr.addr)
+    PRINTVERBOSE2("\tsrc vproc_id: %d, src addr: %d\n",
+                  srcAddr.vproc_id, srcAddr.addr)
+
+    return(0);
+}
+
+int SocketBindAddr(int fd, UInt16 rprocId, UInt32 localAddr)
+{
+    int         err;
+    socklen_t    len;
+    struct sockaddr_rpmsg srcAddr;
+
+    /* Now bind to the source address.   */
+    memset(&srcAddr, 0, sizeof(srcAddr));
+    srcAddr.family = AF_RPMSG;
+    /* We bind the remote proc ID, but local address! */
+    srcAddr.vproc_id = (rprocId - 1);
+    srcAddr.addr  = localAddr;
+
+    len = sizeof(struct sockaddr_rpmsg);
+    err = bind(fd, (struct sockaddr *)&srcAddr, len);
+    if (err >= 0) {
+        PRINTVERBOSE3("socket_bind_addr: bound sock: %d\n\tto dst "
+                      "vproc_id: %d, src addr: %d\n",
+                      fd, srcAddr.vproc_id, srcAddr.addr)
+
+        /* let's see what local address we got */
+        err = getsockname(fd, (struct sockaddr *)&srcAddr, &len);
+        if (err < 0) {
+            printf("getsockname failed: %s (%d)\n", strerror(errno), errno);
+        }
+        else {
+            PRINTVERBOSE2("\tsrc vproc_id: %d, src addr: %d\n",
+                          srcAddr.vproc_id, srcAddr.addr)
+        }
+    }
+
+    return (err);
+}
diff --git a/ltmain.sh b/ltmain.sh
new file mode 100644 (file)
index 0000000..06823e0
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,6863 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.22
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+  setopt NO_GLOB_SUBST
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  SP2NL='tr \040 \012'
+  NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  SP2NL='tr \100 \n'
+  NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS="  $lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+       # Failing that, at least try and use $RANDOM to avoid a race
+       my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+       save_mktempdir_umask=`umask`
+       umask 0077
+       $mkdir "$my_tmpdir"
+       umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || {
+        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+       exit $EXIT_FAILURE
+      }
+    fi
+
+    $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+       $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+       case $arg in
+         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+       for z in $available_tags; do
+         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           CC_quoted=
+           for arg in $CC; do
+           # Double-quote args containing other shell metacharacters.
+           case $arg in
+             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
+             arg="\"$arg\""
+             ;;
+           esac
+           CC_quoted="$CC_quoted $arg"
+         done
+           case "$@ " in
+             " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+             # The compiler in the base compile command matches
+             # the one in the tagged configuration.
+             # Assume this is the tagged configuration we want.
+             tagname=$z
+             break
+             ;;
+           esac
+         fi
+       done
+       # If $tagname still isn't set, then no tagged configuration
+       # was found and let the user know that the "--tag" command
+       # line option must be used.
+       if test -z "$tagname"; then
+         $echo "$modename: unable to infer tagged configuration"
+         $echo "$modename: specify a tag with \`--tag'" 1>&2
+         exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+       fi
+       ;;
+      esac
+    fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+
+    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+      exit $EXIT_FAILURE
+    fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+       [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+       *) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xdir="$my_gentop/$my_xlib"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+       exit $exit_status
+      fi
+      case $host in
+      *-darwin*)
+       $show "Extracting $my_xabs"
+       # Do not bother doing anything if just a dry run
+       if test -z "$run"; then
+         darwin_orig_dir=`pwd`
+         cd $my_xdir || exit $?
+         darwin_archive=$my_xabs
+         darwin_curdir=`pwd`
+         darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+         darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+         if test -n "$darwin_arches"; then 
+           darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+           darwin_arch=
+           $show "$darwin_base_archive has multiple architectures $darwin_arches"
+           for darwin_arch in  $darwin_arches ; do
+             mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+             cd "$darwin_curdir"
+             $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+           done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+           darwin_file=
+           darwin_files=
+           for darwin_file in $darwin_filelist; do
+             darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+             lipo -create -output "$darwin_file" $darwin_files
+           done # $darwin_filelist
+           ${rm}r unfat-$$
+           cd "$darwin_orig_dir"
+         else
+           cd "$darwin_orig_dir"
+           func_extract_an_archive "$my_xdir" "$my_xabs"
+         fi # $darwin_arches
+       fi # $run
+       ;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+        ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+       $echo "$progname: invalid tag name: $tagname" 1>&2
+       exit $EXIT_FAILURE
+       ;;
+      esac
+
+      case $tagname in
+      CC)
+       # Don't test for the "default" C tag, as we know, it's there, but
+       # not specially marked.
+       ;;
+      *)
+       if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+         taglist="$taglist $tagname"
+         # Evaluate the configuration.
+         eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+       else
+         $echo "$progname: ignoring unknown tag $tagname" 1>&2
+       fi
+       ;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $?
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $?
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $?
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag)
+    prevopt="--tag"
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no) 
+  ;;
+shared)
+  build_libtool_libs=no
+  build_old_libs=yes
+  ;;
+static)
+  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+  ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+       case $arg in
+       -c)
+          mode=compile
+          break
+          ;;
+       esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+       if test -n "$nonopt"; then
+         $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+       else
+         $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+       fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+       # do not "continue".  Instead, add this to base_compile
+       lastarg="$arg"
+       arg_mode=normal
+       ;;
+
+      target )
+       libobj="$arg"
+       arg_mode=normal
+       continue
+       ;;
+
+      normal )
+       # Accept any command-line options.
+       case $arg in
+       -o)
+         if test -n "$libobj" ; then
+           $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         arg_mode=target
+         continue
+         ;;
+
+       -static | -prefer-pic | -prefer-non-pic)
+         later="$later $arg"
+         continue
+         ;;
+
+       -no-suppress)
+         suppress_opt=no
+         continue
+         ;;
+
+       -Xcompiler)
+         arg_mode=arg  #  the next one goes into the "base_compile" arg list
+         continue      #  The current "srcfile" will either be retained or
+         ;;            #  replaced later.  I would guess that would be a bug.
+
+       -Wc,*)
+         args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+         lastarg=
+         save_ifs="$IFS"; IFS=','
+         for arg in $args; do
+           IFS="$save_ifs"
+
+           # Double-quote args containing other shell metacharacters.
+           # Many Bourne shells cannot handle close brackets correctly
+           # in scan sets, so we specify it separately.
+           case $arg in
+             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
+             arg="\"$arg\""
+             ;;
+           esac
+           lastarg="$lastarg $arg"
+         done
+         IFS="$save_ifs"
+         lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+         # Add the arguments to base_compile.
+         base_compile="$base_compile $lastarg"
+         continue
+         ;;
+
+       * )
+         # Accept the current argument as the source file.
+         # The previous "srcfile" becomes the current argument.
+         #
+         lastarg="$srcfile"
+         srcfile="$arg"
+         ;;
+       esac  #  case $arg
+       ;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, and some SunOS ksh mistreat backslash-escaping
+      # in scan sets (worked around with variable expansion),
+      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
+      # at all, so we specify them separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       lastarg="\"$lastarg\""
+       ;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+       build_old_libs=yes
+       continue
+       ;;
+
+      -prefer-pic)
+       pic_mode=yes
+       continue
+       ;;
+
+      -prefer-non-pic)
+       pic_mode=no
+       continue
+       ;;
+      esac
+    done
+
+    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+    case $qlibobj in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       qlibobj="\"$qlibobj\"" ;;
+    esac
+    test "X$libobj" != "X$qlibobj" \
+       && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
+       && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+       $show "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+       $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+      $echo "$srcfile" > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+    case $qsrcfile in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+      qsrcfile="\"$qsrcfile\"" ;;
+    esac
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+       command="$base_compile $qsrcfile $pic_flag"
+      else
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+       $show "$mkdir ${xdir}$objdir"
+       $run $mkdir ${xdir}$objdir
+       exit_status=$?
+       if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+         exit $exit_status
+       fi
+      fi
+
+      if test -z "$output_obj"; then
+       # Place PIC objects in $objdir
+       command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+       test -n "$output_obj" && $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+       $show "$mv $output_obj $lobj"
+       if $run $mv $output_obj $lobj; then :
+       else
+         error=$?
+         $run $rm $removelist
+         exit $error
+       fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      else
+       command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+       command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+       $show "$mv $output_obj $obj"
+       if $run $mv $output_obj $obj; then :
+       else
+         error=$?
+         $run $rm $removelist
+         exit $error
+       fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    notinst_path= # paths that contain not-installed libtool libraries
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+       if test "X$arg" = "X-all-static"; then
+         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+           $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+         fi
+         if test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+       else
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=built
+       fi
+       build_libtool_libs=no
+       build_old_libs=yes
+       break
+       ;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+       ;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+       case $prev in
+       output)
+         compile_command="$compile_command @OUTPUT@"
+         finalize_command="$finalize_command @OUTPUT@"
+         ;;
+       esac
+
+       case $prev in
+       dlfiles|dlprefiles)
+         if test "$preload" = no; then
+           # Add the symbol object into the linking commands.
+           compile_command="$compile_command @SYMFILE@"
+           finalize_command="$finalize_command @SYMFILE@"
+           preload=yes
+         fi
+         case $arg in
+         *.la | *.lo) ;;  # We handle these cases below.
+         force)
+           if test "$dlself" = no; then
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         self)
+           if test "$prev" = dlprefiles; then
+             dlself=yes
+           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+             dlself=yes
+           else
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         *)
+           if test "$prev" = dlfiles; then
+             dlfiles="$dlfiles $arg"
+           else
+             dlprefiles="$dlprefiles $arg"
+           fi
+           prev=
+           continue
+           ;;
+         esac
+         ;;
+       expsyms)
+         export_symbols="$arg"
+         if test ! -f "$arg"; then
+           $echo "$modename: symbol file \`$arg' does not exist"
+           exit $EXIT_FAILURE
+         fi
+         prev=
+         continue
+         ;;
+       expsyms_regex)
+         export_symbols_regex="$arg"
+         prev=
+         continue
+         ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
+       precious_regex)
+         precious_files_regex="$arg"
+         prev=
+         continue
+         ;;
+       release)
+         release="-$arg"
+         prev=
+         continue
+         ;;
+       objectlist)
+         if test -f "$arg"; then
+           save_arg=$arg
+           moreargs=
+           for fil in `cat $save_arg`
+           do
+#            moreargs="$moreargs $fil"
+             arg=$fil
+             # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+               pic_object=
+               non_pic_object=
+
+               # Read the .lo file
+               # If there is no directory component, then add one.
+               case $arg in
+               */* | *\\*) . $arg ;;
+               *) . ./$arg ;;
+               esac
+
+               if test -z "$pic_object" || \
+                  test -z "$non_pic_object" ||
+                  test "$pic_object" = none && \
+                  test "$non_pic_object" = none; then
+                 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+                 exit $EXIT_FAILURE
+               fi
+
+               # Extract subdirectory from the argument.
+               xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+               if test "X$xdir" = "X$arg"; then
+                 xdir=
+               else
+                 xdir="$xdir/"
+               fi
+
+               if test "$pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 pic_object="$xdir$pic_object"
+
+                 if test "$prev" = dlfiles; then
+                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+                     dlfiles="$dlfiles $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                 if test "$prev" = dlprefiles; then
+                   # Preload the old-style object.
+                   dlprefiles="$dlprefiles $pic_object"
+                   prev=
+                 fi
+
+                 # A PIC object.
+                 libobjs="$libobjs $pic_object"
+                 arg="$pic_object"
+               fi
+
+               # Non-PIC object.
+               if test "$non_pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 non_pic_object="$xdir$non_pic_object"
+
+                 # A standard non-PIC object
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+                 if test -z "$pic_object" || test "$pic_object" = none ; then
+                   arg="$non_pic_object"
+                 fi
+               else
+                 # If the PIC object exists, use it instead.
+                 # $xdir was prepended to $pic_object above.
+                 non_pic_object="$pic_object"
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+               fi
+             else
+               # Only an error if not doing a dry-run.
+               if test -z "$run"; then
+                 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+                 exit $EXIT_FAILURE
+               else
+                 # Dry-run case.
+
+                 # Extract subdirectory from the argument.
+                 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+                 if test "X$xdir" = "X$arg"; then
+                   xdir=
+                 else
+                   xdir="$xdir/"
+                 fi
+
+                 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+                 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+                 libobjs="$libobjs $pic_object"
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+               fi
+             fi
+           done
+         else
+           $echo "$modename: link input file \`$save_arg' does not exist"
+           exit $EXIT_FAILURE
+         fi
+         arg=$save_arg
+         prev=
+         continue
+         ;;
+       rpath | xrpath)
+         # We need an absolute path.
+         case $arg in
+         [\\/]* | [A-Za-z]:[\\/]*) ;;
+         *)
+           $echo "$modename: only absolute run-paths are allowed" 1>&2
+           exit $EXIT_FAILURE
+           ;;
+         esac
+         if test "$prev" = rpath; then
+           case "$rpath " in
+           *" $arg "*) ;;
+           *) rpath="$rpath $arg" ;;
+           esac
+         else
+           case "$xrpath " in
+           *" $arg "*) ;;
+           *) xrpath="$xrpath $arg" ;;
+           esac
+         fi
+         prev=
+         continue
+         ;;
+       xcompiler)
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         compile_command="$compile_command $qarg"
+         finalize_command="$finalize_command $qarg"
+         continue
+         ;;
+       xlinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $wl$qarg"
+         prev=
+         compile_command="$compile_command $wl$qarg"
+         finalize_command="$finalize_command $wl$qarg"
+         continue
+         ;;
+       xcclinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         compile_command="$compile_command $qarg"
+         finalize_command="$finalize_command $qarg"
+         continue
+         ;;
+       shrext)
+         shrext_cmds="$arg"
+         prev=
+         continue
+         ;;
+       darwin_framework|darwin_framework_skip)
+         test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+         compile_command="$compile_command $arg"
+         finalize_command="$finalize_command $arg"
+         prev=
+         continue
+         ;;
+       *)
+         eval "$prev=\"\$arg\""
+         prev=
+         continue
+         ;;
+       esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+       if test -n "$link_static_flag"; then
+         compile_command="$compile_command $link_static_flag"
+         finalize_command="$finalize_command $link_static_flag"
+       fi
+       continue
+       ;;
+
+      -allow-undefined)
+       # FIXME: remove this flag sometime in the future.
+       $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+       continue
+       ;;
+
+      -avoid-version)
+       avoid_version=yes
+       continue
+       ;;
+
+      -dlopen)
+       prev=dlfiles
+       continue
+       ;;
+
+      -dlpreopen)
+       prev=dlprefiles
+       continue
+       ;;
+
+      -export-dynamic)
+       export_dynamic=yes
+       continue
+       ;;
+
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+         $echo "$modename: more than one -exported-symbols argument is not allowed"
+         exit $EXIT_FAILURE
+       fi
+       if test "X$arg" = "X-export-symbols"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
+       continue
+       ;;
+
+      -framework|-arch|-isysroot)
+       case " $CC " in
+         *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
+               prev=darwin_framework_skip ;;
+         *) compiler_flags="$compiler_flags $arg"
+            prev=darwin_framework ;;
+       esac
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+       continue
+       ;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix* | /*-*-irix*)
+         compile_command="$compile_command $arg"
+         finalize_command="$finalize_command $arg"
+         ;;
+       esac
+       continue
+       ;;
+
+      -L*)
+       dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         if test -z "$absdir"; then
+           $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+           absdir="$dir"
+           notinst_path="$notinst_path $dir"
+         fi
+         dir="$absdir"
+         ;;
+       esac
+       case "$deplibs " in
+       *" -L$dir "*) ;;
+       *)
+         deplibs="$deplibs -L$dir"
+         lib_search_path="$lib_search_path $dir"
+         ;;
+       esac
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$dir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+       esac
+       continue
+       ;;
+
+      -l*)
+       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+         *-*-os2*)
+           # These systems don't actually have a C library (as such)
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C and math libraries are in the System framework
+           deplibs="$deplibs -framework System"
+           continue
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           test "X$arg" = "X-lc" && continue
+           ;;
+         esac
+       elif test "X$arg" = "X-lc_r"; then
+        case $host in
+        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+          # Do not include libc_r directly, use -pthread flag.
+          continue
+          ;;
+        esac
+       fi
+       deplibs="$deplibs $arg"
+       continue
+       ;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      -model)
+       compile_command="$compile_command $arg"
+       compiler_flags="$compiler_flags $arg"
+       finalize_command="$finalize_command $arg"
+       prev=xcompiler
+       continue
+       ;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+       compiler_flags="$compiler_flags $arg"
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+       continue
+       ;;
+
+      -module)
+       module=yes
+       continue
+       ;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m* pass through architecture-specific compiler args for GCC
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -pg pass through profiling flag for GCC
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
+      -t[45]*|-txscale*|@*)
+
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      -shrext)
+       prev=shrext
+       continue
+       ;;
+
+      -no-fast-install)
+       fast_install=no
+       continue
+       ;;
+
+      -no-install)
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # in order for the loader to find any dlls it needs.
+         $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+         $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+         fast_install=no
+         ;;
+       *) no_install=yes ;;
+       esac
+       continue
+       ;;
+
+      -no-undefined)
+       allow_undefined=no
+       continue
+       ;;
+
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+       prev=precious_regex
+       continue
+       ;;
+
+      -release)
+       prev=release
+       continue
+       ;;
+
+      -rpath)
+       prev=rpath
+       continue
+       ;;
+
+      -R)
+       prev=xrpath
+       continue
+       ;;
+
+      -R*)
+       dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         $echo "$modename: only absolute run-paths are allowed" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+       case "$xrpath " in
+       *" $dir "*) ;;
+       *) xrpath="$xrpath $dir" ;;
+       esac
+       continue
+       ;;
+
+      -static)
+       # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
+       continue
+       ;;
+
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
+      -version-info)
+       prev=vinfo
+       continue
+       ;;
+      -version-number)
+       prev=vinfo
+       vinfo_number=yes
+       continue
+       ;;
+
+      -Wc,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case $flag in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         compiler_flags="$compiler_flags $flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
+      -Wl,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case $flag in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         compiler_flags="$compiler_flags $wl$flag"
+         linker_flags="$linker_flags $flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
+      -Xcompiler)
+       prev=xcompiler
+       continue
+       ;;
+
+      -Xlinker)
+       prev=xlinker
+       continue
+       ;;
+
+      -XCClinker)
+       prev=xcclinker
+       continue
+       ;;
+
+      # Some other compiler flag.
+      -* | +*)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       ;;
+
+      *.$objext)
+       # A standard object.
+       objs="$objs $arg"
+       ;;
+
+      *.lo)
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         pic_object=
+         non_pic_object=
+
+         # Read the .lo file
+         # If there is no directory component, then add one.
+         case $arg in
+         */* | *\\*) . $arg ;;
+         *) . ./$arg ;;
+         esac
+
+         if test -z "$pic_object" || \
+            test -z "$non_pic_object" ||
+            test "$pic_object" = none && \
+            test "$non_pic_object" = none; then
+           $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         # Extract subdirectory from the argument.
+         xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+         if test "X$xdir" = "X$arg"; then
+           xdir=
+         else
+           xdir="$xdir/"
+         fi
+
+         if test "$pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           pic_object="$xdir$pic_object"
+
+           if test "$prev" = dlfiles; then
+             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+               dlfiles="$dlfiles $pic_object"
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
+
+           # CHECK ME:  I think I busted this.  -Ossama
+           if test "$prev" = dlprefiles; then
+             # Preload the old-style object.
+             dlprefiles="$dlprefiles $pic_object"
+             prev=
+           fi
+
+           # A PIC object.
+           libobjs="$libobjs $pic_object"
+           arg="$pic_object"
+         fi
+
+         # Non-PIC object.
+         if test "$non_pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           non_pic_object="$xdir$non_pic_object"
+
+           # A standard non-PIC object
+           non_pic_objects="$non_pic_objects $non_pic_object"
+           if test -z "$pic_object" || test "$pic_object" = none ; then
+             arg="$non_pic_object"
+           fi
+         else
+           # If the PIC object exists, use it instead.
+           # $xdir was prepended to $pic_object above.
+           non_pic_object="$pic_object"
+           non_pic_objects="$non_pic_objects $non_pic_object"
+         fi
+       else
+         # Only an error if not doing a dry-run.
+         if test -z "$run"; then
+           $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+           exit $EXIT_FAILURE
+         else
+           # Dry-run case.
+
+           # Extract subdirectory from the argument.
+           xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+           if test "X$xdir" = "X$arg"; then
+             xdir=
+           else
+             xdir="$xdir/"
+           fi
+
+           pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+           non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+           libobjs="$libobjs $pic_object"
+           non_pic_objects="$non_pic_objects $non_pic_object"
+         fi
+       fi
+       ;;
+
+      *.$libext)
+       # An archive.
+       deplibs="$deplibs $arg"
+       old_deplibs="$old_deplibs $arg"
+       continue
+       ;;
+
+      *.la)
+       # A libtool-controlled library.
+
+       if test "$prev" = dlfiles; then
+         # This library was specified with -dlopen.
+         dlfiles="$dlfiles $arg"
+         prev=
+       elif test "$prev" = dlprefiles; then
+         # The library was specified with -dlpreopen.
+         dlprefiles="$dlprefiles $arg"
+         prev=
+       else
+         deplibs="$deplibs $arg"
+       fi
+       continue
+       ;;
+
+      # Some other compiler argument.
+      *)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       ;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+       exit $exit_status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+       case "$libs " in
+       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+       esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+       for pre_post_dep in $predeps $postdeps; do
+         case "$pre_post_deps " in
+         *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+         esac
+         pre_post_deps="$pre_post_deps $pre_post_dep"
+       done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    case $linkmode in
+    lib)
+       passes="conv link"
+       for file in $dlfiles $dlprefiles; do
+         case $file in
+         *.la) ;;
+         *)
+           $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+           exit $EXIT_FAILURE
+           ;;
+         esac
+       done
+       ;;
+    prog)
+       compile_deplibs=
+       finalize_deplibs=
+       alldeplibs=no
+       newdlfiles=
+       newdlprefiles=
+       passes="conv scan dlopen dlpreopen link"
+       ;;
+    *)  passes="conv"
+       ;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+        test "$linkmode,$pass" = "prog,scan"; then
+       libs="$deplibs"
+       deplibs=
+      fi
+      if test "$linkmode" = prog; then
+       case $pass in
+       dlopen) libs="$dlfiles" ;;
+       dlpreopen) libs="$dlprefiles" ;;
+       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+       esac
+      fi
+      if test "$pass" = dlopen; then
+       # Collect dlpreopened libraries
+       save_deplibs="$deplibs"
+       deplibs=
+      fi
+      for deplib in $libs; do
+       lib=
+       found=no
+       case $deplib in
+       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           compiler_flags="$compiler_flags $deplib"
+         fi
+         continue
+         ;;
+       -l*)
+         if test "$linkmode" != lib && test "$linkmode" != prog; then
+           $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+           continue
+         fi
+         name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+         for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+           for search_ext in .la $std_shrext .so .a; do
+             # Search the libtool library
+             lib="$searchdir/lib${name}${search_ext}"
+             if test -f "$lib"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break 2
+             fi
+           done
+         done
+         if test "$found" != yes; then
+           # deplib doesn't seem to be a libtool library
+           if test "$linkmode,$pass" = "prog,link"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
+         else # deplib is a libtool library
+           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+           # We need to do some special things here, and not later.
+           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             case " $predeps $postdeps " in
+             *" $deplib "*)
+               if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+                 library_names=
+                 old_library=
+                 case $lib in
+                 */* | *\\*) . $lib ;;
+                 *) . ./$lib ;;
+                 esac
+                 for l in $old_library $library_names; do
+                   ll="$l"
+                 done
+                 if test "X$ll" = "X$old_library" ; then # only static version available
+                   found=no
+                   ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+                   test "X$ladir" = "X$lib" && ladir="."
+                   lib=$ladir/$old_library
+                   if test "$linkmode,$pass" = "prog,link"; then
+                     compile_deplibs="$deplib $compile_deplibs"
+                     finalize_deplibs="$deplib $finalize_deplibs"
+                   else
+                     deplibs="$deplib $deplibs"
+                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+                   fi
+                   continue
+                 fi
+               fi
+               ;;
+             *) ;;
+             esac
+           fi
+         fi
+         ;; # -l
+       -L*)
+         case $linkmode in
+         lib)
+           deplibs="$deplib $deplibs"
+           test "$pass" = conv && continue
+           newdependency_libs="$deplib $newdependency_libs"
+           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+           ;;
+         prog)
+           if test "$pass" = conv; then
+             deplibs="$deplib $deplibs"
+             continue
+           fi
+           if test "$pass" = scan; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+           ;;
+         *)
+           $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+           ;;
+         esac # linkmode
+         continue
+         ;; # -L
+       -R*)
+         if test "$pass" = link; then
+           dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+           # Make sure the xrpath contains only unique directories.
+           case "$xrpath " in
+           *" $dir "*) ;;
+           *) xrpath="$xrpath $dir" ;;
+           esac
+         fi
+         deplibs="$deplib $deplibs"
+         continue
+         ;;
+       *.la) lib="$deplib" ;;
+       *.$libext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         case $linkmode in
+         lib)
+           valid_a_lib=no
+           case $deplibs_check_method in
+             match_pattern*)
+               set dummy $deplibs_check_method
+               match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+               if eval $echo \"$deplib\" 2>/dev/null \
+                   | $SED 10q \
+                   | $EGREP "$match_pattern_regex" > /dev/null; then
+                 valid_a_lib=yes
+               fi
+               ;;
+             pass_all)
+               valid_a_lib=yes
+               ;;
+            esac
+           if test "$valid_a_lib" != yes; then
+             $echo
+             $echo "*** Warning: Trying to link with static lib archive $deplib."
+             $echo "*** I have the capability to make that library automatically link in when"
+             $echo "*** you link to this library.  But I can only do this if you have a"
+             $echo "*** shared version of the library, which you do not appear to have"
+             $echo "*** because the file extensions .$libext of this argument makes me believe"
+             $echo "*** that it is just a static archive that I should not used here."
+           else
+             $echo
+             $echo "*** Warning: Linking the shared library $output against the"
+             $echo "*** static library $deplib is not portable!"
+             deplibs="$deplib $deplibs"
+           fi
+           continue
+           ;;
+         prog)
+           if test "$pass" != link; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           continue
+           ;;
+         esac # linkmode
+         ;; # *.$libext
+       *.lo | *.$objext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+         elif test "$linkmode" = prog; then
+           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             newdlprefiles="$newdlprefiles $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             newdlfiles="$newdlfiles $deplib"
+           fi
+         fi
+         continue
+         ;;
+       %DEPLIBS%)
+         alldeplibs=yes
+         continue
+         ;;
+       esac # case $deplib
+       if test "$found" = yes || test -f "$lib"; then :
+       else
+         $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$ladir" = "X$lib" && ladir="."
+
+       dlname=
+       dlopen=
+       dlpreopen=
+       libdir=
+       library_names=
+       old_library=
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variables installed, or shouldnotlink
+       installed=yes
+       shouldnotlink=no
+       avoidtemprpath=
+
+
+       # Read the .la file
+       case $lib in
+       */* | *\\*) . $lib ;;
+       *) . ./$lib ;;
+       esac
+
+       if test "$linkmode,$pass" = "lib,link" ||
+          test "$linkmode,$pass" = "prog,scan" ||
+          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+         test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+         test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+       fi
+
+       if test "$pass" = conv; then
+         # Only check for convenience libraries
+         deplibs="$lib $deplibs"
+         if test -z "$libdir"; then
+           if test -z "$old_library"; then
+             $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+             exit $EXIT_FAILURE
+           fi
+           # It is a libtool convenience library, so add in its objects.
+           convenience="$convenience $ladir/$objdir/$old_library"
+           old_convenience="$old_convenience $ladir/$objdir/$old_library"
+           tmp_libs=
+           for deplib in $dependency_libs; do
+             deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+               case "$tmp_libs " in
+               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+               esac
+              fi
+             tmp_libs="$tmp_libs $deplib"
+           done
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
+           $echo "$modename: \`$lib' is not a convenience library" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         continue
+       fi # $pass = conv
+
+
+       # Get the name of the library we link against.
+       linklib=
+       for l in $old_library $library_names; do
+         linklib="$l"
+       done
+       if test -z "$linklib"; then
+         $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # This library was specified with -dlopen.
+       if test "$pass" = dlopen; then
+         if test -z "$libdir"; then
+           $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         if test -z "$dlname" ||
+            test "$dlopen_support" != yes ||
+            test "$build_libtool_libs" = no; then
+           # If there is no dlname, no dlopen support or we're linking
+           # statically, we need to preload.  We also need to preload any
+           # dependent libraries so libltdl's deplib preloader doesn't
+           # bomb out in the load deplibs phase.
+           dlprefiles="$dlprefiles $lib $dependency_libs"
+         else
+           newdlfiles="$newdlfiles $lib"
+         fi
+         continue
+       fi # $pass = dlopen
+
+       # We need an absolute path.
+       case $ladir in
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+       *)
+         abs_ladir=`cd "$ladir" && pwd`
+         if test -z "$abs_ladir"; then
+           $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+           abs_ladir="$ladir"
+         fi
+         ;;
+       esac
+       laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+       # Find the relevant object directory and library name.
+       if test "X$installed" = Xyes; then
+         if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           $echo "$modename: warning: library \`$lib' was moved." 1>&2
+           dir="$ladir"
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
+           dir="$libdir"
+           absdir="$libdir"
+         fi
+         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+       else
+         if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           dir="$ladir"
+           absdir="$abs_ladir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         else
+           dir="$ladir/$objdir"
+           absdir="$abs_ladir/$objdir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         fi
+       fi # $installed = yes
+       name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+       # This library was specified with -dlpreopen.
+       if test "$pass" = dlpreopen; then
+         if test -z "$libdir"; then
+           $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         # Prefer using a static library (so that no silly _DYNAMIC symbols
+         # are required to link).
+         if test -n "$old_library"; then
+           newdlprefiles="$newdlprefiles $dir/$old_library"
+         # Otherwise, use the dlname, so that lt_dlopen finds it.
+         elif test -n "$dlname"; then
+           newdlprefiles="$newdlprefiles $dir/$dlname"
+         else
+           newdlprefiles="$newdlprefiles $dir/$linklib"
+         fi
+       fi # $pass = dlpreopen
+
+       if test -z "$libdir"; then
+         # Link the convenience library
+         if test "$linkmode" = lib; then
+           deplibs="$dir/$old_library $deplibs"
+         elif test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+         else
+           deplibs="$lib $deplibs" # used for prog,scan pass
+         fi
+         continue
+       fi
+
+
+       if test "$linkmode" = prog && test "$pass" != link; then
+         newlib_search_path="$newlib_search_path $ladir"
+         deplibs="$lib $deplibs"
+
+         linkalldeplibs=no
+         if test "$link_all_deplibs" != no || test -z "$library_names" ||
+            test "$build_libtool_libs" = no; then
+           linkalldeplibs=yes
+         fi
+
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           case $deplib in
+           -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+           esac
+           # Need to link against all dependency_libs?
+           if test "$linkalldeplibs" = yes; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           if test "X$duplicate_deps" = "Xyes" ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done # for deplib
+         continue
+       fi # $linkmode = prog...
+
+       if test "$linkmode,$pass" = "prog,link"; then
+         if test -n "$library_names" &&
+            { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+           # We need to hardcode the library path
+           if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+             # Make sure the rpath contains only unique directories.
+             case "$temp_rpath " in
+             *" $dir "*) ;;
+             *" $absdir "*) ;;
+             *) temp_rpath="$temp_rpath $absdir" ;;
+             esac
+           fi
+
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi # $linkmode,$pass = prog,link...
+
+         if test "$alldeplibs" = yes &&
+            { test "$deplibs_check_method" = pass_all ||
+              { test "$build_libtool_libs" = yes &&
+                test -n "$library_names"; }; }; then
+           # We only need to search for static libraries
+           continue
+         fi
+       fi
+
+       link_static=no # Whether the deplib will be linked statically
+       use_static_libs=$prefer_static_libs
+       if test "$use_static_libs" = built && test "$installed" = yes ; then
+         use_static_libs=no
+       fi
+       if test -n "$library_names" &&
+          { test "$use_static_libs" = no || test -z "$old_library"; }; then
+         if test "$installed" = no; then
+           notinst_deplibs="$notinst_deplibs $lib"
+           need_relink=yes
+         fi
+         # This is a shared library
+
+         # Warn about portability, can't link against -module's on
+         # some systems (darwin)
+         if test "$shouldnotlink" = yes && test "$pass" = link ; then
+           $echo
+           if test "$linkmode" = prog; then
+             $echo "*** Warning: Linking the executable $output against the loadable module"
+           else
+             $echo "*** Warning: Linking the shared library $output against the loadable module"
+           fi
+           $echo "*** $linklib is not portable!"
+         fi
+         if test "$linkmode" = lib &&
+            test "$hardcode_into_libs" = yes; then
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi
+
+         if test -n "$old_archive_from_expsyms_cmds"; then
+           # figure out the soname
+           set dummy $library_names
+           realname="$2"
+           shift; shift
+           libname=`eval \\$echo \"$libname_spec\"`
+           # use dlname if we got it. it's perfectly good, no?
+           if test -n "$dlname"; then
+             soname="$dlname"
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+             *cygwin* | mingw*)
+               major=`expr $current - $age`
+               versuffix="-$major"
+               ;;
+             esac
+             eval soname=\"$soname_spec\"
+           else
+             soname="$realname"
+           fi
+
+           # Make a new name for the extract_expsyms_cmds to use
+           soroot="$soname"
+           soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+           newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+           # If the library has no export list, then create one now
+           if test -f "$output_objdir/$soname-def"; then :
+           else
+             $show "extracting exported symbol list from \`$soname'"
+             save_ifs="$IFS"; IFS='~'
+             cmds=$extract_expsyms_cmds
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+             done
+             IFS="$save_ifs"
+           fi
+
+           # Create $newlib
+           if test -f "$output_objdir/$newlib"; then :; else
+             $show "generating import library for \`$soname'"
+             save_ifs="$IFS"; IFS='~'
+             cmds=$old_archive_from_expsyms_cmds
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+             done
+             IFS="$save_ifs"
+           fi
+           # make sure the library variables are pointing to the new library
+           dir=$output_objdir
+           linklib=$newlib
+         fi # test -n "$old_archive_from_expsyms_cmds"
+
+         if test "$linkmode" = prog || test "$mode" != relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           lib_linked=yes
+           case $hardcode_action in
+           immediate | unsupported)
+             if test "$hardcode_direct" = no; then
+               add="$dir/$linklib"
+               case $host in
+                 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+                 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+                 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+                   *-*-unixware7*) add_dir="-L$dir" ;;
+                 *-*-darwin* )
+                   # if the lib is a module then we can not link against
+                   # it, someone is ignoring the new warnings I added
+                   if /usr/bin/file -L $add 2> /dev/null |
+                      $EGREP ": [^:]* bundle" >/dev/null ; then
+                     $echo "** Warning, lib $linklib is a module, not a shared library"
+                     if test -z "$old_library" ; then
+                       $echo
+                       $echo "** And there doesn't seem to be a static archive available"
+                       $echo "** The link will probably fail, sorry"
+                     else
+                       add="$dir/$old_library"
+                     fi
+                   fi
+               esac
+             elif test "$hardcode_minus_L" = no; then
+               case $host in
+               *-*-sunos*) add_shlibpath="$dir" ;;
+               esac
+               add_dir="-L$dir"
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = no; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           relink)
+             if test "$hardcode_direct" = yes; then
+               add="$dir/$linklib"
+             elif test "$hardcode_minus_L" = yes; then
+               add_dir="-L$dir"
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case $libdir in
+                   [\\/]*)
+                     add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                     ;;
+                 esac
+               fi
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = yes; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           *) lib_linked=no ;;
+           esac
+
+           if test "$lib_linked" != yes; then
+             $echo "$modename: configuration error: unsupported hardcode properties"
+             exit $EXIT_FAILURE
+           fi
+
+           if test -n "$add_shlibpath"; then
+             case :$compile_shlibpath: in
+             *":$add_shlibpath:"*) ;;
+             *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+             esac
+           fi
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+             if test "$hardcode_direct" != yes && \
+                test "$hardcode_minus_L" != yes && \
+                test "$hardcode_shlibpath_var" = yes; then
+               case :$finalize_shlibpath: in
+               *":$libdir:"*) ;;
+               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+               esac
+             fi
+           fi
+         fi
+
+         if test "$linkmode" = prog || test "$mode" = relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           # Finalize command for both is simple: just hardcode it.
+           if test "$hardcode_direct" = yes; then
+             add="$libdir/$linklib"
+           elif test "$hardcode_minus_L" = yes; then
+             add_dir="-L$libdir"
+             add="-l$name"
+           elif test "$hardcode_shlibpath_var" = yes; then
+             case :$finalize_shlibpath: in
+             *":$libdir:"*) ;;
+             *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+             esac
+             add="-l$name"
+           elif test "$hardcode_automatic" = yes; then
+             if test -n "$inst_prefix_dir" &&
+                test -f "$inst_prefix_dir$libdir/$linklib" ; then
+               add="$inst_prefix_dir$libdir/$linklib"
+             else
+               add="$libdir/$linklib"
+             fi
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case $libdir in
+                 [\\/]*)
+                   add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                   ;;
+               esac
+             fi
+             add="-l$name"
+           fi
+
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+           fi
+         fi
+       elif test "$linkmode" = prog; then
+         # Here we assume that one of hardcode_direct or hardcode_minus_L
+         # is not unsupported.  This is valid on all known static and
+         # shared platforms.
+         if test "$hardcode_direct" != unsupported; then
+           test -n "$old_library" && linklib="$old_library"
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+         else
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+         fi
+       elif test "$build_libtool_libs" = yes; then
+         # Not a shared library
+         if test "$deplibs_check_method" != pass_all; then
+           # We're trying link a shared library against a static one
+           # but the system doesn't support it.
+
+           # Just print a warning and add the library to dependency_libs so
+           # that the program can be linked against the static library.
+           $echo
+           $echo "*** Warning: This system can not link to static lib archive $lib."
+           $echo "*** I have the capability to make that library automatically link in when"
+           $echo "*** you link to this library.  But I can only do this if you have a"
+           $echo "*** shared version of the library, which you do not appear to have."
+           if test "$module" = yes; then
+             $echo "*** But as you try to build a module library, libtool will still create "
+             $echo "*** a static module, that should work as long as the dlopening application"
+             $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             if test -z "$global_symbol_pipe"; then
+               $echo
+               $echo "*** However, this would only work if libtool was able to extract symbol"
+               $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               $echo "*** not find such a program.  So, this module is probably useless."
+               $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+             fi
+             if test "$build_old_libs" = no; then
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         else
+           deplibs="$dir/$old_library $deplibs"
+           link_static=yes
+         fi
+       fi # link shared/static library?
+
+       if test "$linkmode" = lib; then
+         if test -n "$dependency_libs" &&
+            { test "$hardcode_into_libs" != yes ||
+              test "$build_old_libs" = yes ||
+              test "$link_static" = yes; }; then
+           # Extract -R from dependency_libs
+           temp_deplibs=
+           for libdir in $dependency_libs; do
+             case $libdir in
+             -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+                  case " $xrpath " in
+                  *" $temp_xrpath "*) ;;
+                  *) xrpath="$xrpath $temp_xrpath";;
+                  esac;;
+             *) temp_deplibs="$temp_deplibs $libdir";;
+             esac
+           done
+           dependency_libs="$temp_deplibs"
+         fi
+
+         newlib_search_path="$newlib_search_path $absdir"
+         # Link against this library
+         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         # ... and its dependency_libs
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           if test "X$duplicate_deps" = "Xyes" ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done
+
+         if test "$link_all_deplibs" != no; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
+             case $deplib in
+             -L*) path="$deplib" ;;
+             *.la)
+               dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+               test "X$dir" = "X$deplib" && dir="."
+               # We need an absolute path.
+               case $dir in
+               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+               *)
+                 absdir=`cd "$dir" && pwd`
+                 if test -z "$absdir"; then
+                   $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+                   absdir="$dir"
+                 fi
+                 ;;
+               esac
+               if grep "^installed=no" $deplib > /dev/null; then
+                 path="$absdir/$objdir"
+               else
+                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 if test -z "$libdir"; then
+                   $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+                   exit $EXIT_FAILURE
+                 fi
+                 if test "$absdir" != "$libdir"; then
+                   $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+                 fi
+                 path="$absdir"
+               fi
+               depdepl=
+               case $host in
+               *-*-darwin*)
+                 # we do not want to link against static libs,
+                 # but need to link against shared
+                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names" ; then
+                   for tmp in $deplibrary_names ; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$path/$depdepl" ; then
+                     depdepl="$path/$depdepl"
+                   fi
+                   # do not add paths which are already there
+                   case " $newlib_search_path " in
+                   *" $path "*) ;;
+                   *) newlib_search_path="$newlib_search_path $path";;
+                   esac
+                 fi
+                 path=""
+                 ;;
+               *)
+                 path="-L$path"
+                 ;;
+               esac
+               ;;
+             -l*)
+               case $host in
+               *-*-darwin*)
+                 # Again, we only want to link against shared libraries
+                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+                 for tmp in $newlib_search_path ; do
+                   if test -f "$tmp/lib$tmp_libs.dylib" ; then
+                     eval depdepl="$tmp/lib$tmp_libs.dylib"
+                     break
+                   fi
+                 done
+                 path=""
+                 ;;
+               *) continue ;;
+               esac
+               ;;
+             *) continue ;;
+             esac
+             case " $deplibs " in
+             *" $path "*) ;;
+             *) deplibs="$path $deplibs" ;;
+             esac
+             case " $deplibs " in
+             *" $depdepl "*) ;;
+             *) deplibs="$depdepl $deplibs" ;;
+             esac
+           done
+         fi # link_all_deplibs != no
+       fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+       # Link the dlpreopened libraries before other libraries
+       for deplib in $save_deplibs; do
+         deplibs="$deplib $deplibs"
+       done
+      fi
+      if test "$pass" != dlopen; then
+       if test "$pass" != conv; then
+         # Make sure lib_search_path contains only unique directories.
+         lib_search_path=
+         for dir in $newlib_search_path; do
+           case "$lib_search_path " in
+           *" $dir "*) ;;
+           *) lib_search_path="$lib_search_path $dir" ;;
+           esac
+         done
+         newlib_search_path=
+       fi
+
+       if test "$linkmode,$pass" != "prog,link"; then
+         vars="deplibs"
+       else
+         vars="compile_deplibs finalize_deplibs"
+       fi
+       for var in $vars dependency_libs; do
+         # Add libraries to $var in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           # FIXME: Pedantically, this is the right thing to do, so
+           #        that some nasty dependency loop isn't accidentally
+           #        broken:
+           #new_libs="$deplib $new_libs"
+           # Pragmatically, this seems to cause very few problems in
+           # practice:
+           case $deplib in
+           -L*) new_libs="$deplib $new_libs" ;;
+           -R*) ;;
+           *)
+             # And here is the reason: when a library appears more
+             # than once as an explicit dependence of a library, or
+             # is implicitly linked in more than once by the
+             # compiler, it is considered special, and multiple
+             # occurrences thereof are not removed.  Compare this
+             # with having the same library being listed as a
+             # dependency of multiple other libraries: in this case,
+             # we know (pedantically, we assume) the library does not
+             # need to be listed more than once, so we keep only the
+             # last copy.  This is not always right, but it is rare
+             # enough that we require users that really mean to play
+             # such unportable linking tricks to link the library
+             # using -Wl,-lname, so that libtool does not consider it
+             # for duplicate removal.
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case $deplib in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) tmp_libs="$tmp_libs $deplib" ;;
+             esac
+             ;;
+           *) tmp_libs="$tmp_libs $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+       case " $predeps $postdeps $compiler_lib_search_path " in
+       *" $i "*)
+         i=""
+         ;;
+       esac
+       if test -n "$i" ; then
+         tmp_libs="$tmp_libs $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+       $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+       eval shared_ext=\"$shrext_cmds\"
+       eval libname=\"$libname_spec\"
+       ;;
+      *)
+       if test "$module" = no; then
+         $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       if test "$need_lib_prefix" != no; then
+         # Add the "lib" prefix for modules if required
+         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+         eval shared_ext=\"$shrext_cmds\"
+         eval libname=\"$libname_spec\"
+       else
+         libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+       fi
+       ;;
+      esac
+
+      if test -n "$objs"; then
+       if test "$deplibs_check_method" != pass_all; then
+         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+         exit $EXIT_FAILURE
+       else
+         $echo
+         $echo "*** Warning: Linking the shared library $output against the non-libtool"
+         $echo "*** objects $objs is not portable!"
+         libobjs="$libobjs $objs"
+       fi
+      fi
+
+      if test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+       $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+       if test "$build_libtool_libs" = yes; then
+         # Building a libtool convenience library.
+         # Some compilers have problems with a `.al' extension so
+         # convenience libraries should have the same extension an
+         # archive normally would.
+         oldlibs="$output_objdir/$libname.$libext $oldlibs"
+         build_libtool_libs=convenience
+         build_old_libs=yes
+       fi
+
+       if test -n "$vinfo"; then
+         $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+       fi
+
+       if test -n "$release"; then
+         $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+       fi
+      else
+
+       # Parse the version information argument.
+       save_ifs="$IFS"; IFS=':'
+       set dummy $vinfo 0 0 0
+       IFS="$save_ifs"
+
+       if test -n "$8"; then
+         $echo "$modename: too many parameters to \`-version-info'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # convert absolute version numbers to libtool ages
+       # this retains compatibility with .la files and attempts
+       # to make the code below a bit more comprehensible
+
+       case $vinfo_number in
+       yes)
+         number_major="$2"
+         number_minor="$3"
+         number_revision="$4"
+         #
+         # There are really only two kinds -- those that
+         # use the current revision as the major version
+         # and those that subtract age and use age as
+         # a minor version.  But, then there is irix
+         # which has an extra 1 added just for fun
+         #
+         case $version_type in
+         darwin|linux|osf|windows)
+           current=`expr $number_major + $number_minor`
+           age="$number_minor"
+           revision="$number_revision"
+           ;;
+         freebsd-aout|freebsd-elf|sunos)
+           current="$number_major"
+           revision="$number_minor"
+           age="0"
+           ;;
+         irix|nonstopux)
+           current=`expr $number_major + $number_minor - 1`
+           age="$number_minor"
+           revision="$number_minor"
+           ;;
+         esac
+         ;;
+       no)
+         current="$2"
+         revision="$3"
+         age="$4"
+         ;;
+       esac
+
+       # Check that each of the things are valid numbers.
+       case $current in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       case $revision in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       case $age in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       if test "$age" -gt "$current"; then
+         $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Calculate the version variables.
+       major=
+       versuffix=
+       verstring=
+       case $version_type in
+       none) ;;
+
+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         # Darwin ld doesn't like 0 for these options...
+         minor_current=`expr $current + 1`
+         verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+         ;;
+
+       freebsd-aout)
+         major=".$current"
+         versuffix=".$current.$revision";
+         ;;
+
+       freebsd-elf)
+         major=".$current"
+         versuffix=".$current";
+         ;;
+
+       irix | nonstopux)
+         major=`expr $current - $age + 1`
+
+         case $version_type in
+           nonstopux) verstring_prefix=nonstopux ;;
+           *)         verstring_prefix=sgi ;;
+         esac
+         verstring="$verstring_prefix$major.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test "$loop" -ne 0; do
+           iface=`expr $revision - $loop`
+           loop=`expr $loop - 1`
+           verstring="$verstring_prefix$major.$iface:$verstring"
+         done
+
+         # Before this point, $major must not contain `.'.
+         major=.$major
+         versuffix="$major.$revision"
+         ;;
+
+       linux)
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         ;;
+
+       osf)
+         major=.`expr $current - $age`
+         versuffix=".$current.$age.$revision"
+         verstring="$current.$age.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$age
+         while test "$loop" -ne 0; do
+           iface=`expr $current - $loop`
+           loop=`expr $loop - 1`
+           verstring="$verstring:${iface}.0"
+         done
+
+         # Make executables depend on our current version.
+         verstring="$verstring:${current}.0"
+         ;;
+
+       sunos)
+         major=".$current"
+         versuffix=".$current.$revision"
+         ;;
+
+       windows)
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 filesystems.
+         major=`expr $current - $age`
+         versuffix="-$major"
+         ;;
+
+       *)
+         $echo "$modename: unknown library version type \`$version_type'" 1>&2
+         $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       # Clear the version info if we defaulted, and they specified a release.
+       if test -z "$vinfo" && test -n "$release"; then
+         major=
+         case $version_type in
+         darwin)
+           # we can't check for "0.0" in archive_cmds due to quoting
+           # problems, so we reset it completely
+           verstring=
+           ;;
+         *)
+           verstring="0.0"
+           ;;
+         esac
+         if test "$need_version" = no; then
+           versuffix=
+         else
+           versuffix=".0.0"
+         fi
+       fi
+
+       # Remove version info from name if versioning should be avoided
+       if test "$avoid_version" = yes && test "$need_version" = no; then
+         major=
+         versuffix=
+         verstring=""
+       fi
+
+       # Check to see if the archive will have undefined symbols.
+       if test "$allow_undefined" = yes; then
+         if test "$allow_undefined_flag" = unsupported; then
+           $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+           build_libtool_libs=no
+           build_old_libs=yes
+         fi
+       else
+         # Don't allow undefined symbols.
+         allow_undefined_flag="$no_undefined_flag"
+       fi
+      fi
+
+      if test "$mode" != relink; then
+       # Remove our outputs, but don't remove object files since they
+       # may have been created when compiling PIC objects.
+       removelist=
+       tempremovelist=`$echo "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+           *.$objext)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+              if test "X$precious_files_regex" != "X"; then
+                if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+                then
+                  continue
+                fi
+              fi
+              removelist="$removelist $p"
+              ;;
+           *) ;;
+         esac
+       done
+       if test -n "$removelist"; then
+         $show "${rm}r $removelist"
+         $run ${rm}r $removelist
+       fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+       oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+       # Transform .lo files to .o files.
+       oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+       lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+       deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+       dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      done
+
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         temp_xrpath="$temp_xrpath -R$libdir"
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+         dependency_libs="$temp_xrpath $dependency_libs"
+       fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+       case " $dlprefiles $dlfiles " in
+       *" $lib "*) ;;
+       *) dlfiles="$dlfiles $lib" ;;
+       esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+       case "$dlprefiles " in
+       *" $lib "*) ;;
+       *) dlprefiles="$dlprefiles $lib" ;;
+       esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+       if test -n "$rpath"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           deplibs="$deplibs -framework System"
+           ;;
+         *-*-netbsd*)
+           # Don't link with libc until the a.out ld.so is fixed.
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           ;;
+         *)
+           # Add libc to deplibs on all other systems if necessary.
+           if test "$build_libtool_need_lc" = "yes"; then
+             deplibs="$deplibs -lc"
+           fi
+           ;;
+         esac
+       fi
+
+       # Transform deplibs into only deplibs that can be linked in shared.
+       name_save=$name
+       libname_save=$libname
+       release_save=$release
+       versuffix_save=$versuffix
+       major_save=$major
+       # I'm not sure if I'm treating the release correctly.  I think
+       # release should show up in the -l (ie -lgmp5) so we don't want to
+       # add it in twice.  Is that correct?
+       release=""
+       versuffix=""
+       major=""
+       newdeplibs=
+       droppeddeps=no
+       case $deplibs_check_method in
+       pass_all)
+         # Don't check for shared/static.  Everything works.
+         # This might be a little naive.  We might want to check
+         # whether the library exists or not.  But this is on
+         # osf3 & osf4 and I'm not really sure... Just
+         # implementing what was already the behavior.
+         newdeplibs=$deplibs
+         ;;
+       test_compile)
+         # This code stresses the "libraries are programs" paradigm to its
+         # limits. Maybe even breaks it.  We compile a program, linking it
+         # against the deplibs as a proxy for the library.  Then we can check
+         # whether they linked in statically or dynamically with ldd.
+         $rm conftest.c
+         cat > conftest.c <<EOF
+         int main() { return 0; }
+EOF
+         $rm conftest
+         $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
+         if test "$?" -eq 0 ; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             name=`expr $i : '-l\(.*\)'`
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" -ne "0"; then
+               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                 case " $predeps $postdeps " in
+                 *" $i "*)
+                   newdeplibs="$newdeplibs $i"
+                   i=""
+                   ;;
+                 esac
+               fi
+               if test -n "$i" ; then
+                 libname=`eval \\$echo \"$libname_spec\"`
+                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                 set dummy $deplib_matches
+                 deplib_match=$2
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   newdeplibs="$newdeplibs $i"
+                 else
+                   droppeddeps=yes
+                   $echo
+                   $echo "*** Warning: dynamic linker does not accept needed library $i."
+                   $echo "*** I have the capability to make that library automatically link in when"
+                   $echo "*** you link to this library.  But I can only do this if you have a"
+                   $echo "*** shared version of the library, which I believe you do not have"
+                   $echo "*** because a test_compile did reveal that the linker did not use it for"
+                   $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+                 fi
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         else
+           # Error occurred in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             name=`expr $i : '-l\(.*\)'`
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+               $rm conftest
+               $LTCC $LTCFLAGS -o conftest conftest.c $i
+               # Did it work?
+               if test "$?" -eq 0 ; then
+                 ldd_output=`ldd conftest`
+                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                   case " $predeps $postdeps " in
+                   *" $i "*)
+                     newdeplibs="$newdeplibs $i"
+                     i=""
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i" ; then
+                   libname=`eval \\$echo \"$libname_spec\"`
+                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                   set dummy $deplib_matches
+                   deplib_match=$2
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                     newdeplibs="$newdeplibs $i"
+                   else
+                     droppeddeps=yes
+                     $echo
+                     $echo "*** Warning: dynamic linker does not accept needed library $i."
+                     $echo "*** I have the capability to make that library automatically link in when"
+                     $echo "*** you link to this library.  But I can only do this if you have a"
+                     $echo "*** shared version of the library, which you do not appear to have"
+                     $echo "*** because a test_compile did reveal that the linker did not use this one"
+                     $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+                   fi
+                 fi
+               else
+                 droppeddeps=yes
+                 $echo
+                 $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+                 $echo "***  make it link in!  You will probably need to install it or some"
+                 $echo "*** library that it depends on before this library will be fully"
+                 $echo "*** functional.  Installing it before continuing would be even better."
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method
+         file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+         for a_deplib in $deplibs; do
+           name=`expr $a_deplib : '-l\(.*\)'`
+           # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                     # Follow soft links.
+                     if ls -lLd "$potent_lib" 2>/dev/null \
+                        | grep " -> " >/dev/null; then
+                       continue
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib="$potent_lib"
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       case $potliblink in
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+                       *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+                       esac
+                     done
+                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+                        | ${SED} 10q \
+                        | $EGREP "$file_magic_regex" > /dev/null; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $echo
+               $echo "*** Warning: linker path does not have real file for library $a_deplib."
+               $echo "*** I have the capability to make that library automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if you have a"
+               $echo "*** shared version of the library, which you do not appear to have"
+               $echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $echo "*** with $libname but no candidates were found. (...for file magic test)"
+               else
+                 $echo "*** with $libname and none of the candidates passed a file format test"
+                 $echo "*** using a file magic. Last file checked: $potlib"
+               fi
+             fi
+           else
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+           fi
+         done # Gone through all deplibs.
+         ;;
+       match_pattern*)
+         set dummy $deplibs_check_method
+         match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+         for a_deplib in $deplibs; do
+           name=`expr $a_deplib : '-l\(.*\)'`
+           # If $name is empty we are operating on a -L argument.
+           if test -n "$name" && test "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib="$potent_lib" # see symlink-check above in file_magic test
+                   if eval $echo \"$potent_lib\" 2>/dev/null \
+                       | ${SED} 10q \
+                       | $EGREP "$match_pattern_regex" > /dev/null; then
+                     newdeplibs="$newdeplibs $a_deplib"
+                     a_deplib=""
+                     break 2
+                   fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $echo
+               $echo "*** Warning: linker path does not have real file for library $a_deplib."
+               $echo "*** I have the capability to make that library automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if you have a"
+               $echo "*** shared version of the library, which you do not appear to have"
+               $echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+               else
+                 $echo "*** with $libname and none of the candidates passed a file format test"
+                 $echo "*** using a regex pattern. Last file checked: $potlib"
+               fi
+             fi
+           else
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+           fi
+         done # Gone through all deplibs.
+         ;;
+       none | unknown | *)
+         newdeplibs=""
+         tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+           -e 's/ -[LR][^ ]*//g'`
+         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+           for i in $predeps $postdeps ; do
+             # can't use Xsed below, because $i might contain '/'
+             tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+           done
+         fi
+         if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
+           | grep . >/dev/null; then
+           $echo
+           if test "X$deplibs_check_method" = "Xnone"; then
+             $echo "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             $echo "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           $echo "*** All declared inter-library dependencies are being dropped."
+           droppeddeps=yes
+         fi
+         ;;
+       esac
+       versuffix=$versuffix_save
+       major=$major_save
+       release=$release_save
+       libname=$libname_save
+       name=$name_save
+
+       case $host in
+       *-*-rhapsody* | *-*-darwin1.[012])
+         # On Rhapsody replace the C library is the System framework
+         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+         ;;
+       esac
+
+       if test "$droppeddeps" = yes; then
+         if test "$module" = yes; then
+           $echo
+           $echo "*** Warning: libtool could not satisfy all declared inter-library"
+           $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+           $echo "*** a static module, that should work as long as the dlopening"
+           $echo "*** application is linked with the -dlopen flag."
+           if test -z "$global_symbol_pipe"; then
+             $echo
+             $echo "*** However, this would only work if libtool was able to extract symbol"
+             $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             $echo "*** not find such a program.  So, this module is probably useless."
+             $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+           fi
+           if test "$build_old_libs" = no; then
+             oldlibs="$output_objdir/$libname.$libext"
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+         else
+           $echo "*** The inter-library dependencies that have been dropped here will be"
+           $echo "*** automatically added whenever a program is linked with this library"
+           $echo "*** or is declared to -dlopen it."
+
+           if test "$allow_undefined" = no; then
+             $echo
+             $echo "*** Since this library must not contain undefined symbols,"
+             $echo "*** because either the platform does not support them or"
+             $echo "*** it was explicitly requested with -no-undefined,"
+             $echo "*** libtool will only create a static version of it."
+             if test "$build_old_libs" = no; then
+               oldlibs="$output_objdir/$libname.$libext"
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         fi
+       fi
+       # Done checking deplibs!
+       deplibs=$newdeplibs
+      fi
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      deplibs="$new_libs"
+
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+       if test "$hardcode_into_libs" = yes; then
+         # Hardcode the library paths
+         hardcode_libdirs=
+         dep_rpath=
+         rpath="$finalize_rpath"
+         test "$mode" != relink && rpath="$compile_rpath$rpath"
+         for libdir in $rpath; do
+           if test -n "$hardcode_libdir_flag_spec"; then
+             if test -n "$hardcode_libdir_separator"; then
+               if test -z "$hardcode_libdirs"; then
+                 hardcode_libdirs="$libdir"
+               else
+                 # Just accumulate the unique libdirs.
+                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                   ;;
+                 *)
+                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+                   ;;
+                 esac
+               fi
+             else
+               eval flag=\"$hardcode_libdir_flag_spec\"
+               dep_rpath="$dep_rpath $flag"
+             fi
+           elif test -n "$runpath_var"; then
+             case "$perm_rpath " in
+             *" $libdir "*) ;;
+             *) perm_rpath="$perm_rpath $libdir" ;;
+             esac
+           fi
+         done
+         # Substitute the hardcoded libdirs into the rpath.
+         if test -n "$hardcode_libdir_separator" &&
+            test -n "$hardcode_libdirs"; then
+           libdir="$hardcode_libdirs"
+           if test -n "$hardcode_libdir_flag_spec_ld"; then
+             eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+           else
+             eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+           fi
+         fi
+         if test -n "$runpath_var" && test -n "$perm_rpath"; then
+           # We should set the runpath_var.
+           rpath=
+           for dir in $perm_rpath; do
+             rpath="$rpath$dir:"
+           done
+           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+         fi
+         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+       fi
+
+       shlibpath="$finalize_shlibpath"
+       test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+       if test -n "$shlibpath"; then
+         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+       fi
+
+       # Get the real and link names of the library.
+       eval shared_ext=\"$shrext_cmds\"
+       eval library_names=\"$library_names_spec\"
+       set dummy $library_names
+       realname="$2"
+       shift; shift
+
+       if test -n "$soname_spec"; then
+         eval soname=\"$soname_spec\"
+       else
+         soname="$realname"
+       fi
+       if test -z "$dlname"; then
+         dlname=$soname
+       fi
+
+       lib="$output_objdir/$realname"
+       linknames=
+       for link
+       do
+         linknames="$linknames $link"
+       done
+
+       # Use standard objects if they are pic
+       test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $run $rm $export_symbols
+           cmds=$export_symbols_cmds
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             IFS="$save_ifs"
+             eval cmd=\"$cmd\"
+             if len=`expr "X$cmd" : ".*"` &&
+              test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+               skipped_export=false
+             else
+               # The command line is too long to execute in one step.
+               $show "using reloadable object file for export list..."
+               skipped_export=:
+               # Break out early, otherwise skipped_export may be
+               # set to false by a later but shorter cmd.
+               break
+             fi
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex"; then
+             $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+             $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+             $run eval '$mv "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+       fi
+
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+               case " $convenience " in
+               *" $test_deplib "*) ;;
+               *)
+                       tmp_deplibs="$tmp_deplibs $test_deplib"
+                       ;;
+               esac
+       done
+       deplibs="$tmp_deplibs"
+
+       if test -n "$convenience"; then
+         if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         else
+           gentop="$output_objdir/${outputname}x"
+           generated="$generated $gentop"
+
+           func_extract_archives $gentop $convenience
+           libobjs="$libobjs $func_extract_archives_result"
+         fi
+       fi
+       
+       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+         eval flag=\"$thread_safe_flag_spec\"
+         linker_flags="$linker_flags $flag"
+       fi
+
+       # Make a backup of the uninstalled library when relinking
+       if test "$mode" = relink; then
+         $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+       fi
+
+       # Do each of the archive commands.
+       if test "$module" = yes && test -n "$module_cmds" ; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval test_cmds=\"$module_expsym_cmds\"
+           cmds=$module_expsym_cmds
+         else
+           eval test_cmds=\"$module_cmds\"
+           cmds=$module_cmds
+         fi
+       else
+       if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+         eval test_cmds=\"$archive_expsym_cmds\"
+         cmds=$archive_expsym_cmds
+       else
+         eval test_cmds=\"$archive_cmds\"
+         cmds=$archive_cmds
+         fi
+       fi
+
+       if test "X$skipped_export" != "X:" &&
+          len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+          test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         :
+       else
+         # The command line is too long to link in one step, link piecewise.
+         $echo "creating reloadable object files..."
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
+         save_output=$output
+         output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
+         test_cmds=
+         concat_cmds=
+         objlist=
+         delfiles=
+         last_robj=
+         k=1
+         output=$output_objdir/$output_la-${k}.$objext
+         # Loop over the list of objects to be linked.
+         for obj in $save_libobjs
+         do
+           eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+           if test "X$objlist" = X ||
+              { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+                test "$len" -le "$max_cmd_len"; }; then
+             objlist="$objlist $obj"
+           else
+             # The command $test_cmds is almost too long, add a
+             # command to the queue.
+             if test "$k" -eq 1 ; then
+               # The first file doesn't have a previous command to add.
+               eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+             else
+               # All subsequent reloadable object files will link in
+               # the last one created.
+               eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+             fi
+             last_robj=$output_objdir/$output_la-${k}.$objext
+             k=`expr $k + 1`
+             output=$output_objdir/$output_la-${k}.$objext
+             objlist=$obj
+             len=1
+           fi
+         done
+         # Handle the remaining objects by creating one last
+         # reloadable object file.  All subsequent reloadable object
+         # files will link in the last one created.
+         test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+         eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+         if ${skipped_export-false}; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $run $rm $export_symbols
+           libobjs=$output
+           # Append the command to create the export file.
+           eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+         # Set up a command to remove the reloadable object files
+         # after they are used.
+         i=0
+         while test "$i" -lt "$k"
+         do
+           i=`expr $i + 1`
+           delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+         done
+
+         $echo "creating a temporary reloadable object file: $output"
+
+         # Loop through the commands generated above and execute them.
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $concat_cmds; do
+           IFS="$save_ifs"
+           $show "$cmd"
+           $run eval "$cmd" || exit $?
+         done
+         IFS="$save_ifs"
+
+         libobjs=$output
+         # Restore the value of output.
+         output=$save_output
+
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
+         # Do each of the archive commands.
+         if test "$module" = yes && test -n "$module_cmds" ; then
+           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+             cmds=$module_expsym_cmds
+           else
+             cmds=$module_cmds
+           fi
+         else
+         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+           cmds=$archive_expsym_cmds
+         else
+           cmds=$archive_cmds
+           fi
+         fi
+
+         # Append the command to remove the reloadable object files
+         # to the just-reset $cmds.
+         eval cmds=\"\$cmds~\$rm $delfiles\"
+       fi
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test "$mode" = relink; then
+             $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+           fi
+
+           exit $lt_exit
+         }
+       done
+       IFS="$save_ifs"
+
+       # Restore the uninstalled library and exit
+       if test "$mode" = relink; then
+         $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             $show "${rm}r $gentop"
+             $run ${rm}r "$gentop"
+           fi
+         fi
+
+         exit $EXIT_SUCCESS
+       fi
+
+       # Create links to the real library.
+       for linkname in $linknames; do
+         if test "$realname" != "$linkname"; then
+           $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+           $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+         fi
+       done
+
+       # If -module or -export-dynamic was specified, set the dlname.
+       if test "$module" = yes || test "$export_dynamic" = yes; then
+         # On all known operating systems, these are identical.
+         dlname="$soname"
+       fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+       if test -n "$objs$old_deplibs"; then
+         $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       libobj="$output"
+       obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+       ;;
+      *)
+       libobj=
+       obj="$output"
+       ;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+       if test -n "$whole_archive_flag_spec"; then
+         eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+       else
+         gentop="$output_objdir/${obj}x"
+         generated="$generated $gentop"
+
+         func_extract_archives $gentop $convenience
+         reload_conv_objs="$reload_objs $func_extract_archives_result"
+       fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       eval cmd=\"$cmd\"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+       if test -n "$gentop"; then
+         $show "${rm}r $gentop"
+         $run ${rm}r $gentop
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+       if test -n "$gentop"; then
+         $show "${rm}r $gentop"
+         $run ${rm}r $gentop
+       fi
+
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       # $show "echo timestamp > $libobj"
+       # $run eval "echo timestamp > $libobj" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs $reload_conv_objs"
+       output="$libobj"
+       cmds=$reload_cmds
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd" || exit $?
+       done
+       IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+       $show "${rm}r $gentop"
+       $run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+       *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+       if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+          test "$dlopen_self_static" = unknown; then
+         $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+       fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+       # On Rhapsody replace the C library is the System framework
+       compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       ;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $compile_deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $compile_deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       for libdir in $rpath $xrpath; do
+         # This is the magic to use -rpath.
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$perm_rpath " in
+         *" $libdir "*) ;;
+         *) perm_rpath="$perm_rpath $libdir" ;;
+         esac
+       fi
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$libdir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+       esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$finalize_perm_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+         esac
+       fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+       # Transform all the library objects into standard objects.
+       compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       if test -n "$NM" && test -n "$global_symbol_pipe"; then
+         dlsyms="${outputname}S.c"
+       else
+         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+       fi
+      fi
+
+      if test -n "$dlsyms"; then
+       case $dlsyms in
+       "") ;;
+       *.c)
+         # Discover the nlist of each of the dlfiles.
+         nlist="$output_objdir/${outputname}.nm"
+
+         $show "$rm $nlist ${nlist}S ${nlist}T"
+         $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+         # Parse the name list into a source file.
+         $show "creating $output_objdir/$dlsyms"
+
+         test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+         if test "$dlself" = yes; then
+           $show "generating symbol list for \`$output'"
+
+           test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+           # Add our own program objects to the symbol list.
+           progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+           for arg in $progfiles; do
+             $show "extracting global C symbols from \`$arg'"
+             $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+           done
+
+           if test -n "$exclude_expsyms"; then
+             $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             $run eval '$mv "$nlist"T "$nlist"'
+           fi
+
+           if test -n "$export_symbols_regex"; then
+             $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             $run eval '$mv "$nlist"T "$nlist"'
+           fi
+
+           # Prepare the list of exported symbols
+           if test -z "$export_symbols"; then
+             export_symbols="$output_objdir/$outputname.exp"
+             $run $rm $export_symbols
+             $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+              case $host in
+              *cygwin* | *mingw* )
+               $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+               $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+           else
+             $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+             $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+             $run eval 'mv "$nlist"T "$nlist"'
+              case $host in
+              *cygwin* | *mingw* )
+               $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+               $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+           fi
+         fi
+
+         for arg in $dlprefiles; do
+           $show "extracting global C symbols from \`$arg'"
+           name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+           $run eval '$echo ": $name " >> "$nlist"'
+           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+         done
+
+         if test -z "$run"; then
+           # Make sure we have at least an empty file.
+           test -f "$nlist" || : > "$nlist"
+
+           if test -n "$exclude_expsyms"; then
+             $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+             $mv "$nlist"T "$nlist"
+           fi
+
+           # Try sorting and uniquifying the output.
+           if grep -v "^: " < "$nlist" |
+               if sort -k 3 </dev/null >/dev/null 2>&1; then
+                 sort -k 3
+               else
+                 sort +2
+               fi |
+               uniq > "$nlist"S; then
+             :
+           else
+             grep -v "^: " < "$nlist" > "$nlist"S
+           fi
+
+           if test -f "$nlist"S; then
+             eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+           else
+             $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+           fi
+
+           $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+           case $host in
+           *cygwin* | *mingw* )
+         $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs */
+struct {
+"
+             ;;
+           * )
+         $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+             ;;
+           esac
+
+
+         $echo >> "$output_objdir/$dlsyms" "\
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+           $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+         fi
+
+         pic_flag_for_symtable=
+         case $host in
+         # compiling the symbol table file with pic_flag works around
+         # a FreeBSD bug that causes programs to crash when -lm is
+         # linked before any other PIC object.  But we must not use
+         # pic_flag when linking with -static.  The problem exists in
+         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+           esac;;
+         *-*-hpux*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag";;
+           esac
+         esac
+
+         # Now compile the dynamic symbol file.
+         $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+         $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+         # Clean up the generated files.
+         $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+         $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+         # Transform the symbol file into the correct name.
+          case $host in
+          *cygwin* | *mingw* )
+            if test -f "$output_objdir/${outputname}.def" ; then
+              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+            else
+              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+             fi
+            ;;
+          * )
+            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            ;;
+          esac
+         ;;
+       *)
+         $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+      else
+       # We keep going just in case the user didn't refer to
+       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+       # really was required.
+
+       # Nullify the symbol file.
+       compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+       # Replace the output file specification.
+       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       link_command="$compile_command$compile_rpath"
+
+       # We have no uninstalled library dependencies, so finalize right now.
+       $show "$link_command"
+       $run eval "$link_command"
+       exit_status=$?
+
+       # Delete the generated files.
+       if test -n "$dlsyms"; then
+         $show "$rm $output_objdir/${outputname}S.${objext}"
+         $run $rm "$output_objdir/${outputname}S.${objext}"
+       fi
+
+       exit $exit_status
+      fi
+
+      if test -n "$shlibpath_var"; then
+       # We should set the shlibpath_var
+       rpath=
+       for dir in $temp_rpath; do
+         case $dir in
+         [\\/]* | [A-Za-z]:[\\/]*)
+           # Absolute path.
+           rpath="$rpath$dir:"
+           ;;
+         *)
+           # Relative path: add a thisdir entry.
+           rpath="$rpath\$thisdir/$dir:"
+           ;;
+         esac
+       done
+       temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+       if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+       if test -n "$finalize_perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $finalize_perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+      fi
+
+      if test "$no_install" = yes; then
+       # We don't need to create a wrapper script.
+       link_command="$compile_var$compile_command$compile_rpath"
+       # Replace the output file specification.
+       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       # Delete the old output file.
+       $run $rm $output
+       # Link the executable and exit
+       $show "$link_command"
+       $run eval "$link_command" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+       # Fast installation is not supported
+       link_command="$compile_var$compile_command$compile_rpath"
+       relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+       $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+       $echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+       if test "$fast_install" != no; then
+         link_command="$finalize_var$compile_command$finalize_rpath"
+         if test "$fast_install" = yes; then
+           relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+         else
+           # fast_install is set to needless
+           relink_command=
+         fi
+       else
+         link_command="$compile_var$compile_command$compile_rpath"
+         relink_command="$finalize_var$finalize_command$finalize_rpath"
+       fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+       # Preserve any variables that may affect compiler behavior
+       for var in $variables_saved_for_relink; do
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+           relink_command="$var=\"$var_value\"; export $var; $relink_command"
+         fi
+       done
+       relink_command="(cd `pwd`; $relink_command)"
+       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+       case $progpath in
+       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+       esac
+       qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+       # win32 will think the script is a binary if it has
+       # a .exe suffix, so we strip it off here.
+       case $output in
+         *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+       esac
+       # test for cygwin because mv fails w/o .exe extensions
+       case $host in
+         *cygwin*)
+           exeext=.exe
+           outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+         *) exeext= ;;
+       esac
+       case $host in
+         *cygwin* | *mingw* )
+            output_name=`basename $output`
+            output_path=`dirname $output`
+            cwrappersource="$output_path/$objdir/lt-$output_name.c"
+            cwrapper="$output_path/$output_name.exe"
+            $rm $cwrappersource $cwrapper
+            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+           cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+           cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS.  */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int    check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  DEBUG("(main) argv[0]      : %s\n",argv[0]);
+  DEBUG("(main) program_name : %s\n",program_name);
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+            cat >> $cwrappersource <<EOF
+  newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+            cat >> $cwrappersource <<"EOF"
+  newargz[1] = find_executable(argv[0]);
+  if (newargz[1] == NULL)
+    lt_fatal("Couldn't find %s", argv[0]);
+  DEBUG("(main) found exe at : %s\n",newargz[1]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+
+  for (i=0; i<argc+1; i++)
+  {
+    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
+    ;
+  }
+
+EOF
+
+            case $host_os in
+              mingw*)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",(char const **)newargz);
+EOF
+              ;;
+              *)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+              ;;
+            esac
+
+            cat >> $cwrappersource <<"EOF"
+  return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable(const char * path)
+{
+  struct stat st;
+
+  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0) &&
+      (
+        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+       ((st.st_mode & S_IXUSR) == S_IXUSR))
+      )
+    return 1;
+  else
+    return 0;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+  int has_slash = 0;
+  const char* p;
+  const char* p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char* concat_name;
+
+  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+  {
+    concat_name = xstrdup (wrapper);
+    if (check_executable(concat_name))
+      return concat_name;
+    XFREE(concat_name);
+  }
+  else
+  {
+#endif
+    if (IS_DIR_SEPARATOR (wrapper[0]))
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable(concat_name))
+        return concat_name;
+      XFREE(concat_name);
+    }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+    {
+      has_slash = 1;
+      break;
+    }
+  if (!has_slash)
+  {
+    /* no slashes; search PATH */
+    const char* path = getenv ("PATH");
+    if (path != NULL)
+    {
+      for (p = path; *p; p = p_next)
+      {
+        const char* q;
+        size_t p_len;
+        for (q = p; *q; q++)
+          if (IS_PATH_SEPARATOR(*q))
+            break;
+        p_len = q - p;
+        p_next = (*q == '\0' ? q : q + 1);
+        if (p_len == 0)
+        {
+          /* empty path: current directory */
+          if (getcwd (tmp, LT_PATHMAX) == NULL)
+            lt_fatal ("getcwd failed");
+          tmp_len = strlen(tmp);
+          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, tmp, tmp_len);
+          concat_name[tmp_len] = '/';
+          strcpy (concat_name + tmp_len + 1, wrapper);
+        }
+        else
+        {
+          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, p, p_len);
+          concat_name[p_len] = '/';
+          strcpy (concat_name + p_len + 1, wrapper);
+        }
+        if (check_executable(concat_name))
+          return concat_name;
+        XFREE(concat_name);
+      }
+    }
+    /* not found in PATH; assume curdir */
+  }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen(tmp);
+  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable(concat_name))
+    return concat_name;
+  XFREE(concat_name);
+  return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+          # we should really use a build-platform specific compiler
+          # here, but OTOH, the wrappers (shell script and this C one)
+          # are only useful if you want to execute the "real" binary.
+          # Since the "real" binary is built for $host, then this
+          # wrapper might as well be built for $host, too.
+          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+          ;;
+        esac
+        $rm $output
+        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+       $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+       $echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+       if test "$fast_install" = yes; then
+         $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+         $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+       $echo \"\$relink_command_output\" >&2
+       $rm \"\$progdir/\$file\"
+       exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+       else
+         $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+       fi
+
+       $echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+       # Export our shlibpath_var if we have one.
+       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+         $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+       fi
+
+       # fixup the dll searchpath if we need to.
+       if test -n "$dllsearchpath"; then
+         $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+       fi
+
+       $echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+       case $host in
+       # Backslashes separate directories on plain windows
+       *-*-mingw | *-*-os2*)
+         $echo >> $output "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+         ;;
+
+       *)
+         $echo >> $output "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+         ;;
+       esac
+       $echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+       chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+       oldobjs="$libobjs_save"
+       addlibs="$convenience"
+       build_libtool_libs=no
+      else
+       if test "$build_libtool_libs" = module; then
+         oldobjs="$libobjs_save"
+         build_libtool_libs=no
+       else
+         oldobjs="$old_deplibs $non_pic_objects"
+       fi
+       addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+       gentop="$output_objdir/${outputname}x"
+       generated="$generated $gentop"
+
+       func_extract_archives $gentop $addlibs
+       oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+       # POSIX demands no paths to be encoded in archives.  We have
+       # to avoid creating archives with duplicate basenames if we
+       # might have to extract them afterwards, e.g., when creating a
+       # static archive out of a convenience library, or when linking
+       # the entirety of a libtool archive into another (currently
+       # not supported by libtool).
+       if (for obj in $oldobjs
+           do
+             $echo "X$obj" | $Xsed -e 's%^.*/%%'
+           done | sort | sort -uc >/dev/null 2>&1); then
+         :
+       else
+         $echo "copying selected object files to avoid basename conflicts..."
+
+         if test -z "$gentop"; then
+           gentop="$output_objdir/${outputname}x"
+           generated="$generated $gentop"
+
+           $show "${rm}r $gentop"
+           $run ${rm}r "$gentop"
+           $show "$mkdir $gentop"
+           $run $mkdir "$gentop"
+           exit_status=$?
+           if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+             exit $exit_status
+           fi
+         fi
+
+         save_oldobjs=$oldobjs
+         oldobjs=
+         counter=1
+         for obj in $save_oldobjs
+         do
+           objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+           case " $oldobjs " in
+           " ") oldobjs=$obj ;;
+           *[\ /]"$objbase "*)
+             while :; do
+               # Make sure we don't pick an alternate name that also
+               # overlaps.
+               newobj=lt$counter-$objbase
+               counter=`expr $counter + 1`
+               case " $oldobjs " in
+               *[\ /]"$newobj "*) ;;
+               *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+               esac
+             done
+             $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+             $run ln "$obj" "$gentop/$newobj" ||
+             $run cp "$obj" "$gentop/$newobj"
+             oldobjs="$oldobjs $gentop/$newobj"
+             ;;
+           *) oldobjs="$oldobjs $obj" ;;
+           esac
+         done
+       fi
+
+       eval cmds=\"$old_archive_cmds\"
+
+       if len=`expr "X$cmds" : ".*"` &&
+            test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         cmds=$old_archive_cmds
+       else
+         # the command line is too long to link in one step, link in parts
+         $echo "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
+         objlist=
+         concat_cmds=
+         save_oldobjs=$oldobjs
+
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done
+         for obj in $save_oldobjs
+         do
+           oldobjs="$objlist $obj"
+           objlist="$objlist $obj"
+           eval test_cmds=\"$old_archive_cmds\"
+           if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+              test "$len" -le "$max_cmd_len"; then
+             :
+           else
+             # the above command should be used before it gets too long
+             oldobjs=$objlist
+             if test "$obj" = "$last_oldobj" ; then
+               RANLIB=$save_RANLIB
+             fi
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+             objlist=
+           fi
+         done
+         RANLIB=$save_RANLIB
+         oldobjs=$objlist
+         if test "X$oldobjs" = "X" ; then
+           eval cmds=\"\$concat_cmds\"
+         else
+           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+         fi
+       fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+       IFS="$save_ifs"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+         relink_command="$var=\"$var_value\"; export $var; $relink_command"
+       fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+       relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+       for installed in no yes; do
+         if test "$installed" = yes; then
+           if test -z "$install_libdir"; then
+             break
+           fi
+           output="$output_objdir/$outputname"i
+           # Replace all uninstalled libtool libraries with the installed ones
+           newdependency_libs=
+           for deplib in $dependency_libs; do
+             case $deplib in
+             *.la)
+               name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+               if test -z "$libdir"; then
+                 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+                 exit $EXIT_FAILURE
+               fi
+               newdependency_libs="$newdependency_libs $libdir/$name"
+               ;;
+             *) newdependency_libs="$newdependency_libs $deplib" ;;
+             esac
+           done
+           dependency_libs="$newdependency_libs"
+           newdlfiles=
+           for lib in $dlfiles; do
+             name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+             eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+             if test -z "$libdir"; then
+               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+               exit $EXIT_FAILURE
+             fi
+             newdlfiles="$newdlfiles $libdir/$name"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+             eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+             if test -z "$libdir"; then
+               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+               exit $EXIT_FAILURE
+             fi
+             newdlprefiles="$newdlprefiles $libdir/$name"
+           done
+           dlprefiles="$newdlprefiles"
+         else
+           newdlfiles=
+           for lib in $dlfiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlfiles="$newdlfiles $abs"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlprefiles="$newdlprefiles $abs"
+           done
+           dlprefiles="$newdlprefiles"
+         fi
+         $rm $output
+         # place dlname in correct position for cygwin
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+         esac
+         $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+         if test "$installed" = no && test "$need_relink" = yes; then
+           $echo >> $output "\
+relink_command=\"$relink_command\""
+         fi
+       done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       arg="\"$arg\""
+       ;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \      ]*|*]*|"")
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+       files="$files $dest"
+       dest=$arg
+       continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) 
+       case " $install_prog " in
+       *[\\\ /]cp\ *) ;;
+       *) prev=$arg ;;
+       esac
+       ;;
+      -g | -m | -o) prev=$arg ;;
+      -s)
+       stripme=" -s"
+       continue
+       ;;
+      -*)
+       ;;
+      *)
+       # If the previous option needed an argument, then skip it.
+       if test -n "$prev"; then
+         prev=
+       else
+         dest=$arg
+         continue
+       fi
+       ;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       arg="\"$arg\""
+       ;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+       $echo "$modename: no file or destination specified" 1>&2
+      else
+       $echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+       $echo "$modename: \`$dest' is not a directory" 1>&2
+       $echo "$help" 1>&2
+       exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+       case $file in
+       *.lo) ;;
+       *)
+         $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+       # Do the static libraries later.
+       staticlibs="$staticlibs $file"
+       ;;
+
+      *.la)
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       library_names=
+       old_library=
+       relink_command=
+       # If there is no directory component, then add one.
+       case $file in
+       */* | *\\*) . $file ;;
+       *) . ./$file ;;
+       esac
+
+       # Add the libdir to current_libdirs if it is the destination.
+       if test "X$destdir" = "X$libdir"; then
+         case "$current_libdirs " in
+         *" $libdir "*) ;;
+         *) current_libdirs="$current_libdirs $libdir" ;;
+         esac
+       else
+         # Note the libdir as a future libdir.
+         case "$future_libdirs " in
+         *" $libdir "*) ;;
+         *) future_libdirs="$future_libdirs $libdir" ;;
+         esac
+       fi
+
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+       test "X$dir" = "X$file/" && dir=
+       dir="$dir$objdir"
+
+       if test -n "$relink_command"; then
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         if test "$inst_prefix_dir" = "$destdir"; then
+           $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+         fi
+
+         $echo "$modename: warning: relinking \`$file'" 1>&2
+         $show "$relink_command"
+         if $run eval "$relink_command"; then :
+         else
+           $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+           exit $EXIT_FAILURE
+         fi
+       fi
+
+       # See the names of the shared library.
+       set dummy $library_names
+       if test -n "$2"; then
+         realname="$2"
+         shift
+         shift
+
+         srcname="$realname"
+         test -n "$relink_command" && srcname="$realname"T
+
+         # Install the shared library and build the symlinks.
+         $show "$install_prog $dir/$srcname $destdir/$realname"
+         $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+         if test -n "$stripme" && test -n "$striplib"; then
+           $show "$striplib $destdir/$realname"
+           $run eval "$striplib $destdir/$realname" || exit $?
+         fi
+
+         if test "$#" -gt 0; then
+           # Delete the old symlinks, and create new ones.
+           # Try `ln -sf' first, because the `ln' binary might depend on
+           # the symlink we replace!  Solaris /bin/ln does not understand -f,
+           # so we also need to try rm && ln -s.
+           for linkname
+           do
+             if test "$linkname" != "$realname"; then
+                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+             fi
+           done
+         fi
+
+         # Do each command in the postinstall commands.
+         lib="$destdir/$realname"
+         cmds=$postinstall_cmds
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $cmds; do
+           IFS="$save_ifs"
+           eval cmd=\"$cmd\"
+           $show "$cmd"
+           $run eval "$cmd" || {
+             lt_exit=$?
+
+             # Restore the uninstalled library and exit
+             if test "$mode" = relink; then
+               $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+             fi
+
+             exit $lt_exit
+           }
+         done
+         IFS="$save_ifs"
+       fi
+
+       # Install the pseudo-library for information purposes.
+       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+       instname="$dir/$name"i
+       $show "$install_prog $instname $destdir/$name"
+       $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+       # Maybe install the static library, too.
+       test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+       ;;
+
+      *.lo)
+       # Install (i.e. copy) a libtool object.
+
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+         destfile="$destdir/$destfile"
+       fi
+
+       # Deduce the name of the destination old-style object file.
+       case $destfile in
+       *.lo)
+         staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+         ;;
+       *.$objext)
+         staticdest="$destfile"
+         destfile=
+         ;;
+       *)
+         $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       # Install the libtool object if requested.
+       if test -n "$destfile"; then
+         $show "$install_prog $file $destfile"
+         $run eval "$install_prog $file $destfile" || exit $?
+       fi
+
+       # Install the old object if enabled.
+       if test "$build_old_libs" = yes; then
+         # Deduce the name of the old-style object file.
+         staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+         $show "$install_prog $staticobj $staticdest"
+         $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+       fi
+       exit $EXIT_SUCCESS
+       ;;
+
+      *)
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+         destfile="$destdir/$destfile"
+       fi
+
+       # If the file is missing, and there is a .exe on the end, strip it
+       # because it is most likely a libtool script we actually want to
+       # install
+       stripped_ext=""
+       case $file in
+         *.exe)
+           if test ! -f "$file"; then
+             file=`$echo $file|${SED} 's,.exe$,,'`
+             stripped_ext=".exe"
+           fi
+           ;;
+       esac
+
+       # Do a test to see if this is really a libtool program.
+       case $host in
+       *cygwin*|*mingw*)
+           wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+           ;;
+       *)
+           wrapper=$file
+           ;;
+       esac
+       if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+         notinst_deplibs=
+         relink_command=
+
+         # Note that it is not necessary on cygwin/mingw to append a dot to
+         # foo even if both foo and FILE.exe exist: automatic-append-.exe
+         # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+         # `FILE.' does not work on cygwin managed mounts.
+         #
+         # If there is no directory component, then add one.
+         case $wrapper in
+         */* | *\\*) . ${wrapper} ;;
+         *) . ./${wrapper} ;;
+         esac
+
+         # Check the variables that should have been set.
+         if test -z "$notinst_deplibs"; then
+           $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         finalize=yes
+         for lib in $notinst_deplibs; do
+           # Check to see that each library is installed.
+           libdir=
+           if test -f "$lib"; then
+             # If there is no directory component, then add one.
+             case $lib in
+             */* | *\\*) . $lib ;;
+             *) . ./$lib ;;
+             esac
+           fi
+           libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           if test -n "$libdir" && test ! -f "$libfile"; then
+             $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+             finalize=no
+           fi
+         done
+
+         relink_command=
+         # Note that it is not necessary on cygwin/mingw to append a dot to
+         # foo even if both foo and FILE.exe exist: automatic-append-.exe
+         # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+         # `FILE.' does not work on cygwin managed mounts.
+         #
+         # If there is no directory component, then add one.
+         case $wrapper in
+         */* | *\\*) . ${wrapper} ;;
+         *) . ./${wrapper} ;;
+         esac
+
+         outputname=
+         if test "$fast_install" = no && test -n "$relink_command"; then
+           if test "$finalize" = yes && test -z "$run"; then
+             tmpdir=`func_mktempdir`
+             file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+             outputname="$tmpdir/$file"
+             # Replace the output file specification.
+             relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+             $show "$relink_command"
+             if $run eval "$relink_command"; then :
+             else
+               $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+               ${rm}r "$tmpdir"
+               continue
+             fi
+             file="$outputname"
+           else
+             $echo "$modename: warning: cannot relink \`$file'" 1>&2
+           fi
+         else
+           # Install the binary that we compiled earlier.
+           file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+         fi
+       fi
+
+       # remove .exe since cygwin /usr/bin/install will append another
+       # one anyway 
+       case $install_prog,$host in
+       */usr/bin/install*,*cygwin*)
+         case $file:$destfile in
+         *.exe:*.exe)
+           # this is ok
+           ;;
+         *.exe:*)
+           destfile=$destfile.exe
+           ;;
+         *:*.exe)
+           destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+           ;;
+         esac
+         ;;
+       esac
+       $show "$install_prog$stripme $file $destfile"
+       $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+       test -n "$outputname" && ${rm}r "$tmpdir"
+       ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+       $show "$old_striplib $oldlib"
+       $run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       eval cmd=\"$cmd\"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+       libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+       if test -n "$finish_cmds"; then
+         # Do each command in the finish commands.
+         cmds=$finish_cmds
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $cmds; do
+           IFS="$save_ifs"
+           eval cmd=\"$cmd\"
+           $show "$cmd"
+           $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+         done
+         IFS="$save_ifs"
+       fi
+       if test -n "$finish_eval"; then
+         # Do the single finish_eval.
+         eval cmds=\"$finish_eval\"
+         $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+       fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+       $echo "$modename: \`$file' is not a file" 1>&2
+       $echo "$help" 1>&2
+       exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Read the libtool library.
+       dlname=
+       library_names=
+
+       # If there is no directory component, then add one.
+       case $file in
+       */* | *\\*) . $file ;;
+       *) . ./$file ;;
+       esac
+
+       # Skip this library if it cannot be dlopened.
+       if test -z "$dlname"; then
+         # Warn if it was a shared library.
+         test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+         continue
+       fi
+
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$file" && dir=.
+
+       if test -f "$dir/$objdir/$dlname"; then
+         dir="$dir/$objdir"
+       else
+         $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       ;;
+
+      *.lo)
+       # Just add the directory containing the .lo file.
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$file" && dir=.
+       ;;
+
+      *)
+       $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+       continue
+       ;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+       eval "$shlibpath_var=\"\$dir\""
+      else
+       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+       # Do a test to see if this is really a libtool program.
+       if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         # If there is no directory component, then add one.
+         case $file in
+         */* | *\\*) . $file ;;
+         *) . ./$file ;;
+         esac
+
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       fi
+       ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+       # Export the shlibpath_var.
+       eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      if test "${save_LC_ALL+set}" = set; then
+       LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+       LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+       $echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+       dir=.
+       objdir="$origobjdir"
+      else
+       objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+       case " $rmdirs " in
+         *" $objdir "*) ;;
+         *) rmdirs="$rmdirs $objdir" ;;
+       esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+       || (test -h "$file") >/dev/null 2>&1 \
+       || test -f "$file"; then
+       :
+      elif test -d "$file"; then
+       exit_status=1
+       continue
+      elif test "$rmforce" = yes; then
+       continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+       # Possibly a libtool archive, so verify it.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         . $dir/$name
+
+         # Delete the libtool libraries and symlinks.
+         for n in $library_names; do
+           rmfiles="$rmfiles $objdir/$n"
+         done
+         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+         case "$mode" in
+         clean)
+           case "  $library_names " in
+           # "  " in the beginning catches empty $dlname
+           *" $dlname "*) ;;
+           *) rmfiles="$rmfiles $objdir/$dlname" ;;
+           esac
+            test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+           ;;
+         uninstall)
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             cmds=$postuninstall_cmds
+             save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd"
+               if test "$?" -ne 0 && test "$rmforce" != yes; then
+                 exit_status=1
+               fi
+             done
+             IFS="$save_ifs"
+           fi
+
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             cmds=$old_postuninstall_cmds
+             save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd"
+               if test "$?" -ne 0 && test "$rmforce" != yes; then
+                 exit_status=1
+               fi
+             done
+             IFS="$save_ifs"
+           fi
+           # FIXME: should reinstall the best remaining shared library.
+           ;;
+         esac
+       fi
+       ;;
+
+      *.lo)
+       # Possibly a libtool object, so verify it.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+         # Read the .lo file
+         . $dir/$name
+
+         # Add PIC object to the list of files to remove.
+         if test -n "$pic_object" \
+            && test "$pic_object" != none; then
+           rmfiles="$rmfiles $dir/$pic_object"
+         fi
+
+         # Add non-PIC object to the list of files to remove.
+         if test -n "$non_pic_object" \
+            && test "$non_pic_object" != none; then
+           rmfiles="$rmfiles $dir/$non_pic_object"
+         fi
+       fi
+       ;;
+
+      *)
+       if test "$mode" = clean ; then
+         noexename=$name
+         case $file in
+         *.exe)
+           file=`$echo $file|${SED} 's,.exe$,,'`
+           noexename=`$echo $name|${SED} 's,.exe$,,'`
+           # $file with .exe has already been added to rmfiles,
+           # add $file without .exe
+           rmfiles="$rmfiles $file"
+           ;;
+         esac
+         # Do a test to see if this is a libtool program.
+         if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+           relink_command=
+           . $dir/$noexename
+
+           # note $name still contains .exe if it was in $file originally
+           # as does the version of $file that was added into $rmfiles
+           rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+           if test "$fast_install" = yes && test -n "$relink_command"; then
+             rmfiles="$rmfiles $objdir/lt-$name"
+           fi
+           if test "X$noexename" != "X$name" ; then
+             rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+           fi
+         fi
+       fi
+       ;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+       $show "rmdir $dir"
+       $run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                   try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                   try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                   specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/missing b/missing
new file mode 100755 (executable)
index 0000000..894e786
--- /dev/null
+++ b/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/packages/ti/ipc/GateMP.h b/packages/ti/ipc/GateMP.h
new file mode 100644 (file)
index 0000000..ed86259
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       GateMP.h
+ *
+ *  @brief      Multiple processor gate that provides local and remote context
+ *              protection.
+ *
+ *  A GateMP instance can be used to enforce both local and remote context
+ *  context protection.  That is, entering a GateMP can prevent preemption by
+ *  another thread running on the same processor and simultaneously prevent a
+ *  remote processor from entering the same gate.  GateMP's are typically used
+ *  to protect reads/writes to a shared resource, such as shared memory.
+ *
+ *  Creating a GateMP requires supplying the following configuration
+ *      - Instance name (see #GateMP_Params::name)
+ *      - Region id (see #GateMP_Params::regionId)
+ *  In addition, the following parameters should be configured as necessary:
+ *      - The level of local protection (interrupt, thread, tasklet, process
+ *        or none) can be configured using the #GateMP_Params::localProtect
+ *        config parameter.
+ *      - The type of remote system gate that can be used.  Most devices will
+ *        typically have a single type of system gate so this configuration
+ *        should typically be left alone.  See #GateMP_Params::remoteProtect for
+ *        more information.
+
+ *  Once created GateMP allows the gate to be opened on another processor
+ *  using GateMP_open() and the name that was used in GateMP_create().
+ *
+ *  A GateMP can be entered and left using GateMP_enter() and GateMP_leave()
+ *  like any other gate that implements the IGateProvider interface.
+ *
+ *  GateMP has the following proxies - RemoteSystemProxy, RemoteCustom1Proxy
+ *  and RemoteCustom2Proxy which are automatically plugged with device-specific
+ *  delegates that implement multiple processor mutexes using a variety of
+ *  hardware mechanisms.
+ *
+ *  GateMP creates a default system gate whose handle may be obtained
+ *  using GateMP_getDefaultRemote().  Most IPC modules typically use this gate
+ *  by default if they require gates and no instance gate is configured by the
+ *  user.
+ *
+ *  The GateMP header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/GateMP.h>
+ *  @endcode
+ *
+ *
+ *  @version        0.00.01
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_GateMP__include
+#define ti_ipc_GateMP__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  The resource is still in use
+ */
+#define GateMP_S_BUSY               2
+
+/*!
+ *  @brief  The module has been already setup
+ */
+#define GateMP_S_ALREADYSETUP       1
+
+/*!
+ *  @brief  Operation is successful.
+ */
+#define GateMP_S_SUCCESS            0
+
+/*!
+ *  @brief  Generic failure.
+ */
+#define GateMP_E_FAIL              -1
+
+/*!
+ *  @brief  Argument passed to function is invalid.
+ */
+#define GateMP_E_INVALIDARG        -2
+
+/*!
+ *  @brief  Operation resulted in memory failure.
+ */
+#define GateMP_E_MEMORY            -3
+
+/*!
+ *  @brief  The specified entity already exists.
+ */
+#define GateMP_E_ALREADYEXISTS     -4
+
+/*!
+ *  @brief  Unable to find the specified entity.
+ */
+#define GateMP_E_NOTFOUND          -5
+
+/*!
+ *  @brief  Operation timed out.
+ */
+#define GateMP_E_TIMEOUT           -6
+
+/*!
+ *  @brief  Module is not initialized.
+ */
+#define GateMP_E_INVALIDSTATE      -7
+
+/*!
+ *  @brief  A failure occurred in an OS-specific call  */
+#define GateMP_E_OSFAILURE         -8
+
+/*!
+ *  @brief  Specified resource is not available  */
+#define GateMP_E_RESOURCE          -9
+
+/*!
+ *  @brief  Operation was interrupted. Please restart the operation  */
+#define GateMP_E_RESTART           -10
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  A set of local context protection levels
+ *
+ *  Each member corresponds to a specific local processor gates used for
+ *  local protection.
+ *
+ *  In Linux user mode, the following are the mapping for the constants
+ *      - INTERRUPT -> [N/A]
+ *      - TASKLET   -> [N/A]
+ *      - THREAD    -> GateMutex
+ *      - PROCESS   -> GateMutex
+ *
+ *  In Linux kernel mode, the following are the mapping for the constants
+ *      - INTERRUPT -> [Interrupts disabled]
+ *      - TASKLET   -> GateMutex
+ *      - THREAD    -> GateMutex
+ *      - PROCESS   -> GateMutex
+ *
+ *  For SYS/BIOS users, the following are the mappings for the constants
+ *      - INTERRUPT -> GateAll: disables interrupts, Swis and Tasks
+ *      - TASKLET   -> GateSwi: disables Swis and Tasks
+ *      - THREAD    -> GateMutexPri: based on Semaphores
+ *      - PROCESS   -> GateMutexPri: based on Semaphores
+ */
+typedef enum GateMP_LocalProtect {
+    GateMP_LocalProtect_NONE      = 0,
+    /*!< Use no local protection */
+
+    GateMP_LocalProtect_INTERRUPT = 1,
+    /*!< Use the INTERRUPT local protection level */
+
+    GateMP_LocalProtect_TASKLET   = 2,
+    /*!< Use the TASKLET local protection level */
+
+    GateMP_LocalProtect_THREAD    = 3,
+    /*!< Use the THREAD local protection level */
+
+    GateMP_LocalProtect_PROCESS   = 4
+    /*!< Use the PROCESS local protection level */
+
+} GateMP_LocalProtect;
+
+
+/*!
+ *  @brief  Type of remote Gate
+ *
+ *  Each member corresponds to a specific type of remote gate.
+ *  Each enum value corresponds to the following remote protection levels:
+ *      - NONE      -> No remote protection (the GateMP instance will
+ *                     exclusively offer local protection configured in
+ *                     #GateMP_Params::localProtect
+ *      - SYSTEM    -> Use the SYSTEM remote protection level (default for
+ *                     remote protection
+ *      - CUSTOM1   -> Use the CUSTOM1 remote protection level
+ *      - CUSTOM2   -> Use the CUSTOM2 remote protection level
+ */
+typedef enum GateMP_RemoteProtect {
+    GateMP_RemoteProtect_NONE     = 0,
+    /*!< No remote protection (the GateMP instance will exclusively
+     *  offer local protection configured in #GateMP_Params::localProtect)
+     */
+
+    GateMP_RemoteProtect_SYSTEM   = 1,
+    /*!< Use the SYSTEM remote protection level (default remote protection) */
+
+    GateMP_RemoteProtect_CUSTOM1  = 2,
+    /*!< Use the CUSTOM1 remote protection level */
+
+    GateMP_RemoteProtect_CUSTOM2  = 3
+    /*!< Use the CUSTOM2 remote protection level */
+
+} GateMP_RemoteProtect;
+
+/*!
+ *  @brief  GateMP_Handle type
+ */
+typedef struct GateMP_Object *GateMP_Handle;
+
+/*!
+ *  @brief  Structure defining parameters for the GateMP module.
+ */
+typedef struct GateMP_Params {
+    String name;
+    /*!< Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all GateMP instances
+     *  in the entire system.  The name does not have to be in persistent
+     *  memory.  The supplied string is copied into persistent memory.
+     *  If no name is supplied, the instance cannot be opened calling
+     *  GateMP_open().  The max length of the name is defined by the
+     *  maxNameLen of the NameServer instance.
+     */
+
+    UInt16 regionId;
+    /*!< Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  is allocated for the instance.  If not specified, the default of '0'
+     *  is used, otherwise the specified SharedRegion is used.  The amount
+     *  of shared memory allocated can be determined by calling
+     *  GateMP_sharedMemReq().
+     */
+
+    /*! @cond */
+    Ptr sharedAddr;
+    /*!< Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  instance at a specific location in shared memory.  If specified,
+     *  it must be from a valid SharedRegion and the regionId is ignored.
+     *  If sharedAddr is null, then shared memory for a new instance is
+     *  allocated from the heap belonging to the region identified by
+     *  #GateMP_Params::regionId.  The amount of shared memory allocated
+     *  can be determined by calling GateMP_sharedMemReq().
+     */
+    /*! @endcond */
+
+
+    GateMP_LocalProtect localProtect;
+    /*!< Local protection level
+     *
+     *   The default value is #GateMP_LocalProtect_THREAD
+     */
+
+    GateMP_RemoteProtect remoteProtect;
+    /*!< Remote protection level
+     *
+     *   The default value is #GateMP_RemoteProtect_SYSTEM
+     */
+} GateMP_Params;
+
+/* =============================================================================
+ *  GateMP Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Close an opened gate
+ *
+ *  @param[in,out]  handlePtr   Pointer to handle to opened GateMP instance
+ *
+ *  @return     GateMP status
+ */
+Int GateMP_close(GateMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Create a GateMP instance
+ *
+ *  The params structure should be initialized using GateMP_Params_init().
+ *
+ *  @param[in]  params      GateMP parameters
+ *
+ *  @return     GateMP Handle
+ */
+GateMP_Handle GateMP_create(const GateMP_Params *params);
+
+/*!
+ *  @brief      Delete a created GateMP instance
+ *
+ *  @param[in,out]  handlePtr       Pointer to GateMP handle
+ *
+ *  @return     GateMP Status
+ */
+Int GateMP_delete(GateMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Get the default remote gate
+ *
+ *  @return     GateMP handle
+ */
+GateMP_Handle GateMP_getDefaultRemote(Void);
+
+/*!
+ *  @brief      Get the local protection level configured in a GateMP instance
+ *
+ *  @return     GateMP_LocalProtect corresponding to local protection level
+ */
+GateMP_LocalProtect GateMP_getLocalProtect(GateMP_Handle handle);
+
+/*!
+ *  @brief      Get the remote protection level configured in a GateMP instance
+ *
+ *  @return     GateMP_RemoteProtect corresponding to remote protection level
+ */
+GateMP_RemoteProtect GateMP_getRemoteProtect(GateMP_Handle handle);
+
+/*!
+ *  @brief      Open a created GateMP by name
+ *
+ *  @param[in]  name        Name of the GateMP instance
+ *  @param[out] handlePtr   Pointer to GateMP handle to be opened
+ *
+ *  @return     GateMP status:
+ *              - #GateMP_E_NOTFOUND: open failed (name not found on any
+ *                processor)
+ *              - #GateMP_E_FAIL: open failed (general failure occurred)
+ *              - #GateMP_S_SUCCESS: open successful
+ */
+Int GateMP_open(String name, GateMP_Handle *handlePtr);
+
+/*! @cond */
+Int GateMP_openByAddr(Ptr sharedAddr, GateMP_Handle *handlePtr);
+
+/*! @endcond */
+
+/*!
+ *  @brief      Initialize a GateMP parameters struct
+ *
+ *  @param[out] params      Pointer to GateMP parameters
+ *
+ */
+Void GateMP_Params_init(GateMP_Params *params);
+
+/*! @cond */
+/*!
+ *  @brief      Amount of shared memory required for creation of each instance
+ *
+ *  @param[in]  params      Pointer to the parameters that will be used in
+ *                          the create.
+ *
+ *  @return     Number of MAUs needed to create the instance.
+ */
+SizeT GateMP_sharedMemReq(const GateMP_Params *params);
+
+/*! @endcond */
+
+/* =============================================================================
+ *  GateMP Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Enter the GateMP
+ *
+ *  @param[in]  handle      GateMP handle
+ *
+ *  @return     key that must be used to leave the gate
+ */
+IArg GateMP_enter(GateMP_Handle handle);
+
+/*!
+ *  @brief      Leave the GateMP
+ *
+ *  @param[in]  handle      GateMP handle
+ *  @param[in]  key         key returned from GateMP_enter
+ */
+Void GateMP_leave(GateMP_Handle handle, IArg key);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_GateMP__include */
diff --git a/packages/ti/ipc/HeapBufMP.h b/packages/ti/ipc/HeapBufMP.h
new file mode 100644 (file)
index 0000000..9542089
--- /dev/null
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       HeapBufMP.h
+ *
+ *  @brief      Multi-processor fixed-size buffer heap implementation
+ *
+ *  Heap implementation that manages fixed size buffers that can be used
+ *  in a multiprocessor system with shared memory.
+ *
+ *  The HeapBufMP manager provides functions to allocate and free storage from a
+ *  heap of type HeapBufMP which inherits from IHeap. HeapBufMP manages a single
+ *  fixed-size buffer, split into equally sized allocatable blocks.
+ *
+ *  The HeapBufMP manager is intended as a very fast memory
+ *  manager which can only allocate blocks of a single size. It is ideal for
+ *  managing a heap that is only used for allocating a single type of object,
+ *  or for objects that have very similar sizes.
+ *
+ *  The HeapBufMP module uses a NameServer instance to
+ *  store instance information when an instance is created.  The name supplied
+ *  must be unique for all HeapBufMP instances.
+ *
+ *  The #HeapBufMP_create call initializes the shared memory as needed. Once an
+ *  instance is created, a #HeapBufMP_open can be performed. The
+ *  open is used to gain access to the same HeapBufMP instance.
+ *  Generally an instance is created on one processor and opened on the
+ *  other processor(s).
+ *
+ *  The open returns a HeapBufMP instance handle like the create,
+ *  however the open does not modify the shared memory.
+ *
+ *  The HeapBufMP header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/HeapBufMP.h>
+ *  @endcode
+ *
+ *  @version        0.00.01
+ */
+
+
+#ifndef ti_ipc_HeapBufMP__include
+#define ti_ipc_HeapBufMP__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include <ti/ipc/GateMP.h>
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @def    HeapBufMP_S_BUSY
+ *  @brief  The resource is still in use
+ */
+#define HeapBufMP_S_BUSY               2
+
+/*!
+ *  @def    HeapBufMP_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define HeapBufMP_S_ALREADYSETUP       1
+
+/*!
+ *  @def    HeapBufMP_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define HeapBufMP_S_SUCCESS            0
+
+/*!
+ *  @def    HeapBufMP_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define HeapBufMP_E_FAIL              -1
+
+/*!
+ *  @def    HeapBufMP_E_INVALIDARG
+ *  @brief  Argument passed to function is invalid.
+ */
+#define HeapBufMP_E_INVALIDARG        -2
+
+/*!
+ *  @def    HeapBufMP_E_MEMORY
+ *  @brief  Operation resulted in memory failure.
+ */
+#define HeapBufMP_E_MEMORY            -3
+
+/*!
+ *  @def    HeapBufMP_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define HeapBufMP_E_ALREADYEXISTS     -4
+
+/*!
+ *  @def    HeapBufMP_E_NOTFOUND
+ *  @brief  Unable to find the specified entity.
+ */
+#define HeapBufMP_E_NOTFOUND          -5
+
+/*!
+ *  @def    HeapBufMP_E_TIMEOUT
+ *  @brief  Operation timed out.
+ */
+#define HeapBufMP_E_TIMEOUT           -6
+
+/*!
+ *  @def    HeapBufMP_E_INVALIDSTATE
+ *  @brief  Module is not initialized.
+ */
+#define HeapBufMP_E_INVALIDSTATE      -7
+
+/*!
+ *  @def    HeapBufMP_E_OSFAILURE
+ *  @brief  A failure occurred in an OS-specific call  */
+#define HeapBufMP_E_OSFAILURE         -8
+
+/*!
+ *  @def    HeapBufMP_E_RESOURCE
+ *  @brief  Specified resource is not available  */
+#define HeapBufMP_E_RESOURCE          -9
+
+/*!
+ *  @def    HeapBufMP_E_RESTART
+ *  @brief  Operation was interrupted. Please restart the operation  */
+#define HeapBufMP_E_RESTART           -10
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  HeapBufMP_Handle type
+ */
+typedef struct HeapBufMP_Object *HeapBufMP_Handle;
+
+/*!
+ *  @brief  Structure defining parameters for the HeapBufMP module.
+ */
+typedef struct HeapBufMP_Params {
+    String name;
+    /*!< Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all HeapBufMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     *
+     *  The name does not have to be persistent.  The supplied string is copied
+     *  into persistent memory.
+     */
+
+    UInt16 regionId;
+    /*!< Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  will be allocated.
+     */
+
+    /*! @cond */
+    Ptr sharedAddr;
+    /*!< Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  heap at a specific location in shared memory.  If sharedAddr is null,
+     *  then shared memory for a new instance will be allocated from the
+     *  heap belonging to the region identified by #HeapBufMP_Params::regionId.
+     */
+    /*! @endcond */
+
+    SizeT blockSize;
+    /*!< Size (in MAUs) of each block.
+     *
+     *  HeapBufMP will round the blockSize up to the nearest multiple of the
+     *  alignment, so the actual blockSize may be larger. When creating a
+     *  HeapBufMP dynamically, this needs to be taken into account to determine
+     *  the proper buffer size to pass in.
+     *
+     *  Required parameter.
+     *
+     *  The default size of the blocks is 0 MAUs.
+     */
+
+    UInt numBlocks;
+    /*!<Number of fixed-size blocks.
+     *
+     *  This is a required parameter for all new HeapBufMP instances.
+     */
+
+    SizeT align;
+    /*!< Alignment (in MAUs) of each block.
+     *
+     *  The alignment must be a power of 2. If the value 0 is specified,
+     *  the value will be changed to meet minimum structure alignment
+     *  requirements and the cache alignment size of the region in which the
+     *  heap will be placed.  Therefore, the actual alignment may be larger.
+     *
+     *  The default alignment is 0.
+     */
+
+    Bool exact;
+    /*!< Use exact matching
+     *
+     *  Setting this flag will allow allocation only if the requested size
+     *  is equal to (rather than less than or equal to) the buffer's block
+     *  size.
+     */
+
+    GateMP_Handle gate;
+    /*!< GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+
+} HeapBufMP_Params;
+
+/*!
+ *  @brief  Stats structure for the HeapBufMP_getExtendedStats API.
+ */
+typedef struct HeapBufMP_ExtendedStats {
+    UInt maxAllocatedBlocks;
+    /*!< The maximum number of blocks allocated from this heap at any point in
+     *  time during the lifetime of this HeapBufMP instance.
+     */
+
+    UInt numAllocatedBlocks;
+    /*!< The total number of blocks currently allocated in this HeapBufMP
+     *  instance.
+     */
+} HeapBufMP_ExtendedStats;
+
+/* =============================================================================
+ *  HeapBufMP Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Close a HeapBufMP instance
+ *
+ *  Closing an instance will free local memory consumed by the opened
+ *  instance. All opened instances should be closed before the instance
+ *  is deleted.
+ *
+ *  @param[in,out]  handlePtr   Pointer to HeapBufMP handle typically returned
+ *                              from #HeapBufMP_open
+ *
+ *  @return     HeapBufMP status:
+ *              - #HeapBufMP_S_SUCCESS: Heap successfully closed
+ *
+ *  @sa         HeapBufMP_open
+ */
+Int HeapBufMP_close(HeapBufMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Create a HeapBufMP instance
+ *
+ *  @param[in]  params      HeapBufMP parameters
+ *
+ *  @return     HeapBufMP Handle
+ */
+HeapBufMP_Handle HeapBufMP_create(const HeapBufMP_Params *params);
+
+/*!
+ *  @brief      Delete a created HeapBufMP instance
+ *
+ *  @param[in,out]  handlePtr   Pointer to handle to delete.
+ *
+ *  @return     HeapBufMP status:
+ *              - #HeapBufMP_S_SUCCESS: Heap successfully deleted
+ */
+Int HeapBufMP_delete(HeapBufMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Open a created HeapBufMP instance
+ *
+ *  Once an instance is created, an open can be performed. The
+ *  open is used to gain access to the same HeapBufMP instance.
+ *  Generally an instance is created on one processor and opened on the
+ *  other processor.
+ *
+ *  The open returns a HeapBufMP instance handle like the create,
+ *  however the open does not initialize the shared memory. The supplied
+ *  name is used to identify the created instance.
+ *
+ *  Call #HeapBufMP_close when the opened instance is not longer needed.
+ *
+ *  @param[in]  name        Name of created HeapBufMP instance
+ *  @param[out] handlePtr   Pointer to HeapBufMP handle to be opened
+ *
+ *  @return     HeapBufMP status:
+ *              - #HeapBufMP_S_SUCCESS: Heap successfully opened
+ *              - #HeapBufMP_E_NOTFOUND: Heap is not yet ready to be opened.
+ *              - #HeapBufMP_E_FAIL: A general failure has occurred
+ *
+ *  @sa         HeapBufMP_close
+ */
+Int HeapBufMP_open(String name, HeapBufMP_Handle *handlePtr);
+
+/*! @cond */
+Int HeapBufMP_openByAddr(Ptr sharedAddr, HeapBufMP_Handle *handlePtr);
+
+/*! @endcond */
+
+/*!
+ *  @brief      Initialize a HeapBufMP parameters struct
+ *
+ *  @param[out] params      Pointer to GateMP parameters
+ *
+ */
+Void HeapBufMP_Params_init(HeapBufMP_Params *params);
+
+/*! @cond */
+/*!
+ *  @brief      Amount of shared memory required for creation of each instance
+ *
+ *  @param[in]  params      Pointer to the parameters that will be used in
+ *                          the create.
+ *
+ *  @return     Number of MAUs needed to create the instance.
+ */
+SizeT HeapBufMP_sharedMemReq(const HeapBufMP_Params *params);
+
+/*! @endcond */
+
+/* =============================================================================
+ *  HeapBufMP Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Allocate a block of memory of specified size and alignment
+ *
+ *  The actual block returned may be larger than requested to satisfy
+ *  alignment requirements. NULL is returned if alloc fails.
+ *
+ *  HeapBufMP_alloc will lock the heap using the HeapBufMP gate
+ *  while it traverses the list of free blocks to find a large enough block
+ *  for the request.
+ *
+ *  Guidelines for using large heaps and multiple alloc() calls.
+ *      - If possible, allocate larger blocks first. Previous allocations
+ *        of small memory blocks can reduce the size of the blocks
+ *        available for larger memory allocations.
+ *      - Realize that alloc() can fail even if the heap contains a
+ *        sufficient absolute amount of unalloccated space. This is
+ *        because the largest free memory block may be smaller than
+ *        total amount of unallocated memory.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[in]  size      Size to be allocated (in MADUs)
+ *  @param[in]  align     Alignment for allocation (power of 2)
+ *
+ *  @sa         HeapBufMP_free
+ */
+Void *HeapBufMP_alloc(HeapBufMP_Handle handle, SizeT size, SizeT align);
+
+/*!
+ *  @brief      Frees a block of memory.
+ *
+ *  free() places the memory block specified by addr and size back into the
+ *  free pool of the heap specified. The newly freed block is combined with
+ *  any adjacent free blocks. The space is then available for further
+ *  allocation by alloc().
+ *
+ *  #HeapBufMP_free will lock the heap using the HeapBufMP gate if one is
+ *  specified or the system GateMP if not.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[in]  block     Block of memory to be freed.
+ *  @param[in]  size      Size to be freed (in MADUs)
+ *
+ *  @sa         HeapBufMP_alloc
+ */
+Void HeapBufMP_free(HeapBufMP_Handle handle, Ptr block, SizeT size);
+
+/*!
+ *  @brief      Get extended memory statistics
+ *
+ *  This function retrieves the extended statistics for a HeapBufMP
+ *  instance.  It does not retrieve the standard Memory_Stats
+ *  information.  Refer to #HeapBufMP_ExtendedStats for more information
+ *  regarding what information is returned.
+ *
+ *  In BIOS, HeapBufMP.trackAllocs needs to be set to 'true' in the
+ *  configuration to get meaningful extended stats.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[out] stats     ExtendedStats structure
+ *
+ *  @sa     HeapBufMP_getStats
+ */
+Void HeapBufMP_getExtendedStats(HeapBufMP_Handle handle,
+                                HeapBufMP_ExtendedStats *stats);
+
+/*!
+ *  @brief      Get memory statistics
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[out] stats     Memory statistics structure
+ *
+ *  @sa     HeapBufMP_getExtendedStats
+ */
+Void HeapBufMP_getStats(HeapBufMP_Handle handle, Ptr stats);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_HeapBufMP__include */
diff --git a/packages/ti/ipc/HeapMemMP.h b/packages/ti/ipc/HeapMemMP.h
new file mode 100644 (file)
index 0000000..1de7f3d
--- /dev/null
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       HeapMemMP.h
+ *
+ *  @brief      Multi-processor variable size buffer heap implementation
+ *
+ *  HeapMemMP is a heap implementation that manages variable size buffers that
+ *  can be used in a multiprocessor system with shared memory. HeapMemMP
+ *  manages a single buffer in shared memory from which blocks of user-
+ *  specified length are allocated and freed.
+ *
+ *  The HeapMemMP module uses a NameServer instance to
+ *  store instance information when an instance is created.  The name supplied
+ *  must be unique for all HeapMemMP instances.
+ *
+ *  The #HeapMemMP_create call initializes the shared memory as needed. Once an
+ *  instance is created, an #HeapMemMP_open can be performed. The
+ *  open is used to gain access to the same HeapMemMP instance.
+ *  Generally an instance is created on one processor and opened on the
+ *  other processor(s).
+ *
+ *  The open returns a HeapMemMP instance handle like the create,
+ *  however the open does not modify the shared memory.
+ *
+ *  Because HeapMemMP is a variable-size heap implementation, it is also used
+ *  by the SharedRegion module to manage shared memory in each shared
+ *  region.  When any shared memory IPC instance is created in a
+ *  particular shared region, the HeapMemMP that manages shared memory in the
+ *  shared region allocates shared memory for the instance.
+ *
+ *  The HeapMemMP header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/HeapMemMP.h>
+ *  @endcode
+ *
+ *  @version        0.00.01
+ *
+ *  ============================================================================
+ */
+
+
+#ifndef ti_ipc_HeapMemMP__include
+#define ti_ipc_HeapMemMP__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include <ti/ipc/GateMP.h>
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @def    HeapMemMP_S_BUSY
+ *  @brief  The resource is still in use
+ */
+#define HeapMemMP_S_BUSY               2
+
+/*!
+ *  @def    HeapMemMP_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define HeapMemMP_S_ALREADYSETUP       1
+
+/*!
+ *  @def    HeapMemMP_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define HeapMemMP_S_SUCCESS            0
+
+/*!
+ *  @def    HeapMemMP_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define HeapMemMP_E_FAIL              -1
+
+/*!
+ *  @def    HeapMemMP_E_INVALIDARG
+ *  @brief  Argument passed to function is invalid.
+ */
+#define HeapMemMP_E_INVALIDARG        -2
+
+/*!
+ *  @def    HeapMemMP_E_MEMORY
+ *  @brief  Operation resulted in memory failure.
+ */
+#define HeapMemMP_E_MEMORY            -3
+
+/*!
+ *  @def    HeapMemMP_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define HeapMemMP_E_ALREADYEXISTS     -4
+
+/*!
+ *  @def    HeapMemMP_E_NOTFOUND
+ *  @brief  Unable to find the specified entity.
+ */
+#define HeapMemMP_E_NOTFOUND          -5
+
+/*!
+ *  @def    HeapMemMP_E_TIMEOUT
+ *  @brief  Operation timed out.
+ */
+#define HeapMemMP_E_TIMEOUT           -6
+
+/*!
+ *  @def    HeapMemMP_E_INVALIDSTATE
+ *  @brief  Module is not initialized.
+ */
+#define HeapMemMP_E_INVALIDSTATE      -7
+
+/*!
+ *  @def    HeapMemMP_E_OSFAILURE
+ *  @brief  A failure occurred in an OS-specific call  */
+#define HeapMemMP_E_OSFAILURE         -8
+
+/*!
+ *  @def    HeapMemMP_E_RESOURCE
+ *  @brief  Specified resource is not available  */
+#define HeapMemMP_E_RESOURCE          -9
+
+/*!
+ *  @def    HeapMemMP_E_RESTART
+ *  @brief  Operation was interrupted. Please restart the operation  */
+#define HeapMemMP_E_RESTART           -10
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  HeapMemMP_Handle type
+ */
+typedef struct HeapMemMP_Object *HeapMemMP_Handle;
+
+/*!
+ *  @brief  Structure defining parameters for the HeapMemMP module.
+ */
+typedef struct HeapMemMP_Params {
+    String name;
+    /*!< Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all HeapMemMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     *
+     *  The name does not have to be persistent.  The supplied string is copied
+     *  into persistent memory.
+     */
+
+    UInt16 regionId;
+    /*!< Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  will be allocated.
+     */
+
+    /*! @cond */
+    Ptr sharedAddr;
+    /*!< Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  heap at a specific location in shared memory.  If sharedAddr is null,
+     *  then shared memory for a new instance will be allocated from the
+     *  heap belonging to the region identified by
+     *  #HeapMemMP_Params::regionId.
+     */
+    /*! @endcond */
+
+    SizeT sharedBufSize;
+    /*!< Size of shared buffer
+     *
+     *  This is the size of the buffer to be used in the HeapMemMP instance.
+     *  The actual buffer size in the created instance might actually be less
+     *  than the value supplied in 'sharedBufSize' because of alignment
+     *  constraints.
+     *
+     *  It is important to note that the total amount of shared memory required
+     *  for a HeapMemMP instance will be greater than the size supplied here.
+     *  Additional space will be consumed by shared instance attributes and
+     *  alignment-related padding.
+     */
+
+    GateMP_Handle gate;
+    /*!< GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+
+} HeapMemMP_Params;
+
+/*!
+ *  @brief  Stats structure for the HeapMemMP_getExtendedStats API.
+ */
+typedef struct HeapMemMP_ExtendedStats {
+    Ptr   buf;
+    /*!< Local address of the shared buffer */
+
+    SizeT size;
+    /*!< Size of the shared buffer */
+} HeapMemMP_ExtendedStats;
+
+/* =============================================================================
+ *  HeapMemMP Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Close a HeapMemMP instance
+ *
+ *  Closing an instance will free local memory consumed by the opened
+ *  instance. All opened instances should be closed before the instance
+ *  is deleted.
+ *
+ *  @param[in,out]  handlePtr   Pointer to handle returned from #HeapMemMP_open
+ *
+ *  @return     HeapMemMP status:
+ *              - #HeapMemMP_S_SUCCESS: Heap successfully closed
+ */
+Int HeapMemMP_close(HeapMemMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Create a HeapMemMP instance
+ *
+ *  @param[in]  params      HeapMemMP parameters
+ *
+ *  @return     HeapMemMP Handle
+ */
+HeapMemMP_Handle HeapMemMP_create(const HeapMemMP_Params *params);
+
+/*!
+ *  @brief      Delete a created HeapMemMP instance
+ *
+ *  @param[in,out]      handlePtr   Pointer to handle to delete.
+ *
+ *  @return     HeapMemMP status:
+ *              - #HeapMemMP_S_SUCCESS: Heap successfully deleted
+ */
+Int HeapMemMP_delete(HeapMemMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Open a created HeapMemMP instance
+ *
+ *  Once an instance is created, an open can be performed. The
+ *  open is used to gain access to the same HeapMemMP instance.
+ *  Generally an instance is created on one processor and opened on the
+ *  other processor.
+ *
+ *  The open returns a HeapMemMP instance handle like the create,
+ *  however the open does not initialize the shared memory. The supplied
+ *  name is used to identify the created instance.
+ *
+ *  Call #HeapMemMP_close when the opened instance is not longer needed.
+ *
+ *  @param[in]  name        Name of created HeapMemMP instance
+ *  @param[out] handlePtr   Pointer to HeapMemMP handle to be opened
+ *
+ *  @return     HeapMemMP status:
+ *              - #HeapMemMP_S_SUCCESS: Heap successfully opened
+ *              - #HeapMemMP_E_NOTFOUND: Heap is not yet ready to be opened.
+ *              - #HeapMemMP_E_FAIL: A general failure has occurred
+ *
+ *  @sa         HeapMemMP_close
+ */
+Int HeapMemMP_open(String name, HeapMemMP_Handle *handlePtr);
+
+/*! @cond */
+Int HeapMemMP_openByAddr(Ptr sharedAddr, HeapMemMP_Handle *handlePtr);
+
+/*! @endcond */
+
+/*!
+ *  @brief      Initialize a HeapMemMP parameters struct
+ *
+ *  @param[out] params      Pointer to GateMP parameters
+ *
+ */
+Void HeapMemMP_Params_init(HeapMemMP_Params *params);
+
+/*! @cond */
+/*!
+ *  @brief      Amount of shared memory required for creation of each instance
+ *
+ *  @param[in]  params      Pointer to the parameters that will be used in
+ *                          the create.
+ *
+ *  @return     Number of MAUs needed to create the instance.
+ */
+SizeT HeapMemMP_sharedMemReq(const HeapMemMP_Params *params);
+
+/*! @endcond */
+
+/* =============================================================================
+ *  HeapMemMP Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Allocate a block of memory of specified size and alignment
+ *
+ *  The actual block returned may be larger than requested to satisfy
+ *  alignment requirements. NULL is returned if the alloc fails.
+ *
+ *  HeapMemMP_alloc will lock the heap using the HeapMemMP gate
+ *  while it traverses the list of free blocks to find a large enough block
+ *  for the request.
+ *
+ *  Guidelines for using large heaps and multiple alloc() calls.
+ *      - If possible, allocate larger blocks first. Previous allocations
+ *        of small memory blocks can reduce the size of the blocks
+ *        available for larger memory allocations.
+ *      - Realize that alloc() can fail even if the heap contains a
+ *        sufficient absolute amount of unalloccated space. This is
+ *        because the largest free memory block may be smaller than
+ *        total amount of unallocated memory.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[in]  size      Size to be allocated (in MADUs)
+ *  @param[in]  align     Alignment for allocation (power of 2)
+ *
+ *  @sa         HeapMemMP_free
+ */
+Void *HeapMemMP_alloc(HeapMemMP_Handle handle, SizeT size, SizeT align);
+
+/*!
+ *  @brief      Frees a block of memory.
+ *
+ *  free() places the memory block specified by addr and size back into the
+ *  free pool of the heap specified. The newly freed block is combined with
+ *  any adjacent free blocks. The space is then available for further
+ *  allocation by alloc().
+ *
+ *  #HeapMemMP_free will lock the heap using the HeapMemMP gate if one is
+ *  specified or the system GateMP if not.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[in]  block     Block of memory to be freed.
+ *  @param[in]  size      Size to be freed (in MADUs)
+ *
+ *  @sa         HeapMemMP_alloc
+ */
+Void HeapMemMP_free(HeapMemMP_Handle handle, Ptr block, SizeT size);
+
+/*!
+ *  @brief      Get extended memory statistics
+ *
+ *  This function retrieves extended statistics for a HeapMemMP
+ *  instance. Refer to #HeapMemMP_ExtendedStats for more information
+ *  regarding what information is returned.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[out] stats     ExtendedStats structure
+ *
+ *  @sa     HeapMemMP_getStats
+ */
+Void HeapMemMP_getExtendedStats(HeapMemMP_Handle handle,
+                                HeapMemMP_ExtendedStats *stats);
+
+/*!
+ *  @brief      Get memory statistics
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[out] stats     Memory statistics structure
+ *
+ *  @sa     HeapMemMP_getExtendedStats
+ */
+Void HeapMemMP_getStats(HeapMemMP_Handle handle, Ptr stats);
+
+/*!
+ *  @brief      Restore an instance to it's original created state.
+ *
+ *  This function restores an instance to
+ *  its original created state. Any memory previously allocated from the
+ *  heap is no longer valid after this API is called. This function
+ *  does not check whether there is allocated memory or not.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ */
+Void HeapMemMP_restore(HeapMemMP_Handle handle);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_HeapMemMP__include */
diff --git a/packages/ti/ipc/HeapMultiBufMP.h b/packages/ti/ipc/HeapMultiBufMP.h
new file mode 100644 (file)
index 0000000..785086e
--- /dev/null
@@ -0,0 +1,470 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       HeapMultiBufMP.h
+ *
+ *  @brief      Multiple fixed size buffer heap implementation.
+ *
+ *  The HeapMultiBufMP manager provides functions to allocate and free storage
+ *  from a shared memory heap of type HeapMultiBufMP which inherits from IHeap.
+ *  HeapMultiBufMP manages multiple fixed-size memory buffers. Each buffer
+ *  contains a fixed number of allocatable memory 'blocks' of the same size.
+ *  HeapMultiBufMP is intended as a fast and deterministic memory manager which
+ *  can service requests for blocks of arbitrary size.
+ *
+ *  An example HeapMultiBufMP instance might have sixteen 32-byte blocks in one
+ *  buffer, and four 128-byte blocks in another buffer. A request for memory
+ *  will be serviced by the smallest possible block, so a request for 100
+ *  bytes would receive a 128-byte block in our example.
+ *
+ *  Allocating from HeapMultiBufMP will try to return a block from the first
+ *  buffer which has:
+ *
+ *    1. A block size that is >= to the requested size
+ *
+ *    AND
+ *
+ *    2. An alignment that is >= to the requested alignment
+ *
+ *  Buffer configuration for a new instance is primarily supplied via the
+ *  #HeapMultiBufMP_Params::bucketEntries instance configuration parameter.
+ *  Once buckets are adjusted for size and alignment, buffers with equal sizes
+ *  and alignments are combined.
+ *
+ *  Block Sizes and Alignment
+ *      - A buffer with a requested alignment of 0 will receive the target-
+ *        specific minimum alignment
+ *      - If cache is enabled for the particular shared region in which the
+ *        shared buffer is to be placed, then the minimum alignment for each
+ *        buffer is equal to the cache line size of the shared region.
+ *      - The actual block sizes will be a multiple of the alignment. For
+ *        example, if a buffer is configured to have 56-byte blocks with an
+ *        alignment of 32, HeapMultiBufMP will actually create 64-byte blocks.
+ *        When providing the buffer for a dynamic create, make sure it is
+ *        large enough to take this into account.
+ *      - Multiple buffers with the same block size ARE allowed. This may
+ *        occur, for example, if sizeof is used to specify the block sizes.
+ *      - If any buffers have both the same block size and alignment, they
+ *        will be merged. If this is a problem, consider managing these buffers
+ *        directly with HeapBufMP objects.
+ *
+ *  In addition to the buffer configuration, a #HeapMultiBufMP_Params::name
+ *  and a #HeapMultiBufMP_Params::regionId (from which shared memory is
+ *  allocated) must be supplied when creating an instance.
+ *
+ *  Once an instance is created, HeapMultiBufMP_open() can be performed using the
+ *  name that was supplied in HeapMultiBufMP_create(). The open is used to gain
+ *  access to the same HeapMultiBufMP instance.  Generally an instance is
+ *  created on one processor and opened on the other processor(s). The open
+ *  returns (by reference) a HeapMultiBufMP instance handle like the create,
+ *  however the open does not modify the shared memory.
+ *
+ *  HeapMultiBufMP_open() will return #HeapMultiBufMP_E_FAIL if called before
+ *  the instance is created.
+ *
+ *  The HeapMultiBufMP header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/HeapMultiBufMP.h>
+ *  @endcode
+ *
+ *  @version        0.00.01
+ *
+ *  ============================================================================
+ */
+
+
+#ifndef ti_ipc_HeapMultiBufMP__include
+#define ti_ipc_HeapMultiBufMP__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include <ti/ipc/GateMP.h>
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  The resource is still in use
+ */
+#define HeapMultiBufMP_S_BUSY               2
+
+/*!
+ *  @brief  The module has been already setup
+ */
+#define HeapMultiBufMP_S_ALREADYSETUP       1
+
+/*!
+ *  @brief  Operation is successful.
+ */
+#define HeapMultiBufMP_S_SUCCESS            0
+
+/*!
+ *  @brief  Generic failure.
+ */
+#define HeapMultiBufMP_E_FAIL              -1
+
+/*!
+ *  @brief  Argument passed to function is invalid.
+ */
+#define HeapMultiBufMP_E_INVALIDARG        -2
+
+/*!
+ *  @brief  Operation resulted in memory failure.
+ */
+#define HeapMultiBufMP_E_MEMORY            -3
+
+/*!
+ *  @brief  The specified entity already exists.
+ */
+#define HeapMultiBufMP_E_ALREADYEXISTS     -4
+
+/*!
+ *  @brief  Unable to find the specified entity.
+ */
+#define HeapMultiBufMP_E_NOTFOUND          -5
+
+/*!
+ *  @brief  Operation timed out.
+ */
+#define HeapMultiBufMP_E_TIMEOUT           -6
+
+/*!
+ *  @brief  Module is not initialized.
+ */
+#define HeapMultiBufMP_E_INVALIDSTATE      -7
+
+/*!
+ *  @brief  A failure occurred in an OS-specific call  */
+#define HeapMultiBufMP_E_OSFAILURE         -8
+
+/*!
+ *  @brief  Specified resource is not available  */
+#define HeapMultiBufMP_E_RESOURCE          -9
+
+/*!
+ *  @brief  Operation was interrupted. Please restart the operation  */
+#define HeapMultiBufMP_E_RESTART           -10
+
+/* =============================================================================
+ *  Macros
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  Maximum number of buffer buckets supported.
+ */
+#define HeapMultiBufMP_MAXBUCKETS          ((UInt)8)
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  HeapMultiBufMP_Handle type
+ */
+typedef struct HeapMultiBufMP_Object *HeapMultiBufMP_Handle;
+
+/*!
+ *  @brief   Structure for bucket configuration
+ *
+ *  An array of buckets is a required parameter to create any
+ *  HeapMultiBufMP instance.  The fields of each bucket correspond
+ *  to the attributes of each buffer in the HeapMultiBufMP.  The actual
+ *  block sizes and alignments may be adjusted per the process described
+ *  at #HeapMultiBufMP_Params::bucketEntries.
+ */
+typedef struct HeapMultiBufMP_Bucket {
+    SizeT blockSize;    /*!< Size of each block in this bucket (in MADUs)   */
+    UInt numBlocks;     /*!< Number of blocks of this size                  */
+    SizeT align;        /*!< Alignment of each block (in MADUs)             */
+} HeapMultiBufMP_Bucket;
+
+/*!
+ *  @brief  Structure defining parameters for the HeapMultiBufMP module.
+ */
+typedef struct HeapMultiBufMP_Params {
+    GateMP_Handle gate;
+    /*!< GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+
+    Bool exact;
+    /*!< Use exact matching
+     *
+     *  Setting this flag will allow allocation only if the requested size
+     *  is equal to (rather than less than or equal to) a buffer's block size.
+     */
+
+    String name;
+    /*!< Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all HeapMultiBufMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     *
+     *  The name does not have to be persistent.  The supplied string is copied
+     *  into persistent memory.
+     */
+
+    Int numBuckets;
+    /*!< Number of buckets in #HeapMultiBufMP_Params::bucketEntries
+     *
+     *  This parameter is required to create any instance.
+     */
+
+    HeapMultiBufMP_Bucket *bucketEntries;
+    /*!< Bucket Entries
+     *
+     *  The bucket entries are an array of #HeapMultiBufMP_Bucket whose values
+     *  correspond to the desired alignment, block size and length for each
+     *  buffer.  It is important to note that the alignments and sizes for each
+     *  buffer may be adjusted due to cache and alignment related constraints.
+     *  Buffer sizes are rounded up by their corresponding alignments.  Buffer
+     *  alignments themselves will assume the value of region cache alignment
+     *  size when the cache size is greater than the requested buffer alignment.
+     *
+     *  For example, specifying a bucket with {blockSize: 192, align: 256} will
+     *  result in a buffer of blockSize = 256 and alignment = 256.  If cache
+     *  alignment is required, then a bucket of {blockSize: 96, align: 64} will
+     *  result in a buffer of blockSize = 128 and alignment = 128 (assuming
+     *  cacheSize = 128).
+     */
+
+    UInt16 regionId;
+    /*!<Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  will be allocated.
+     */
+
+    /*! @cond */
+    Ptr sharedAddr;
+    /*!<Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  heap at a specific location in shared memory.  If sharedAddr is null,
+     *  then shared memory for a new instance will be allocated from the
+     *  heap belonging to the region identified by
+     *  #HeapMultiBufMP_Params::regionId.
+     */
+    /*! @endcond */
+
+} HeapMultiBufMP_Params;
+
+/*!
+ *  @brief  Stats structure for the HeapMultiBufMP_getExtendedStats() API.
+ */
+typedef struct HeapMultiBufMP_ExtendedStats {
+    UInt numBuckets;
+    /*!< Number of buffers after optimization */
+
+    UInt numBlocks          [HeapMultiBufMP_MAXBUCKETS];
+    /*!< Number of blocks in each buffer */
+
+    UInt blockSize          [HeapMultiBufMP_MAXBUCKETS];
+    /*!< Block size of each buffer */
+
+    UInt align              [HeapMultiBufMP_MAXBUCKETS];
+    /*!< Alignment of each buffer */
+
+    UInt maxAllocatedBlocks [HeapMultiBufMP_MAXBUCKETS];
+    /*!< The maximum number of blocks allocated from this heap at any single
+     *  point in time during the lifetime of this HeapMultiBufMP instance
+     */
+
+    UInt numAllocatedBlocks [HeapMultiBufMP_MAXBUCKETS];
+    /*!< The total number of blocks currently allocated in this HeapMultiBufMP
+     *  instance
+     */
+
+} HeapMultiBufMP_ExtendedStats;
+
+/* =============================================================================
+ *  HeapMultiBufMP Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Close a HeapMultiBufMP instance
+ *
+ *  Closing an instance will free local memory consumed by the opened
+ *  instance. All opened instances should be closed before the instance
+ *  is deleted.
+ *
+ *  @param[in,out]  handlePtr   Pointer to handle returned from
+ *                              #HeapMultiBufMP_open
+ *
+ *  @sa         HeapMultiBufMP_open
+ */
+Int HeapMultiBufMP_close(HeapMultiBufMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Create a HeapMultiBufMP instance
+ *
+ *  @param[in]  params      HeapMultiBufMP parameters
+ *
+ *  @return     HeapMultiBufMP Handle
+ */
+HeapMultiBufMP_Handle HeapMultiBufMP_create(const HeapMultiBufMP_Params *params);
+
+/*!
+ *  @brief      Delete a created HeapMultiBufMP instance
+ *
+ *  @param[in,out]  handlePtr   Pointer to handle to delete.
+ *
+ *  @return     HeapMultiBufMP status:
+ *              - #HeapMultiBufMP_S_SUCCESS: Heap successfully deleted
+ */
+Int HeapMultiBufMP_delete(HeapMultiBufMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Open a created HeapMultiBufMP instance
+ *
+ *  Once an instance is created, an open can be performed. The
+ *  open is used to gain access to the same HeapMultiBufMP instance.
+ *  Generally an instance is created on one processor and opened on the
+ *  other processor.
+ *
+ *  The open returns a HeapMultiBufMP instance handle like the create,
+ *  however the open does not initialize the shared memory. The supplied
+ *  name is used to identify the created instance.
+ *
+ *  Call HeapMultiBufMP_close() when the opened instance is not longer needed.
+ *
+ *  @param[in]  name        Name of created HeapMultiBufMP instance
+ *  @param[out] handlePtr   Pointer to HeapMultiBufMP handle to be opened
+ *
+ *  @return     HeapMultiBufMP status
+ *              - #HeapMultiBufMP_S_SUCCESS: Heap successfully opened
+ *              - #HeapMultiBufMP_E_NOTFOUND: Heap is not yet ready to be opened.
+ *              - #HeapMultiBufMP_E_FAIL: A general failure has occurred
+ *
+ *  @sa         HeapMultiBufMP_close
+ */
+Int HeapMultiBufMP_open(String name, HeapMultiBufMP_Handle *handlePtr);
+
+/*! @cond */
+Int HeapMultiBufMP_openByAddr(Ptr sharedAddr, HeapMultiBufMP_Handle *handlePtr);
+
+/*! @endcond */
+
+/*!
+ *  @brief      Initialize a HeapMultiBufMP parameters struct
+ *
+ *  @param[out] params      Pointer to GateMP parameters
+ *
+ */
+Void HeapMultiBufMP_Params_init(HeapMultiBufMP_Params *params);
+
+/*! @cond */
+/*!
+ *  @brief      Amount of shared memory required for creation of each instance
+ *
+ *  @param[in]  params      Pointer to the parameters that will be used in
+ *                          the create.
+ *
+ *  @return     Number of MAUs needed to create the instance.
+ */
+SizeT HeapMultiBufMP_sharedMemReq(const HeapMultiBufMP_Params *params);
+
+/*! @endcond */
+
+/* =============================================================================
+ *  HeapMultiBufMP Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Allocate a block of memory of specified size and alignment
+ *
+ *  NULL is returned if alloc fails.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[in] size      Size to be allocated (in MADUs)
+ *  @param[in] align     Alignment for allocation (power of 2)
+ *
+ *  @sa         HeapMultiBufMP_free
+ */
+Void *HeapMultiBufMP_alloc(HeapMultiBufMP_Handle handle, SizeT size,
+                           SizeT align);
+
+/*!
+ *  @brief      Frees a block of memory.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[in]  block     Block of memory to be freed.
+ *  @param[in]  size      Size to be freed (in MADUs)
+ *
+ *  @sa         HeapMultiBufMP_alloc
+ */
+Void HeapMultiBufMP_free(HeapMultiBufMP_Handle handle, Ptr block, SizeT size);
+
+/*!
+ *  @brief      Get extended memory statistics
+ *
+ *  This function retrieves the extended statistics for a HeapMultiBufMP
+ *  instance.  It does not retrieve the standard Memory_Stats
+ *  information.  Refer to #HeapMultiBufMP_ExtendedStats for more information
+ *  regarding what information is returned.
+ *
+ *  In BIOS, HeapMultiBufMP.trackAllocs needs to be set to 'true' in the
+ *  configuration to get meaningful extended stats.
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[out] stats     ExtendedStats structure
+ *
+ *  @sa     HeapMultiBufMP_getStats()
+ */
+Void HeapMultiBufMP_getExtendedStats(HeapMultiBufMP_Handle handle,
+                                     HeapMultiBufMP_ExtendedStats *stats);
+
+/*!
+ *  @brief      Get memory statistics
+ *
+ *  @param[in]  handle    Handle to previously created/opened instance.
+ *  @param[out] stats     Memory statistics structure
+ *
+ *  @sa     HeapMultiBufMP_getExtendedStats()
+ */
+Void HeapMultiBufMP_getStats(HeapMultiBufMP_Handle handle, Ptr stats);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_HeapMultiBufMP__include */
diff --git a/packages/ti/ipc/Ipc.h b/packages/ti/ipc/Ipc.h
new file mode 100644 (file)
index 0000000..ba0c708
--- /dev/null
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       Ipc.h
+ *
+ *  @brief      Ipc Manager.
+ *
+ *  This module is primarily used to configure IPC, synchronize processors, and
+ *  initialize the IPC runtime.  The memory for SharedRegion zero must be valid
+ *  before Ipc_start() can be called.  Ipc_start() must be called before any
+ *  other IPC APIs are used.
+ *
+ *  The Ipc header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/Ipc.h>
+ *  @endcode
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_Ipc__include
+#define ti_ipc_Ipc__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @def    Ipc_S_BUSY
+ *  @brief  The resource is still in use
+ */
+#define Ipc_S_BUSY              2
+
+/*!
+ *  @def    Ipc_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define Ipc_S_ALREADYSETUP      1
+
+/*!
+ *  @def    Ipc_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define Ipc_S_SUCCESS           0
+
+/*!
+ *  @def    Ipc_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define Ipc_E_FAIL             -1
+
+/*!
+ *  @def    Ipc_E_INVALIDARG
+ *  @brief  Argument passed to function is invalid.
+ */
+#define Ipc_E_INVALIDARG       -2
+
+/*!
+ *  @def    Ipc_E_MEMORY
+ *  @brief  Operation resulted in memory failure.
+ */
+#define Ipc_E_MEMORY           -3
+
+/*!
+ *  @def    Ipc_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define Ipc_E_ALREADYEXISTS    -4
+
+/*!
+ *  @def    Ipc_E_NOTFOUND
+ *  @brief  Unable to find the specified entity.
+ */
+#define Ipc_E_NOTFOUND         -5
+
+/*!
+ *  @def    Ipc_E_TIMEOUT
+ *  @brief  Operation timed out.
+ */
+#define Ipc_E_TIMEOUT          -6
+
+/*!
+ *  @def    Ipc_E_INVALIDSTATE
+ *  @brief  Module is not initialized or in an invalid state.
+ */
+#define Ipc_E_INVALIDSTATE     -7
+
+/*!
+ *  @def    Ipc_E_OSFAILURE
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define Ipc_E_OSFAILURE        -8
+
+/*!
+ *  @def    Ipc_E_RESOURCE
+ *  @brief  Specified resource is not available
+ */
+#define Ipc_E_RESOURCE         -9
+
+/*!
+ *  @def    Ipc_E_RESTART
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define Ipc_E_RESTART          -10
+
+/*!
+ *  @def    Ipc_E_NOTREADY
+ *  @brief  Operation was not ready.
+ */
+#define Ipc_E_NOTREADY         -11
+
+
+/* =============================================================================
+ *  Ipc Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Attach to remote processor
+ *
+ *  This function uses shared memory to synchronize self with the remote
+ *  processor.  Both processors must call this function to attach to each
+ *  other.  Ipc_start() must be called before calling Ipc_attach().
+ *  A processor must attach to the owner of SharedRegion zero before
+ *  it can successfully attach to another processor.  Attempting to
+ *  attach to another processor first returns #Ipc_E_FAIL.
+ *
+ *  This function opens the default GateMP and SharedRegion zero heap.
+ *  The Notify, NameServerRemoteNotify, and MessageQ transport
+ *  instances are created for communicating with the specified remote
+ *  processor in SharedRegion zero heap.  The user's Ipc attach function
+ *  is called.
+ *
+ *  For BIOS, this function should be called within a 'while' loop
+ *  within a Task.  A Task_sleep() or Task_yield() should be called
+ *  within the loop to allow other threads in the system to execute.
+ *  This function needs to be called in a loop because the remote
+ *  processor may not be in a ready state.
+ *
+ *  Note:  For BIOS, if the config parameter Ipc.procSync is set to
+ *  Ipc.ProcSync_ALL, there is no need to call this function as it is
+ *  internally called by Ipc_start().
+ *
+ *  @code
+ *  while (Ipc_attach(remoteProcId) < 0) {
+ *      Task_sleep(1);
+ *  }
+ *  @endcode
+ *
+ *  @param      remoteProcId  remote processor's MultiProc id
+ *
+ *  @return     Status
+ *              - #Ipc_S_SUCCESS: attach was successful
+ *              - #Ipc_S_ALREADYSETUP: already attached
+ *              - #Ipc_E_MEMORY: operation failed due to a memory error
+ *              - #Ipc_E_FAIL: General failure
+ *              - #Ipc_E_NOTREADY: remote processor not ready
+ *
+ *  @sa         Ipc_detach Ipc_isAttached
+ */
+Int Ipc_attach(UInt16 remoteProcId);
+
+/*!
+ *  @brief      Detach from the remote processor
+ *
+ *  A processor must detach from all other processors before it can
+ *  successfully detach from the owner of SharedRegion zero.  Attempting to
+ *  detach from the owner of SharedRegion zero first returns #Ipc_E_FAIL.
+ *
+ *  If a processor successfully attached to a remote processor 'N' times,
+ *  it must call Ipc_detach 'N' times to be completely detached.
+ *  Ipc_detach returns #Ipc_S_BUSY for the first 'N - 1' times its called.
+ *  Ipc_detach returns #Ipc_S_SUCCESS, if successful, on the 'N' time its
+ *  called.  If called on a remote processor that is detached, #Ipc_S_SUCCESS
+ *  is returned.
+ *
+ *  This function should be called within a loop to make sure the processor
+ *  successfully detached from the remote processor.
+ *  If called from the processor with the bigger procId, this function closes
+ *  the instances created for communicating with the specified remote processor.
+ *  If called from the processor with the smaller procId, this function returns
+ *  Ipc_E_NOTREADY while the processor with the bigger procId has not finished
+ *  detaching.  Once the processor with the bigger procId is finished detaching,
+ *  this function deletes the instances created for communicating with the
+ *  specified remote processor.
+ *
+ *  For BIOS, this function should be called within a 'while' loop in a Task
+ *  because the slave may have to wait for the master to detach.  Furthermore,
+ *  a Task_sleep() or Task_yield() should be called within the same 'while'
+ *  loop to allow other threads in the system to execute.
+ *
+ *  @code
+ *  while (TRUE) {
+ *      status = Ipc_detach(remoteProcId);
+ *      if (status == Ipc_E_NOTREADY) {
+ *          Task_sleep(1);
+ *      }
+ *      else if (status < 0) {
+ *          System_printf("Ipc_detach failed \n");
+ *          break;
+ *      }
+ *      else {
+ *          break;
+ *      }
+ *  }
+ *  @endcode
+ *
+ *  @param      remoteProcId  remote processor's MultiProc id
+ *
+ *  @return     Status
+ *              - #Ipc_S_SUCCESS: operation was successful
+ *              - #Ipc_S_BUSY: attach count != 0
+ *              - #Ipc_E_FAIL: operation failed
+ *              - #Ipc_E_NOTREADY: processor not ready to detach
+ *
+ *  @sa         Ipc_attach Ipc_isAttached
+ */
+Int Ipc_detach(UInt16 remoteProcId);
+
+/*!
+ *  @brief      Query whether attached to a remote processor
+ *
+ *  Returns TRUE if attached to a remote processor and FALSE otherwise.  If
+ *  remoteProcId == MultiProc_self(), FALSE is always returned.
+ *
+ *  @param      remoteProcId  remote processor's MultiProc id
+ *
+ *  @return     TRUE if attached, FALSE if not attached
+ *
+ *  @sa         Ipc_attach Ipc_detach
+ */
+Bool Ipc_isAttached(UInt16 remoteProcId);
+
+/*!
+ *  @brief      Reads the config entry from the config area.
+ *
+ *  For more information about this API, refer to the documentation for
+ *  #Ipc_writeConfig
+ *
+ *  @param      remoteProcId  remote processor's MultiProc id
+ *  @param      tag           tag to identify a config entry
+ *  @param      cfg           address where the entry will be copied
+ *  @param      size          size of config entry
+ *
+ *  @return     Status
+ *              - #Ipc_S_SUCCESS: operation was successful
+ *              - #Ipc_E_FAIL: operation failed
+ *
+ *  @sa         Ipc_writeConfig
+ */
+Int Ipc_readConfig(UInt16 remoteProcId, UInt32 tag, Ptr cfg, SizeT size);
+
+/*!
+ *  @brief      Reserves memory, creates default GateMP and HeapMemMP
+ *
+ *  This function needs to be called before Ipc_attach().  It should
+ *  only be called once, unless the return value is #Ipc_E_NOTREADY.
+ *  This indicates that either the SharedRegion zero is not valid or
+ *  has not been setup yet so Ipc_start may be called again. Once
+ *  sucessfully started, subsequent calls returns #Ipc_S_ALREADYSETUP.
+ *
+ *  Ipc reserves some shared memory in SharedRegion zero for synchronization.
+ *  GateMP reserves some shared memory for managing the gates and for the
+ *  default GateMP.  The same amount of memory must be reserved by each
+ *  processor, but only the owner of SharedRegion zero clears the reserved
+ *  memory and creates the default GateMP. The default heap for each
+ *  SharedRegion is created by the owner of each SharedRegion.
+ *
+ *  Note:  For BIOS, if the config parameter Ipc.procSync is set to
+ *  Ipc.ProcSync_ALL, this function calls Ipc_attach() internally.
+ *
+ *  @return     Status
+ *              - #Ipc_S_SUCCESS: operation was successful
+ *              - #Ipc_S_ALREADYSETUP: already successfully called
+ *              - #Ipc_E_NOTREADY: shared memory is not ready
+ *              - #Ipc_E_FAIL: operation failed
+ */
+Int Ipc_start(Void);
+
+/*!
+ *  @brief      Resets the Ipc state
+ *
+ *  This function should be called only once and only after detaching
+ *  from all processors.  Once called, Ipc is placed back to
+ *  the same state as it was before Ipc_start() was called.
+ *
+ *  @return     Status
+ *              - #Ipc_S_SUCCESS: operation was successful
+ */
+Int Ipc_stop(Void);
+
+/*!
+ *  @brief      Writes the config entry to the config area.
+ *
+ *  The #Ipc_writeConfig and #Ipc_readConfig APIs are used to pass
+ *  configuration information from one core to another.  This 'information'
+ *  is passed via a pointer to shared memory with a given size and is
+ *  identified via a unique tag.  A typical use case of this API would be
+ *  passing configuration information from a Slave core to the Host at
+ *  startup-time.  For example, if MessageQ is used, this information
+ *  might include the queue name, message heap sizes, etc.
+ *
+ *  For #Ipc_writeConfig, if 'NULL' is passed in for the cfg parameter,
+ *  it attempts to free the shared memory that is allocated by a previous
+ *  #Ipc_writeConfig call. The remoteProcId, tag, and size must match
+ *  the previous #Ipc_writeConfig call.
+ *
+ *  The #Ipc_writeConfig API writes into SharedRegion 0 (SR0) and uses
+ *  the tag to uniquely identify the structure (cfg) and size written
+ *  into SR0 which both sides must agree on.
+ *
+ *  @param      remoteProcId  remote processor's MultiProc id
+ *  @param      tag           tag to identify a config entry
+ *  @param      cfg           address where the entry will be copied
+ *  @param      size          size of config entry
+ *
+ *  @return     Status
+ *              - #Ipc_S_SUCCESS: if operation was successful
+ *              - #Ipc_E_FAIL: if operation failed
+ *
+ *  @sa         Ipc_readConfig
+ */
+Int Ipc_writeConfig(UInt16 remoteProcId, UInt32 tag, Ptr cfg, SizeT size);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* ti_ipc_Ipc__include */
diff --git a/packages/ti/ipc/ListMP.h b/packages/ti/ipc/ListMP.h
new file mode 100644 (file)
index 0000000..0a84d86
--- /dev/null
@@ -0,0 +1,573 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       ListMP.h
+ *
+ *  @brief      Multiple processor shared memory list
+ *
+ *  ListMP is a doubly linked-list based module designed to be used
+ *  in a multi-processor environment.  It provides a way for
+ *  multiple processors to create, access, and manipulate the same link
+ *  list in shared memory.
+ *
+ *  The ListMP module uses a NameServer instance
+ *  to store information about an instance during create.  Each
+ *  ListMP instance is created by specifying a name and region id.
+ *  The name supplied must be unique for all ListMP instances in the system.
+ *
+ *  ListMP_create() is used to create an instance of a ListMP.
+ *  Shared memory is modified during create.  Once created, an instance
+ *  may be opened by calling ListMP_open().  Open does not
+ *  modify any shared memory.  Open() should be called only when global
+ *  interrupts are enabled.
+ *
+ *  To use a ListMP instance, a #ListMP_Elem must be embedded
+ *  as the very first element of a structure.  ListMP does not provide
+ *  cache coherency for the buffer put onto the link list.
+ *  ListMP only provides cache coherency for the #ListMP_Elem
+ *  fields.  The buffer should be written back before being placed
+ *  on a ListMP, if cache coherency is required.
+ *
+ *  The ListMP header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/ListMP.h>
+ *  @endcode
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_ListMP__include
+#define ti_ipc_ListMP__include
+
+#include <ti/ipc/SharedRegion.h>
+#include <ti/ipc/GateMP.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @def    ListMP_S_BUSY
+ *  @brief  The resource is still in use
+ */
+#define ListMP_S_BUSY            2
+
+/*!
+ *  @def    ListMP_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define ListMP_S_ALREADYSETUP    1
+
+/*!
+ *  @def    ListMP_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define ListMP_S_SUCCESS         0
+
+/*!
+ *  @def    ListMP_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define ListMP_E_FAIL           -1
+
+/*!
+ *  @def    ListMP_E_INVALIDARG
+ *  @brief  Argument passed to function is invalid.
+ */
+#define ListMP_E_INVALIDARG     -2
+
+/*!
+ *  @def    ListMP_E_MEMORY
+ *  @brief  Operation resulted in memory failure.
+ */
+#define ListMP_E_MEMORY         -3
+
+/*!
+ *  @def    ListMP_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define ListMP_E_ALREADYEXISTS  -4
+
+/*!
+ *  @def    ListMP_E_NOTFOUND
+ *  @brief  Unable to find the specified entity.
+ */
+#define ListMP_E_NOTFOUND       -5
+
+/*!
+ *  @def    ListMP_E_TIMEOUT
+ *  @brief  Operation timed out.
+ */
+#define ListMP_E_TIMEOUT        -6
+
+/*!
+ *  @def    ListMP_E_INVALIDSTATE
+ *  @brief  Module is not initialized.
+ */
+#define ListMP_E_INVALIDSTATE   -7
+
+/*!
+ *  @def    ListMP_E_OSFAILURE
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define ListMP_E_OSFAILURE      -8
+
+/*!
+ *  @def    ListMP_E_RESOURCE
+ *  @brief  Specified resource is not available
+ */
+#define ListMP_E_RESOURCE       -9
+
+/*!
+ *  @def    ListMP_E_RESTART
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define ListMP_E_RESTART        -10
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      ListMP_Handle type
+ */
+typedef struct ListMP_Object *ListMP_Handle;
+
+/*!
+ *  @brief  Structure defining a ListMP element.
+ */
+typedef struct ListMP_Elem {
+    volatile SharedRegion_SRPtr next;
+    /*!< SharedRegion pointer to next element */
+
+    volatile SharedRegion_SRPtr prev;
+    /*!< SharedRegion pointer to previous element */
+
+} ListMP_Elem;
+
+/*!
+ *  @brief  Structure defining parameter structure for ListMP_create().
+ */
+typedef struct ListMP_Params {
+    GateMP_Handle gate;
+    /*!< GateMP instance for critical region management of shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+
+    /*! @cond */
+    Ptr sharedAddr;
+    /*!< Physical address of the shared memory
+     *
+     *  The shared memory that will be used for maintaining shared state
+     *  information.  This is an optional parameter to create.  If value
+     *  is null, then the shared memory for the new instance will be
+     *  allocated from the heap in the specified region Id.
+     */
+    /*! @endcond */
+
+    String name;
+    /*!< Name of the instance
+     *
+     *  The name (if not NULL) must be unique among all ListMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     *
+     *  The name does not have to be persistent.  The supplied string is copied
+     *  into persistent memory.
+     */
+
+    UInt16 regionId;
+    /*!< SharedRegion ID.
+     *
+     *  The ID corresponding to the index of the shared region in which this
+     *  shared instance is to be placed.  This is used in create() only when
+     *  name is not null.
+     */
+
+} ListMP_Params;
+
+/* =============================================================================
+ *  ListMP Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Initializes ListMP parameters.
+ *
+ *  @param      params  Instance param structure.
+ */
+Void ListMP_Params_init(ListMP_Params *params);
+
+/*!
+ *  @brief      Creates and initializes ListMP module.
+ *
+ *  @param      params  Instance param structure.
+ *
+ *  @return     ListMP instance handle.  NULL if create failed.
+ *
+ *  @sa         ListMP_delete
+ */
+ListMP_Handle ListMP_create(const ListMP_Params *params);
+
+/*!
+ *  @brief      Close an opened ListMP instance
+ *
+ *  Closing an instance will free local memory consumed by the opened
+ *  instance.  Instances that are opened should be closed before the
+ *  instance is deleted.  If using NameServer,
+ *  the instance name will be removed from the NameServer instance.
+ *
+ *  @param      handlePtr  Pointer to a ListMP instance
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  ListMP successfully closed
+ *              - #ListMP_E_FAIL:  A general failure has occurred
+ *
+ *  @sa         ListMP_open
+ */
+Int ListMP_close(ListMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Deletes a ListMP instance.
+ *
+ *  @param      handlePtr  Pointer to ListMP instance
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  ListMP successfully deleted
+ *                  - #ListMP_E_FAIL:  ListMP delete failed
+ *
+ *  @sa         ListMP_create
+ */
+Int ListMP_delete(ListMP_Handle *handlePtr);
+
+/*!
+ *  @brief      Open a created ListMP instance
+ *
+ *  An open can be performed on a previously created instance.
+ *  Open is used to gain access to the same ListMP instance.
+ *  Generally an instance is created on one processor and opened on
+ *  other processors but it can be opened on the same processor too.
+ *  Open returns a ListMP instance handle like create, but it does
+ *  not initialize any shared memory.
+ *
+ *  The open call searches the local ListMP NameServer table first
+ *  for a matching name. If no local match is found, it will search all
+ *  remote ListMP NameServer tables for a matching name.
+ *
+ *  A status value of #ListMP_S_SUCCESS is returned if a matching
+ *  ListMP instance is found.  A #ListMP_E_FAIL is returned if no
+ *  matching instance is found.  Generally this means the ListMP instance
+ *  has not yet been created.  A more specific status error is returned if
+ *  an error was raised.
+ *
+ *  Call close() when the opened instance is no longer needed.
+ *
+ *  @param      name        Name of created ListMP instance
+ *  @param      handlePtr   pointer to the handle if a handle was found.
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS: ListMP successfully opened
+ *              - #ListMP_E_NOTFOUND: ListMP is not yet ready to be opened.
+ *              - #ListMP_E_FAIL: A general failure has occurred
+ *
+ *  @sa         ListMP_create
+ */
+Int ListMP_open(String name, ListMP_Handle *handlePtr);
+
+/*! @cond
+ *  @brief      Open a created ListMP instance by address
+ *
+ *  Just like ListMP_open(), openByAddr returns a handle to a
+ *  created ListMP instance.  This function allows the ListMP to be
+ *  opened using a shared address instead of a name.
+ *  While ListMP_open() should generally be used to open ListMP
+ *  instances that have been either locally or remotely created, openByAddr
+ *  may be used to bypass a NameServer query that would typically be
+ *  required of an ListMP_open() call.
+ *
+ *  Opening by address requires that the created instance was created
+ *  by supplying a ListMP_Params#sharedAddr parameter rather than a
+ *  ListMP_Params#regionId parameter.
+ *
+ *  A status value of #ListMP_S_SUCCESS is returned if the ListMP is
+ *  successfully opened.  #ListMP_E_FAIL indicates that the ListMP is
+ *  not yet ready to be opened.
+ *
+ *  Call ListMP_close() when the opened instance is not longer needed.
+ *
+ *  @param      sharedAddr  Shared address for the ListMP instance
+ *  @param      handlePtr   Pointer to ListMP handle to be opened
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  ListMP successfully opened
+ *              - #ListMP_E_FAIL:  ListMP is not ready to be opened
+ */
+Int ListMP_openByAddr(Ptr sharedAddr, ListMP_Handle *handlePtr);
+
+/*! @endcond */
+
+/*! @cond
+ *  @brief      Amount of shared memory required for creation of each instance
+ *
+ *  The ListMP_Params#regionId or ListMP_Params#sharedAddr
+ *  needs to be supplied because the cache alignment settings for the region
+ *  may affect the total amount of shared memory required.
+ *
+ *  @param      params  Pointer to the parameters that will be used in
+ *                      the create.
+ *
+ *  @return     Number of MAUs needed to create the instance.
+ */
+SizeT ListMP_sharedMemReq(const ListMP_Params *params);
+
+/*! @endcond */
+
+/* =============================================================================
+ *  ListMP Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Determines if a ListMP instance is empty
+ *
+ *  @param      handle  a ListMP handle.
+ *
+ *  @return     TRUE if 'next' element points to head, otherwise FALSE
+ */
+Bool ListMP_empty(ListMP_Handle handle);
+
+/*!
+ *  @brief      Retrieves the GateMP handle associated with the ListMP instance.
+ *
+ *  @param      handle  a ListMP handle.
+ *
+ *  @return     GateMP handle for ListMP instance.
+ */
+GateMP_Handle ListMP_getGate(ListMP_Handle handle);
+
+/*!
+ *  @brief      Get an element from front of a ListMP instance
+ *
+ *  Atomically removes the element from the front of a
+ *  ListMP instance and returns a pointer to it.
+ *  Uses #ListMP_Params#gate for critical region management.
+ *
+ *  @param  handle  a ListMP handle.
+ *
+ *  @return     pointer to former first element.
+ *              -NULL if the ListMP is empty.
+ */
+Ptr ListMP_getHead(ListMP_Handle handle);
+
+/*!
+ *  @brief      Get an element from back of a ListMP instance
+ *
+ *  Atomically removes the element from the back of a
+ *  ListMP instance and returns a pointer to it.
+ *  Uses #ListMP_Params#gate for critical region management.
+ *
+ *  @param      handle  a ListMP handle.
+ *
+ *  @return     pointer to former last element
+ *              -NULL if the ListMP is empty.
+ */
+Ptr ListMP_getTail(ListMP_Handle handle);
+
+/*!
+ *  @brief      Insert an element into a ListMP instance
+ *
+ *  Atomically inserts `newElem` in the instance in front of `curElem`.
+ *  To place an element at the back of a ListMP instance, use
+ *  #ListMP_putTail.  To place an element at the front of a
+ *  ListMP instance, use #ListMP_putHead.
+ *
+ *  The following code shows an example.
+ *
+ *  @code
+ *  ListMP_Elem elem, curElem;
+ *
+ *  ListMP_insert(listHandle, &elem, &curElem);  // insert before curElem
+ *  @endcode
+ *
+ *  @param      handle  a ListMP handle.
+ *  @param      newElem  new element to insert into the ListMP.
+ *  @param      curElem  current element in the ListMP.
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  if operation was successful
+ *              - #ListMP_E_FAIL:  if operation failed
+ */
+Int ListMP_insert(ListMP_Handle handle,
+                  ListMP_Elem *newElem,
+                  ListMP_Elem *curElem);
+
+/*!
+ *  @brief      Return the next element in a ListMP instance (non-atomic)
+ *
+ *  Is useful in searching a ListMP instance.
+ *  It does not remove any items from the ListMP instance.
+ *  The caller should protect the ListMP instance from being changed
+ *  while using this call since it is non-atomic.
+ *
+ *  To look at the first `elem` on the ListMP, use NULL as the `elem`
+ *  argument.
+ *
+ *  The following code shows an example.
+ *  The scanning of a ListMP instance should be protected
+ *  against other threads that modify the ListMP.
+ *
+ *  @code
+ *  ListMP_Elem   *elem = NULL;
+ *  GateMP_Handle gate;
+ *  IArg          key;
+ *
+ *  // get the gate for the ListMP instance
+ *  gate = ListMP_getGate(listHandle);
+ *
+ *  // Begin protection against modification of the ListMP.
+ *  key = GateMP_enter(gate);
+ *
+ *  while ((elem = ListMP_next(ListMPHandle, elem)) != NULL) {
+ *      //act on elem as needed. For example call ListMP_remove().
+ *  }
+ *
+ *  // End protection against modification of the ListMP.
+ *  GateMP_leave(gate, key);
+ *  @endcode
+ *
+ *  @param      handle  a ListMP handle.
+ *  @param      elem    element in ListMP or NULL to start at the head
+ *
+ *  @return     next element in ListMP instance or NULL to denote end.
+ */
+Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem);
+
+/*!
+ *  @brief      Return the previous element in ListMP instance (non-atomic)
+ *
+ *  Useful in searching a ListMP instance in reverse order.
+ *  It does not remove any items from the ListMP instance.
+ *  The caller should protect the ListMP instance from being changed
+ *  while using this call since it is non-atomic.
+ *
+ *  To look at the last `elem` on the ListMP instance, use NULL as the
+ *  `elem` argument.
+ *
+ *  The following code shows an example. The scanning of a ListMP instance
+ *  should be protected against other threads that modify the instance.
+ *
+ *  @code
+ *  ListMP_Elem  *elem = NULL;
+ *  GateMP_Handle gate;
+ *  IArg          key;
+ *
+ *  // get the gate for the ListMP instance
+ *  gate = ListMP_getGate(listHandle);
+ *
+ *  // Begin protection against modification of the ListMP.
+ *  key = GateMP_enter(gate);
+ *
+ *  while ((elem = ListMP_prev(listHandle, elem)) != NULL) {
+ *      //act on elem as needed. For example call ListMP_remove().
+ *  }
+ *
+ *  // End protection against modification of the ListMP.
+ *  GateMP_leave(gate, key);
+ *  @endcode
+ *
+ *  @param      handle  a ListMP handle.
+ *  @param      elem    element in ListMP or NULL to start at the end
+ *
+ *  @return     previous element in ListMP or NULL if empty.
+ */
+Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem);
+
+/*!
+ *  @brief      Put an element at head of a ListMP instance
+ *
+ *  Atomically places the element at the front of a ListMP instance.
+ *  Uses #ListMP_Params#gate for critical region management.
+ *
+ *  @param      handle  a ListMP handle
+ *  @param      elem    pointer to new ListMP element
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  if operation was successful
+ *              - #ListMP_E_FAIL:  if operation failed
+ */
+Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem);
+
+/*!
+ *  @brief      Put an element at back of a ListMP instance
+ *
+ *  Atomically places the element at the back of a ListMP instance.
+ *  Uses #ListMP_Params#gate for critical region management.
+ *
+ *  @param      handle  a ListMP handle
+ *  @param      elem    pointer to new ListMP element
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  if operation was successful
+ *              - #ListMP_E_FAIL:  if operation failed
+ */
+Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem);
+
+/*!
+ *  @brief      Remove an element from a ListMP instance
+ *
+ *  Atomically removes an element from a ListMP.
+ *
+ *  The `elem` parameter is a pointer to an existing element to be removed
+ *  from a ListMP instance.
+ *
+ *  @param      handle  a ListMP handle
+ *  @param      elem    element in ListMP
+ *
+ *  @return     Status
+ *              - #ListMP_S_SUCCESS:  if operation was successful
+ *              - #ListMP_E_FAIL:  if operation failed
+ */
+Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* ti_ipc_ListMP__include */
diff --git a/packages/ti/ipc/MessageQ.h b/packages/ti/ipc/MessageQ.h
new file mode 100644 (file)
index 0000000..4a6623d
--- /dev/null
@@ -0,0 +1,802 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       MessageQ.h
+ *
+ *  @brief      MessageQ Manager
+ *
+ *  The MessageQ module supports the structured sending and receiving of
+ *  variable length messages. This module can be used for homogeneous
+ *  (DSP to DSP)  or heterogeneous (Arm to DSP) multi-processor messaging.
+ *
+ *  MessageQ provides more sophisticated messaging than other modules. It is
+ *  typically used for complex situations such as multi-processor messaging.
+ *
+ *  The following are key features of the MessageQ module:
+ *  - Writers and readers can be relocated to another processor with no
+ *    runtime code changes.
+ *  - Timeouts are allowed when receiving messages.
+ *  - Readers can determine the writer and reply back.
+ *  - Receiving a message is deterministic when the timeout is zero.
+ *  - Messages can reside on any message queue.
+ *  - Supports zero-copy transfers.
+ *  - Can send and receive from any type of thread.
+ *  - Notification mechanism is specified by application.
+ *  - Allows QoS (quality of service) on message buffer pools. For example,
+ *    using specific buffer pools for specific message queues.
+ *
+ *  Messages are sent and received by being placed on and removed from a
+ *  message queue. A reader is a thread that gets (reads) messages from a
+ *  message queue. A writer is a thread that puts (writes) a message to a
+ *  message queue. Each message queue has one reader and can have many writers.
+ *  A thread may read from or write to multiple message queues.
+ *
+ *  Conceptually, the reader thread owns a message queue. The reader thread
+ *  creates a message queue. The writer threads open a created message queue
+ *  to get access to them.
+ *
+ *  Message queues are identified by a system-wide unique name. Internally,
+ *  MessageQ uses the NameServer module for managing
+ *  these names. The names are used for opening a message queue.
+ *
+ *  Messages must be allocated from the MessageQ module. Once a message is
+ *  allocated, it can be sent to any message queue. Once a message is sent, the
+ *  writer loses ownership of the message and should not attempt to modify the
+ *  message. Once the reader receives the message, it owns the message. It
+ *  may either free the message or re-use the message.
+ *
+ *  Messages in a message queue can be of variable length. The only
+ *  requirement is that the first field in the definition of a message must be a
+ *  #MessageQ_MsgHeader structure. For example:
+ *  @code
+ *  typedef struct MyMsg {
+ *      MessageQ_MsgHeader header;
+ *      ...
+ *  } MyMsg;
+ *  @endcode
+ *
+ *  The MessageQ API uses the MessageQ_MsgHeader internally. Your application
+ *  should not modify or directly access the fields in the MessageQ_MsgHeader.
+ *
+ *  All messages sent via the MessageQ module must be allocated from a
+ *  heap. The heap can also be used for other memory allocation not related to
+ *  MessageQ.
+ *
+ *  An application can use multiple heaps. The purpose of having multiple
+ *  heaps is to allow an application to regulate its message usage. For
+ *  example, an application can allocate critical messages from one heap of fast
+ *  on-chip memory and non-critical messages from another heap of slower
+ *  external memory.
+ *
+ *  The MessageQ_registerHeap() API is used to
+ *  assign a MessageQ heapId to a heap. When allocating a message, the heapId
+ *  is used, not the heap handle. This heapId is actually placed into the
+ *  message (part of the #MessageQ_MsgHeader). Care must be taken when
+ *  assigning heapIds. Refer to the MessageQ_registerHeap() API description for
+ *  more details.
+ *
+ *  MessageQ also supports the usage of messages that are not allocated via the
+ *  MessageQ_alloc() function. Please refer to the MessageQ_staticMsgInit()
+ *  function description for more details.
+ *
+ *  MessageQ supports reads/writes of different thread models. This is
+ *  accomplished by having the creator of the message queue specify a
+ *  synchronizer via the #MessageQ_Params::synchronizer
+ *  configuration parameter. The synchronizer is signaled whenever the
+ *  MessageQ_put() is called. The synchronizer waits if MessageQ_get() is called
+ *  and there are no messages.
+ *
+ *  Since ISyncs are binary, the reader must drain the message queue of all
+ *  messages before waiting for another signal. For example, if the reader
+ *  was a SYSBIOS Swi, the synchronizer instance could be a SyncSwi.
+ *  If a #MessageQ_put was called, the Swi_post() would
+ *  be called. The Swi would run and it must call #MessageQ_get until no
+ *  messages are returned.
+ *
+ *  The MessageQ header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/MessageQ.h>
+ *  @endcode
+ *
+ *  @version        0.00.01
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_MessageQ__include
+#define ti_ipc_MessageQ__include
+
+#include <ti/ipc/MultiProc.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  The resource is still in use
+ */
+#define MessageQ_S_BUSY                  2
+
+/*!
+ *  @brief  The module has been already setup
+ */
+#define MessageQ_S_ALREADYSETUP          1
+
+/*!
+ *  @brief  Operation is successful.
+ */
+#define MessageQ_S_SUCCESS               0
+
+/*!
+ *  @brief  Operation is not successful.
+ */
+#define MessageQ_E_FAIL                 -1
+
+/*!
+ *  @brief  There is an invalid argument.
+ */
+#define MessageQ_E_INVALIDARG           -2
+
+/*!
+ *  @brief  Operation resulted in memory failure.
+ */
+#define MessageQ_E_MEMORY               -3
+
+/*!
+ *  @brief  The specified entity already exists.
+ */
+#define MessageQ_E_ALREADYEXISTS        -4
+
+/*!
+ *  @brief  Unable to find the specified entity.
+ */
+#define MessageQ_E_NOTFOUND             -5
+
+/*!
+ *  @brief  Operation timed out.
+ */
+#define MessageQ_E_TIMEOUT              -6
+
+/*!
+ *  @brief  Module is not initialized.
+ */
+#define MessageQ_E_INVALIDSTATE         -7
+
+/*!
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define MessageQ_E_OSFAILURE            -8
+
+/*!
+ *  @brief  Specified resource is not available
+ */
+#define MessageQ_E_RESOURCE             -9
+
+/*!
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define MessageQ_E_RESTART              -10
+
+/*!
+ *  @brief  An invalid message was encountered
+ */
+#define MessageQ_E_INVALIDMSG           -11
+
+/*!
+ *  @brief  Not the owner
+ */
+#define MessageQ_E_NOTOWNER             -12
+
+/*!
+ *  @brief  Operation resulted in error
+ */
+#define MessageQ_E_REMOTEACTIVE         -13
+
+/*!
+ *  @brief  An invalid heap id was encountered
+ */
+#define MessageQ_E_INVALIDHEAPID        -14
+
+/*!
+ *  @brief  An invalid MultiProc id was encountered
+ */
+#define MessageQ_E_INVALIDPROCID        -15
+
+/*!
+ *  @brief  The max has been reached.
+ */
+#define MessageQ_E_MAXREACHED           -16
+
+/*!
+ *  @brief  Attempting to use an unregistered heap id.
+ */
+#define MessageQ_E_UNREGISTEREDHEAPID   -17
+
+/*!
+ *  @brief  Trying to free a statically initialized message
+ */
+#define MessageQ_E_CANNOTFREESTATICMSG  -18
+
+/*!
+ *  @brief  MessageQ was unblocked
+ */
+#define MessageQ_E_UNBLOCKED            -19
+
+/* =============================================================================
+ *  Macros
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Used as the timeout value to specify wait forever
+ */
+#define MessageQ_FOREVER                ~(0)
+
+/*!
+ *  @brief      Invalid message id
+ */
+#define MessageQ_INVALIDMSGID           0xffff
+
+/*!
+ *  @brief      Invalid message queue
+ */
+#define MessageQ_INVALIDMESSAGEQ        0xffff
+
+/*!
+ *  @brief      Mask to extract priority setting
+ */
+#define MessageQ_PRIORITYMASK           0x3
+
+/*!
+ *  @brief      Extract the destination queue ID from a message.
+ *
+ *  Can only be used on the same processor where the destination queue resides.
+ *  This function should only be used by Message Queue Transport writers.
+ *
+ *  @param[in]  msg     Message of type #MessageQ_Msg
+ *
+ *  @retval  queueId    Destination message queue ID of type #MessageQ_QueueId
+ */
+#define MessageQ_getDstQueue(msg)                                             \
+        ((msg)->dstId == (MessageQ_QueueIndex)MessageQ_INVALIDMESSAGEQ) ?     \
+            (MessageQ_QueueId)MessageQ_INVALIDMESSAGEQ :                      \
+            (MessageQ_QueueId)(((MessageQ_QueueId)MultiProc_self() << 16u)    \
+            | (((MessageQ_Msg)(msg))->dstId))
+
+
+/*!
+ *  @brief   Retrieves the message ID of a message.
+ *
+ *  This function retrieves the message ID from the message. The
+ *  MessageQ_setMsgId() function is used to insert the message ID.
+ *
+ *  The message id is part of the #MessageQ_MsgHeader header and is in every
+ *  MessageQ message. All message ids are initialized to #MessageQ_INVALIDMSGID
+ *  in the MessageQ_alloc() and MessageQ_staticMsgInit() calls.
+ *
+ *  @param[in]  msg     Message of type #MessageQ_Msg
+ *
+ *  @retval     msgId   16-bit message ID from the message
+ */
+#define MessageQ_getMsgId(msg) (((MessageQ_Msg) (msg))->msgId)
+
+/*!
+ *  @brief   Returns the size of the specified message. This function is helpful
+ *           when re-using a message.
+ *
+ *  @param[in]  msg     Message of type #MessageQ_Msg
+ *
+ *  @retval     size    Size of the message
+ */
+#define MessageQ_getMsgSize(msg) (((MessageQ_Msg) (msg))->msgSize)
+
+/*!
+ *  @brief   Gets the message priority of a message
+ *
+ *  @param[in]  msg     Message of type #MessageQ_Msg
+ *
+ *  @retval priority    Priority of the message
+ */
+#define MessageQ_getMsgPri(msg)        \
+                 ((((MessageQ_Msg) (msg))->flags & MessageQ_PRIORITYMASK))
+
+/*!
+ *  @brief      Returns the MultiProc processor id on which the queue resides
+ *
+ *  Message queues reside on the processor that created them. This function
+ *  allows the caller to determined on which processor the queue resides.
+ *
+ *  @param[in]  queueId      Unique #MessageQ_QueueId that identifies the queue
+ *
+ *  @retval     procId       The MultiProc id on which the queue resides
+ */
+#define MessageQ_getProcId(queueId)     \
+                 ((UInt16)((queueId) >> 16))
+
+/*!
+ *  @brief   Retrieves the message queue ID from a message.
+ *
+ *  This function along with the MessageQ_setReplyQueue() function can  be used
+ *  instead of the open function. The sender of a message can embed a messageQ
+ *  into the message with the MessageQ_setReplyQueue() function. The receiver of
+ *  the message can extract the message queue ID with this function.
+ *
+ *  This method is particularing useful in a client/server relationship where
+ *  the server does not want to know who the clients are. The clients can embed
+ *  their message queue into the message to the server and the server extracts
+ *  it and uses it to reply.
+ *
+ *  @param[in]  msg     Message of type #MessageQ_Msg
+ *
+ *  @retval  queueId    Message queue ID of type #MessageQ_QueueId
+ */
+#define MessageQ_getReplyQueue(msg)           \
+                (MessageQ_QueueId)((((MessageQ_Msg) (msg))->replyProc << 16u) \
+                | ((MessageQ_Msg)(msg))->replyId)
+
+/*!
+ *  @brief   Sets the message id in a message.
+ *
+ *  This function sets the message ID in the message. The MessageQ_getMsgId()
+ *  function is used to retrieve the message ID.  The message id is part of the
+ *  #MessageQ_MsgHeader header and is in every MessageQ message. All message ids
+ *  are initialized to #MessageQ_INVALIDMSGID in the MessageQ_alloc() and
+ *  MessageQ_staticMsgInit() calls.
+ *
+ *  @param[in]   msg    Message of type #MessageQ_Msg
+ *  @param[in]   id     16-bit value
+ */
+#define MessageQ_setMsgId(msg, id) ((MessageQ_Msg) (msg))->msgId = (id)
+
+/*!
+ *  @brief   Sets the message priority of a message
+ *
+ *  @param[in]   msg      Message of type #MessageQ_Msg
+ *  @param[in]   priority Priority of message to be set.
+ */
+#define MessageQ_setMsgPri(msg, priority) \
+        (((MessageQ_Msg) (msg))->flags = ((priority) & MessageQ_PRIORITYMASK))
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  A 32-bit value that uniquely identifies a message queue
+ */
+typedef UInt32 MessageQ_QueueId;
+
+/*!
+ *  @brief  Local queue index
+ */
+typedef UInt16 MessageQ_QueueIndex;
+
+/*!
+ *  @brief  MessageQ_Handle type
+ */
+typedef struct MessageQ_Object *MessageQ_Handle;
+
+/*!
+ *  @brief  Structure defining parameters for the MessageQ module.
+ */
+typedef struct {
+    Void *synchronizer;
+    /*!< Synchronizer instance used to signal IO completion
+     *
+     *  The synchronizer is used in MessageQ_put() and MessageQ_get().
+     *  The synchronizer signal is called as part of MessageQ_put().
+     *  The synchronizer waits in MessageQ_get() if there are no messages
+     *  present.
+     */
+
+} MessageQ_Params;
+
+/*!
+ *  @brief      Required first field in every message
+ */
+typedef struct {
+    Bits32       reserved0;         /*!< reserved for List.elem->next       */
+    Bits32       reserved1;         /*!< reserved for List.elem->prev       */
+    Bits32       msgSize;           /*!< message size                       */
+    Bits16       flags;             /*!< bitmask of different flags         */
+    Bits16       msgId;             /*!< message id                         */
+    Bits16       dstId;             /*!< destination queue id               */
+    Bits16       dstProc;           /*!< destination processor id           */
+    Bits16       replyId;           /*!< reply id                           */
+    Bits16       replyProc;         /*!< reply processor                    */
+    Bits16       srcProc;           /*!< source processor                   */
+    Bits16       heapId;            /*!< heap id                            */
+    Bits16       seqNum;            /*!< sequence number                    */
+    Bits16       reserved;          /*!< reserved                           */
+} MessageQ_MsgHeader;
+
+/*!
+ *  @brief  Typedef for ease of use
+ */
+typedef MessageQ_MsgHeader *MessageQ_Msg;
+
+/*!
+ *  @brief      Message priority
+ */
+typedef enum {
+    MessageQ_NORMALPRI      = 0,    /*!< Normal Priority                  */
+    MessageQ_HIGHPRI        = 1,    /*!< High Priority                    */
+    MessageQ_RESERVEDPRI    = 2,    /*!< Reserved Priorit                 */
+    MessageQ_URGENTPRI      = 3     /*!< Urgent Priority                  */
+} MessageQ_Priority;
+
+
+/* =============================================================================
+ *  MessageQ Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Initialize MessageQ_Params
+ *
+ *  @param[in]  params      Parameters required to create a MessageQ
+ */
+Void MessageQ_Params_init(MessageQ_Params *params);
+
+/*!
+ *  @brief      Create a MessageQ instance
+ *
+ *  The name supplied here does not have to be in persistent memory.  The
+ *  maximum length of the string supplied here, including the '\\0' terminator
+ *  is '32' by default.
+ *
+ *  There are no verifications to ensure that the name supplied in
+ *  MessageQ_create() is unique across all processors. Caution must be exercised
+ *  to ensure that each processor uses a unique name.
+ *
+ *  @param[in]  name        Name of the queue
+ *  @param[in]  params      Initialized MessageQ parameters
+ *
+ *  @return     MessageQ Handle
+ */
+MessageQ_Handle MessageQ_create(String name, const MessageQ_Params *params);
+
+/*!
+ *  @brief      Delete a created MessageQ instance
+ *
+ *  This function deletes a created message queue instance. If the
+ *  message queue is non-empty, any messages remaining in the queue
+ *  will not be freed and will be lost.
+ *
+ *  @param[in,out]  handlePtr   Pointer to handle to delete.
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_E_FAIL: delete failed
+ *              - #MessageQ_S_SUCCESS: delete successful
+ */
+Int MessageQ_delete(MessageQ_Handle *handlePtr);
+
+/*!
+ *  @brief      Open a message queue
+ *
+ *  MessageQ_open() is used to retrieve the queue id for a queue that has been
+ *  created either locally or remotely.  Note that the queueId is simply a
+ *  32 bit value that uniquely identifies a queue.  Therefore, it is also
+ *  possible to put a message on a queue whose queueId has been retrieved using
+ *  any other method.
+ *
+ *  @param[in]  name        Name of queue to open
+ *  @param[out] queueId     QueueId that can be used in MessageQ_put()
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_E_NOTFOUND: open failed (name not found on any
+ *                processor)
+ *              - #MessageQ_S_SUCCESS: open successful
+ */
+Int MessageQ_open(String name, MessageQ_QueueId *queueId);
+
+/*!
+ *  @brief      Close the opened handle
+ *
+ *  Only close a queueId that was returned from MessageQ_open().
+ *
+ *  @param[in]  queueId     Pointer to queueId to close
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_E_FAIL: close failed
+ *              - #MessageQ_S_SUCCESS: close successful
+ */
+Int MessageQ_close(MessageQ_QueueId *queueId);
+
+/*!
+ *  @brief      Allocates a message from the heap
+ *
+ *  This function allocates a message from the heap associated with the heapId.
+ *  The first field of the message must be a #MessageQ_MsgHeader structure.
+ *  For example:
+ *      @code
+ *      typedef struct MyMsg {
+ *         MessageQ_MsgHeader header;
+ *         ...
+ *      } MyMsg;
+ *      @endcode
+ *
+ *  @param[in]  heapId      heapId
+ *  @param[in]  size        size of requested message (including the
+ *                          #MessageQ_MsgHeader).
+ *
+ *  @pre        @c size must be at least large enough to hold a
+ *              MessageQ_MsgHeader
+ *
+ *  @return    Allocated message or NULL if no memory.
+ */
+MessageQ_Msg MessageQ_alloc(UInt16 heapId, UInt32 size);
+
+/*!
+ *  @brief      Frees a message back to the heap
+ *
+ *  Frees the message back to the heap that was used to allocate it.
+ *
+ *  @param[in]  msg         Message to free.
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_E_FAIL: failed to free message
+ *              - #MessageQ_S_SUCCESS: successfully freed the message
+ */
+Int MessageQ_free(MessageQ_Msg msg);
+
+/*!
+ *  @brief      Register a heap with MessageQ
+ *
+ *  This function registers a heap with MessageQ. The user selects a unique
+ *  heapId associated with this heap. When a message is allocated via
+ *  MessageQ_alloc(), the heapId is specified. Internally, MessageQ
+ *  uses the heapId to access the heap.
+ *
+ *  Care must be taken when assigning heapIds. Internally MessageQ stores
+ *  the heapId into the message. When the message is freed
+ *  (via MessageQ_free()), the heapId is used to determine which heap to use.
+ *  On systems with shared memory the heapIds must match on corresponding
+ *  processors. For example, assume there is a heap called myHeap which
+ *  acts on shared memory and processors 0 and 1 both use this heap.
+ *  When you register the heap with MessageQ, the same heapId must be used
+ *  on both processor 0 and 1.
+ *
+ *  If a heap is already registered for the specified heapId, no action is
+ *  taken and #MessageQ_E_ALREADYEXISTS is returned.
+ *
+ *  @param[in]  heap        Heap to register
+ *  @param[in]  heapId      heapId associated with the heap
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_S_SUCCESS: heap successfully registered
+ *              - #MessageQ_E_ALREADYEXISTS: heap already exists with heapId
+ */
+Int MessageQ_registerHeap(Ptr heap, UInt16 heapId);
+
+/*!
+ *  @brief      Unregister a heap with MessageQ
+ *
+ *  This function unregisters the heap associated with the heapId.
+ *  Care must be taken to ensure that there are no outstanding messages
+ *  allocated from this heap. If there are outstanding messages, an attempt
+ *  to free the message will result in non-deterministic results.
+ *
+ *  @param[in]  heapId      Heap to unregister
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_S_SUCCESS: heap successfully unregistered
+ */
+Int MessageQ_unregisterHeap(UInt16 heapId);
+
+/*!
+ *  @brief      Sets the message tracing flag on a given message
+ *
+ *  This function enables message tracing for a message.  Tracing is offered
+ *  in the form of Log messages that are output during operations on the
+ *  message (i.e. MessageQ_free(), MessageQ_put(), etc).
+ *
+ *  @param      msg         Message
+ *  @param      traceFlag   Message trace flag (TRUE = tracing enabled)
+ */
+Void MessageQ_setMsgTrace(MessageQ_Msg msg, Bool traceFlag);
+
+/*!
+ *  @brief      Initializes a message not obtained from MessageQ_alloc()
+ *
+ *  There are several fields in the #MessageQ_MsgHeader that
+ *  are initialized by the MessageQ_alloc() function. MessageQ_staticMsgInit()
+ *  can be used to initialize these fields for messages that are
+ *  not allocated from MessageQ.
+ *
+ *  There is one strict constraint with using messages not allocated
+ *  from MessageQ. The message cannot be freed via MessageQ_free().
+ *  This includes
+ *      - The application calling MessageQ_free() on the same processor
+ *      - The application calling MessageQ_free() on a different processor
+ *      - The application cannot send the message to another processor
+ *        where the transport might call MessageQ_free() on the message.
+ *        For example, copy based transport call MessageQ_free() after sending
+ *        the message.
+ *  If a staticMsgInit'd msg is passed to MessageQ_free() an assert will occur
+ *
+ *  @param      msg     Message to initialize
+ *  @param[in]  size    Size of the message in MAUs
+ *
+ *  @pre    @c size must be at least large enough to hold a #MessageQ_MsgHeader
+ */
+Void MessageQ_staticMsgInit(MessageQ_Msg msg, UInt32 size);
+
+/* =============================================================================
+ *  MessageQ Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Gets a message from the message queue
+ *
+ *  This function returns a status. It also returns a message in msg.
+ *  If no message is available, it blocks on the synchronizer object
+ *  until the synchronizer is signaled or a timeout occurs.
+ *  The synchronizer is signaled, when Message_put is called on the MessageQ
+ *  handle. If a timeout occurs, the msg is set to NULL and the status is
+ *  #MessageQ_E_TIMEOUT. If a timeout of zero is specified, the function
+ *  returns immediately and if no message is available, the msg
+ *  is set to NULL and the status is #MessageQ_E_TIMEOUT. The
+ *  #MessageQ_E_UNBLOCKED status is return, if MessageQ_unblock is called
+ *  on the MessageQ handle. If a message is successfully retrieved, the msg
+ *  is set to the message and a #MessageQ_S_SUCCESS status is returned.
+ *
+ *  @param[in]  handle      MessageQ handle
+ *  @param[out] msg         Pointer to the message
+ *  @param[in]  timeout     Maximum duration to wait for a message in
+ *                          microseconds.
+ *
+ *  @return     MessageQ status:
+ *              - #MessageQ_S_SUCCESS: Message successfully returned
+ *              - #MessageQ_E_TIMEOUT: MessageQ_get() timed out
+ *              - #MessageQ_E_UNBLOCKED: MessageQ_get() was unblocked
+ *              - #MessageQ_E_FAIL:    A general failure has occurred
+ *
+ *  @sa         MessageQ_put()
+ *  @sa         MessageQ_unblock()
+ */
+Int MessageQ_get(MessageQ_Handle handle, MessageQ_Msg *msg, UInt timeout);
+
+/*!
+ *  @brief      Place a message onto a message queue
+ *
+ *  This call places the message onto the specified message queue. The
+ *  message queue could be local or remote. The MessageQ module manages
+ *  the delivery.
+ *
+ *  In the case where the queue is remote, MessageQ does not guarantee that
+ *  the message is actually delivered before the MessageQ_put() call returns
+ *
+ *  The queue id must have been returned from one of the following functions:
+ *  - MessageQ_open()
+ *  - MessageQ_getReplyQueue()
+ *  - MessageQ_getDstQueue()
+ *
+ *  After the message is placed onto the final destination, the queue's
+ *  #MessageQ_Params::synchronizer signal function is called.
+ *
+ *  The application loses ownership of the message once MessageQ_put() is called.
+ *
+ *  @param[in]  queueId     Destination MessageQ
+ *  @param[in]  msg         Message to be sent.
+ *
+ *  @return     Status of the call.
+ *              - #MessageQ_S_SUCCESS denotes success.
+ *              - #MessageQ_E_FAIL denotes failure. The put was not successful.
+ *                 The caller still owns the message.
+ */
+Int MessageQ_put(MessageQ_QueueId queueId, MessageQ_Msg msg);
+
+/*!
+ *  @brief      Returns the number of messages in a message queue
+ *
+ *  This function returns the number of messages in a message queue.
+ *
+ *  @param[in]  handle      MessageQ handle
+ *
+ *  @return     Number of messages in the message queue.
+ */
+Int MessageQ_count(MessageQ_Handle handle);
+
+/*!
+ *  @brief      Returns the QueueId associated with the handle
+ *
+ *  Since the MessageQ_put() function takes a QueueId, the creator
+ *  of a message queue cannot send a message to itself without
+ *  retrieving the QueueId. This function extracts the QueueId
+ *  from the object.
+ *
+ *  @param[in]  handle      MessageQ handle
+ *
+ *  @return     QueueId associated to the object
+ */
+UInt32 MessageQ_getQueueId(MessageQ_Handle handle);
+
+/*!
+ *  @brief      Embeds a source message queue into a message
+ *
+ *  This function along with MessageQ_getReplyQueue()
+ *  can be used instead of MessageQ_open(). The sender
+ *  of a message can embed a messageQ into the message with this
+ *  function. The receiver of the message can extract the message queue
+ *  id with the MessageQ_getReplyQueue() function.
+ *
+ *  This method is particularly useful in a client/server relationship
+ *  where the server does not want to know who the clients are. The
+ *  clients can embed their message queue into the message to the server
+ *  and the server extracts it and uses it to reply.
+ *
+ *  @param      handle      MessageQ handle
+ *  @param      msg         Message to embed queue into
+ */
+Void MessageQ_setReplyQueue(MessageQ_Handle handle, MessageQ_Msg msg);
+
+/*!
+ *  @brief      Unblocks a MessageQ
+ *
+ *  Unblocks a reader thread that is blocked on a MessageQ_get().  The
+ *  MessageQ_get() call will return with status #MessageQ_E_UNBLOCKED indicating
+ *  that it returned due to a MessageQ_unblock() rather than a timeout or a
+ *  received message.  This call should only be used during a shutdown sequence
+ *  in order to ensure that there is no blocked reader on a queue before
+ *  deleting the queue.  A queue may not be used after it has been unblocked.
+ *
+ *  MessageQ_unblock() works by raising a flag in the queue indicating that it
+ *  is unblocked and then signaling the synchronizer that is configured with
+ *  the target queue.  If MessageQ_unblock() is called upon a queue that has
+ *  no blocked listeners, then any subsequent MessageQ_get will not block and
+ *  will immediately return #MessageQ_E_UNBLOCKED regardless of whether there
+ *  is a message on the queue.
+ *
+ *  Restrictions:
+ *  -  A queue may not be used after it has been unblocked.
+ *  -  MessageQ_unblock() may only be called on a local queue.
+ *  -  May only be used with a queue configured with a blocking synchronizer.
+ *
+ *  @param[in]  handle      MessageQ handle
+ *
+ *  @sa         MessageQ_get
+ */
+Void MessageQ_unblock(MessageQ_Handle handle);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_MessageQ__include */
diff --git a/packages/ti/ipc/MultiProc.h b/packages/ti/ipc/MultiProc.h
new file mode 100644 (file)
index 0000000..a86b9ac
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       MultiProc.h
+ *
+ *  @brief      Processor ID Manager
+ *
+ *  Many IPC modules require the ability to uniquely specify and identify
+ *  processors in a multi-processor environment. The MultiProc module
+ *  centeralizes processor id management into one module.  Since this
+ *  configuration is almost always universally required, most IPC applications
+ *  require supplying configuration of this module.
+ *
+ *  Each processor in the MultiProc module may be uniquely identified by
+ *  either a name string or an integer ranging from 0 to NUMPROCESSORS - 1.
+ *
+ *  At runtime, the #MultiProc_getId call returns the MultiProc id for any
+ *  processor given its name.
+ *
+ *  The MultiProc header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/MultiProc.h>
+ *  @endcode
+ */
+
+#ifndef ti_ipc_MultiProc__include
+#define ti_ipc_MultiProc__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @def    MultiProc_S_BUSY
+ *  @brief  The resource is still in use
+ */
+#define MultiProc_S_BUSY                 2
+
+/*!
+ *  @def    MultiProc_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define MultiProc_S_ALREADYSETUP         1
+
+/*!
+ *  @def    MultiProc_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define MultiProc_S_SUCCESS              0
+
+/*!
+ *  @def    MultiProc_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define MultiProc_E_FAIL                -1
+
+/*!
+ *  @def    MultiProc_E_INVALIDARG
+ *  @brief  Argument passed to function is invalid.
+ */
+#define MultiProc_E_INVALIDARG          -2
+
+/*!
+ *  @def    MultiProc_E_MEMORY
+ *  @brief  Operation resulted in memory failure.
+ */
+#define MultiProc_E_MEMORY              -3
+
+/*!
+ *  @def    MultiProc_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define MultiProc_E_ALREADYEXISTS       -4
+
+/*!
+ *  @def    MultiProc_E_NOTFOUND
+ *  @brief  Unable to find the specified entity.
+ */
+#define MultiProc_E_NOTFOUND            -5
+
+/*!
+ *  @def    MultiProc_E_TIMEOUT
+ *  @brief  Operation timed out.
+ */
+#define MultiProc_E_TIMEOUT             -6
+
+/*!
+ *  @def    MultiProc_E_INVALIDSTATE
+ *  @brief  Module is not initialized.
+ */
+#define MultiProc_E_INVALIDSTATE        -7
+
+/*!
+ *  @def    MultiProc_E_OSFAILURE
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define MultiProc_E_OSFAILURE           -8
+
+/*!
+ *  @def    MultiProc_E_RESOURCE
+ *  @brief  Specified resource is not available
+ */
+#define MultiProc_E_RESOURCE            -9
+
+/*!
+ *  @def    MultiProc_E_RESTART
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define MultiProc_E_RESTART             -10
+
+/* =============================================================================
+ *  Macros
+ * =============================================================================
+ */
+
+/*!
+ *  @def    MultiProc_INVALIDID
+ *  @brief  Invalid processor id.
+ */
+#define MultiProc_INVALIDID             (0xFFFF)
+
+/* =============================================================================
+ *  MultiProc Module-wide Functions
+ * =============================================================================
+ */
+
+ /*!
+ *  @brief      Gets the base MultiProc id of the cluster
+ *
+ *  Retrieves the base MultiProc id for the cluster of processors.
+ *
+ *  @return     MultiProc id for base of cluster
+ *
+ *  @sa         MultiProc_getClusterId
+ */
+UInt16 MultiProc_getBaseIdOfCluster(Void);
+
+/*!
+ *  @brief      Gets the MultiProc id
+ *
+ *  Retrieves the MultiProc id for the processor with corresponding MultiProc
+ *  name. #MultiProc_INVALIDID is returned if the name was not found.
+ *
+ *  @param      name  Name of the processor.
+ *
+ *  @return     MultiProc id
+ *
+ *  @sa         MultiProc_getName
+ */
+UInt16 MultiProc_getId(String name);
+
+/*!
+ *  @brief      Gets the name of a processor
+ *
+ *  @param      id  MultiProc id.
+ *
+ *  @return     Name of the processor
+ *
+ *  The returned string should never be modified.
+ *
+ *  @sa         MultiProc_getId
+ */
+String MultiProc_getName(UInt16 id);
+
+/*!
+ *  @brief      Gets the number of processors
+ *
+ *  @return     Number of processors configured with MultiProc
+ */
+UInt16 MultiProc_getNumProcessors(Void);
+
+/*!
+ *  @brief      Gets the number of processors in the cluster
+ *
+ *  @return     Number of processors in cluster
+ */
+UInt16 MultiProc_getNumProcsInCluster(Void);
+
+/*!
+ *  @brief      Gets executing processor's MultiProc id
+ *
+ *  @return     Executing processor's id
+ *
+ *  @sa         MultiProc_getId
+ */
+UInt16 MultiProc_self(Void);
+
+/*!
+ *  @brief      Sets executing processor's base id of the cluster
+ *
+ *  @param      baseId  The MultiProc base id of the cluster
+ *
+ *  @return     MultiProc status:
+ *              - #MultiProc_S_SUCCESS: sucessfully set base id of cluster
+ *              - #MultiProc_E_FAIL:    failed to set base id of cluster
+ */
+Int MultiProc_setBaseIdOfCluster(UInt16 baseId);
+
+/*!
+ *  @brief      Sets executing processor's MultiProc id
+ *
+ *  @param      id  MultiProc id
+ *
+ *  @return     MultiProc status:
+ *              - #MultiProc_S_SUCCESS: MultiProc id successfully set
+ *              - #MultiProc_E_FAIL:    MultiProc id cannot be set at this time
+ */
+Int MultiProc_setLocalId(UInt16 id);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* ti_ipc_MultiProc__include */
diff --git a/packages/ti/ipc/NameServer.h b/packages/ti/ipc/NameServer.h
new file mode 100644 (file)
index 0000000..7055f50
--- /dev/null
@@ -0,0 +1,645 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       NameServer.h
+ *
+ *  @brief      NameServer Manager
+ *
+ *  The NameServer module manages local name/value pairs that
+ *  enables an application and other modules to store and
+ *  retrieve values based on a name. The module supports different
+ *  lengths of values. The #NameServer_add and #NameServer_get
+ *  functions are for variable length values. The #NameServer_addUInt32 and
+ *  #NameServer_getUInt32 functions are optimized for UInt32 variables
+ *  and constants.
+ *
+ *  The NameServer module maintains thread-safety for the APIs. However,
+ *  the NameServer APIs cannot be called from an interrupt (i.e. Hwi) context.
+ *  However, it is safe to use the APIs in Swi's and Tasks.
+ *
+ *  Each NameServer instance manages a different name/value table.
+ *  This allows each table to be customized to meet the requirements
+ *  of user:
+ *  @li <b>Size differences:</b> one table could allow long values
+ *  (e.g. > 32 bits) while another table could be used to store integers.
+ *  This customization enables better memory usage.
+ *  @li <b>Performance:</b> improves search time when retrieving
+ *  a name/value pair.
+ *  @li <b>Relax name uniqueness:</b> names in a specific table must
+ *  be unique, but the same name can be used in different tables.
+ *
+ *  When adding a name/value pair, the name and value are copied into
+ *  internal buffers in NameServer. To minimize runtime memory allocation
+ *  these buffers can be allocated at creation time.
+ *
+ *  NameServer maintains the name/values table in local memory (e.g.
+ *  not shared memory). However the NameServer module can be
+ *  used in a multiprocessor system.
+ *
+ *  The NameServer module uses the MultiProc module for
+ *  identifying the different processors. Which remote processors and
+ *  the order they are queried is determined by the procId array in the
+ *  #NameServer_get function.
+ *
+ *  Currently there is no endian or wordsize conversion performed by the
+ *  NameServer module. Also there is no asynchronous support at this time.
+ *
+ *  The NameServer header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/NameServer.h>
+ *  @endcode
+ */
+
+#ifndef ti_ipc_NameServer__include
+#define ti_ipc_NameServer__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @def    NameServer_S_BUSY
+ *  @brief  The resource is still in use
+ */
+#define NameServer_S_BUSY                2
+
+/*!
+ *  @def    NameServer_S_ALREADYSETUP
+ *  @brief  The module has been already setup
+ */
+#define NameServer_S_ALREADYSETUP        1
+
+/*!
+ *  @def    NameServer_S_SUCCESS
+ *  @brief  Operation is successful.
+ */
+#define NameServer_S_SUCCESS             0
+
+/*!
+ *  @def    NameServer_E_FAIL
+ *  @brief  Generic failure.
+ */
+#define NameServer_E_FAIL               -1
+
+/*!
+ *  @def    NameServer_E_INVALIDARG
+ *  @brief  Argument passed to function is invalid.
+ */
+#define NameServer_E_INVALIDARG         -2
+
+/*!
+ *  @def    NameServer_E_MEMORY
+ *  @brief  Operation resulted in memory failure.
+ */
+#define NameServer_E_MEMORY             -3
+
+/*!
+ *  @def    NameServer_E_ALREADYEXISTS
+ *  @brief  The specified entity already exists.
+ */
+#define NameServer_E_ALREADYEXISTS      -4
+
+/*!
+ *  @def    NameServer_E_NOTFOUND
+ *  @brief  Unable to find the specified entity.
+ */
+#define NameServer_E_NOTFOUND           -5
+
+/*!
+ *  @def    NameServer_E_TIMEOUT
+ *  @brief  Operation timed out.
+ */
+#define NameServer_E_TIMEOUT            -6
+
+/*!
+ *  @def    NameServer_E_INVALIDSTATE
+ *  @brief  Module is not initialized.
+ */
+#define NameServer_E_INVALIDSTATE       -7
+
+/*!
+ *  @def    NameServer_E_OSFAILURE
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define NameServer_E_OSFAILURE          -8
+
+/*!
+ *  @def    NameServer_E_RESOURCE
+ *  @brief  Specified resource is not available
+ */
+#define NameServer_E_RESOURCE           -9
+
+/*!
+ *  @def    NameServer_E_RESTART
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define NameServer_E_RESTART            -10
+
+/* =============================================================================
+ *  Macros
+ * =============================================================================
+ */
+
+/*!
+ *  @def    NameServer_ALLOWGROWTH
+ *  @brief  Allow dynamic growth of the NameServer instance table
+ */
+#define NameServer_ALLOWGROWTH          (~0)
+
+/*!
+ *  @def    NameServer_Params_MAXNAMELEN
+ *  @brief  The default maximum length of the name for the name/value pair
+ */
+#define NameServer_Params_MAXNAMELEN    16
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      NameServer handle type
+ */
+typedef struct NameServer_Object *NameServer_Handle;
+
+/*!
+ *  @brief      NameServer_Handle type
+ */
+typedef struct NameServer_Params {
+    UInt maxRuntimeEntries;
+    /*!< Maximum number of name/value pairs that can be dynamically created.
+     *
+     *  This parameter allows NameServer to pre-allocate memory.
+     *  When NameServer_add() or NameServer_addUInt32() is
+     *  called, no memory allocation occurs.
+     *
+     *  If the number of pairs is not known at configuration time, set this
+     *  value to #NameServer_ALLOWGROWTH. This instructs NameServer
+     *  to grow the table as needed. NameServer will allocate memory from the
+     *  #NameServer_Params#tableHeap when a name/value pair is added.
+     *
+     *  The default is #NameServer_ALLOWGROWTH.
+     */
+
+    Ptr  tableHeap;
+    /*!< Name/value table is allocated from this heap.
+     *
+     *  The instance table and related buffers are allocated out of this heap
+     *  during the dynamic create. This heap is also used to allocate new
+     *  name/value pairs when #NameServer_ALLOWGROWTH for
+     *  #NameServer_Params#maxRuntimeEntries
+     *
+     *  The default is to use the same heap that instances are allocated
+     *  from which can be configured via the
+     *  NameServer.common$.instanceHeap configuration parameter.
+     */
+
+    Bool checkExisting;
+    /*!< Check if a name already exists in the name/value table.
+     *
+     *  When a name/value pair is added during runtime, if this boolean is
+     *  true, the table is searched to see if the name already exists. If
+     *  it does, the name is not added and the
+     *  #NameServer_E_ALREADYEXISTS error is returned.
+     *
+     *  If this flag is false, the table will not be checked to see if the
+     *  name already exists. It will simply be added. This mode has better
+     *  performance at the expense of potentially having non-unique names
+     *  in the table.
+     *
+     *  This flag is used for runtime adds only. Adding non-unique names during
+     *  configuration results in a build error.
+     */
+
+    UInt maxValueLen;
+    /*!< Length, in MAUs, of the value field in the table.
+     *
+     *  Any value less than sizeof(UInt32) will be rounded up to sizeof(UInt32)
+     */
+
+    UInt maxNameLen;
+    /*!< Length, in MAUs, of the name field in the table.
+     *
+     *  The maximum length of the name portion of the name/value
+     *  pair.  The length includes the null terminator ('\\0').
+     */
+
+} NameServer_Params;
+
+
+/* =============================================================================
+ *  NameServer Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Initializes parameter structure
+ *
+ *  @param      params  Instance param structure
+ *
+ *  @sa         NameServer_create
+ */
+Void NameServer_Params_init(NameServer_Params *params);
+
+/*!
+ *  @brief      Creates a NameServer instance
+ *
+ *  @param      name    Instance name
+ *  @param      params  Instance param structure
+ *
+ *  @return     NameServer handle
+ *
+ *  @sa         NameServer_delete
+ */
+NameServer_Handle NameServer_create(String name,
+                                    const NameServer_Params *params);
+
+/*!
+ *  @brief      Deletes a NameServer instance
+ *
+ *  If the instance is not empty, the contents is freed back to the
+ *  heap it was allocated from.
+ *
+ *  @param      handlePtr  Pointer to a NameServer handle
+ *
+ *  @return     Status
+ *              - #NameServer_S_SUCCESS:  Instance successfully deleted
+ *              - #NameServer_E_FAIL:  Instance delete failed
+ *
+ *  @sa         NameServer_create
+ */
+Int NameServer_delete(NameServer_Handle *handlePtr);
+
+/*!
+ *  @brief      Gets the NameServer handle given the name
+ *
+ *  Each NameServer instance has a name. The name and this function can be
+ *  used by the remote driver module to aid in queries to remote
+ *  processors. This function allows the caller to get the local handle
+ *  based on the instance name.
+ *
+ *  For example, when a remote driver sends a request to the remote
+ *  processor, it probably contains the name of the instance to query.
+ *  The receiving remote driver uses that name to obtain the handle for
+ *  the local NameServer instance in question. Then that instance
+ *  can be queried for the name/value pair.
+ *
+ *  This function does not query remote processors.
+ *
+ *  @param      name  Name of instance
+ *
+ *  @return     NameServer handle
+ */
+NameServer_Handle NameServer_getHandle(String name);
+
+/* =============================================================================
+ *  NameServer Per-instance Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  Adds a variable length value into the local NameServer table
+ *
+ *  This function adds a variable length value into the local table.
+ *  If the #NameServer_Params#checkExisting flag was true on
+ *  creation, this function searches the table to make sure the name
+ *  does not already exist.  If it does, the name/value pair is not
+ *  added and the #NameServer_E_ALREADYEXISTS error is returned.
+ *
+ *  There is memory allocation during this function if
+ *  #NameServer_Params#maxRuntimeEntries is set to
+ *  #NameServer_ALLOWGROWTH.
+ *
+ *  This function copies the name and buffer into the name/value table,
+ *  so they do not need to be persistent after the call.
+ *
+ *  The function does not query remote processors to make sure the
+ *  name is unique.
+ *
+ *  @param      handle  Instance handle
+ *  @param      name    Name for the name/value pair
+ *  @param      buf     Pointer to value for the name/value pair
+ *  @param      len     length of the value
+ *
+ *  @return     Unique entry identifier
+ *
+ *  @sa         NameServer_addUInt32,
+ *              NameServer_get,
+ */
+Ptr NameServer_add(NameServer_Handle handle, String name, Ptr buf, UInt32 len);
+
+/*!
+ *  @brief      Adds a 32-bit value into the local NameServer table
+ *
+ *  This function adds a 32-bit value into the local table. This
+ *  function is simply a specialized NameServer_add() function
+ *  that allows a convenient way to add UInt32 bit values without needing
+ *  to specify the address of a UInt32 local variable.
+ *
+ *  If the #NameServer_Params#checkExisting flag was true on
+ *  creation, this function searches the table to make sure the name does
+ *  not already exist.  If it does, the name/value pair is not added and the
+ *  #NameServer_E_ALREADYEXISTS error is returned.
+ *
+ *  This function copies the name into the name/value table.
+ *
+ *  There is memory allocation during this function if
+ *  #NameServer_Params#maxRuntimeEntries is set to
+ *  #NameServer_ALLOWGROWTH.
+ *
+ *  The function does not query remote processors to make sure the
+ *  name is unique.
+ *
+ *  @param      handle  Instance handle
+ *  @param      name    Name for the name/value pair
+ *  @param      value   Value for the name/value pair
+ *
+ *  @return     Unique entry identifier
+ *
+ *  @sa         NameServer_add,
+ *              NameServer_getUInt32
+ */
+Ptr NameServer_addUInt32(NameServer_Handle handle, String name, UInt32 value);
+
+/*!
+ *  @brief      Gets the variable value length by name
+ *
+ *  If the name is found, the value is copied into the value
+ *  argument, the number of MAUs copied is returned in len, and
+ *  a success status is returned.
+ *
+ *  If the name is not found, zero is returned in len, the contents
+ *  of value are not modified.  Not finding a name is not considered
+ *  an error.
+ *
+ *  For NameServer to work across processors, each processor must
+ *  must be assigned a unique id.  Because remote NameServer requests
+ *  usually employ the use of notifications, it is good practice to
+ *  sleep/wait between successive NameServer_get[UInt32] operations if polling
+ *  on the success of this call.  This helps ensure that remote cores
+ *  are not inundated by a flood of incoming notifications and helps
+ *  reduce the possiblity of deadlocks.
+ *
+ *  The processors to query is determined by the procId array.
+ *  The array is used to specify which processors to query and the order.
+ *  The processor ids are determined via the MultiProc module.
+ *  The following are the valid settings for the procId array:
+ *  @li <b>NULL:</b> denotes that the local table is searched first, then
+ *  all remote processors in ascending order by MultiProc id.
+ *  @li <b>Filled in array:</b> The NameServer will search the processors
+ *  in the order given in the array. The end of the list must be denoted
+ *  by the #MultiProc_INVALIDID value.
+ *
+ *  @code
+ *  UInt16 queryList[4] = {3, 2, 4, MultiProc_INVALIDID};
+ *  count = NameServer_get(handle, "foo", &value, &len, queryList);
+ *  @endcode
+ *
+ *  The NameServer_getLocal() call can be used for searching
+ *  the local table only.
+ *
+ *  @param      handle          Instance handle
+ *  @param      name            Name to query
+ *  @param      buf             Pointer where the value is returned
+ *  @param      len             Pointer for input/output length.
+ *  @param      procId          Array of processor(s) to query
+ *
+ *  @return     NameServer status:
+ *              - #NameServer_S_SUCCESS:  Successfully found entry
+ *              - #NameServer_E_NOTFOUND: Entry was not found, len unchanged
+ *              - #NameServer_E_FAIL: Error searching for entry
+ *
+ *  @sa         NameServer_add,
+ *              NameServer_getLocal
+ */
+Int NameServer_get(NameServer_Handle handle,
+                   String name,
+                   Ptr buf,
+                   UInt32 *len,
+                   UInt16 procId[]);
+
+/*!
+ *  @brief      Gets a 32-bit value by name
+ *
+ *  If the name is found, the value is copied into the value
+ *  argument, and a success status is returned.
+ *
+ *  If the name is not found, the contents of value are not modified.
+ *  Not finding a name is not considered an error.
+ *
+ *  For NameServer to work across processors, each processor must
+ *  must be assigned a unique id.  Because remote NameServer requests
+ *  usually employ the use of notifications, it is good practice to
+ *  sleep/wait between successive NameServer_get[UInt32] operations if polling
+ *  on the success of this call.  This helps ensure that remote cores
+ *  are not inundated by a flood of incoming notifications and helps
+ *  reduce the possiblity of deadlocks.
+ *
+ *  The processors to query is determined by the procId array.
+ *  The array is used to specify which processors to query and the order.
+ *  The processor ids are determined via the MultiProc module.
+ *  The following are the valid settings for the procId array:
+ *  @li <b>NULL:</b> denotes that the local table is searched first, then
+ *  all remote processors in ascending order by MultiProc id.
+ *  @li <b>Filled in array:</b> The NameServer will search the processors
+ *  in the order given in the array. The end of the list must be denoted
+ *  by the #MultiProc_INVALIDID value.
+ *
+ *  @code
+ *  UInt16 queryList[4] = {3, 2, 4, MultiProc_INVALIDID};
+ *  count = NameServer_getUInt32(handle, "foo", &value, queryList);
+ *  @endcode
+ *
+ *  The NameServer_getLocal() call can be used for searching
+ *  the local table only.
+ *  @param      handle          Instance handle
+ *  @param      name            Name to query
+ *  @param      buf             Pointer where the value is returned
+ *  @param      procId          Array of processor(s) to query
+ *
+ *  @return     Status
+ *              - #NameServer_S_SUCCESS:  Successfully found entry
+ *              - #NameServer_E_NOTFOUND: Entry was not found
+ *              - #NameServer_E_FAIL: Error searching for entry
+ *
+ *  @sa         NameServer_addUInt32,
+ *              NameServer_getLocalUInt32
+ */
+Int NameServer_getUInt32(NameServer_Handle handle,
+                         String name,
+                         Ptr buf,
+                         UInt16 procId[]);
+
+/*!
+ *  @brief      Gets the variable value length by name from the local table
+ *
+ *  If the name is found, the value is copied into the value
+ *  argument, the number of MAUs copied is returned in len, and
+ *  a success status is returned.
+ *
+ *  If the name is not found, zero is returned in len, a fail status is
+ *  returned and the contents of value are not modified.
+ *  Not finding a name is not considered an error.
+ *
+ *  This function only searches the local name/value table.
+ *
+ *  @param      handle  Instance handle
+ *  @param      name    Name to query
+ *  @param      buf     Pointer where the value is returned
+ *  @param      len     Length of the value
+ *
+ *  @return     Status
+ *              - #NameServer_S_SUCCESS:  Successfully found entry, len
+ *                                        holds amount of data retrieved.
+ *              - #NameServer_E_NOTFOUND:  Entry was not found, len remains
+ *                                     unchanged.
+ *
+ *  @sa         NameServer_add,
+ *              NameServer_get
+ */
+Int NameServer_getLocal(NameServer_Handle handle,
+                        String name,
+                        Ptr buf,
+                        UInt32 *len);
+
+/*!
+ *  @brief      Gets a 32-bit value by name from the local table
+ *
+ *  If the name is found, the 32-bit value is copied into buf
+ *  and NameServer_S_SUCCESS is returned.
+ *
+ *  If the name is not found, zero is copied into buf and
+ *  NameServer_E_NOTFOUND is returned.
+ *
+ *  This function only searches the local name/value table.
+ *
+ *  @param      handle  Instance handle
+ *  @param      name    Name to query
+ *  @param      buf     Pointer where the value is returned
+ *
+ *  @return     Status
+ *              - #NameServer_S_SUCCESS:  Successfully found entry
+ *              - #NameServer_E_NOTFOUND:  Entry was not found
+ *
+ *  @sa         NameServer_addUInt32,
+ *              NameServer_getUInt32
+ */
+Int NameServer_getLocalUInt32(NameServer_Handle handle,
+                              String name,
+                              Ptr buf);
+
+/*!  @cond
+  *  @brief      Match the name with the longest entry
+  *
+  *  Returns the number of characters that matched with an entry.
+  *  So if "abc" and "ab" was an entry and you called match with "abcd",
+  *  this function will match the "abc" entry. The return would be 3 since
+  *  three characters matched.
+  *
+  *  Currently only 32-bit values are supported.
+  *
+  *  @param     handle  Instance handle
+  *  @param     name    Name in question
+  *  @param     value   Pointer in which the value is returned
+  *
+  *  @return    Number of matching characters
+  */
+Int NameServer_match(NameServer_Handle handle, String name, UInt32 *value);
+
+/*! @endcond */
+
+/*!
+ *  @brief        Remove a name/value pair from the table
+ *
+ *  This function removes a name/value pair from the table.
+ *
+ *  If #NameServer_Params#maxRuntimeEntries is set to
+ *  #NameServer_ALLOWGROWTH,
+ *  memory will be freed which was allocated in NameServer_add().
+ *  Otherwise, no memory is freed during this call.
+ *  The entry in the table is simply emptied.
+ *  When another NameServer_add() occurs, it will reuse the empty
+ *  entry.
+ *
+ *  @param      handle  Instance handle
+ *  @param      name    Name to remove
+ *
+ *  @return     Status
+ *              - #NameServer_S_SUCCESS:  Successfully removed entry or
+ *                                        entry does not exists
+ *              - #NameServer_E_FAIL:  Operation failed
+ *
+ *  @sa         NameServer_add
+ */
+Int NameServer_remove(NameServer_Handle handle, String name);
+
+/*!
+ *  @brief        Remove a name/value pair from the table
+ *
+ *  This function removes an entry from the table based on the
+ *  unique identifier returned from NameServer_add() or
+ *  NameServer_addUInt32().
+ *
+ *  If #NameServer_Params#maxRuntimeEntries is set to
+ *  #NameServer_ALLOWGROWTH,
+ *  memory will be freed which was allocated in NameServer_add().
+ *  Otherwise, no memory is freed during this call.
+ *  The entry in the table is simply emptied.
+ *  When another NameServer_add() occurs, it will reuse the
+ *  empty entry.
+ *
+ *  Once an Entry is removed from the NameServer table, it cannot be
+ *  removed again (just like you cannot free the same block of memory
+ *  twice).
+ *
+ *  @param      handle  Instance handle
+ *  @param      entry   Pointer to entry to be removed
+ *
+ *  @return     Status
+ *              - #NameServer_S_SUCCESS:  Successfully removed entry or
+ *                                        entry does not exists
+ *              - #NameServer_E_FAIL:  Operation failed
+ *
+ *  @sa         NameServer_add
+ */
+Int NameServer_removeEntry(NameServer_Handle handle, Ptr entry);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* ti_ipc_NameServer__include */
diff --git a/packages/ti/ipc/Notify.h b/packages/ti/ipc/Notify.h
new file mode 100644 (file)
index 0000000..acf4293
--- /dev/null
@@ -0,0 +1,614 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       Notify.h
+ *
+ *  @brief      Notification manager for IPC
+ *
+ *  The Notify module manages the multiplexing/demultiplexing of software
+ *  interrupts over hardware interrupts.  In order to receive notifications,
+ *  a processor registers one or more callback functions to an eventId
+ *  using Notify_registerEvent().  The Notify_registerEvent()
+ *  call (like most other Notify APIs) uses a MultiProc id and
+ *  line id to target a specific interrupt line to/from a specific processor
+ *  on a device.  The Notify_eventAvailable() API may be used to query whether
+ *  an event id is availble for use before registration.
+ *
+ *  Once an event has been registered, a remote processor may send an event
+ *  using the Notify_sendEvent() call.  If the event and the interrupt line
+ *  are both enabled, all callback functions registered to the event will
+ *  be called sequentially.
+ *
+ *  A specific event may be disabled or enabled using the Notify_disableEvent()
+ *  and Notify_enableEvent() calls.  An entire interrupt line may be disabled
+ *  or restored using the Notify_disable() or Notify_restore() calls.
+ *  Notify_disable() does not alter the state of individual events.
+ *  Instead, it just disables the ability of the Notify module to receive
+ *  events on the interrupt line.
+ *
+ *  Notify APIs should never be called within an Hwi context.  All API calls
+ *  should be made within main(), a Task or a Swi with the exception of
+ *  Notify_sendEvent() which may also be called within a Hwi.
+ *
+ *  "Loopback" functionality allows Notifications to be registered
+ *  and sent locally.  This is accomplished by supplying our own MultiProc id
+ *  to Notify APIs. Line id #0 is always used for local notifications.  It is
+ *  important to be aware of some subtle (but important) differences between
+ *  remote and local notifications:
+ *
+ *      - Loopback callback functions will execute in the same thread in which
+ *        Notify_sendEvent() is called.  This is in contrast to callback
+ *        functions that are called due to another processor's sent
+ *        notification- these 'remote' callback functions will execute in an
+ *        ISR context.
+ *
+ *      - Loopback callback functions will execute with interrupts disabled
+ *
+ *      - Disabling the local interrupt line will cause all notifications that
+ *        are sent to the local processor to be lost.  By contrast, a
+ *        notification sent to an enabled event on a remote processor that has
+ *        called Notify_disable() results in a pending notifications until the
+ *        disabled processor has called Notify_restore().
+ *
+ *      - Local notifications do not support events of different priorities.
+ *        By contrast, Notify driver implementations may correlate event ids
+ *        with varying priorities.
+ *
+ *  In order to use any Notify APIs on DSP/BIOS, IPC/SysLink must first be
+ *  started.  This will internally call Notify_attach() which sets up
+ *  all necessary Notify drivers, shared memory and interprocessor interrupts.
+ *  It is possible for a user application to call Notify_attach() directly
+ *  (before Ipc_attach() or Ipc_start()) if notifications must be set up prior
+ *  to runtime SharedRegion initialization. Refer to the documentation for
+ *  Notify_attach() for more information.
+ *
+ *  The Notify header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/Notify.h>
+ *  @endcode
+ *
+ *  @version  0.00.01
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_Notify__include
+#define ti_ipc_Notify__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* =============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  The resource is still in use
+ */
+#define Notify_S_BUSY                    2
+
+/*!
+ *  @brief  Module already set up
+ */
+#define Notify_S_ALREADYSETUP            1
+
+/*!
+ *  @brief  Operation is successful.
+ */
+#define Notify_S_SUCCESS                 0
+
+/*!
+ *  @brief  Generic failure.
+ */
+#define Notify_E_FAIL                   -1
+
+/*!
+ *  @brief  Argument passed to function is invalid.
+ */
+#define Notify_E_INVALIDARG             -2
+
+/*!
+ *  @brief  Operation resulted in memory failure.
+ */
+#define Notify_E_MEMORY                 -3
+
+/*!
+ *  @brief  The specified entity already exists.
+ */
+#define Notify_E_ALREADYEXISTS          -4
+
+/*!
+ *  @brief  Unable to find the specified entity.
+ */
+#define Notify_E_NOTFOUND               -5
+
+/*!
+ *  @brief  Operation timed out.
+ */
+#define Notify_E_TIMEOUT                -6
+
+/*!
+ *  @brief  Module is not initialized.
+ */
+#define Notify_E_INVALIDSTATE           -7
+
+/*!
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define Notify_E_OSFAILURE              -8
+
+/*!
+ *  @brief  The module has been already setup
+ */
+#define Notify_E_ALREADYSETUP           -9
+
+/*!
+ *  @brief  Specified resource is not available
+ */
+#define Notify_E_RESOURCE               -10
+
+/*!
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define Notify_E_RESTART                -11
+
+/*!
+ *  @brief  The resource is still in use
+ */
+#define Notify_E_BUSY                   -12
+
+/*!
+ *  @brief  Driver corresponding to the specified eventId is not registered
+ */
+#define Notify_E_DRIVERNOTREGISTERED    -13
+
+/*!
+ *  @brief  Event not registered
+ */
+#define Notify_E_EVTNOTREGISTERED       -14
+
+/*!
+ *  @brief  Event is disabled
+ */
+#define Notify_E_EVTDISABLED            -15
+
+/*!
+ *  @brief  Remote notification is not initialized
+ */
+#define Notify_E_NOTINITIALIZED         -16
+
+/*!
+ *  @brief  Trying to illegally use a reserved event
+ */
+#define Notify_E_EVTRESERVED            -17
+
+/* =============================================================================
+ *  Macros
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  Maximum number of events supported by the Notify module
+ */
+#define Notify_MAXEVENTS                (UInt16)32
+
+/*!
+ *  @brief  Maximum number of IPC interrupt lines for any pair of processors
+ */
+#define Notify_MAX_INTLINES             4u
+
+/*!
+ *  @brief  This key must be provided as the upper 16 bits of the eventId when
+ *          registering for an event, if any reserved event numbers are to be
+ *          used.
+ */
+#define Notify_SYSTEMKEY                ((UInt16)0xC1D2)
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @var     Notify_FnNotifyCbck
+ *  @brief   Signature of any callback function that can be registered with the
+ *           Notify component.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  eventId     Event id (minus system key if reserved event)
+ *  @param[in]  arg         Argument specified in the registerEvent
+ *  @param[in]  payload     Payload specified in the sendEvent
+ */
+typedef Void (*Notify_FnNotifyCbck)(UInt16 , UInt16, UInt32, UArg, UInt32);
+
+/* =============================================================================
+ *  Notify Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Creates notify drivers and registers them with Notify
+ *
+ *  This function must be called before other Notify API calls are
+ *  invoked.  Performing a attach invokes a device-specific Notify
+ *  initialization routine that creates required drivers and
+ *  registers those drivers with the Notify module.  If the drivers
+ *  require shared memory, a shared address must be supplied.
+ *
+ *  Notify_attach() is typically called internally as part of the IPC
+ *  initialization sequence.  Any memory required for Notify drivers
+ *  is reserved by SharedRegion and passed to Notify_attach().  However, if it
+ *  is necessary to pass a specific base address to Notify_attach() (i.e. if
+ *  the shared region is not valid yet), then Notify_attach() should be called
+ *  before Ipc_start() with this address.  When Ipc_start() is eventually
+ *  called, Notify_attach() will be internally bypassed since it was directly
+ *  called by the user.
+ *
+ *  @param[in]  remoteProcId    Remote processor id
+ *  @param[in]  sharedAddr      Shared address to use if any driver requires
+ *                              shared memory
+ *  @return     Notify status:
+ *              - #Notify_E_FAIL: failed to attach to remote processor
+ *              - #Notify_S_SUCCESS: successfully attach to remote processor
+ */
+Int Notify_attach(UInt16 remoteProcId, Ptr sharedAddr);
+
+/*!
+ *  @brief      Disable ability to receive interrupts on an interrupt line
+ *
+ *  This function disables a NotifyDriver from processing received
+ *  events. The key that is returned from this call must be used
+ *  in the Notify_restore() function.
+ *
+ *  Notify supports nested disable/restore calls. The value of the returned
+ *  key is the nesting depth.
+ *
+ *  If Notify_disable() is called upon an interrupt line that is already
+ *  disabled, then the corresponding Notify_restore() will not re-enable
+ *  notifications.  Only the restore call that corresponds to the
+ *  Notify_disable() that actually disabled notifications will re-enable
+ *  notifications on the interrupt line.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *
+ *  @return     Key that must be used in Notify_restore()
+ *
+ *  @sa         Notify_restore()
+ */
+UInt Notify_disable(UInt16 procId, UInt16 lineId);
+
+/*!
+ *  @brief      Disable an event
+ *
+ *  This function allows the disabling of a single event number
+ *  from the specified source processor.  Sending to a disabled event
+ *  will return #Notify_E_EVTDISABLED on the sender if waitClear is false.
+ *  Notify_disableEvent() and Notify_enableEvent() may not be supported by all
+ *  Notify drivers.  Consult the documentation for the Notify driver to determine
+ *  whether it supports this API call.
+ *
+ *  An event is, by default, enabled upon driver initialization.
+ *  Calling Notify_disableEvent() upon an event that is already disabled
+ *  results in no change in state.
+ *
+ *  Note that callbacks may be registered to an event or removed
+ *  from the event even while the event has been disabled.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  eventId     Event id
+ *
+ *  @sa         Notify_enableEvent()
+ */
+Void Notify_disableEvent(UInt16 procId, UInt16 lineId, UInt32 eventId);
+
+/*!
+ *  @brief      Enable an event
+ *
+ *  This function re-enables an event that has been previously disabled
+ *  using disableEvent().  Calling Notify_enableEvent() upon an event that is
+ *  already enabled results in no change in state.  An event is,
+ *  by default, enabled upon driver initialization.
+ *
+ *  Notify_disableEvent() and Notify_enableEvent() may not be supported by all
+ *  Notify drivers.  Consult the documentation for the Notify driver to determine
+ *  whether it supports this API call.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  eventId     Event id
+ *
+ *  @sa         Notify_disableEvent()
+ */
+Void Notify_enableEvent(UInt16 procId, UInt16 lineId, UInt32 eventId);
+
+/*!
+ *  @brief      Whether an unused event is available on an interrupt line
+ *
+ *  This function can be used to determine whether an unused eventId for a
+ *  specific interrupt line is available for use in Notify_registerEvent()
+ *  or Notify_registerEventSingle().  This function will return TRUE if and only
+ *  if the following conditions are simultaneously TRUE:
+ *  -  The corresponding interrupt line is available.  Notifications over an
+ *     interrupt line to a remote processor are typically made available by
+ *     calling Notify_attach() or Ipc_attach().
+ *  -  The event is not a reserved event
+ *  -  The event is a reserved event and #Notify_SYSTEMKEY has been passed
+ *     as the upper 16 bits of the 32-bit eventId argument
+ *  -  No callback functions have been registered to the event
+ *  If any of the above conditions is false, this function will return FALSE.
+ *  Note that an event may still be registered using Notify_registerEvent()
+ *  while the last condition is false if the existing callback function(s)
+ *  were registered using Notify_registerEvent() (not
+ *  Notify_registerEventSingle()).
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  eventId     Event id
+ *
+ *  @return     TRUE if an unused event is available, FALSE otherwise
+ */
+Bool Notify_eventAvailable(UInt16 procId, UInt16 lineId, UInt32 eventId);
+
+/*!
+ *  @brief      Whether notification via interrupt line has been registered.
+ *
+ *  This function will return TRUE if and only if a notify driver has been
+ *  registered for the interrupt line identified by the supplied procId and
+ *  lineId.  The interrupt line corresponding to loopback functionality is
+ *  always registered.  A value of FALSE indicates that either
+ *  Notify_attach() has not yet been called or that notification to the
+ *  remote processor is unsupported.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *
+ *  @return     TRUE if registered, FALSE otherwise
+ */
+Bool Notify_intLineRegistered(UInt16 procId, UInt16 lineId);
+
+/*!
+ *  @brief      Returns number of interrupt lines to remote processor
+ *
+ *  This function returns the number of available interrupt lines to a remote
+ *  processor.
+ *
+ *  @param[in]  procId      Remote processor id
+ *
+ *  @return     Number of interrupt lines
+ */
+UInt16 Notify_numIntLines(UInt16 procId);
+
+/*! @cond */
+/*!
+ *  @brief  Returns the amount of shared memory used by one Notify instance.
+ *
+ *  This will typically be used internally by other IPC modules during system
+ *  initialization.  The return value depends upon the base address because
+ *  of cache alignment settings.
+ *
+ *  @param[in]  sharedAddr      Base address that will be passed to
+ *                              Notify_attach()
+ *
+ *  @return     Shared memory required (in MAUs)
+ */
+SizeT Notify_sharedMemReq(UInt16 procId, Ptr sharedAddr);
+
+/*! @endcond */
+
+/*!
+ *  @brief      Register a callback for an event (supports multiple callbacks)
+ *
+ *  This function registers a callback to a specific event number,
+ *  processor id and interrupt line. When the event is received by the
+ *  specified processor, the callback is called.
+ *
+ *  The callback function prototype is of type #Notify_FnNotifyCbck.
+ *  This function must be non-blocking.
+ *
+ *  It is important to note that multiple callbacks may be registered with
+ *  a single event.  This is accomplished by simply calling
+ *  Notify_registerEvent() for each combination of callback functions and
+ *  callback arguments as needed.
+ *
+ *  It is important to note that interrupts are disabled during the entire
+ *  duration of this function's execution.
+ *
+ *  @param[in]  procId          Remote processor id
+ *  @param[in]  lineId          Line id (0 for most systems)
+ *  @param[in]  eventId         Event id
+ *  @param[in]  fnNotifyCbck    Pointer to callback function
+ *  @param[in]  cbckArg         Callback function argument
+ *
+ *  @return     Notify status:
+ *              - #Notify_S_SUCCESS: Event successfully registered
+ *              - #Notify_E_MEMORY: Failed to register due to memory error
+ *
+ *  @sa         Notify_unregisterEvent()
+ */
+Int Notify_registerEvent(UInt16 procId,
+                         UInt16 lineId,
+                         UInt32 eventId,
+                         Notify_FnNotifyCbck fnNotifyCbck,
+                         UArg cbckArg);
+
+/*!
+ *  @brief      Register a single callback for an event
+ *
+ *  This function registers a callback to a specific event number,
+ *  processor id and interrupt line. When the event is received by the
+ *  specified processor, the callback is called.
+ *
+ *  The callback function prototype is of type #Notify_FnNotifyCbck.
+ *  The callback function must be non-blocking.
+ *
+ *  Only one callback may be registered with this API.
+ *
+ *  Use Notify_registerEvent() to register multiple callbacks for a single event.
+ *
+ *  @param[in]  procId          Remote processor id
+ *  @param[in]  lineId          Line id (0 for most systems)
+ *  @param[in]  eventId         Event id
+ *  @param[in]  fnNotifyCbck    Pointer to callback function
+ *  @param[in]  cbckArg         Callback function argument
+ *
+ *  @return     Notify status:
+ *              - #Notify_E_ALREADYEXISTS: Event already registered
+ *              - #Notify_S_SUCCESS: Event successfully registered
+ *
+ *  @sa         Notify_unregisterEventSingle()
+ */
+Int Notify_registerEventSingle(UInt16 procId,
+                               UInt16 lineId,
+                               UInt32 eventId,
+                               Notify_FnNotifyCbck fnNotifyCbck,
+                               UArg cbckArg);
+
+/*!
+ *  @brief      Restore ability to receive interrupts on an interrupt line
+ *
+ *  This function re-enables receiving notifications on a specific interrupt
+ *  line.
+ *
+ *  Notify supports nested disable/restore calls. The last restore call
+ *  will re-enable Notifications.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  key         Key returned by Notify_disable()
+ *
+ *  @sa         Notify_disable()
+ */
+Void Notify_restore(UInt16 procId, UInt16 lineId, UInt key);
+
+/*!
+ *  @brief      Send an event on an interrupt line
+ *
+ *  This function sends an event to a processor via an interrupt line
+ *  identified by a processor id and line id. A payload may be optionally
+ *  sent to the the remote processor if supported by the device.
+ *
+ *  On the destination processor, the callback functions registered
+ *  with Notify with the associated eventId and source
+ *  processor id are called.
+ *
+ *  For example, when using 'NotifyDriverShm', a 'waitClear' value of 'TRUE'
+ *  indicates that, if an event was previously sent to the same eventId,
+ *  sendEvent should spin until the previous event has been acknowledged by the
+ *  remote processor. If 'waitClear' is FALSE, a pending event with the same
+ *  eventId will be overwritten by the event currently being sent. When in
+ *  doubt, a value of TRUE should be used because notifications may be
+ *  potentially dropped when FALSE is used.  When using NotifyDriverShm, a
+ *  payload should never be sent with 'waitClear = FALSE.'
+ *
+ *  On the other hand, other notify drivers that use a FIFO to transmit events
+ *  will spin if @c waitClear is TRUE until the FIFO has enough room to accept
+ *  the event being sent.  If @c waitClear is FALSE, Notify_sendEvent() will
+ *  return #Notify_E_FAIL if the FIFO does not have room for the event.
+ *
+ *  Refer to the documentation for the Notify drivers for more information
+ *  about the effect of the @c waitClear flag in Notify_sendEvent().
+ *
+ *  Notify_sendEvent can be called from a Hwi context unlike other Notify APIs.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  eventId     Event id
+ *  @param[in]  payload     Payload to be sent along with the event.
+ *  @param[in]  waitClear   Indicates whether to spin waiting for the remote
+ *                          core to process previous events
+ *
+ *  @return     Notify status:
+ *              - #Notify_E_EVTNOTREGISTERED: event has no registered callback
+ *                functions
+ *              - #Notify_E_NOTINITIALIZED: remote driver has not yet been
+ *                initialized
+ *              - #Notify_E_EVTDISABLED: remote event is disabled
+ *              - #Notify_E_TIMEOUT: timeout occured (when waitClear is TRUE)
+ *              - #Notify_S_SUCCESS: event successfully sent
+ */
+Int Notify_sendEvent(UInt16 procId, UInt16 lineId, UInt32 eventId,
+        UInt32 payload, Bool waitClear);
+
+/*!
+ *  @brief      Remove an event listener from an event
+ *
+ *  This function unregisters a single callback that was registered to an event
+ *  using Notify_registerEvent(). The @c procId, @c lineId, @c eventId,
+ *  @c fnNotifyCbck and @c cbckArg must exactly match with the registered one.
+ *
+ *  This API is used to unregister events that were registered with
+ *  Notify_registerEvent().  If this is the last event, then
+ *  Notify_unregisterEventSingle() is called to completely remove the event.
+ *
+ *  @param[in]  procId          Remote processor id
+ *  @param[in]  lineId          Line id
+ *  @param[in]  eventId         Event id
+ *  @param[in]  fnNotifyCbck    Pointer to callback function
+ *  @param[in]  cbckArg         Callback function argument
+ *
+ *  @return     Notify status:
+ *              - #Notify_E_NOTFOUND: event listener not found
+ *              - #Notify_S_SUCCESS: event listener unregistered
+ *
+ *  @sa         Notify_registerEvent()
+ */
+Int Notify_unregisterEvent(UInt16 procId, UInt16 lineId, UInt32 eventId,
+        Notify_FnNotifyCbck fnNotifyCbck, UArg cbckArg);
+
+/*!
+ *  @brief      Remove an event listener from an event
+ *
+ *  This function removes a previously registered callback registered with
+ *  Notify_registerEventSingle(). The @c procId, @c lineId, and @c eventId
+ *  must exactly match the registered one.
+ *
+ *  @param[in]  procId      Remote processor id
+ *  @param[in]  lineId      Line id
+ *  @param[in]  eventId     Event id that is being unregistered
+ *
+ *  @return     Notify status:
+ *              - #Notify_S_SUCCESS: event unregistered
+ *              - #Notify_E_FAIL: fail to unregister event
+ *
+ *  @sa         Notify_registerEventSingle()
+ */
+Int Notify_unregisterEventSingle(UInt16 procId, UInt16 lineId, UInt32 eventId);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_Notify__include */
diff --git a/packages/ti/ipc/SharedRegion.h b/packages/ti/ipc/SharedRegion.h
new file mode 100644 (file)
index 0000000..bf01a95
--- /dev/null
@@ -0,0 +1,463 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       SharedRegion.h
+ *
+ *  @brief      Shared memory manager and address translator.
+ *
+ *  The SharedRegion module is designed to be used in a multi-processor
+ *  environment in which memory regions are shared and accessed
+ *  across different processors. The module itself does not use any shared
+ *  memory, because all module state is stored locally.  SharedRegion
+ *  APIs use the system gate for thread protection.
+ *
+ *  This module creates and stores a local shared memory region table.  The
+ *  table contains the processor's view for every shared region in the system.
+ *  The table must not contain any overlapping regions.  Each processor's
+ *  view of a particular shared memory region is determined by the region id.
+ *  In cases where a processor cannot access a certain shared memory region,
+ *  that shared memory region should be left invalid for that processor.
+ *  Note:  The number of entries must be the same on all processors.
+ *
+ *  Each shared region contains the following:
+ *  @li @b base - The base address
+ *  @li @b len - The length
+ *  @li @b name - The name of the region
+ *  @li @b isValid - Whether the region is valid
+ *  @li @b ownerProcId - The id of the processor which owns the region
+ *  @li @b cacheEnable - Whether the region is cacheable
+ *  @li @b cacheLineSize - The cache line size
+ *  @li @b createHeap - Whether a heap is created for the region.
+ *
+ *  A region is added using the SharedRegion_setEntry() API.
+ *  The length of a region must be the same across all processors.
+ *  The owner of the region can be specified.  If specified, the owner
+ *  manages the shared region.  It creates a HeapMemMP instance which spans
+ *  the full size of the region.  The other processors open the same HeapMemMP
+ *  instance.
+ *
+ *  Note: Prior to calling Ipc_start(), If a SharedRegion's 'isValid'
+ *  is true and 'createHeap' is true then the owner of the SharedRegion
+ *  must be the same as the owner of SharedRegion 0.
+ *
+ *  After a shared region is valid, SharedRegion APIs can be used to convert
+ *  pointers between the local processor's address space and the SharedRegion-
+ *  pointer (SRPtr) address space.  These APIs include
+ *  SharedRegion_getId(), SharedRegion_getSRPtr() and SharedRegion_getPtr().
+ *  An example is shown below:
+ *
+ *  @code
+ *  SharedRegion_SRPtr srptr;
+ *  Ptr     addr;
+ *  UInt16  id;
+ *
+ *  // to get the id of the local address if id is not already known.
+ *  id = SharedRegion_getId(addr);
+ *
+ *  // to get the shared region pointer for the local address
+ *  srptr = SharedRegion_getSRPtr(addr, id);
+ *
+ *  // to get the local address from the shared region pointer
+ *  addr = SharedRegion_getPtr(srptr);
+ *  @endcode
+ *
+ *  The SharedRegion header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/SharedRegion.h>
+ *  @endcode
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_SharedRegion__include
+#define ti_ipc_SharedRegion__include
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* ============================================================================
+ *  All success and failure codes for the module
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  The resource is still in use
+ */
+#define SharedRegion_S_BUSY             2
+
+/*!
+ *  @brief  The module has been already setup
+ */
+#define SharedRegion_S_ALREADYSETUP     1
+
+/*!
+ *  @brief  Operation is successful.
+ */
+#define SharedRegion_S_SUCCESS          0
+
+/*!
+ *  @brief  Generic failure.
+ */
+#define SharedRegion_E_FAIL             -1
+
+/*!
+ *  @brief  Argument passed to function is invalid.
+ */
+#define SharedRegion_E_INVALIDARG       -2
+
+/*!
+ *  @brief  Operation resulted in memory failure.
+ */
+#define SharedRegion_E_MEMORY           -3
+
+/*!
+ *  @brief  The specified entity already exists.
+ */
+#define SharedRegion_E_ALREADYEXISTS    -4
+
+/*!
+ *  @brief  Unable to find the specified entity.
+ */
+#define SharedRegion_E_NOTFOUND         -5
+
+/*!
+ *  @brief  Operation timed out.
+ */
+#define SharedRegion_E_TIMEOUT          -6
+
+/*!
+ *  @brief  Module is not initialized.
+ */
+#define SharedRegion_E_INVALIDSTATE     -7
+
+/*!
+ *  @brief  A failure occurred in an OS-specific call
+ */
+#define SharedRegion_E_OSFAILURE        -8
+
+/*!
+ *  @brief  Specified resource is not available
+ */
+#define SharedRegion_E_RESOURCE         -9
+
+/*!
+ *  @brief  Operation was interrupted. Please restart the operation
+ */
+#define SharedRegion_E_RESTART          -10
+
+/* =============================================================================
+ *  Macros
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  Invalid region id
+ */
+#define SharedRegion_INVALIDREGIONID    (0xFFFF)
+
+/* =============================================================================
+ *  Structures & Enums
+ * =============================================================================
+ */
+
+/*!
+ *  @brief  SharedRegion pointer type
+ */
+typedef Bits32 SharedRegion_SRPtr;
+
+/*!
+ *  @brief  Structure defining a region
+ */
+typedef struct SharedRegion_Entry {
+    Ptr base;
+    /*!< The base address of the region */
+
+    SizeT len;
+    /*!< The length of the region
+     *
+     *  Ths length of a region must be the same across all
+     *  processors in the system.
+     */
+
+    UInt16 ownerProcId;
+    /*!< The MultiProc id of the owner of the region
+     *
+     *  The owner id for a shared region must be the same across
+     *  all processors in the system.
+     */
+
+    Bool isValid;
+    /*!< Whether the region is valid */
+
+    Bool cacheEnable;
+    /*!< Whether to perform cache operations for the region
+     *
+     *  If 'TRUE', a cache invalidate is performed before any read
+     *  and a cache write back invalidate is performed after any
+     *  write for the shared region.  The cache operations are done
+     *  for all caches.  If 'FALSE', no cache operations are performed.
+     */
+
+    SizeT cacheLineSize;
+    /*!< The cache line size of the region
+     *
+     *  The cache line size for a region must be the same across
+     *  all processors in the system.  It is used for structure
+     *  alignment and padding.
+     */
+
+    Bool createHeap;
+    /*!< Whether a heap is created for the region
+     *
+     *  If 'TRUE', a HeapMemMP instance is created with the size
+     *  spanning the length of the shared region minus any memory
+     *  that is reserved in the region.  If 'FALSE', no heap
+     *  is created in the shared region.
+     */
+
+    String name;
+    /*!< The name of the region.
+     *
+     *  The name must be in persistent memory.  It is used for
+     *  displaying in ROV.
+     */
+} SharedRegion_Entry;
+
+
+/* =============================================================================
+ *  SharedRegion Module-wide Functions
+ * =============================================================================
+ */
+
+/*!
+ *  @brief      Clears the entry at the specified region id
+ *
+ *  SharedRegion_clearEntry() is used to render invalid a shared region that is
+ *  currently valid.  If the region has a heap, it will either be closed or
+ *  deleted as necessary.  All attributes of region are reset to defaults.
+ *
+ *  Calling SharedRegion_clearEntry() upon a region that is already invalid
+ *  simply resets the region attributes to their defaults.
+ *
+ *  NOTE: Region #0 is special and can neither be cleared nor set.
+ *
+ *  @param      regionId  the region id
+ *
+ *  @return     Status
+ *              - #SharedRegion_S_SUCCESS:  Operation was successful
+ *              - #SharedRegion_E_FAIL:  Delete or close of heap created
+ *                in region failed.
+ *
+ *  @sa         SharedRegion_setEntry()
+ */
+Int SharedRegion_clearEntry(UInt16 regionId);
+
+/*!
+ *  @brief      Initializes the entry fields
+ *
+ *  @param      entry  pointer to a SharedRegion entry
+ *
+ *  @sa         SharedRegion_setEntry()
+ */
+Void SharedRegion_entryInit(SharedRegion_Entry *entry);
+
+/*!
+ *  @brief      Gets the cache line size for the specified region id
+ *
+ *  @param      regionId  the region id
+ *
+ *  @return     Cache line size
+ *
+ *  @sa         SharedRegion_isCacheEnabled()
+ */
+SizeT SharedRegion_getCacheLineSize(UInt16 regionId);
+
+/*!
+ *  @brief      Gets the entry information for the specified region id
+ *
+ *  @param      regionId  the region id
+ *  @param      entry     pointer to return region information
+ *
+ *  @return     Status
+ *              - #SharedRegion_S_SUCCESS:  Operation was successful
+ *              - #SharedRegion_E_FAIL:  Operation failed
+ *
+ *  @sa         SharedRegion_setEntry()
+ */
+Int SharedRegion_getEntry(UInt16 regionId, SharedRegion_Entry *entry);
+
+/*!
+ *  @brief      Gets the heap associated with the specified region id
+ *
+ *  If running on BIOS, the heap handle returned is of type xdc.runtime.IHeap.
+ *  This handle type can be used with xdc.runtime.Memory. However, if running
+ *  on Linux, the heap handle is of type ti.syslink.utils.IHeap.  This handle
+ *  type cannot be used with xdc.runtime.Memory, but can be used with
+ *  ti.syslink.utils.Memory. The handle type is determined at compile time
+ *  and cannot be deferred until runtime. The correct header file must be
+ *  included to get the right type.
+ *
+ *  The following code shows an example.
+ *
+ *  @code
+ *  #if defined(ti_sdo_ipc)
+ *  #include <xdc/runtime/IHeap.h>
+ *  #include <xdc/runtime/Memory.h>
+ *  #elif defined(ti_syslink)
+ *  #include <ti/syslink/utils/IHeap.h>
+ *  #include <ti/syslink/utils/Memory.h>
+ *  #endif
+ *  #include <ti/ipc/SharedRegion.h>
+ *
+ *  IHeap_Handle heap;
+ *  UInt16       regionId;
+ *  SizeT        size;
+ *  SizeT        align;
+ *
+ *  heap = (IHeap_Handle)SharedRegion_getHeap(regionId);  // get the heap
+ *  Memory_alloc(heap, size, align, NULL);  // alloc memory from heap
+ *  @endcode
+ *
+ *  @param      regionId  the region id
+ *
+ *  @return     Handle of the heap, NULL if the region has no heap
+ */
+Ptr SharedRegion_getHeap(UInt16 regionId);
+
+/*!
+ *  @brief      Gets the region id for the specified address
+ *
+ *  @param      addr  address
+ *
+ *  @return     region id
+ */
+UInt16 SharedRegion_getId(Ptr addr);
+
+/*!
+ *  @brief      Gets the id of a region, given its name
+ *
+ *  @param      name  name of the region
+ *
+ *  @return     region id
+ */
+UInt16 SharedRegion_getIdByName(String name);
+
+/*!
+ *  @brief      Gets the number of regions
+ *
+ *  @return     number of regions
+ */
+UInt16 SharedRegion_getNumRegions(Void);
+
+/*!
+ *  @brief      Calculate the local pointer from the shared region pointer
+ *
+ *  @param      srptr  SharedRegion pointer
+ *
+ *  @return     local pointer or NULL if shared region pointer is invalid
+ *
+ *  @sa         SharedRegion_getSRPtr()
+ */
+Ptr SharedRegion_getPtr(SharedRegion_SRPtr srptr);
+
+/*!
+ *  @brief      Calculate the shared region pointer given local address and id
+ *
+ *  @param      addr      the local address
+ *  @param      regionId  region id
+ *
+ *  @return     SharedRegion pointer
+ *
+ *  @sa         SharedRegion_getPtr()
+ */
+SharedRegion_SRPtr SharedRegion_getSRPtr(Ptr addr, UInt16 regionId);
+
+/*!
+ *  @brief      whether cache enable was specified
+ *
+ *  @param      regionId  region id
+ *
+ *  @return     'TRUE' if cache enable specified, otherwise 'FALSE'
+ */
+Bool SharedRegion_isCacheEnabled(UInt16 regionId);
+
+/*!
+ *  @brief      Sets the entry at the specified region id
+ *
+ *  SharedRegion_setEntry() is used to set up a shared region that is
+ *  currently invalid.  Configuration is performed using the values supplied
+ *  in the 'entry' parameter.  If the 'createHeap' flag is TRUE, then a
+ *  region heap will be created (if the processor is the region owner)
+ *  or opened.
+ *
+ *  If 'createHeap' is TRUE, SharedRegion_setEntry() must always be called by
+ *  a 'client' of the shared region only after the region owner has called
+ *  SharedRegion_setEntry().  It is unsafe to poll using SharedRegion_setEntry()
+ *  to wait for the corresponding heap to be created by the owner.  An external
+ *  synchronization mechanism (i.e. Notify, shared memory, etc) must be used
+ *  to ensure the proper sequence of operations.
+ *
+ *  NOTE: This function should never be called upon a region
+ *  that is currently valid.
+ *
+ *  @param      regionId  region id
+ *  @param      entry     pointer to set region information.
+ *
+ *  @return     Status
+ *              - #SharedRegion_S_SUCCESS:  Operation was successful
+ *              - #SharedRegion_E_FAIL:  Region already exists or overlaps with
+ *                 with another region
+ *              - #SharedRegion_E_MEMORY: Unable to create Heap
+ */
+Int SharedRegion_setEntry(UInt16 regionId, SharedRegion_Entry *entry);
+
+/*!
+ *  @brief      Whether address translation is enabled
+ *
+ *  @return     'TRUE' if translate is enabled otherwise 'FALSE'
+ */
+Bool SharedRegion_translateEnabled(Void);
+
+/*!
+ *  @brief      Returns the SharedRegion_SRPtr value that maps to NULL
+ *
+ *  @return     Value in SRPtr-space that maps to NULL in Ptr-space
+ */
+SharedRegion_SRPtr SharedRegion_invalidSRPtr(Void);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* ti_ipc_SharedRegion__include */
diff --git a/packages/ti/ipc/family/omapl138/VirtQueue.c b/packages/ti/ipc/family/omapl138/VirtQueue.c
new file mode 100644 (file)
index 0000000..317d5f4
--- /dev/null
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       VirtQueue.c
+ *
+ *  @brief      Virtio Queue implementation for BIOS
+ *
+ *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
+ *  - Renamed module from virtio.h to VirtQueue_Object.h to match the API prefixes;
+ *  - BIOS (XDC) types and CamelCasing used;
+ *  - virtio_device concept removed (i.e, assumes no containing device);
+ *  - simplified scatterlist from Linux version;
+ *  - VirtQueue_Objects are created statically here, so just added a VirtQueue_Object_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - The notify function is implicit in the implementation, and not provided
+ *    by the client, as it is in Linux virtio.
+ *
+ *  All VirtQueue operations can be called in any context.
+ *
+ *  The virtio header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/rpmsg/VirtQueue.h>
+ *  @endcode
+ *
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/SysMin.h>
+
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/knl/Swi.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/ipc/family/da830/InterruptDsp.h>
+#include <ti/ipc/remoteproc/Resource.h>
+
+#include <ti/ipc/MultiProc.h>
+
+#include "package/internal/VirtQueue.xdc.h"
+
+#include <string.h>
+
+#include <ti/ipc/rpmsg/virtio_ring.h>
+
+/* Used for defining the size of the virtqueue registry */
+#define NUM_QUEUES                      5
+
+/* Predefined device addresses */
+#define IPU_MEM_VRING0          0xc3000000
+#define IPU_MEM_VRING1          0xc3004000
+
+#define CONSOLE_VRING0_PA       0xc3008000
+#define CONSOLE_VRING1_PA       0xc300c000
+
+/*
+ * enum - Predefined Mailbox Messages
+ *
+ * @RP_MSG_MBOX_READY: informs the M3's that we're up and running. will be
+ * followed by another mailbox message that carries the A9's virtual address
+ * of the shared buffer. This would allow the A9's drivers to send virtual
+ * addresses of the buffers.
+ *
+ * @RP_MSG_MBOX_STATE_CHANGE: informs the receiver that there is an inbound
+ * message waiting in its own receive-side vring. please note that currently
+ * this message is optional: alternatively, one can explicitly send the index
+ * of the triggered virtqueue itself. the preferred approach will be decided
+ * as we progress and experiment with those design ideas.
+ *
+ * @RP_MSG_MBOX_CRASH: this message indicates that the BIOS side is unhappy
+ *
+ * @RP_MBOX_ECHO_REQUEST: this message requests the remote processor to reply
+ * with RP_MBOX_ECHO_REPLY
+ *
+ * @RP_MBOX_ECHO_REPLY: this is a reply that is sent when RP_MBOX_ECHO_REQUEST
+ * is received.
+ *
+ * @RP_MBOX_ABORT_REQUEST:  tells the M3 to crash on demand
+ */
+enum {
+    RP_MSG_MBOX_READY           = (Int)0xFFFFFF00,
+    RP_MSG_MBOX_STATE_CHANGE    = (Int)0xFFFFFF01,
+    RP_MSG_MBOX_CRASH           = (Int)0xFFFFFF02,
+    RP_MBOX_ECHO_REQUEST        = (Int)0xFFFFFF03,
+    RP_MBOX_ECHO_REPLY          = (Int)0xFFFFFF04,
+    RP_MBOX_ABORT_REQUEST       = (Int)0xFFFFFF05,
+    RP_MSG_FLUSH_CACHE          = (Int)0xFFFFFF06,
+    RP_MSG_HIBERNATION          = (Int)0xFFFFFF07
+};
+
+#define DIV_ROUND_UP(n,d)   (((n) + (d) - 1) / (d))
+#define RP_MSG_BUFS_SPACE   (VirtQueue_RP_MSG_NUM_BUFS * VirtQueue_RP_MSG_BUF_SIZE * 2)
+
+/* With 256 buffers, our vring will occupy 3 pages */
+#define RP_MSG_RING_SIZE    ((DIV_ROUND_UP(vring_size(VirtQueue_RP_MSG_NUM_BUFS, \
+                            VirtQueue_RP_MSG_VRING_ALIGN), VirtQueue_PAGE_SIZE)) * VirtQueue_PAGE_SIZE)
+
+/* The total IPC space needed to communicate with a remote processor */
+#define RPMSG_IPC_MEM   (RP_MSG_BUFS_SPACE + 2 * RP_MSG_RING_SIZE)
+
+#define ID_DSP_TO_A9      0
+#define ID_A9_TO_DSP      1
+
+#define CONSOLE_DSP_TO_A9 2
+#define CONSOLE_A9_TO_DSP 3
+
+/* TODO: do we need these to be configurable? */
+#define DSPEVENTID              5
+#define DSPINT                  5
+#define DSP2ARM_CHIPINT0        28
+
+static VirtQueue_Object *queueRegistry[NUM_QUEUES] = {NULL};
+
+static inline Void * mapPAtoVA(UInt pa)
+{
+    return (Void *)((pa & 0x000fffffU) | 0xc3000000U);
+}
+
+static inline UInt mapVAtoPA(Void * va)
+{
+    return ((UInt)va & 0x000fffffU) | 0xc9000000U;
+}
+
+/*
+ * ======== VirtQueue_kick ========
+ */
+Void VirtQueue_kick(VirtQueue_Handle vq)
+{
+    struct vring *vring = vq->vringPtr;
+    IInterrupt_IntInfo intInfo;
+
+    intInfo.remoteIntId = DSP2ARM_CHIPINT0;
+
+    /* For now, simply interrupt remote processor */
+    if (vring->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) {
+        Log_print0(Diags_USER1,
+                "VirtQueue_kick: no kick because of VRING_AVAIL_F_NO_INTERRUPT\n");
+        return;
+    }
+
+    Log_print2(Diags_USER1,
+            "VirtQueue_kick: Sending interrupt to proc %d with payload 0x%x\n",
+            (IArg)vq->procId, (IArg)vq->id);
+    InterruptDsp_intSend(vq->procId, &intInfo, vq->id);
+}
+
+/*
+ * ======== VirtQueue_addUsedBuf ========
+ */
+Int VirtQueue_addUsedBuf(VirtQueue_Handle vq, Int16 head)
+{
+    struct vring_used_elem *used;
+    struct vring *vring = vq->vringPtr;
+
+    if ((head > vring->num) || (head < 0)) {
+        Error_raise(NULL, Error_E_generic, 0, 0);
+    }
+
+    /*
+    * The virtqueue contains a ring of used buffers.  Get a pointer to the
+    * next entry in that used ring.
+    */
+    used = &vring->used->ring[vring->used->idx % vring->num];
+    used->id = head;
+    used->len = VirtQueue_RP_MSG_BUF_SIZE;
+
+    vring->used->idx++;
+
+    return (0);
+}
+
+/*
+ * ======== VirtQueue_addAvailBuf ========
+ */
+Int VirtQueue_addAvailBuf(VirtQueue_Object *vq, Void *buf)
+{
+    UInt16 avail;
+    struct vring *vring = vq->vringPtr;
+
+    if (vq->num_free == 0) {
+        /* There's no more space */
+        Error_raise(NULL, Error_E_generic, 0, 0);
+    }
+
+    vq->num_free--;
+
+    avail =  vring->avail->idx++ % vring->num;
+
+    vring->desc[avail].addr = mapVAtoPA(buf);
+    vring->desc[avail].len = VirtQueue_RP_MSG_BUF_SIZE;
+
+    return (vq->num_free);
+}
+
+/*
+ * ======== VirtQueue_getUsedBuf ========
+ */
+Void *VirtQueue_getUsedBuf(VirtQueue_Object *vq)
+{
+    UInt16 head;
+    Void *buf;
+    struct vring *vring = vq->vringPtr;
+
+    /* There's nothing available? */
+    if (vq->last_used_idx == vring->used->idx) {
+        return (NULL);
+    }
+
+    head = vring->used->ring[vq->last_used_idx % vring->num].id;
+    vq->last_used_idx++;
+    vq->num_free++;
+
+    buf = mapPAtoVA(vring->desc[head].addr);
+
+    return (buf);
+}
+
+/*
+ * ======== VirtQueue_getAvailBuf ========
+ */
+Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf)
+{
+    UInt16 head;
+    struct vring *vring = vq->vringPtr;
+
+    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x\n",
+    (IArg)vq,
+        vq->last_avail_idx, vring->avail->idx, vring->num,
+        (IArg)&vring->avail, (IArg)vring->avail);
+
+    /* There's nothing available? */
+    if (vq->last_avail_idx == vring->avail->idx) {
+        /* We need to know about added buffers */
+        vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
+        /* check again after setting flag */
+        if (vq->last_avail_idx == vring->avail->idx)
+            return -1;
+    }
+
+    /* No need to be kicked about added buffers anymore */
+    vring->used->flags |= VRING_USED_F_NO_NOTIFY;
+
+    /*
+     * Grab the next descriptor number they're advertising, and increment
+     * the index we've seen.
+     */
+    head = vring->avail->ring[vq->last_avail_idx++ % vring->num];
+
+    *buf = mapPAtoVA(vring->desc[head].addr);
+
+    return (head);
+}
+
+/*
+ * ======== VirtQueue_isr ========
+ * Note 'arg' is ignored: it is the Hwi argument, not the mailbox argument.
+ */
+Void VirtQueue_isr(UArg msg)
+{
+    VirtQueue_Object *vq;
+    IInterrupt_IntInfo intInfo;
+
+    Log_print1(Diags_USER1, "VirtQueue_isr received msg = 0x%x\n", msg);
+
+    intInfo.localIntId = DSPEVENTID;
+    intInfo.remoteIntId = DSP2ARM_CHIPINT0;
+
+    Assert_isTrue((InterruptDsp_isIntSet(msg, &intInfo) == TRUE), NULL);
+    InterruptDsp_intClear(msg, &intInfo);
+
+    vq = queueRegistry[0];
+    if (vq) {
+        vq->callback(vq);
+    }
+    vq = queueRegistry[1];
+    if (vq) {
+       vq->callback(vq);
+    }
+}
+
+
+/*
+ * ======== VirtQueue_create ========
+ */
+Void VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
+                             const VirtQueue_Params *params)
+{
+    void *vring_phys = NULL;
+    Error_Block eb;
+
+    VirtQueue_module->traceBufPtr = Resource_getTraceBufPtr();
+
+    Error_init(&eb);
+
+    vq->vringPtr = Memory_calloc(NULL, sizeof(struct vring), 0, &eb);
+    Assert_isTrue((vq->vringPtr != NULL), NULL);
+
+    vq->callback = params->callback;
+    vq->id = VirtQueue_module->numQueues++;
+    vq->procId = remoteProcId;
+    vq->last_avail_idx = 0;
+    vq->last_used_idx = 0;
+    vq->num_free = VirtQueue_RP_MSG_NUM_BUFS;
+    vq->swiHandle = params->swiHandle;
+
+    switch (vq->id) {
+    /* sysm3 rpmsg vrings */
+        case ID_DSP_TO_A9:
+            vring_phys = (struct vring *) IPU_MEM_VRING0;
+            break;
+        case ID_A9_TO_DSP:
+            vring_phys = (struct vring *) IPU_MEM_VRING1;
+            break;
+
+    /* sysm3 console vrings */
+        case CONSOLE_DSP_TO_A9:
+            vring_phys = (struct vring *) CONSOLE_VRING0_PA;
+            break;
+        case CONSOLE_A9_TO_DSP:
+            vring_phys = (struct vring *) CONSOLE_VRING1_PA;
+            break;
+    }
+
+    Log_print3(Diags_USER1,
+            "vring: %d 0x%x (0x%x)\n", vq->id, (IArg)vring_phys,
+            RP_MSG_RING_SIZE);
+
+    vring_init(vq->vringPtr, VirtQueue_RP_MSG_NUM_BUFS, vring_phys, VirtQueue_RP_MSG_VRING_ALIGN);
+
+    queueRegistry[vq->id] = vq;
+}
+
+/*
+ * ======== VirtQueue_startup ========
+ */
+Void VirtQueue_startup(UInt16 remoteProcId, Bool isHost)
+{
+    IInterrupt_IntInfo intInfo;
+
+    /*
+     * Wait for first kick from host, which happens to coincide with the
+     * priming of host's receive buffers, indicating host is ready to send.
+     * Since interrupt is cleared, we throw away this first kick, which is
+     * OK since we don't process this in the ISR anyway.
+     */
+    intInfo.intVectorId = DSPINT;
+    intInfo.localIntId = DSPEVENTID;
+    intInfo.remoteIntId = DSP2ARM_CHIPINT0;  /* ??? don't care??? */
+    while (InterruptDsp_isIntSet(remoteProcId, &intInfo) == FALSE);
+    InterruptDsp_intClear(remoteProcId, &intInfo);
+
+    /*
+     *  DSP can be used to prototype communications with CORE0 instead of
+     *  HOST
+     */
+    if (MultiProc_self() == VirtQueue_dspProcId) {
+        InterruptDsp_intRegister(remoteProcId, &intInfo, (Fxn)VirtQueue_isr, NULL);
+    }
+    Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
+}
+
+/* By convention, Host VirtQueues host are the even number in the pair */
+Bool VirtQueue_isSlave(VirtQueue_Handle vq)
+{
+  return (vq->id & 0x1);
+}
+
+Bool VirtQueue_isHost(VirtQueue_Handle vq)
+{
+  return (~(vq->id & 0x1));
+}
+
+UInt16 VirtQueue_getId(VirtQueue_Handle vq)
+{
+  return (vq->id);
+}
+
+Swi_Handle VirtQueue_getSwiHandle(VirtQueue_Handle vq)
+{
+  return (vq->swiHandle);
+}
+
+/*
+ * ======== postCrashToMailbox ========
+ */
+Void postCrashToMailbox(Error_Block * eb)
+{
+    IInterrupt_IntInfo intInfo;
+
+    intInfo.remoteIntId = DSP2ARM_CHIPINT0;
+
+    Error_print(eb);
+    InterruptDsp_intSend(0, &intInfo, (UInt)RP_MSG_MBOX_CRASH);
+}
+
+
+#define CACHE_WB_TICK_PERIOD    5
+
+/*
+ * ======== VirtQueue_cacheWb ========
+ *
+ * Used for flushing SysMin trace buffer.
+ */
+Void VirtQueue_cacheWb()
+{
+    static UInt32 oldticks = 0;
+    UInt32 newticks;
+
+    newticks = Clock_getTicks();
+    if (newticks - oldticks < (UInt32)CACHE_WB_TICK_PERIOD) {
+        /* Don't keep flushing cache */
+        return;
+    }
+
+    oldticks = newticks;
+
+    /* Flush the cache of the SysMin buffer only: */
+    Assert_isTrue((VirtQueue_module->traceBufPtr != NULL), NULL);
+    Cache_wb(VirtQueue_module->traceBufPtr, SysMin_bufSize, Cache_Type_ALL,
+             FALSE);
+}
diff --git a/packages/ti/ipc/family/omapl138/VirtQueue.xdc b/packages/ti/ipc/family/omapl138/VirtQueue.xdc
new file mode 100644 (file)
index 0000000..58eecdf
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       VirtQueue.xdc
+ *
+ *  @brief      Virtio Queue interface for BIOS
+ *
+ *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
+ *  - Renamed module from virtio.h to VirtQueue.h to match the API prefixes;
+ *  - BIOS (XDC) types and CamelCasing used;
+ *  - virtio_device concept removed (i.e, assumes no containing device);
+ *  - removed scatterlist;
+ *  - VirtQueues are created statically here, so just added a VirtQueue_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - The notify function is implicit in the implementation, and not provided
+ *    by the client, as it is in Linux virtio.
+ *  - Broke into APIs to add/get used and avail buffers, as the API is
+ *    assymmetric.
+ *
+ *  Usage:
+ *     This IPC only works between one processor designated as the Host (Linux)
+ *     and one or more Slave processors (BIOS).
+ *
+ *     For any Host/Slave pair, there are 2 VirtQueues (aka Vrings);
+ *     Only the Host adds new buffers to the avail list of a vring;
+ *     Available buffers can be empty or full, depending on direction;
+ *     Used buffer means "processed" (emptied or filled);
+ *
+ *  Host:
+ *    - To send buffer to the slave processor:
+ *          add_avail_buf(slave_virtqueue);
+ *          kick(slave_virtqueue);
+ *          get_used_buf(slave_virtqueue);
+ *    - To receive buffer from slave processor:
+ *          add_avail_buf(host_virtqueue);
+ *          kick(host_virtqueue);
+ *          get_used_buf(host_virtqueue);
+ *
+ *  Slave:
+ *    - To send buffer to the host:
+ *          get_avail_buf(host_virtqueue);
+ *          add_used_buf(host_virtqueue);
+ *          kick(host_virtqueue);
+ *    - To receive buffer from the host:
+ *          get_avail_buf(slave_virtqueue);
+ *          add_used_buf(slave_virtqueue);
+ *          kick(slave_virtqueue);
+ *
+ *  All VirtQueue operations can be called in any context.
+ *
+ *  The virtio header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/rpmsg/VirtQueue.h>
+ *  @endcode
+ *
+ *  ============================================================================
+ */
+
+import  ti.sysbios.knl.Swi;
+import  ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== VirtQueue ========
+ *
+ */
+
+module VirtQueue
+{
+    // -------- Module Constants --------
+
+    // -------- Module Types --------
+
+
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     */
+    metaonly struct BasicView {
+
+    };
+
+    /*!
+     *  ======== ModuleView ========
+     *  @_nodoc
+     */
+    metaonly struct ModuleView {
+
+    };
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+/*    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',  {type: ViewInfo.INSTANCE, viewInitFxn: 'viewInitBasic',  structName: 'BasicView'}],
+                ['Module', {type: ViewInfo.MODULE,   viewInitFxn: 'viewInitModule', structName: 'ModuleView'}]
+            ]
+         });
+*/
+    // -------- Module Proxies --------
+
+    // -------- Module Parameters --------
+
+    /*
+     * Sizes of the virtqueues (expressed in number of buffers supported,
+     * and must be power of two)
+     */
+    config UInt VQ0_SIZE = 256;
+    config UInt VQ1_SIZE = 256;
+
+    /* See VirtQueue.c also for other constants:   */
+    config UInt RP_MSG_NUM_BUFS = VQ0_SIZE; /* must be power of two */
+    config UInt RP_MSG_BUF_SIZE = 512;
+
+
+    config UInt PAGE_SIZE = 4096;
+
+    /*
+     * The alignment to use between consumer and producer parts of vring.
+     * Note: this is part of the "wire" protocol. If you change this, you need
+     * to update your BIOS image as well
+     */
+    config UInt RP_MSG_VRING_ALIGN = 4096;
+
+   /*!
+    * ======== startup ========
+    *
+    * Plug interrupts, and if host, initialize vring memory and send
+    * startup sequence events to slave.
+    */
+    Void startup(UInt16 remoteProcId, Bool isHost);
+
+instance:
+
+    /*!
+     *  @brief      Initialize at runtime the VirtQueue
+     *
+     *  Maps to Instance_init function
+     *
+     *  @param[in]  remoteProcId    Remote processor ID associated with this VirtQueue.
+     *
+     *  @Returns    Returns a handle to a new initialized VirtQueue.
+     */
+    @DirectCall
+    create(UInt16 remoteProcId);
+
+    /*!
+     *  @brief      Notify other processor of new buffers in the queue.
+     *
+     *  After one or more add_buf calls, invoke this to kick the other side.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     *  @sa         VirtQueue_addBuf
+     */
+    @DirectCall
+    Void kick();
+
+    /*!
+     *  @brief      VirtQueue instance returns slave status
+     *
+     *  Returns if this VirtQueue instance belongs to a slave
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Bool isSlave();
+
+    /*!
+     *  @brief      VirtQueue instance returns host status
+     *
+     *  Returns if this VirtQueue instance belongs to a host
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Bool isHost();
+
+    /*!
+     *  @brief      VirtQueue instance returns queue ID
+     *
+     *  Returns VirtQueue instance's queue ID.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    UInt16 getId();
+
+    /*!
+     *  @brief      VirtQueue instance returns Swi handle
+     *
+     *  Returns VirtQueue instance Swi handle
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Swi.Handle getSwiHandle();
+
+    /*
+     *  ========================================================================
+     *  Host Only Functions:
+     *  ========================================================================
+     */
+
+    /*!
+     *  @brief      Add available buffer to virtqueue's available buffer list.
+     *              Only used by Host.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[in]  buf      the buffer to be processed by the slave.
+     *
+     *  @return     Remaining capacity of queue or a negative error.
+     *
+     *  @sa         VirtQueue_getUsedBuf
+     */
+    @DirectCall
+    Int addAvailBuf(Void *buf);
+
+    /*!
+     *  @brief      Get the next used buffer.
+     *              Only used by Host.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     *  @return     Returns NULL or the processed buffer.
+     *
+     *  @sa         VirtQueue_addAvailBuf
+     */
+    @DirectCall
+    Void *getUsedBuf();
+
+    /*
+     *  ========================================================================
+     *  Slave Only Functions:
+     *  ========================================================================
+     */
+
+    /*!
+     *  @brief      Get the next available buffer.
+     *              Only used by Slave.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[out] buf       Pointer to location of available buffer;
+     *
+     *  @return     Returns a token used to identify the available buffer, to be
+     *              passed back into VirtQueue_addUsedBuf();
+     *              token is negative if failure to find an available buffer.
+     *
+     *  @sa         VirtQueue_addUsedBuf
+     */
+    @DirectCall
+    Int16 getAvailBuf(Void **buf);
+
+    /*!
+     *  @brief      Add used buffer to virtqueue's used buffer list.
+     *              Only used by Slave.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[in]  token     token of the buffer to be added to vring used list.
+     *
+     *  @return     Remaining capacity of queue or a negative error.
+     *
+     *  @sa         VirtQueue_getAvailBuf
+     */
+    @DirectCall
+    Int addUsedBuf(Int16 head);
+
+    // -------- Handle Parameters --------
+
+    config Bool host = false;
+
+    config Fxn callback = null;
+
+    config Swi.Handle swiHandle = null;
+
+    config UInt intVectorId = ~1u;
+
+    // -------- Handle Functions --------
+
+internal:   /* not for client use */
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt dspProcId   = MultiProc.INVALIDID;
+
+    /*!
+     *  ======== hostIsr ========
+     */
+    Void hostIsr(UArg msg);
+
+    /*!
+     *  ======== slaveIsr ========
+     */
+    Void slaveIsr(UArg msg);
+
+    /*!
+     * ======== Module_State ========
+     * @_nodoc
+     */
+    struct Module_State
+    {
+        UInt16 numQueues;
+        UInt16 hostSlaveSynced;
+        UInt16 virtQueueInitialized;
+        UInt32 *queueRegistry;
+        Ptr    traceBufPtr;
+    }
+
+    /*!
+     *  ======== Instance_State ========
+     *  @_nodoc
+     */
+    struct Instance_State {
+        Bool hostSlaveSynced;
+        UInt16 id;
+        Fxn callback;
+        Swi.Handle swiHandle;
+        Void *vringPtr;
+        UInt16 num_free;
+        UInt16 last_avail_idx;
+        UInt16 last_used_idx;
+        UInt16 procId;
+    };
+}
diff --git a/packages/ti/ipc/family/omapl138/VirtQueue.xs b/packages/ti/ipc/family/omapl138/VirtQueue.xs
new file mode 100644 (file)
index 0000000..0d19236
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== VirtQueue.xs ================
+ */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    var MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
+
+    xdc.useModule("ti.sysbios.knl.Swi");
+    xdc.useModule("ti.sdo.ipc.family.da830.InterruptDsp");
+    xdc.useModule("ti.ipc.remoteproc.Resource");
+
+    this.hostProcId = MultiProc.getIdMeta("HOST");
+    this.dspProcId = MultiProc.getIdMeta("DSP");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+  /* Init VirtQueue params */
+  mod.numQueues = 0;
+  mod.hostSlaveSynced = 0;
+  mod.virtQueueInitialized = 0;
+  mod.queueRegistry = null;
+  mod.traceBufPtr = null;
+}
diff --git a/packages/ti/ipc/family/omapl138/package.bld b/packages/ti/ipc/family/omapl138/package.bld
new file mode 100644 (file)
index 0000000..076f1b0
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld"];
+
+var SRCS = ["VirtQueue.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+    var lib;
+
+//    print("targ.name = " + targ.name);
+
+    /* build only for DSP-side OMAP-L138 (i.e. C674) */
+    if (targ.isa == "674") {
+        /* Build for all profiles */
+        for (var profile in targ.profiles) {
+
+            Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+                profile: profile
+            }).addObjects(SRCS);
+        }
+    }
+}
diff --git a/packages/ti/ipc/family/omapl138/package.xdc b/packages/ti/ipc/family/omapl138/package.xdc
new file mode 100644 (file)
index 0000000..1247d94
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.family.omapl138 ========
+ */
+package ti.ipc.family.omapl138 [1,0,0,0] {
+    module    VirtQueue;
+}
diff --git a/packages/ti/ipc/family/omapl138/package.xs b/packages/ti/ipc/family/omapl138/package.xs
new file mode 100644 (file)
index 0000000..ee6d6dd
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== close ========
+ */
+function close()
+{
+    /* bring in modules we use in this package */
+    xdc.useModule('ti.sysbios.knl.Swi');
+    xdc.useModule('ti.sysbios.hal.Cache');
+}
+
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var name = this.$name + ".a" + suffix;
+    var lib = "lib/" + this.profile + "/" + name;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/" + name;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/ipc/family/tci6614/Interrupt.c b/packages/ti/ipc/family/tci6614/Interrupt.c
new file mode 100644 (file)
index 0000000..8f068c2
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.c ========
+ *  C647x based interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/ipc/MultiProc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "Interrupt.h"
+
+#include "package/internal/Interrupt.xdc.h"
+
+extern volatile cregister Uns DNUM;
+
+Fxn userFxn = NULL;
+Void Interrupt_isr(UArg arg);
+
+/* Shift to source bit id for CORES 0-3 */
+#define MAP_TO_BITPOS(intId) \
+     (intId == Interrupt_SRCS_BITPOS_CORE0 ? (intId + DNUM) : intId)
+
+/*
+ * Map remoteProcId to CORE ID [0-3]
+ * NOTE: This assumes that HOST is at MultiProcId == 0, and CORE0 at 1i
+ */
+#define MAP_RPROCID_TO_COREID(rProcId)     (rProcId-1)
+
+#define MAP_RPROCID_TO_SRCC(rProcId, intId) \
+         (intId == Interrupt_SRCS_BITPOS_CORE0 ?  \
+         (intId + (rProcId-1)) : intId)
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Interrupt_Module_startup ========
+ */
+Int Interrupt_Module_startup(Int phase)
+{
+    volatile UInt32 *kick0 = (volatile UInt32 *)Interrupt_KICK0;
+    volatile UInt32 *kick1 = (volatile UInt32 *)Interrupt_KICK1;
+    UInt16 procId = MultiProc_self();
+
+    /*
+     * If this assert fails, the MultiProc config has changed to break
+     * an assumption in Linux rpmsg driver, that HOST is listed first in
+     * MultiProc ID configuration.
+     */
+    Assert_isTrue(0 == MultiProc_getId("HOST"), NULL);
+
+    /*
+     *  Wait for Startup to be done (if MultiProc id not yet set) because a
+     *  user fxn should set it
+     */
+    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
+        return (Startup_NOTDONE);
+    }
+
+    if (!Interrupt_enableKick) {
+        /* Do not unlock the kick registers */
+        return (Startup_DONE);
+    }
+
+    /*
+     * Only write to the KICK registers if:
+     * - This core is the SR0 owner
+     * - There is no SR0 and this core has procId '1' (IPC 3.x: this case).
+     */
+    /* TODO: What if CORE0 is not started, but the others are? */
+    if (DNUM == 0) {
+        if (Interrupt_KICK0 && Interrupt_KICK1){
+            /* unlock the KICK mechanism in the Bootcfg MMRs if defined */
+            kick0[0] = 0x83e70b13;      /* must be written with this value */
+            kick1[0] = 0x95a4f1e0;      /* must be written with this value */
+        }
+    }
+
+    return (Startup_DONE);
+}
+
+/*!
+ *  ======== Interrupt_intEnable ========
+ *  Enable interrupt
+ */
+Void Interrupt_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== Interrupt_intDisable ========
+ *  Disables interrupts
+ */
+Void Interrupt_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+Void Interrupt_intClearAll()
+{
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+
+    ipcar[DNUM] = val;
+}
+
+
+/*
+ *  ======== Interrupt_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void Interrupt_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                           Fxn func, UArg arg)
+{
+    Hwi_Params hwiAttrs;
+    Interrupt_FxnTable *table;
+
+    UInt pos;
+    Assert_isTrue(intInfo != NULL, NULL);
+
+    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+
+    Log_print2(Diags_USER1, "Interrupt_intRegister: pos: %d, func: 0x%x\n",
+              (IArg)pos, (IArg)func);
+
+    /* setup the function table with client function and arg to call: */
+    table = &(Interrupt_module->fxnTable[pos]);
+    table->func = func;
+    table->arg  = arg;
+
+    /* Make sure the interrupt only gets plugged once */
+    Interrupt_module->numPlugged++;
+    if (Interrupt_module->numPlugged == 1) {
+        /* Clear all pending interrupts */
+        Interrupt_intClearAll();
+
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+        hwiAttrs.arg         = arg;
+        hwiAttrs.eventId     = Interrupt_INTERDSPINT;
+
+        Hwi_create(intInfo->intVectorId,
+            (Hwi_FuncPtr)Interrupt_isr, &hwiAttrs, NULL);
+
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+}
+
+Void Interrupt_intUnregister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+    Interrupt_FxnTable *table;
+    UInt pos;
+
+    Assert_isTrue(intInfo != NULL, NULL);
+
+    Interrupt_module->numPlugged--;
+    if (Interrupt_module->numPlugged == 0) {
+        /* No need to disable interrupt: Hwi_delete takes care of this */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Unset the function table */
+    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+
+    table = &(Interrupt_module->fxnTable[pos]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+/*!
+ *  ======== Interrupt_intSend ========
+ *  Send interrupt to the remote processor, identifying this core as source.
+ *  If CORE0 BIT POS, we add DNUM to identify this core as the source;
+ *  Otherwise, we just use the localIntId as the source bit position.
+ */
+Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt32 val;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcgrh = (volatile UInt32 *)Interrupt_IPCGRH;
+    UInt pos;
+
+    Assert_isTrue((intInfo != NULL), NULL);
+    pos = MAP_TO_BITPOS(intInfo->localIntId);
+
+    /*
+     *  bit 0 is set to generate the interrupt.
+     *  bits 4-7 are set to specify the interrupt generation source.
+     *  The convention is that bit 4 (SRCS0) is used for core 0,
+     *  bit 5 (SRCS1) for core 1, etc... .
+     */
+    val = (1 << pos) | 1;
+    Log_print3(Diags_USER1,
+        "Interrupt_intSend: setting bit %d in SRCS as 0x%x to for rprocId #%d",
+        (IArg)pos, (IArg)val, (IArg)remoteProcId);
+
+    if (remoteProcId == MultiProc_getId("HOST"))
+    {
+        /* Interrupt is to be generated on the Host processor.  Go through
+         * IPCGRH register
+         */
+        *ipcgrh = val;
+    }
+    else
+    {
+        /* Interrupt is to be generated on another DSP. */
+        ipcgr[MAP_RPROCID_TO_COREID(remoteProcId)] =  val;
+    }
+}
+
+/*
+ *  ======== Interrupt_intClear ========
+ *  Acknowledge interrupt by clearing the corresponding source bit.
+ *
+ *  intInfo->localIntId encodes the Source bit position to be cleared.
+ *  If this corresponds to Core0, adjust using remoteProcId to get true
+ *  SRCS bit position for the DSP core.
+ *
+ *  Otherwise, the localIntId is used directly as the bit position.
+ *
+ *  Only callers setting remoteProcId == HOST id care about return value.
+ */
+UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt payload = Interrupt_INVALIDPAYLOAD;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+    UInt pos;
+
+    Assert_isTrue((intInfo != NULL), NULL);
+    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+    ipcar[DNUM] = (1 << pos);
+
+    Log_print2(Diags_USER1, "Interrupt_intClear: ipcgr: 0x%x, cleared: 0x%x\n",
+                            val, (1 << pos));
+
+    if (remoteProcId == MultiProc_getId("HOST")) {
+        payload = ((val & (UInt)(1 << Interrupt_SRCS_BITPOS_HOST)) ? val :
+                    Interrupt_INVALIDPAYLOAD);
+    }
+
+    return (payload);
+}
+
+/*
+ *  ======== Interrupt_checkAndClear ========
+ *  Return 1 if the interrupt was set (if so, we clear it);
+ *  Otherwise, returns 0.
+ */
+UInt Interrupt_checkAndClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+    UInt pos;
+
+    Assert_isTrue((intInfo != NULL), NULL);
+
+    pos = MAP_TO_BITPOS(intInfo->localIntId);
+    if (val & (1 << pos)) {
+        ipcar[DNUM] = (1 << pos);
+        return(1);
+    }
+
+    return(0);
+}
+
+/*
+ *  ======== Interrupt_isr ========
+ */
+Void Interrupt_isr(UArg arg)
+{
+    Int i;
+    Interrupt_FxnTable *table;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+
+    Log_print1(Diags_USER1,
+        "Interrupt_isr: Interrupt(s) received: 0x%x", (IArg)val);
+
+    for (i = Interrupt_SRCS_BITPOS_CORE0; i < 32; i++) {
+        if (val & (1 << i)) {
+            /* Clear the specific interrupt: */
+            ipcar[DNUM] = (1 << i);
+
+            /* Call the client function: */
+            table = &(Interrupt_module->fxnTable[i]);
+            if (table->func != NULL) {
+                Log_print1(Diags_USER1,
+                    "Interrupt_isr: source id bit: %d", i);
+                (table->func)(table->arg);
+            }
+        }
+    }
+}
diff --git a/packages/ti/ipc/family/tci6614/Interrupt.xdc b/packages/ti/ipc/family/tci6614/Interrupt.xdc
new file mode 100644 (file)
index 0000000..b084beb
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== Interrupt.xdc ========
+ */
+
+/*!
+ *  ======== Interrupt ========
+ *  TCI6614 IPC interrupt manager
+ */
+
+@ModuleStartup
+
+module Interrupt inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+
+    const UInt INVALIDPAYLOAD = 0xFFFFFFFF;
+
+    /*!
+     *  ======== enableKick ========
+     *  If set to 'true' IPC will unlock the KICK registers on C66x devices
+     *
+     *  IPC unlocks the KICK registers on the local core if (and only if) all
+     *  the following conditions are met:
+     *  - This configuration is set to 'true'
+     *  - SharedRegion #0 is valid and the local core is its owner
+     *  - SharedRegion #0 is not valid and the local core is CORE0
+     */
+    config Bool enableKick = true;
+
+    /*!
+     *  ======== Interrupt_intClearAll ========
+     *  Clear all pending interrupts.
+     */
+    Void intClearAll();
+
+    /*!
+     *  ======== Interrupt_checkAndClear =======
+     *  Check to see that interrupt is set, if so clear it and return 1.
+     */
+    UInt checkAndClear(UInt16 remoteProcId, IntInfo *intInfo);
+
+internal:
+
+    /*! Source ID bit position for CORE0 */
+    const UInt SRCS_BITPOS_CORE0 = 4;
+
+    /*! Source ID bit position for HOST */
+    const UInt SRCS_BITPOS_HOST = 31;
+
+    /*! Ptr to the IPC Generation Registers */
+    config Ptr IPCGR0;
+
+    /*! Ptr to the IPC Acknowledgment Registers */
+    config Ptr IPCAR0;
+
+    /*! Ptr to the IPC Host Generation Host Register */
+    config Ptr IPCGRH;
+
+    /*! Ptr to the IPC Acknowledgement Host Register */
+    config Ptr IPCARH;
+
+    /*! Ptr to the KICK0 Bootcfg Registers */
+    config Ptr KICK0;
+
+    /*! Ptr to the KICK1 Bootcfg Registers */
+    config Ptr KICK1;
+
+    /*! Inter-processor interrupt id (varies per device) */
+    config UInt INTERDSPINT;
+
+    /*! Vector interrupt id for Hwi_create */
+    config UInt DSPINT;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+
+    /*!
+     *  ======== isr ========
+     *  Stub function plugged as interrupt handler
+     */
+    Void isr(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[];  /* indexed by Source ID bit pos */
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/ipc/family/tci6614/Interrupt.xs b/packages/ti/ipc/family/tci6614/Interrupt.xs
new file mode 100644 (file)
index 0000000..861bba7
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== Interrupt.xs ========
+ */
+
+var deviceSettings = {
+    'TMS320TCI6614' : {
+        IPCGR0:         0x02620240,
+        IPCAR0:         0x02620280,
+        IPCGRH:         0x0262027C,
+        IPCARH:         0x026202BC,
+        KICK0:          0x02620038,
+        KICK1:          0x0262003C,
+        INTERDSPINT:    90,
+        DSPINT:         5,
+    },
+}
+var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
+Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
+var Hwi         = null;
+var Interrupt = null;
+var MultiProc   = null;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    var settings = deviceSettings[Program.cpu.deviceName];
+
+    this.IPCGR0         = settings.IPCGR0;
+    this.IPCAR0         = settings.IPCAR0;
+    this.IPCGRH         = settings.IPCGRH;
+    this.IPCARH         = settings.IPCARH;
+    this.KICK0          = settings.KICK0;
+    this.KICK1          = settings.KICK1;
+    this.INTERDSPINT    = settings.INTERDSPINT;
+    this.DSPINT         = settings.DSPINT;
+}
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Interrupt     = this;
+
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    var fxnTable = Interrupt.$object.fxnTable;
+
+    /* The function table length should be the number of IPCAR bits */
+    fxnTable.length = 32;
+    for (var i = 0; i < fxnTable.length; i++) {
+        fxnTable[i].func = null;
+        fxnTable[i].arg = 0;
+    }
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/ipc/family/tci6614/NotifySetup.c b/packages/ti/ipc/family/tci6614/NotifySetup.c
new file mode 100644 (file)
index 0000000..faac2d5
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== NotifySetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <xdc/runtime/Error.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*!
+ *  ======== NotifySetup_attach ========
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+
+    Assert_isTrue(remoteProcId != MultiProc_getId("HOST"), NULL);
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* init params and set default values */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
+    notifyShmParams.localIntId = NotifySetup_SRCS_BITPOS_CORE0;
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId = remoteProcId;
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
+            &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+
+        return (Notify_E_FAIL);
+    }
+
+    return (Notify_S_SUCCESS);
+}
+
+/*!
+ * ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params params;
+
+    Assert_isTrue(remoteProcId != MultiProc_getId("HOST"), NULL);
+
+    NotifyDriverShm_Params_init(&params);
+    params.sharedAddr      = sharedAddr;
+    params.intVectorId     = NotifySetup_dspIntVectId;
+    params.remoteProcId    = remoteProcId;
+
+    memReq = NotifyDriverShm_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ * If remoteProc is HOST, say "0" so that Ipc_start skips the attach.
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 retval = 1;
+
+    if (remoteProcId == MultiProc_getId("HOST")) {
+        retval = 0;
+    }
+
+    return (retval);
+}
diff --git a/packages/ti/ipc/family/tci6614/NotifySetup.xdc b/packages/ti/ipc/family/tci6614/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..75f5044
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== NotifySetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    /*! Source ID bit position for CORE0 */
+    const UInt SRCS_BITPOS_CORE0 = 4;
+
+    /*! Source ID bit position for HOST */
+    const UInt SRCS_BITPOS_HOST = 31;
+}
diff --git a/packages/ti/ipc/family/tci6614/NotifySetup.xs b/packages/ti/ipc/family/tci6614/NotifySetup.xs
new file mode 100644 (file)
index 0000000..15d0b4f
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifySetup  = null;
+var MultiProc    = null;
+var Notify       = null;
+var NotifyDriverShm = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifySetup = this;
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+}
diff --git a/packages/ti/ipc/family/tci6614/VirtQueue.c b/packages/ti/ipc/family/tci6614/VirtQueue.c
new file mode 100644 (file)
index 0000000..e8258cf
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       VirtQueue.c
+ *
+ *  @brief      Virtio Queue implementation for BIOS
+ *
+ *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
+ *  - Renamed module from virtio.h to VirtQueue_Object.h to match the API prefixes;
+ *  - BIOS (XDC) types and CamelCasing used;
+ *  - virtio_device concept removed (i.e, assumes no containing device);
+ *  - simplified scatterlist from Linux version;
+ *  - VirtQueue_Objects are created statically here, so just added a VirtQueue_Object_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - The notify function is implicit in the implementation, and not provided
+ *    by the client, as it is in Linux virtio.
+ *
+ *  All VirtQueue operations can be called in any context.
+ *
+ *  The virtio header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/rpmsg/VirtQueue.h>
+ *  @endcode
+ *
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/SysMin.h>
+
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/family/c66/Cache.h>
+#include <ti/sysbios/knl/Swi.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/ipc/family/tci6614/Interrupt.h>
+#include <ti/ipc/remoteproc/Resource.h>
+
+#include <ti/ipc/MultiProc.h>
+
+#include "package/internal/VirtQueue.xdc.h"
+
+#include <string.h>
+
+#include <ti/ipc/rpmsg/virtio_ring.h>
+
+/* Used for defining the size of the virtqueue registry */
+#define NUM_QUEUES                      2
+
+#define DIV_ROUND_UP(n,d)   (((n) + (d) - 1) / (d))
+#define RP_MSG_BUFS_SPACE   (VirtQueue_RP_MSG_NUM_BUFS * VirtQueue_RP_MSG_BUF_SIZE * 2)
+
+/* With 256 buffers, our vring will occupy 3 pages */
+#define RP_MSG_RING_SIZE    ((DIV_ROUND_UP(vring_size(VirtQueue_RP_MSG_NUM_BUFS, \
+                            VirtQueue_RP_MSG_VRING_ALIGN), VirtQueue_PAGE_SIZE)) * VirtQueue_PAGE_SIZE)
+
+/* The total IPC space needed to communicate with a remote processor */
+#define RPMSG_IPC_MEM   (RP_MSG_BUFS_SPACE + 2 * RP_MSG_RING_SIZE)
+
+#define ID_DSP_TO_A9      0
+#define ID_A9_TO_DSP      1
+
+extern volatile cregister Uns DNUM;
+
+static VirtQueue_Object *queueRegistry[NUM_QUEUES] = {NULL};
+
+/* static inline */ Void * mapPAtoVA(UInt pa)
+{
+    Void *va;
+    UInt offset;
+
+    offset = (DNUM * VirtQueue_VRING_OFFSET);
+    va = (Void *)((pa & 0x000fffffU) | offset | 0xa0000000U);
+
+    Log_print3(Diags_USER1,
+            "mapPAtoVA: pa: 0x%x, offset: 0x%x, va: 0x%x\n",
+             pa, offset, (UInt)va);
+    return va;
+}
+
+static inline UInt mapVAtoPA(Void * va)
+{
+    return ((UInt)va & 0x000fffffU) | 0xe1000000U;
+}
+
+
+/*
+ * ======== VirtQueue_init ========
+ */
+Void VirtQueue_init()
+{
+    extern cregister volatile UInt DNUM;
+    UInt16 procId;
+
+    /*
+     * VirtQueue_init() must be called before MultiProcSetup_init().
+     * (Check the xdc_runtime_Startup_firstFxns__A in the XDC generated code)
+     * Abort if the procId has already been set.  We must set it!
+     */
+    if (MultiProc_self() != MultiProc_INVALIDID) {
+        System_abort("VirtQueue_init(): MultiProc_self already set!");
+        return;
+    }
+
+    procId = DNUM + 1;
+
+    /* Set the local ID */
+    MultiProc_setLocalId(procId);
+}
+
+/*
+ * ======== VirtQueue_Instance_init ========
+ */
+Void VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
+                             const VirtQueue_Params *params)
+{
+    void *vring_phys = NULL;
+    Error_Block eb;
+
+    VirtQueue_module->traceBufPtr = Resource_getTraceBufPtr();
+
+    Error_init(&eb);
+
+    vq->vringPtr = Memory_calloc(NULL, sizeof(struct vring), 0, &eb);
+    Assert_isTrue((vq->vringPtr != NULL), NULL);
+
+    vq->callback = params->callback;
+    vq->id = VirtQueue_module->numQueues++;
+    vq->procId = remoteProcId;
+    vq->last_avail_idx = 0;
+    vq->last_used_idx = 0;
+    vq->num_free = VirtQueue_RP_MSG_NUM_BUFS;
+    vq->swiHandle = params->swiHandle;
+
+    switch (vq->id) {
+        case ID_DSP_TO_A9:
+            vring_phys = (struct vring *) (VirtQueue_CORE0_MEM_VRING0 +
+                (DNUM * VirtQueue_VRING_OFFSET));
+            break;
+        case ID_A9_TO_DSP:
+            vring_phys = (struct vring *) (VirtQueue_CORE0_MEM_VRING1 +
+                (DNUM * VirtQueue_VRING_OFFSET));
+            break;
+    }
+
+    Log_print3(Diags_USER1,
+            "vring: %d 0x%x (0x%x)\n", vq->id, (IArg)vring_phys,
+            RP_MSG_RING_SIZE);
+
+    vring_init(vq->vringPtr, VirtQueue_RP_MSG_NUM_BUFS, vring_phys, VirtQueue_RP_MSG_VRING_ALIGN);
+
+    queueRegistry[vq->id] = vq;
+}
+
+/*
+ * ======== VirtQueue_kick ========
+ */
+Void VirtQueue_kick(VirtQueue_Handle vq)
+{
+    IInterrupt_IntInfo intInfo;
+    struct vring *vring = vq->vringPtr;
+
+    /* For now, simply interrupt remote processor */
+    if (vring->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) {
+        Log_print0(Diags_USER1,
+                "VirtQueue_kick: no kick because of VRING_AVAIL_F_NO_INTERRUPT\n");
+        return;
+    }
+
+    Log_print2(Diags_USER1,
+            "VirtQueue_kick: Sending interrupt to proc %d with payload 0x%x\n",
+            (IArg)vq->procId, (IArg)vq->id);
+
+    intInfo.localIntId  = Interrupt_SRCS_BITPOS_CORE0;
+    Interrupt_intSend(vq->procId, &intInfo, vq->id);
+}
+
+/*
+ * ======== VirtQueue_addUsedBuf ========
+ */
+Int VirtQueue_addUsedBuf(VirtQueue_Handle vq, Int16 head)
+{
+    struct vring_used_elem *used;
+    struct vring *vring = vq->vringPtr;
+
+    if ((head > vring->num) || (head < 0)) {
+        Error_raise(NULL, Error_E_generic, 0, 0);
+    }
+
+    /*
+    * The virtqueue contains a ring of used buffers.  Get a pointer to the
+    * next entry in that used ring.
+    */
+    used = &vring->used->ring[vring->used->idx % vring->num];
+    used->id = head;
+    used->len = VirtQueue_RP_MSG_BUF_SIZE;
+
+    vring->used->idx++;
+
+    return (0);
+}
+
+/*
+ * ======== VirtQueue_addAvailBuf ========
+ */
+Int VirtQueue_addAvailBuf(VirtQueue_Object *vq, Void *buf)
+{
+    UInt16 avail;
+    struct vring *vring = vq->vringPtr;
+
+    if (vq->num_free == 0) {
+        /* There's no more space */
+        Error_raise(NULL, Error_E_generic, 0, 0);
+    }
+
+    vq->num_free--;
+
+    avail =  vring->avail->idx++ % vring->num;
+
+    vring->desc[avail].addr = mapVAtoPA(buf);
+    vring->desc[avail].len = VirtQueue_RP_MSG_BUF_SIZE;
+
+    return (vq->num_free);
+}
+
+/*
+ * ======== VirtQueue_getUsedBuf ========
+ */
+Void *VirtQueue_getUsedBuf(VirtQueue_Object *vq)
+{
+    UInt16 head;
+    Void *buf;
+    struct vring *vring = vq->vringPtr;
+
+    /* There's nothing available? */
+    if (vq->last_used_idx == vring->used->idx) {
+        return (NULL);
+    }
+
+    head = vring->used->ring[vq->last_used_idx % vring->num].id;
+    vq->last_used_idx++;
+    vq->num_free++;
+
+    buf = mapPAtoVA(vring->desc[head].addr);
+
+    return (buf);
+}
+
+/*
+ * ======== VirtQueue_getAvailBuf ========
+ */
+Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf)
+{
+    UInt16 head;
+    struct vring *vring = vq->vringPtr;
+
+    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x\n",
+        (IArg)vq,
+        vq->last_avail_idx, vring->avail->idx, vring->num,
+        (IArg)&vring->avail, (IArg)vring->avail);
+
+    /* There's nothing available? */
+    if (vq->last_avail_idx == vring->avail->idx) {
+        /* We need to know about added buffers */
+        vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
+        /* check again after setting flag */
+        if (vq->last_avail_idx == vring->avail->idx)
+            return -1;
+    }
+
+    /* No need to be kicked about added buffers anymore */
+    vring->used->flags |= VRING_USED_F_NO_NOTIFY;
+
+    /*
+     * Grab the next descriptor number they're advertising, and increment
+     * the index we've seen.
+     */
+    head = vring->avail->ring[vq->last_avail_idx++ % vring->num];
+
+    *buf = mapPAtoVA(vring->desc[head].addr);
+
+    return (head);
+}
+
+/*
+ * ======== VirtQueue_isr ========
+ * Note 'msg' is ignored: it is only used where there is a mailbox payload.
+ */
+Void VirtQueue_isr(UArg msg)
+{
+    VirtQueue_Object *vq;
+
+    Log_print1(Diags_USER1, "VirtQueue_isr received msg = 0x%x\n", msg);
+
+    vq = queueRegistry[0];
+    if (vq) {
+        vq->callback(vq);
+    }
+    vq = queueRegistry[1];
+    if (vq) {
+        vq->callback(vq);
+    }
+}
+
+/*
+ * ======== VirtQueue_startup ========
+ */
+Void VirtQueue_startup(UInt16 remoteProcId, Bool isHost)
+{
+    IInterrupt_IntInfo intInfo;
+
+    intInfo.intVectorId = Interrupt_DSPINT;
+    intInfo.localIntId  = Interrupt_SRCS_BITPOS_HOST;
+
+
+    /*
+     * Wait for first kick from host, which happens to coincide with the
+     * priming of host's receive buffers, indicating host is ready to send.
+     * Since interrupt is cleared, we throw away this first kick, which is
+     * OK since we don't process this in the ISR anyway.
+     */
+    Log_print0(Diags_USER1, "VirtQueue_startup: Polling for host int...\n");
+    while (!Interrupt_checkAndClear(remoteProcId, &intInfo));
+
+    Interrupt_intRegister(remoteProcId, &intInfo, (Fxn)VirtQueue_isr, NULL);
+
+    Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
+}
+
+/* By convention, Host VirtQueues host are the even number in the pair */
+Bool VirtQueue_isSlave(VirtQueue_Handle vq)
+{
+  return (vq->id & 0x1);
+}
+
+Bool VirtQueue_isHost(VirtQueue_Handle vq)
+{
+  return (~(vq->id & 0x1));
+}
+
+UInt16 VirtQueue_getId(VirtQueue_Handle vq)
+{
+  return (vq->id);
+}
+
+Swi_Handle VirtQueue_getSwiHandle(VirtQueue_Handle vq)
+{
+  return (vq->swiHandle);
+}
+
+#define CACHE_WB_TICK_PERIOD    5
+
+/*
+ * ======== VirtQueue_cacheWb ========
+ *
+ * Used for flushing SysMin trace buffer.
+ */
+Void VirtQueue_cacheWb()
+{
+    static UInt32 oldticks = 0;
+    UInt32 newticks;
+
+    newticks = Clock_getTicks();
+    if (newticks - oldticks < (UInt32)CACHE_WB_TICK_PERIOD) {
+        /* Don't keep flushing cache */
+        return;
+    }
+
+    oldticks = newticks;
+
+    /* Flush the cache of the SysMin buffer only: */
+    Assert_isTrue((VirtQueue_module->traceBufPtr != NULL), NULL);
+    Cache_wb(VirtQueue_module->traceBufPtr, SysMin_bufSize, Cache_Type_ALL,
+             FALSE);
+}
diff --git a/packages/ti/ipc/family/tci6614/VirtQueue.xdc b/packages/ti/ipc/family/tci6614/VirtQueue.xdc
new file mode 100644 (file)
index 0000000..ad5d2ee
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       VirtQueue.xdc
+ *
+ *  @brief      Virtio Queue interface for BIOS
+ *
+ *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
+ *  - Renamed module from virtio.h to VirtQueue.h to match the API prefixes;
+ *  - BIOS (XDC) types and CamelCasing used;
+ *  - virtio_device concept removed (i.e, assumes no containing device);
+ *  - removed scatterlist;
+ *  - VirtQueues are created statically here, so just added a VirtQueue_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - The notify function is implicit in the implementation, and not provided
+ *    by the client, as it is in Linux virtio.
+ *  - Broke into APIs to add/get used and avail buffers, as the API is
+ *    assymmetric.
+ *
+ *  Usage:
+ *     This IPC only works between one processor designated as the Host (Linux)
+ *     and one or more Slave processors (BIOS).
+ *
+ *     For any Host/Slave pair, there are 2 VirtQueues (aka Vrings);
+ *     Only the Host adds new buffers to the avail list of a vring;
+ *     Available buffers can be empty or full, depending on direction;
+ *     Used buffer means "processed" (emptied or filled);
+ *
+ *  Host:
+ *    - To send buffer to the slave processor:
+ *          add_avail_buf(slave_virtqueue);
+ *          kick(slave_virtqueue);
+ *          get_used_buf(slave_virtqueue);
+ *    - To receive buffer from slave processor:
+ *          add_avail_buf(host_virtqueue);
+ *          kick(host_virtqueue);
+ *          get_used_buf(host_virtqueue);
+ *
+ *  Slave:
+ *    - To send buffer to the host:
+ *          get_avail_buf(host_virtqueue);
+ *          add_used_buf(host_virtqueue);
+ *          kick(host_virtqueue);
+ *    - To receive buffer from the host:
+ *          get_avail_buf(slave_virtqueue);
+ *          add_used_buf(slave_virtqueue);
+ *          kick(slave_virtqueue);
+ *
+ *  All VirtQueue operations can be called in any context.
+ *
+ *  The virtio header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/rpmsg/VirtQueue.h>
+ *  @endcode
+ *
+ *  ============================================================================
+ */
+
+import  ti.sysbios.knl.Swi;
+import  ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== VirtQueue ========
+ *
+ */
+
+
+module VirtQueue
+{
+    // -------- Module Constants --------
+
+    // -------- Module Types --------
+
+
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     */
+    metaonly struct BasicView {
+
+    };
+
+    /*!
+     *  ======== ModuleView ========
+     *  @_nodoc
+     */
+    metaonly struct ModuleView {
+
+    };
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+/*    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',  {type: ViewInfo.INSTANCE, viewInitFxn: 'viewInitBasic',  structName: 'BasicView'}],
+                ['Module', {type: ViewInfo.MODULE,   viewInitFxn: 'viewInitModule', structName: 'ModuleView'}]
+            ]
+         });
+*/
+    // -------- Module Proxies --------
+
+    // -------- Module Parameters --------
+
+    /* Predefined device addresses */
+    config UInt32 CORE0_MEM_VRING0 = 0xA0000000;
+    config UInt32 CORE0_MEM_VRING1 = 0xA0004000;
+    config UInt32 VRING_OFFSET = 0x00080000;
+
+    /*
+     * Sizes of the virtqueues (expressed in number of buffers supported,
+     * and must be power of two)
+     */
+    config UInt VQ0_SIZE = 256;
+    config UInt VQ1_SIZE = 256;
+
+    /* See VirtQueue.c also for other constants:   */
+    config UInt RP_MSG_NUM_BUFS = VQ0_SIZE; /* must be power of two */
+    config UInt RP_MSG_BUF_SIZE = 512;
+
+
+    config UInt PAGE_SIZE = 4096;
+
+    /*
+     * The alignment to use between consumer and producer parts of vring.
+     * Note: this is part of the "wire" protocol. If you change this, you need
+     * to update your BIOS image as well
+     */
+    config UInt RP_MSG_VRING_ALIGN = 4096;
+
+   /*!
+    * ======== startup ========
+    *
+    * Plug interrupts, and if host, initialize vring memory and send
+    * startup sequence events to slave.
+    */
+    Void startup(UInt16 remoteProcId, Bool isHost);
+
+instance:
+
+    /*!
+     *  @brief      Initialize at runtime the VirtQueue
+     *
+     *  Maps to Instance_init function
+     *
+     *  @param[in]  remoteProcId    Remote processor ID associated with this VirtQueue.
+     *
+     *  @Returns    Returns a handle to a new initialized VirtQueue.
+     */
+    @DirectCall
+    create(UInt16 remoteProcId);
+
+    /*!
+     *  @brief      Notify other processor of new buffers in the queue.
+     *
+     *  After one or more add_buf calls, invoke this to kick the other side.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     *  @sa         VirtQueue_addBuf
+     */
+    @DirectCall
+    Void kick();
+
+    /*!
+     *  @brief      VirtQueue instance returns slave status
+     *
+     *  Returns if this VirtQueue instance belongs to a slave
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Bool isSlave();
+
+    /*!
+     *  @brief      VirtQueue instance returns host status
+     *
+     *  Returns if this VirtQueue instance belongs to a host
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Bool isHost();
+
+    /*!
+     *  @brief      VirtQueue instance returns queue ID
+     *
+     *  Returns VirtQueue instance's queue ID.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    UInt16 getId();
+
+    /*!
+     *  @brief      VirtQueue instance returns Swi handle
+     *
+     *  Returns VirtQueue instance Swi handle
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Swi.Handle getSwiHandle();
+
+    /*
+     *  ========================================================================
+     *  Host Only Functions:
+     *  ========================================================================
+     */
+
+    /*!
+     *  @brief      Add available buffer to virtqueue's available buffer list.
+     *              Only used by Host.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[in]  buf      the buffer to be processed by the slave.
+     *
+     *  @return     Remaining capacity of queue or a negative error.
+     *
+     *  @sa         VirtQueue_getUsedBuf
+     */
+    @DirectCall
+    Int addAvailBuf(Void *buf);
+
+    /*!
+     *  @brief      Get the next used buffer.
+     *              Only used by Host.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     *  @return     Returns NULL or the processed buffer.
+     *
+     *  @sa         VirtQueue_addAvailBuf
+     */
+    @DirectCall
+    Void *getUsedBuf();
+
+    /*
+     *  ========================================================================
+     *  Slave Only Functions:
+     *  ========================================================================
+     */
+
+    /*!
+     *  @brief      Get the next available buffer.
+     *              Only used by Slave.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[out] buf       Pointer to location of available buffer;
+     *
+     *  @return     Returns a token used to identify the available buffer, to be
+     *              passed back into VirtQueue_addUsedBuf();
+     *              token is negative if failure to find an available buffer.
+     *
+     *  @sa         VirtQueue_addUsedBuf
+     */
+    @DirectCall
+    Int16 getAvailBuf(Void **buf);
+
+    /*!
+     *  @brief      Add used buffer to virtqueue's used buffer list.
+     *              Only used by Slave.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[in]  token     token of the buffer to be added to vring used list.
+     *
+     *  @return     Remaining capacity of queue or a negative error.
+     *
+     *  @sa         VirtQueue_getAvailBuf
+     */
+    @DirectCall
+    Int addUsedBuf(Int16 head);
+
+    // -------- Handle Parameters --------
+
+    config Bool host = false;
+
+    config Fxn callback = null;
+
+    config Swi.Handle swiHandle = null;
+
+    config UInt intVectorId = ~1u;
+
+    // -------- Handle Functions --------
+
+internal:   /* not for client use */
+
+    void init();
+
+    /*!
+     *  ======== hostIsr ========
+     */
+    Void hostIsr(UArg msg);
+
+    /*!
+     *  ======== slaveIsr ========
+     */
+    Void slaveIsr(UArg msg);
+
+    /*!
+     * ======== Module_State ========
+     * @_nodoc
+     */
+    struct Module_State
+    {
+        UInt16 numQueues;
+        UInt16 hostSlaveSynced;
+        UInt16 virtQueueInitialized;
+        UInt32 *queueRegistry;
+        Ptr    traceBufPtr;
+    }
+
+    /*!
+     *  ======== Instance_State ========
+     *  @_nodoc
+     */
+    struct Instance_State {
+        Bool hostSlaveSynced;
+        UInt16 id;
+        Fxn callback;
+        Swi.Handle swiHandle;
+        Void *vringPtr;
+        UInt16 num_free;
+        UInt16 last_avail_idx;
+        UInt16 last_used_idx;
+        UInt16 procId;
+    };
+}
diff --git a/packages/ti/ipc/family/tci6614/VirtQueue.xs b/packages/ti/ipc/family/tci6614/VirtQueue.xs
new file mode 100644 (file)
index 0000000..8f16ba4
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== VirtQueue.xs ================
+ */
+
+ /*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+
+    VirtQueue = this;
+    var MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+
+    xdc.useModule("ti.sysbios.knl.Swi");
+    xdc.useModule("ti.ipc.family.tci6614.Interrupt");
+    //xdc.useModule("ti.ipc.remoteproc.Resource");
+
+    if (MultiProc.id == MultiProc.INVALIDID) {
+        var Startup = xdc.useModule('xdc.runtime.Startup');
+        Startup.firstFxns.$add(VirtQueue.init);
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+  /* Init VirtQueue params */
+  mod.numQueues = 0;
+  mod.hostSlaveSynced = 0;
+  mod.virtQueueInitialized = 0;
+  mod.queueRegistry = null;
+  mod.traceBufPtr = null;
+}
diff --git a/packages/ti/ipc/family/tci6614/package.bld b/packages/ti/ipc/family/tci6614/package.bld
new file mode 100644 (file)
index 0000000..07f1063
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld"];
+
+var SRCS = ["Interrupt.c", "VirtQueue.c", "NotifySetup.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+    var lib;
+
+//    print("targ.name = " + targ.name);
+
+    /* build only for DSP-side TCI6614 (i.e. C66) */
+    if (targ.isa == "66") {
+        /* Build for all profiles */
+        for (var profile in targ.profiles) {
+
+            Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+                profile: profile
+            }).addObjects(SRCS);
+        }
+    }
+}
diff --git a/packages/ti/ipc/family/tci6614/package.xdc b/packages/ti/ipc/family/tci6614/package.xdc
new file mode 100644 (file)
index 0000000..3f218ee
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.family.tci6614 ========
+ */
+package ti.ipc.family.tci6614[1,0,0,0] {
+    module    Interrupt;
+    module    VirtQueue;
+    module    NotifySetup;
+}
diff --git a/packages/ti/ipc/family/tci6614/package.xs b/packages/ti/ipc/family/tci6614/package.xs
new file mode 100644 (file)
index 0000000..1da79f4
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== close ========
+ */
+function close()
+{
+    /* bring in modules we use in this package */
+    xdc.useModule('ti.sysbios.knl.Swi');
+    xdc.useModule('ti.sysbios.hal.Cache');
+}
+
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var name = this.$name + ".a" + suffix;
+    var lib = "lib/" + this.profile + "/" + name;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/" + name;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/ipc/family/tci6638/Interrupt.c b/packages/ti/ipc/family/tci6638/Interrupt.c
new file mode 100644 (file)
index 0000000..8f068c2
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.c ========
+ *  C647x based interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/ipc/MultiProc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "Interrupt.h"
+
+#include "package/internal/Interrupt.xdc.h"
+
+extern volatile cregister Uns DNUM;
+
+Fxn userFxn = NULL;
+Void Interrupt_isr(UArg arg);
+
+/* Shift to source bit id for CORES 0-3 */
+#define MAP_TO_BITPOS(intId) \
+     (intId == Interrupt_SRCS_BITPOS_CORE0 ? (intId + DNUM) : intId)
+
+/*
+ * Map remoteProcId to CORE ID [0-3]
+ * NOTE: This assumes that HOST is at MultiProcId == 0, and CORE0 at 1i
+ */
+#define MAP_RPROCID_TO_COREID(rProcId)     (rProcId-1)
+
+#define MAP_RPROCID_TO_SRCC(rProcId, intId) \
+         (intId == Interrupt_SRCS_BITPOS_CORE0 ?  \
+         (intId + (rProcId-1)) : intId)
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Interrupt_Module_startup ========
+ */
+Int Interrupt_Module_startup(Int phase)
+{
+    volatile UInt32 *kick0 = (volatile UInt32 *)Interrupt_KICK0;
+    volatile UInt32 *kick1 = (volatile UInt32 *)Interrupt_KICK1;
+    UInt16 procId = MultiProc_self();
+
+    /*
+     * If this assert fails, the MultiProc config has changed to break
+     * an assumption in Linux rpmsg driver, that HOST is listed first in
+     * MultiProc ID configuration.
+     */
+    Assert_isTrue(0 == MultiProc_getId("HOST"), NULL);
+
+    /*
+     *  Wait for Startup to be done (if MultiProc id not yet set) because a
+     *  user fxn should set it
+     */
+    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
+        return (Startup_NOTDONE);
+    }
+
+    if (!Interrupt_enableKick) {
+        /* Do not unlock the kick registers */
+        return (Startup_DONE);
+    }
+
+    /*
+     * Only write to the KICK registers if:
+     * - This core is the SR0 owner
+     * - There is no SR0 and this core has procId '1' (IPC 3.x: this case).
+     */
+    /* TODO: What if CORE0 is not started, but the others are? */
+    if (DNUM == 0) {
+        if (Interrupt_KICK0 && Interrupt_KICK1){
+            /* unlock the KICK mechanism in the Bootcfg MMRs if defined */
+            kick0[0] = 0x83e70b13;      /* must be written with this value */
+            kick1[0] = 0x95a4f1e0;      /* must be written with this value */
+        }
+    }
+
+    return (Startup_DONE);
+}
+
+/*!
+ *  ======== Interrupt_intEnable ========
+ *  Enable interrupt
+ */
+Void Interrupt_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== Interrupt_intDisable ========
+ *  Disables interrupts
+ */
+Void Interrupt_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+Void Interrupt_intClearAll()
+{
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+
+    ipcar[DNUM] = val;
+}
+
+
+/*
+ *  ======== Interrupt_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void Interrupt_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                           Fxn func, UArg arg)
+{
+    Hwi_Params hwiAttrs;
+    Interrupt_FxnTable *table;
+
+    UInt pos;
+    Assert_isTrue(intInfo != NULL, NULL);
+
+    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+
+    Log_print2(Diags_USER1, "Interrupt_intRegister: pos: %d, func: 0x%x\n",
+              (IArg)pos, (IArg)func);
+
+    /* setup the function table with client function and arg to call: */
+    table = &(Interrupt_module->fxnTable[pos]);
+    table->func = func;
+    table->arg  = arg;
+
+    /* Make sure the interrupt only gets plugged once */
+    Interrupt_module->numPlugged++;
+    if (Interrupt_module->numPlugged == 1) {
+        /* Clear all pending interrupts */
+        Interrupt_intClearAll();
+
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+        hwiAttrs.arg         = arg;
+        hwiAttrs.eventId     = Interrupt_INTERDSPINT;
+
+        Hwi_create(intInfo->intVectorId,
+            (Hwi_FuncPtr)Interrupt_isr, &hwiAttrs, NULL);
+
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+}
+
+Void Interrupt_intUnregister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+    Interrupt_FxnTable *table;
+    UInt pos;
+
+    Assert_isTrue(intInfo != NULL, NULL);
+
+    Interrupt_module->numPlugged--;
+    if (Interrupt_module->numPlugged == 0) {
+        /* No need to disable interrupt: Hwi_delete takes care of this */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Unset the function table */
+    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+
+    table = &(Interrupt_module->fxnTable[pos]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+/*!
+ *  ======== Interrupt_intSend ========
+ *  Send interrupt to the remote processor, identifying this core as source.
+ *  If CORE0 BIT POS, we add DNUM to identify this core as the source;
+ *  Otherwise, we just use the localIntId as the source bit position.
+ */
+Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt32 val;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcgrh = (volatile UInt32 *)Interrupt_IPCGRH;
+    UInt pos;
+
+    Assert_isTrue((intInfo != NULL), NULL);
+    pos = MAP_TO_BITPOS(intInfo->localIntId);
+
+    /*
+     *  bit 0 is set to generate the interrupt.
+     *  bits 4-7 are set to specify the interrupt generation source.
+     *  The convention is that bit 4 (SRCS0) is used for core 0,
+     *  bit 5 (SRCS1) for core 1, etc... .
+     */
+    val = (1 << pos) | 1;
+    Log_print3(Diags_USER1,
+        "Interrupt_intSend: setting bit %d in SRCS as 0x%x to for rprocId #%d",
+        (IArg)pos, (IArg)val, (IArg)remoteProcId);
+
+    if (remoteProcId == MultiProc_getId("HOST"))
+    {
+        /* Interrupt is to be generated on the Host processor.  Go through
+         * IPCGRH register
+         */
+        *ipcgrh = val;
+    }
+    else
+    {
+        /* Interrupt is to be generated on another DSP. */
+        ipcgr[MAP_RPROCID_TO_COREID(remoteProcId)] =  val;
+    }
+}
+
+/*
+ *  ======== Interrupt_intClear ========
+ *  Acknowledge interrupt by clearing the corresponding source bit.
+ *
+ *  intInfo->localIntId encodes the Source bit position to be cleared.
+ *  If this corresponds to Core0, adjust using remoteProcId to get true
+ *  SRCS bit position for the DSP core.
+ *
+ *  Otherwise, the localIntId is used directly as the bit position.
+ *
+ *  Only callers setting remoteProcId == HOST id care about return value.
+ */
+UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt payload = Interrupt_INVALIDPAYLOAD;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+    UInt pos;
+
+    Assert_isTrue((intInfo != NULL), NULL);
+    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+    ipcar[DNUM] = (1 << pos);
+
+    Log_print2(Diags_USER1, "Interrupt_intClear: ipcgr: 0x%x, cleared: 0x%x\n",
+                            val, (1 << pos));
+
+    if (remoteProcId == MultiProc_getId("HOST")) {
+        payload = ((val & (UInt)(1 << Interrupt_SRCS_BITPOS_HOST)) ? val :
+                    Interrupt_INVALIDPAYLOAD);
+    }
+
+    return (payload);
+}
+
+/*
+ *  ======== Interrupt_checkAndClear ========
+ *  Return 1 if the interrupt was set (if so, we clear it);
+ *  Otherwise, returns 0.
+ */
+UInt Interrupt_checkAndClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+    UInt pos;
+
+    Assert_isTrue((intInfo != NULL), NULL);
+
+    pos = MAP_TO_BITPOS(intInfo->localIntId);
+    if (val & (1 << pos)) {
+        ipcar[DNUM] = (1 << pos);
+        return(1);
+    }
+
+    return(0);
+}
+
+/*
+ *  ======== Interrupt_isr ========
+ */
+Void Interrupt_isr(UArg arg)
+{
+    Int i;
+    Interrupt_FxnTable *table;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt val = ipcgr[DNUM]; /* Interrupt source bits */
+
+    Log_print1(Diags_USER1,
+        "Interrupt_isr: Interrupt(s) received: 0x%x", (IArg)val);
+
+    for (i = Interrupt_SRCS_BITPOS_CORE0; i < 32; i++) {
+        if (val & (1 << i)) {
+            /* Clear the specific interrupt: */
+            ipcar[DNUM] = (1 << i);
+
+            /* Call the client function: */
+            table = &(Interrupt_module->fxnTable[i]);
+            if (table->func != NULL) {
+                Log_print1(Diags_USER1,
+                    "Interrupt_isr: source id bit: %d", i);
+                (table->func)(table->arg);
+            }
+        }
+    }
+}
diff --git a/packages/ti/ipc/family/tci6638/Interrupt.xdc b/packages/ti/ipc/family/tci6638/Interrupt.xdc
new file mode 100644 (file)
index 0000000..98ba03d
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== Interrupt.xdc ========
+ */
+
+/*!
+ *  ======== Interrupt ========
+ *  TCI66xx IPC interrupt manager
+ */
+
+@ModuleStartup
+
+module Interrupt inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+
+    const UInt INVALIDPAYLOAD = 0xFFFFFFFF;
+
+    /*!
+     *  ======== enableKick ========
+     *  If set to 'true' IPC will unlock the KICK registers on C66x devices
+     *
+     *  IPC unlocks the KICK registers on the local core if (and only if) all
+     *  the following conditions are met:
+     *  - This configuration is set to 'true'
+     *  - SharedRegion #0 is valid and the local core is its owner
+     *  - SharedRegion #0 is not valid and the local core is CORE0
+     */
+    config Bool enableKick = true;
+
+    /*!
+     *  ======== Interrupt_intClearAll ========
+     *  Clear all pending interrupts.
+     */
+    Void intClearAll();
+
+    /*!
+     *  ======== Interrupt_checkAndClear =======
+     *  Check to see that interrupt is set, if so clear it and return 1.
+     */
+    UInt checkAndClear(UInt16 remoteProcId, IntInfo *intInfo);
+
+internal:
+
+    /*! Source ID bit position for CORE0 */
+    const UInt SRCS_BITPOS_CORE0 = 4;
+
+    /*! Source ID bit position for HOST */
+    const UInt SRCS_BITPOS_HOST = 31;
+
+    /*! Ptr to the IPC Generation Registers */
+    config Ptr IPCGR0;
+
+    /*! Ptr to the IPC Acknowledgment Registers */
+    config Ptr IPCAR0;
+
+    /*! Ptr to the IPC Host Generation Host Register */
+    config Ptr IPCGRH;
+
+    /*! Ptr to the IPC Acknowledgement Host Register */
+    config Ptr IPCARH;
+
+    /*! Ptr to the KICK0 Bootcfg Registers */
+    config Ptr KICK0;
+
+    /*! Ptr to the KICK1 Bootcfg Registers */
+    config Ptr KICK1;
+
+    /*! Inter-processor interrupt id (varies per device) */
+    config UInt INTERDSPINT;
+
+    /*! Vector interrupt id for Hwi_create */
+    config UInt DSPINT;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+
+    /*!
+     *  ======== isr ========
+     *  Stub function plugged as interrupt handler
+     */
+    Void isr(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[];  /* indexed by Source ID bit pos */
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/ipc/family/tci6638/Interrupt.xs b/packages/ti/ipc/family/tci6638/Interrupt.xs
new file mode 100644 (file)
index 0000000..8a94de6
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== Interrupt.xs ========
+ */
+
+var deviceSettings = {
+    'Kepler' : {
+        IPCGR0:         0x02620240,
+        IPCAR0:         0x02620280,
+        IPCGRH:         0x02620260,
+        IPCARH:         0x026202A0,
+        KICK0:          0x02620038,
+        KICK1:          0x0262003C,
+        INTERDSPINT:    105,
+        DSPINT:         5,
+    },
+}
+var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
+Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
+var Hwi         = null;
+var Interrupt = null;
+var MultiProc   = null;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    var settings = deviceSettings[Program.cpu.deviceName];
+
+    this.IPCGR0         = settings.IPCGR0;
+    this.IPCAR0         = settings.IPCAR0;
+    this.IPCGRH         = settings.IPCGRH;
+    this.IPCARH         = settings.IPCARH;
+    this.KICK0          = settings.KICK0;
+    this.KICK1          = settings.KICK1;
+    this.INTERDSPINT    = settings.INTERDSPINT;
+    this.DSPINT         = settings.DSPINT;
+}
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Interrupt     = this;
+
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    var fxnTable = Interrupt.$object.fxnTable;
+
+    /* The function table length should be the number of IPCAR bits */
+    fxnTable.length = 32;
+    for (var i = 0; i < fxnTable.length; i++) {
+        fxnTable[i].func = null;
+        fxnTable[i].arg = 0;
+    }
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/ipc/family/tci6638/NotifyCircSetup.c b/packages/ti/ipc/family/tci6638/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..d4b026c
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <xdc/runtime/Error.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+
+    Assert_isTrue(remoteProcId != MultiProc_getId("HOST"), NULL);
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* init params and set default values */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.intVectorId     = NotifyCircSetup_dspIntVectId;
+    notifyShmParams.localIntId      = NotifyCircSetup_SRCS_BITPOS_CORE0;
+    notifyShmParams.sharedAddr      = sharedAddr;
+    notifyShmParams.remoteProcId    = remoteProcId;
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+           NotifyDriverCirc_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
+           &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+
+        return (Notify_E_FAIL);
+    }
+
+    return (Notify_S_SUCCESS);
+}
+
+/*!
+ * ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params params;
+
+    Assert_isTrue(remoteProcId != MultiProc_getId("HOST"), NULL);
+
+    NotifyDriverCirc_Params_init(&params);
+    params.sharedAddr      = sharedAddr;
+    params.intVectorId     = NotifyCircSetup_dspIntVectId;
+    params.remoteProcId    = remoteProcId;
+
+    memReq = NotifyDriverCirc_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 retval = 1;
+
+    if (remoteProcId == MultiProc_getId("HOST")) {
+        retval = 0;
+    }
+
+    return (retval);
+}
diff --git a/packages/ti/ipc/family/tci6638/NotifyCircSetup.xdc b/packages/ti/ipc/family/tci6638/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..9347e4e
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ */
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    /*! Source ID bit position for CORE0 */
+    const UInt SRCS_BITPOS_CORE0 = 4;
+
+    /*! Source ID bit position for HOST */
+    const UInt SRCS_BITPOS_HOST = 31;
+}
diff --git a/packages/ti/ipc/family/tci6638/NotifyCircSetup.xs b/packages/ti/ipc/family/tci6638/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..c45d4da
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ */
+
+var NotifyCircSetup  = null;
+var MultiProc    = null;
+var Notify       = null;
+var NotifyDriverShm = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyCircSetup = this;
+    NotifyDriverCirc =
+        xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+}
diff --git a/packages/ti/ipc/family/tci6638/VirtQueue.c b/packages/ti/ipc/family/tci6638/VirtQueue.c
new file mode 100644 (file)
index 0000000..bf0dbbe
--- /dev/null
@@ -0,0 +1,399 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       VirtQueue.c
+ *
+ *  @brief      Virtio Queue implementation for BIOS
+ *
+ *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
+ *  - Renamed module from virtio.h to VirtQueue_Object.h to match the API prefixes;
+ *  - BIOS (XDC) types and CamelCasing used;
+ *  - virtio_device concept removed (i.e, assumes no containing device);
+ *  - simplified scatterlist from Linux version;
+ *  - VirtQueue_Objects are created statically here, so just added a VirtQueue_Object_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - The notify function is implicit in the implementation, and not provided
+ *    by the client, as it is in Linux virtio.
+ *
+ *  All VirtQueue operations can be called in any context.
+ *
+ *  The virtio header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/rpmsg/VirtQueue.h>
+ *  @endcode
+ *
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/SysMin.h>
+
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/family/c66/Cache.h>
+#include <ti/sysbios/knl/Swi.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/ipc/family/tci6638/Interrupt.h>
+#include <ti/ipc/remoteproc/Resource.h>
+
+#include <ti/ipc/MultiProc.h>
+
+#include "package/internal/VirtQueue.xdc.h"
+
+#include <string.h>
+
+#include <ti/ipc/rpmsg/virtio_ring.h>
+
+/* Used for defining the size of the virtqueue registry */
+#define NUM_QUEUES                      2
+
+#define DIV_ROUND_UP(n,d)   (((n) + (d) - 1) / (d))
+#define RP_MSG_BUFS_SPACE   (VirtQueue_RP_MSG_NUM_BUFS * VirtQueue_RP_MSG_BUF_SIZE * 2)
+
+/* With 256 buffers, our vring will occupy 3 pages */
+#define RP_MSG_RING_SIZE    ((DIV_ROUND_UP(vring_size(VirtQueue_RP_MSG_NUM_BUFS, \
+                            VirtQueue_RP_MSG_VRING_ALIGN), VirtQueue_PAGE_SIZE)) * VirtQueue_PAGE_SIZE)
+
+/* The total IPC space needed to communicate with a remote processor */
+#define RPMSG_IPC_MEM   (RP_MSG_BUFS_SPACE + 2 * RP_MSG_RING_SIZE)
+
+#define ID_DSP_TO_A9      0
+#define ID_A9_TO_DSP      1
+
+extern volatile cregister Uns DNUM;
+
+static VirtQueue_Object *queueRegistry[NUM_QUEUES] = {NULL};
+
+static inline  Void * mapPAtoVA(UInt pa)
+{
+    return (Void *)(pa | 0x80000000);
+}
+
+static inline UInt mapVAtoPA(Void * va)
+{
+    return ((UInt)va & 0x000fffffU) | 0xe1000000U;
+}
+
+/*
+ * ======== VirtQueue_init ========
+ */
+Void VirtQueue_init()
+{
+    extern cregister volatile UInt DNUM;
+    UInt16 procId;
+
+    /*
+     * VirtQueue_init() must be called before MultiProcSetup_init().
+     * (Check the xdc_runtime_Startup_firstFxns__A in the XDC generated code)
+     * Abort if the procId has already been set.  We must set it!
+     */
+    if (MultiProc_self() != MultiProc_INVALIDID) {
+        System_abort("VirtQueue_init(): MultiProc_self already set!");
+        return;
+    }
+
+    procId = DNUM + 1;
+
+    /* Set the local ID */
+    MultiProc_setLocalId(procId);
+}
+
+/*
+ * ======== VirtQueue_Instance_init ========
+ */
+Void VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
+                             const VirtQueue_Params *params)
+{
+    void *vring_phys = NULL;
+    Error_Block eb;
+
+    VirtQueue_module->traceBufPtr = Resource_getTraceBufPtr();
+
+    Error_init(&eb);
+
+    vq->vringPtr = Memory_calloc(NULL, sizeof(struct vring), 0, &eb);
+    Assert_isTrue((vq->vringPtr != NULL), NULL);
+
+    vq->callback = params->callback;
+    vq->id = VirtQueue_module->numQueues++;
+    vq->procId = remoteProcId;
+    vq->last_avail_idx = 0;
+    vq->last_used_idx = 0;
+    vq->num_free = VirtQueue_RP_MSG_NUM_BUFS;
+    vq->swiHandle = params->swiHandle;
+
+    switch (vq->id) {
+        case ID_DSP_TO_A9:
+            vring_phys = (struct vring *) (VirtQueue_CORE0_MEM_VRING0 +
+                (DNUM * VirtQueue_VRING_OFFSET));
+            break;
+        case ID_A9_TO_DSP:
+            vring_phys = (struct vring *) (VirtQueue_CORE0_MEM_VRING1 +
+                (DNUM * VirtQueue_VRING_OFFSET));
+            break;
+    }
+
+    Log_print3(Diags_USER1,
+            "vring: %d 0x%x (0x%x)\n", vq->id, (IArg)vring_phys,
+            RP_MSG_RING_SIZE);
+
+    vring_init(vq->vringPtr, VirtQueue_RP_MSG_NUM_BUFS, vring_phys, VirtQueue_RP_MSG_VRING_ALIGN);
+
+    queueRegistry[vq->id] = vq;
+}
+
+/*
+ * ======== VirtQueue_kick ========
+ */
+Void VirtQueue_kick(VirtQueue_Handle vq)
+{
+    IInterrupt_IntInfo intInfo;
+    struct vring *vring = vq->vringPtr;
+
+    /* For now, simply interrupt remote processor */
+    if (vring->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) {
+        Log_print0(Diags_USER1,
+                "VirtQueue_kick: no kick because of VRING_AVAIL_F_NO_INTERRUPT\n");
+        return;
+    }
+
+    Log_print2(Diags_USER1,
+            "VirtQueue_kick: Sending interrupt to proc %d with payload 0x%x\n",
+            (IArg)vq->procId, (IArg)vq->id);
+
+    intInfo.localIntId  = Interrupt_SRCS_BITPOS_CORE0;
+    Interrupt_intSend(vq->procId, &intInfo, vq->id);
+}
+
+/*
+ * ======== VirtQueue_addUsedBuf ========
+ */
+Int VirtQueue_addUsedBuf(VirtQueue_Handle vq, Int16 head)
+{
+    struct vring_used_elem *used;
+    struct vring *vring = vq->vringPtr;
+
+    if ((head > vring->num) || (head < 0)) {
+        Error_raise(NULL, Error_E_generic, 0, 0);
+    }
+
+    /*
+    * The virtqueue contains a ring of used buffers.  Get a pointer to the
+    * next entry in that used ring.
+    */
+    used = &vring->used->ring[vring->used->idx % vring->num];
+    used->id = head;
+    used->len = VirtQueue_RP_MSG_BUF_SIZE;
+
+    vring->used->idx++;
+
+    return (0);
+}
+
+/*
+ * ======== VirtQueue_addAvailBuf ========
+ */
+Int VirtQueue_addAvailBuf(VirtQueue_Object *vq, Void *buf)
+{
+    UInt16 avail;
+    struct vring *vring = vq->vringPtr;
+
+    if (vq->num_free == 0) {
+        /* There's no more space */
+        Error_raise(NULL, Error_E_generic, 0, 0);
+    }
+
+    vq->num_free--;
+
+    avail =  vring->avail->idx++ % vring->num;
+
+    vring->desc[avail].addr = mapVAtoPA(buf);
+    vring->desc[avail].len = VirtQueue_RP_MSG_BUF_SIZE;
+
+    return (vq->num_free);
+}
+
+/*
+ * ======== VirtQueue_getUsedBuf ========
+ */
+Void *VirtQueue_getUsedBuf(VirtQueue_Object *vq)
+{
+    UInt16 head;
+    Void *buf;
+    struct vring *vring = vq->vringPtr;
+
+    /* There's nothing available? */
+    if (vq->last_used_idx == vring->used->idx) {
+        return (NULL);
+    }
+
+    head = vring->used->ring[vq->last_used_idx % vring->num].id;
+    vq->last_used_idx++;
+    vq->num_free++;
+
+    buf = mapPAtoVA(vring->desc[head].addr);
+
+    return (buf);
+}
+
+/*
+ * ======== VirtQueue_getAvailBuf ========
+ */
+Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf)
+{
+    UInt16 head;
+    struct vring *vring = vq->vringPtr;
+
+    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x\n",
+        (IArg)vq,
+        vq->last_avail_idx, vring->avail->idx, vring->num,
+        (IArg)&vring->avail, (IArg)vring->avail);
+
+    /* There's nothing available? */
+    if (vq->last_avail_idx == vring->avail->idx) {
+        /* We need to know about added buffers */
+        vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
+        /* check again after setting flag */
+        if (vq->last_avail_idx == vring->avail->idx)
+            return -1;
+    }
+
+    /* No need to be kicked about added buffers anymore */
+    vring->used->flags |= VRING_USED_F_NO_NOTIFY;
+
+    /*
+     * Grab the next descriptor number they're advertising, and increment
+     * the index we've seen.
+     */
+    head = vring->avail->ring[vq->last_avail_idx++ % vring->num];
+
+    *buf = mapPAtoVA(vring->desc[head].addr);
+
+    return (head);
+}
+
+/*
+ * ======== VirtQueue_isr ========
+ * Note 'msg' is ignored: it is only used where there is a mailbox payload.
+ */
+Void VirtQueue_isr(UArg msg)
+{
+    VirtQueue_Object *vq;
+
+    Log_print1(Diags_USER1, "VirtQueue_isr received msg = 0x%x\n", msg);
+
+    vq = queueRegistry[0];
+    if (vq) {
+        vq->callback(vq);
+    }
+    vq = queueRegistry[1];
+    if (vq) {
+        vq->callback(vq);
+    }
+}
+
+/*
+ * ======== VirtQueue_startup ========
+ */
+Void VirtQueue_startup(UInt16 remoteProcId, Bool isHost)
+{
+    IInterrupt_IntInfo intInfo;
+
+    intInfo.intVectorId = Interrupt_DSPINT;
+    intInfo.localIntId  = Interrupt_SRCS_BITPOS_HOST;
+
+
+    /*
+     * Wait for first kick from host, which happens to coincide with the
+     * priming of host's receive buffers, indicating host is ready to send.
+     * Since interrupt is cleared, we throw away this first kick, which is
+     * OK since we don't process this in the ISR anyway.
+     */
+    Log_print0(Diags_USER1, "VirtQueue_startup: Polling for host int...\n");
+    while (!Interrupt_checkAndClear(remoteProcId, &intInfo));
+
+    Interrupt_intRegister(remoteProcId, &intInfo, (Fxn)VirtQueue_isr, NULL);
+
+    Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
+}
+
+/* By convention, Host VirtQueues host are the even number in the pair */
+Bool VirtQueue_isSlave(VirtQueue_Handle vq)
+{
+  return (vq->id & 0x1);
+}
+
+Bool VirtQueue_isHost(VirtQueue_Handle vq)
+{
+  return (~(vq->id & 0x1));
+}
+
+UInt16 VirtQueue_getId(VirtQueue_Handle vq)
+{
+  return (vq->id);
+}
+
+Swi_Handle VirtQueue_getSwiHandle(VirtQueue_Handle vq)
+{
+  return (vq->swiHandle);
+}
+
+#define CACHE_WB_TICK_PERIOD    5
+
+/*
+ * ======== VirtQueue_cacheWb ========
+ *
+ * Used for flushing SysMin trace buffer.
+ */
+Void VirtQueue_cacheWb()
+{
+    static UInt32 oldticks = 0;
+    UInt32 newticks;
+
+    newticks = Clock_getTicks();
+    if (newticks - oldticks < (UInt32)CACHE_WB_TICK_PERIOD) {
+        /* Don't keep flushing cache */
+        return;
+    }
+
+    oldticks = newticks;
+
+    /* Flush the cache of the SysMin buffer only: */
+    Assert_isTrue((VirtQueue_module->traceBufPtr != NULL), NULL);
+    Cache_wb(VirtQueue_module->traceBufPtr, SysMin_bufSize, Cache_Type_ALL,
+             FALSE);
+}
diff --git a/packages/ti/ipc/family/tci6638/VirtQueue.xdc b/packages/ti/ipc/family/tci6638/VirtQueue.xdc
new file mode 100644 (file)
index 0000000..ad5d2ee
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       VirtQueue.xdc
+ *
+ *  @brief      Virtio Queue interface for BIOS
+ *
+ *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
+ *  - Renamed module from virtio.h to VirtQueue.h to match the API prefixes;
+ *  - BIOS (XDC) types and CamelCasing used;
+ *  - virtio_device concept removed (i.e, assumes no containing device);
+ *  - removed scatterlist;
+ *  - VirtQueues are created statically here, so just added a VirtQueue_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - The notify function is implicit in the implementation, and not provided
+ *    by the client, as it is in Linux virtio.
+ *  - Broke into APIs to add/get used and avail buffers, as the API is
+ *    assymmetric.
+ *
+ *  Usage:
+ *     This IPC only works between one processor designated as the Host (Linux)
+ *     and one or more Slave processors (BIOS).
+ *
+ *     For any Host/Slave pair, there are 2 VirtQueues (aka Vrings);
+ *     Only the Host adds new buffers to the avail list of a vring;
+ *     Available buffers can be empty or full, depending on direction;
+ *     Used buffer means "processed" (emptied or filled);
+ *
+ *  Host:
+ *    - To send buffer to the slave processor:
+ *          add_avail_buf(slave_virtqueue);
+ *          kick(slave_virtqueue);
+ *          get_used_buf(slave_virtqueue);
+ *    - To receive buffer from slave processor:
+ *          add_avail_buf(host_virtqueue);
+ *          kick(host_virtqueue);
+ *          get_used_buf(host_virtqueue);
+ *
+ *  Slave:
+ *    - To send buffer to the host:
+ *          get_avail_buf(host_virtqueue);
+ *          add_used_buf(host_virtqueue);
+ *          kick(host_virtqueue);
+ *    - To receive buffer from the host:
+ *          get_avail_buf(slave_virtqueue);
+ *          add_used_buf(slave_virtqueue);
+ *          kick(slave_virtqueue);
+ *
+ *  All VirtQueue operations can be called in any context.
+ *
+ *  The virtio header should be included in an application as follows:
+ *  @code
+ *  #include <ti/ipc/rpmsg/VirtQueue.h>
+ *  @endcode
+ *
+ *  ============================================================================
+ */
+
+import  ti.sysbios.knl.Swi;
+import  ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== VirtQueue ========
+ *
+ */
+
+
+module VirtQueue
+{
+    // -------- Module Constants --------
+
+    // -------- Module Types --------
+
+
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     */
+    metaonly struct BasicView {
+
+    };
+
+    /*!
+     *  ======== ModuleView ========
+     *  @_nodoc
+     */
+    metaonly struct ModuleView {
+
+    };
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+/*    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',  {type: ViewInfo.INSTANCE, viewInitFxn: 'viewInitBasic',  structName: 'BasicView'}],
+                ['Module', {type: ViewInfo.MODULE,   viewInitFxn: 'viewInitModule', structName: 'ModuleView'}]
+            ]
+         });
+*/
+    // -------- Module Proxies --------
+
+    // -------- Module Parameters --------
+
+    /* Predefined device addresses */
+    config UInt32 CORE0_MEM_VRING0 = 0xA0000000;
+    config UInt32 CORE0_MEM_VRING1 = 0xA0004000;
+    config UInt32 VRING_OFFSET = 0x00080000;
+
+    /*
+     * Sizes of the virtqueues (expressed in number of buffers supported,
+     * and must be power of two)
+     */
+    config UInt VQ0_SIZE = 256;
+    config UInt VQ1_SIZE = 256;
+
+    /* See VirtQueue.c also for other constants:   */
+    config UInt RP_MSG_NUM_BUFS = VQ0_SIZE; /* must be power of two */
+    config UInt RP_MSG_BUF_SIZE = 512;
+
+
+    config UInt PAGE_SIZE = 4096;
+
+    /*
+     * The alignment to use between consumer and producer parts of vring.
+     * Note: this is part of the "wire" protocol. If you change this, you need
+     * to update your BIOS image as well
+     */
+    config UInt RP_MSG_VRING_ALIGN = 4096;
+
+   /*!
+    * ======== startup ========
+    *
+    * Plug interrupts, and if host, initialize vring memory and send
+    * startup sequence events to slave.
+    */
+    Void startup(UInt16 remoteProcId, Bool isHost);
+
+instance:
+
+    /*!
+     *  @brief      Initialize at runtime the VirtQueue
+     *
+     *  Maps to Instance_init function
+     *
+     *  @param[in]  remoteProcId    Remote processor ID associated with this VirtQueue.
+     *
+     *  @Returns    Returns a handle to a new initialized VirtQueue.
+     */
+    @DirectCall
+    create(UInt16 remoteProcId);
+
+    /*!
+     *  @brief      Notify other processor of new buffers in the queue.
+     *
+     *  After one or more add_buf calls, invoke this to kick the other side.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     *  @sa         VirtQueue_addBuf
+     */
+    @DirectCall
+    Void kick();
+
+    /*!
+     *  @brief      VirtQueue instance returns slave status
+     *
+     *  Returns if this VirtQueue instance belongs to a slave
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Bool isSlave();
+
+    /*!
+     *  @brief      VirtQueue instance returns host status
+     *
+     *  Returns if this VirtQueue instance belongs to a host
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Bool isHost();
+
+    /*!
+     *  @brief      VirtQueue instance returns queue ID
+     *
+     *  Returns VirtQueue instance's queue ID.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    UInt16 getId();
+
+    /*!
+     *  @brief      VirtQueue instance returns Swi handle
+     *
+     *  Returns VirtQueue instance Swi handle
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     */
+    @DirectCall
+    Swi.Handle getSwiHandle();
+
+    /*
+     *  ========================================================================
+     *  Host Only Functions:
+     *  ========================================================================
+     */
+
+    /*!
+     *  @brief      Add available buffer to virtqueue's available buffer list.
+     *              Only used by Host.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[in]  buf      the buffer to be processed by the slave.
+     *
+     *  @return     Remaining capacity of queue or a negative error.
+     *
+     *  @sa         VirtQueue_getUsedBuf
+     */
+    @DirectCall
+    Int addAvailBuf(Void *buf);
+
+    /*!
+     *  @brief      Get the next used buffer.
+     *              Only used by Host.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *
+     *  @return     Returns NULL or the processed buffer.
+     *
+     *  @sa         VirtQueue_addAvailBuf
+     */
+    @DirectCall
+    Void *getUsedBuf();
+
+    /*
+     *  ========================================================================
+     *  Slave Only Functions:
+     *  ========================================================================
+     */
+
+    /*!
+     *  @brief      Get the next available buffer.
+     *              Only used by Slave.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[out] buf       Pointer to location of available buffer;
+     *
+     *  @return     Returns a token used to identify the available buffer, to be
+     *              passed back into VirtQueue_addUsedBuf();
+     *              token is negative if failure to find an available buffer.
+     *
+     *  @sa         VirtQueue_addUsedBuf
+     */
+    @DirectCall
+    Int16 getAvailBuf(Void **buf);
+
+    /*!
+     *  @brief      Add used buffer to virtqueue's used buffer list.
+     *              Only used by Slave.
+     *
+     *  @param[in]  vq        the VirtQueue.
+     *  @param[in]  token     token of the buffer to be added to vring used list.
+     *
+     *  @return     Remaining capacity of queue or a negative error.
+     *
+     *  @sa         VirtQueue_getAvailBuf
+     */
+    @DirectCall
+    Int addUsedBuf(Int16 head);
+
+    // -------- Handle Parameters --------
+
+    config Bool host = false;
+
+    config Fxn callback = null;
+
+    config Swi.Handle swiHandle = null;
+
+    config UInt intVectorId = ~1u;
+
+    // -------- Handle Functions --------
+
+internal:   /* not for client use */
+
+    void init();
+
+    /*!
+     *  ======== hostIsr ========
+     */
+    Void hostIsr(UArg msg);
+
+    /*!
+     *  ======== slaveIsr ========
+     */
+    Void slaveIsr(UArg msg);
+
+    /*!
+     * ======== Module_State ========
+     * @_nodoc
+     */
+    struct Module_State
+    {
+        UInt16 numQueues;
+        UInt16 hostSlaveSynced;
+        UInt16 virtQueueInitialized;
+        UInt32 *queueRegistry;
+        Ptr    traceBufPtr;
+    }
+
+    /*!
+     *  ======== Instance_State ========
+     *  @_nodoc
+     */
+    struct Instance_State {
+        Bool hostSlaveSynced;
+        UInt16 id;
+        Fxn callback;
+        Swi.Handle swiHandle;
+        Void *vringPtr;
+        UInt16 num_free;
+        UInt16 last_avail_idx;
+        UInt16 last_used_idx;
+        UInt16 procId;
+    };
+}
diff --git a/packages/ti/ipc/family/tci6638/VirtQueue.xs b/packages/ti/ipc/family/tci6638/VirtQueue.xs
new file mode 100644 (file)
index 0000000..dcc5f3e
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== VirtQueue.xs ================
+ */
+
+
+ /*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+
+    VirtQueue = this;
+    var MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+
+    xdc.useModule("ti.sysbios.knl.Swi");
+    Interrupt = xdc.useModule("ti.ipc.family.tci6638.Interrupt");
+    //xdc.useModule("ti.ipc.remoteproc.Resource");
+
+    if (MultiProc.id == MultiProc.INVALIDID) {
+        var Startup = xdc.useModule('xdc.runtime.Startup');
+        Startup.firstFxns.$add(VirtQueue.init);
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+  /* Init VirtQueue params */
+  mod.numQueues = 0;
+  mod.hostSlaveSynced = 0;
+  mod.virtQueueInitialized = 0;
+  mod.queueRegistry = null;
+  mod.traceBufPtr = null;
+}
diff --git a/packages/ti/ipc/family/tci6638/package.bld b/packages/ti/ipc/family/tci6638/package.bld
new file mode 100644 (file)
index 0000000..aa6a99d
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld"];
+
+var SRCS = ["Interrupt.c", "VirtQueue.c", "NotifyCircSetup.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+    var lib;
+
+//    print("targ.name = " + targ.name);
+
+    /* build only for DSP-side TCI6638 (i.e. C66) */
+    if (targ.isa == "66") {
+        /* Build for all profiles */
+        for (var profile in targ.profiles) {
+
+            Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+                profile: profile
+            }).addObjects(SRCS);
+        }
+    }
+}
diff --git a/packages/ti/ipc/family/tci6638/package.xdc b/packages/ti/ipc/family/tci6638/package.xdc
new file mode 100644 (file)
index 0000000..564390c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.family.tci6638 ========
+ */
+package ti.ipc.family.tci6638[1,0,0,0] {
+    module    Interrupt;
+    module    VirtQueue;
+    module    NotifyCircSetup;
+}
diff --git a/packages/ti/ipc/family/tci6638/package.xs b/packages/ti/ipc/family/tci6638/package.xs
new file mode 100644 (file)
index 0000000..1da79f4
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== close ========
+ */
+function close()
+{
+    /* bring in modules we use in this package */
+    xdc.useModule('ti.sysbios.knl.Swi');
+    xdc.useModule('ti.sysbios.hal.Cache');
+}
+
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var name = this.$name + ".a" + suffix;
+    var lib = "lib/" + this.profile + "/" + name;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/" + name;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/ipc/getPragmas.xs b/packages/ti/ipc/getPragmas.xs
new file mode 100644 (file)
index 0000000..3623671
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+*  ======== getFileContents ========
+*  Returns a string containing the contents of file at 'filename'
+*/
+
+var mod = "GateMP";
+function getFileContents(filename)
+{
+    var symbolDB = [];
+
+    try {
+        var input = "";
+        var inputFile = java.io.File(filename);
+        var fos = java.io.FileReader(inputFile);
+        var reader = new java.io.BufferedReader(fos);
+        var line;
+        while ((line = reader.readLine()) != null) {
+            var matched = line.match("(" + mod + "_[^ ,().:\t;\[{}]+)");
+            if (matched != null && symbolDB.indexOf(matched[1]) == -1) {
+                if (matched[1].indexOf("__") != -1) {
+                    continue;
+                }
+                symbolDB.push(matched[1]);
+            }
+        }
+
+        reader.close();
+    }
+    catch (e) {
+        print(e);
+        throw("Error reading file '" + filename + "'");
+    }
+
+
+
+    return (symbolDB);
+}
+
+function getVal(str)
+{
+    if (str.indexOf("_S_") != -1) {
+        return (0);
+    }
+    else if (str.indexOf("_E_") != -1) {
+        return (1);
+    }
+    else if (str.match(mod + "_([A-Z_]+[^a-z])")) {
+        return (2);
+    }
+    else if (str != (mod + "_Params_init") && str.match(mod + "_([A-Z])")) {
+        return (3);
+    }
+    else {
+        return (4);
+    }
+}
+
+/*
+ *  ======== sortFunction ========
+ */
+function sortFunction(a, b)
+{
+    var valA = getVal(a);
+    var valB = getVal(b);
+
+    if (valA != valB) {
+        return (valA - valB);
+    }
+    else {
+        return (a > b);
+    }
+}
+
+/*
+ *  ======== strPad ========
+ */
+function strPad(str, pad)
+{
+    for (i = str.length; i < pad; i++) {
+        str += " ";
+    }
+    return(str);
+}
+
+
+var results = getFileContents(mod + ".h");
+results.sort(sortFunction);
+for each (var symbol in results) {
+    print("    #pragma FUNC_EXT_CALLED(" + symbol + ");");
+}
diff --git a/packages/ti/ipc/ipcmgr/IpcMgr.c b/packages/ti/ipc/ipcmgr/IpcMgr.c
new file mode 100644 (file)
index 0000000..e8cd70a
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IpcMgr.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/namesrv/NameServerRemoteRpmsg.h>
+#include <ti/ipc/transports/TransportVirtioSetup.h>
+
+/*
+ *  ======== IpcMgr_ipcStartup ========
+ */
+Void IpcMgr_ipcStartup()
+{
+    UInt procId = MultiProc_getId("HOST");
+    Int status;
+
+    /* TransportVirtioSetup will busy wait until host kicks ready to recv: */
+    status = TransportVirtioSetup_attach(procId, 0);
+    Assert_isTrue(status >= 0, NULL);
+
+    /* Sets up to comminicate with host's NameServer: */
+    status = NameServerRemoteRpmsg_attach(procId, 0);
+    Assert_isTrue(status >= 0, NULL);
+}
+
+/*
+ *  ======== IpcMgr_callIpcStart ========
+ *  Calls the Ipc_start command.  This must be done
+ *  after IpcMgr_ipcStartup().
+ */
+Void IpcMgr_callIpcStart()
+{
+    Int status;
+
+    /*
+     *  Ipc_start() calls Ipc_attach() to synchronize all remote processors
+     *  if 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
+     *  HOST is skipped, thanks to overriding NotifySetup_numIntLines().
+     */
+    status = Ipc_start();
+    Assert_isTrue(status >= 0, NULL);
+}
diff --git a/packages/ti/ipc/ipcmgr/package.bld b/packages/ti/ipc/ipcmgr/package.bld
new file mode 100644 (file)
index 0000000..dcea6c7
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld"];
+
+var SRCS = ["IpcMgr.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+    var lib;
+
+//    print("targ.name = " + targ.name);
+
+    /* Build for all profiles */
+    for (var profile in targ.profiles) {
+
+        Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+            profile: profile
+        }).addObjects(SRCS);
+    }
+}
diff --git a/packages/ti/ipc/ipcmgr/package.xdc b/packages/ti/ipc/ipcmgr/package.xdc
new file mode 100644 (file)
index 0000000..6ac2c56
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.ipcmgr ========
+ *  Home for ipc startup (and later config/other fxns) for rpmsg based IPC.
+ */
+package ti.ipc.ipcmgr [1,0,0,0] {
+}
diff --git a/packages/ti/ipc/ipcmgr/package.xs b/packages/ti/ipc/ipcmgr/package.xs
new file mode 100644 (file)
index 0000000..5c4356c
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var lib = "lib/" + this.profile + "/ti.ipc.ipcmgr.a" + suffix;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/ti.ipc.ipcmgr.a" + suffix;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.c b/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.c
new file mode 100644 (file)
index 0000000..afdb487
--- /dev/null
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteRpmsg.c ========
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/knl/ISync.h>
+
+#include <ti/sysbios/gates/GateMutex.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/utils/INameServerRemote.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/namesrv/_NameServerRemoteRpmsg.h>
+#include <ti/ipc/transports/_TransportVirtio.h>
+
+#include "package/internal/NameServerRemoteRpmsg.xdc.h"
+
+/* Storage for NameServer message replies. Protected by gateMutex: */
+static  NameServerRemote_Msg    NameServer_msg;
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+#define FXNN "NameServerRemoteRpmsg_Instance_init"
+Void NameServerRemoteRpmsg_Instance_init(NameServerRemoteRpmsg_Object *obj,
+        UInt16 remoteProcId,
+        const NameServerRemoteRpmsg_Params *params)
+{
+
+    Log_print1(Diags_INFO, FXNN": remoteProc: %d", remoteProcId);
+
+    obj->remoteProcId = remoteProcId;
+
+    NameServerRemoteRpmsg_module->nsMsg = &NameServer_msg;
+
+    /* register the remote driver with NameServer */
+    ti_sdo_utils_NameServer_registerRemoteDriver(
+        NameServerRemoteRpmsg_Handle_upCast(obj), remoteProcId);
+}
+#undef FXNN
+
+/*
+ *  ======== NameServerRemoteRpmsg_Instance_finalize ========
+ */
+Void NameServerRemoteRpmsg_Instance_finalize(NameServerRemoteRpmsg_Object *obj)
+{
+    /* unregister remote driver from NameServer module */
+    ti_sdo_utils_NameServer_unregisterRemoteDriver(obj->remoteProcId);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+ /*
+ *  ======== NameServerRemoteRpmsg_attach ========
+ *
+ *  Typically called from Ipc_attach(), but since Rpmsg doesn't use Ipc
+ *  module, this may need to be called manually.
+ */
+#define FXNN "NameServerRemoteRpmsg_attach"
+Int NameServerRemoteRpmsg_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    Int status = NameServerRemoteRpmsg_E_FAIL;
+    NameServerRemoteRpmsg_Handle handle;
+
+    Log_print1(Diags_INFO, FXNN": remoteProcId: %d", remoteProcId);
+
+    handle = NameServerRemoteRpmsg_create(remoteProcId, NULL, NULL);
+    if (handle != NULL) {
+        status = NameServerRemoteRpmsg_S_SUCCESS;
+    }
+
+    return (status);
+}
+#undef FXNN
+
+/*
+ *  ======== NameServerRemoteRpmsg_detach ========
+ *
+ *  Typically called from Ipc_detach(), but since Rpmsg doesn't use Ipc
+ *  module, this may need to be called manually.
+ */
+#define FXNN "NameServerRemoteRpmsg_detach"
+Int NameServerRemoteRpmsg_detach(UInt16 remoteProcId)
+{
+    NameServerRemoteRpmsg_Handle handle;
+    Int status = NameServerRemoteRpmsg_S_SUCCESS;
+
+    Log_print1(Diags_INFO, FXNN": remoteProcId: %d", remoteProcId);
+
+    for (handle = NameServerRemoteRpmsg_Object_first(); handle != NULL;
+        handle = NameServerRemoteRpmsg_Object_next(handle)) {
+        if (handle->remoteProcId == remoteProcId) {
+            break;
+        }
+    }
+
+    if (handle == NULL) {
+        status = NameServerRemoteRpmsg_E_FAIL;
+    }
+    else {
+        NameServerRemoteRpmsg_delete(&handle);
+    }
+
+    return (status);
+}
+#undef FXNN
+
+/*
+ *  ======== NameServerRemoteRpmsg_get ========
+ */
+#define FXNN "NameServerRemoteRpmsg_get"
+Int NameServerRemoteRpmsg_get(NameServerRemoteRpmsg_Object *obj,
+        String instanceName, String name, Ptr value, UInt32 *valueLen,
+        ISync_Handle syncHandle, Error_Block *eb)
+{
+    Int                   status = NameServer_E_NOTFOUND;
+    Int                   len;
+    IArg                  key;
+    NameServerRemote_Msg  msg;
+    NameServerRemote_Msg  *replyMsg;
+    Semaphore_Handle      semRemoteWait =
+                           NameServerRemoteRpmsg_module->semRemoteWait;
+
+    GateMutex_Handle gateMutex = NameServerRemoteRpmsg_module->gateMutex;
+
+    /* enter gate - prevent multiple threads from entering */
+    key = GateMutex_enter(gateMutex);
+
+    /* Check that host NameServer is alive to avoid pinging the host: */
+    if (NameServerRemoteRpmsg_module->nsPort == NAME_SERVER_PORT_INVALID) {
+        status = NameServer_E_NOTFOUND;
+        goto exit;
+    }
+
+    Log_print1(Diags_INFO, FXNN": name: %s", (IArg)name);
+
+    /* Create request message and send to remote processor: */
+    msg.request = NameServerRemoteRpmsg_REQUEST;
+    msg.requestStatus = 0;
+
+    len = strlen(instanceName);
+    Assert_isTrue(len < MAXNAMEINCHAR, NameServerRemoteRpmsg_A_nameIsTooLong);
+    strncpy((Char *)msg.instanceName, instanceName, len + 1);
+
+    len = strlen(name);
+    Assert_isTrue(len < MAXNAMEINCHAR, NameServerRemoteRpmsg_A_nameIsTooLong);
+    strncpy((Char *)msg.name, name, len + 1);
+
+    Log_print3(Diags_INFO, FXNN": Requesting from procId %d, %s:%s...\n",
+               obj->remoteProcId, (IArg)msg.instanceName, (IArg)msg.name);
+    sendRpmsg(obj->remoteProcId, NameServerRemoteRpmsg_module->nsPort,
+               RPMSG_MESSAGEQ_PORT, (Ptr)&msg, sizeof(msg));
+
+    /* Now pend for response */
+    status = Semaphore_pend(semRemoteWait, NameServerRemoteRpmsg_timeout);
+
+    if (status == FALSE) {
+        Log_print0(Diags_INFO, FXNN": Wait for NS reply timed out\n");
+        /* return timeout failure */
+        return (NameServer_E_OSFAILURE);
+    }
+
+    /* get the message */
+    replyMsg = NameServerRemoteRpmsg_module->nsMsg;
+
+    if (replyMsg->requestStatus) {
+        /* name is found */
+
+        /* set length to amount of data that was copied */
+        *valueLen = sizeof(Bits32);
+
+        /* set the contents of value */
+        memcpy(value, &(replyMsg->value), sizeof(Bits32));
+
+        /* set the status to success */
+        status = NameServer_S_SUCCESS;
+        Log_print4(Diags_INFO, FXNN": Reply from: %d, %s:%s, value: 0x%x...\n",
+              obj->remoteProcId, (IArg)msg.instanceName, (IArg)msg.name,
+              *(UInt32 *)value);
+    }
+    else {
+        /* name is not found */
+        Log_print2(Diags_INFO, FXNN": value for %s:%s not found.\n",
+                   (IArg)msg.instanceName, (IArg)msg.name);
+
+        /* set status to not found */
+        status = NameServer_E_NOTFOUND;
+    }
+
+exit:
+    /* leave the gate */
+    GateMutex_leave(gateMutex, key);
+
+    return (status);
+}
+#undef FXNN
+
+/*
+ *  ======== NameServerRemoteRpmsg_sharedMemReq ========
+ */
+SizeT NameServerRemoteRpmsg_sharedMemReq(Ptr sharedAddr)
+{
+    return (0);
+}
+
+#define FXNN "NameServerRemote_processMessage"
+void NameServerRemote_processMessage(NameServerRemote_Msg * msg)
+{
+    NameServer_Handle handle;
+    Int               status = NameServer_E_FAIL;
+    Semaphore_Handle  semRemoteWait =
+                        NameServerRemoteRpmsg_module->semRemoteWait;
+    UInt16 dstProc  = MultiProc_getId("HOST");
+
+    Assert_isTrue(msg != NULL, NULL);
+
+    if (msg->request == NameServerRemoteRpmsg_REQUEST) {
+        Log_print1(Diags_INFO, FXNN": Request from procId %d.\n", dstProc);
+
+        /*
+         *  Message is a request. Lookup name in NameServer table.
+         *  Send a response message back to source processor.
+         */
+        handle = NameServer_getHandle((String)msg->instanceName);
+
+        if (handle != NULL) {
+            /* Search for the NameServer entry */
+            status = NameServer_getLocalUInt32(handle,
+                     (String)msg->name, &msg->value);
+        }
+
+        /* set the request status */
+        if (status < 0) {
+            Log_print2(Diags_INFO, FXNN": Replying with: %s:%s not found\n",
+                       (IArg)msg->instanceName, (IArg)msg->name);
+            msg->requestStatus = 0;
+        }
+        else {
+            Log_print3(Diags_INFO, FXNN": Replying with: %s:%s, value: 0x%x\n",
+               (IArg)msg->instanceName, (IArg)msg->name, msg->value);
+            msg->requestStatus = 1;
+        }
+
+        /* specify message as a response */
+        msg->request = NameServerRemoteRpmsg_RESPONSE;
+
+        /* send response message to remote processor */
+        sendRpmsg(dstProc, NameServerRemoteRpmsg_module->nsPort,
+                 RPMSG_MESSAGEQ_PORT, (Ptr)msg, sizeof(NameServerRemote_Msg));
+    }
+    else {
+        Log_print0(Diags_INFO, FXNN": NameServer Reply. Posting Sem...\n");
+
+        /* Save the response message.  */
+        memcpy(NameServerRemoteRpmsg_module->nsMsg, msg,
+                sizeof (NameServerRemote_Msg));
+        /* Post the semaphore upon which NameServer_get() is waiting */
+        Semaphore_post(semRemoteWait);
+    }
+}
+#undef FXNN
+
+#define FXNN "NameServerRemote_SetNameServerPort"
+void NameServerRemote_SetNameServerPort(UInt port)
+{
+    Log_print1(Diags_INFO, FXNN": nsPort: %d", port);
+    NameServerRemoteRpmsg_module->nsPort = port;
+}
+#undef FXNN
diff --git a/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.xdc b/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.xdc
new file mode 100644 (file)
index 0000000..f50ea0a
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteRpmsg.xdc ========
+ */
+
+import xdc.runtime.Assert;
+
+import ti.sysbios.knl.Semaphore;
+import ti.sysbios.gates.GateMutex;
+import ti.sdo.utils.INameServerRemote;
+
+/*
+ *  Used by NameServer to communicate to remote processors.
+ *
+ *  This module is used by {@link ti.sdo.utils.NameServer} to communicate
+ *  to remote processors using {@link ti.sdo.ipc.MessageQ}.
+ *  There needs to be one instance between each two cores in the system.
+ *  Interrupts must be enabled before using this module.
+ *
+ *  This NameServerRemote is tied to the TransportVirtio transport, mainly
+ *  used beteen a Linux host and a BIOS core acting as slave.
+ */
+
+@InstanceFinalize
+
+module NameServerRemoteRpmsg inherits ti.sdo.utils.INameServerRemote
+{
+
+    /*!
+     *  ======== timeoutInMicroSecs ========
+     *  The timeout value in terms of microseconds
+     *
+     *  A NameServer request will return after this amout of time
+     *  without a response. The default timeout value is 1 s.
+     *  To not wait, use the value of '0'.  To wait forever, use '~(0)'.
+     */
+    config UInt timeoutInMicroSecs = 1000000;
+
+    /*!
+     *  Assert raised if too many characters in the name
+     */
+    config Assert.Id A_nameIsTooLong = {
+        msg: "Too many characters in name"
+    };
+
+internal:
+
+    /*
+     *  ======== timeout ========
+     *  The timeout value to pass into Semaphore_pend
+     *
+     *  This value is calculated based on timeoutInMicroSecs and the
+     *  SYSBIOS clock.tickPeriod.
+     */
+    config UInt timeout;
+
+    /*!
+     *  ======== Type ========
+     *  The type of the message
+     */
+    enum Type {
+        REQUEST =  0,
+        RESPONSE = 1
+    };
+
+    struct Instance_State {
+        UInt16              remoteProcId; /* remote MultiProc id            */
+    };
+
+    /* Module state */
+    struct Module_State {
+        Semaphore.Handle    semRemoteWait;  /* sem to wait on remote proc    */
+        GateMutex.Handle    gateMutex;      /* gate to protect critical code */
+        Ptr                 nsMsg;          /* pointer to NameServer msg     */
+        Int                 nsPort;         /* Name Server port rpmsg addr   */
+    };
+}
diff --git a/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.xs b/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.xs
new file mode 100644 (file)
index 0000000..e707f20
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteRpmsg.xs ========
+ */
+
+
+var NameServerRemoteRpmsg = null;
+var Semaphore  = null;
+var Clock = null;
+var GateMutex = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NameServerRemoteRpmsg = this;
+    Semaphore       = xdc.useModule("ti.sysbios.knl.Semaphore");
+    Clock           = xdc.useModule("ti.sysbios.knl.Clock");
+    GateMutex       = xdc.useModule("ti.sysbios.gates.GateMutex");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    mod.nsMsg = null;
+
+    /* calculate the timeout value */
+    if (NameServerRemoteRpmsg.timeoutInMicroSecs != ~(0)) {
+        NameServerRemoteRpmsg.timeout =
+            NameServerRemoteRpmsg.timeoutInMicroSecs / Clock.tickPeriod;
+    }
+    else {
+        NameServerRemoteRpmsg.timeout =
+            NameServerRemoteRpmsg.timeoutInMicroSecs;
+    }
+
+    /* create the semaphore to wait for a response message */
+    mod.semRemoteWait = Semaphore.create(0);
+
+    /* create GateMutex */
+    mod.gateMutex = GateMutex.create();
+
+    /* Will initialize correctly during TransportVirtio swiFxn ns announce */
+    mod.nsPort = (-1);
+}
diff --git a/packages/ti/ipc/namesrv/_NameServerRemoteRpmsg.h b/packages/ti/ipc/namesrv/_NameServerRemoteRpmsg.h
new file mode 100644 (file)
index 0000000..4aa7e29
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 NameServerRemote__include
+#define NameServerRemote__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define MAXNAMEINCHAR   80
+#define NAMEARRAYSZIE   (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+
+/* message sent to remote procId */
+typedef struct NameServerRemote_Msg {
+    Bits32  reserved;           /* reserved field: must be first!   */
+    Bits32  value;              /* holds value                      */
+    Bits32  request;            /* whether its a request/response   */
+    Bits32  requestStatus;      /* status of request                */
+                                /* name of NameServer instance      */
+    Bits32  instanceName[NAMEARRAYSZIE];
+                                /* name of NameServer entry         */
+    Bits32  name[NAMEARRAYSZIE];
+} NameServerRemote_Msg;
+
+#define NAME_SERVER_RPMSG_ADDR  0
+#define NAME_SERVER_PORT_INVALID (-1)
+
+#define NAMESERVER_MSG_TOKEN   0x5678abcd
+
+extern void NameServerRemote_processMessage(NameServerRemote_Msg * ns_msg);
+extern void NameServerRemote_SetNameServerPort(UInt port);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* NameServerRemote__include */
diff --git a/packages/ti/ipc/namesrv/package.bld b/packages/ti/ipc/namesrv/package.bld
new file mode 100644 (file)
index 0000000..4d043d2
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld", "_NameServerRemoteRpmsg.h"];
+
+var SRCS = ["NameServerRemoteRpmsg.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+
+//    print("targ.name = " + targ.name);
+
+    /* Build for all profiles */
+    for (var profile in targ.profiles) {
+
+        Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+            profile: profile
+        }).addObjects(SRCS);
+    }
+}
diff --git a/packages/ti/ipc/namesrv/package.xdc b/packages/ti/ipc/namesrv/package.xdc
new file mode 100644 (file)
index 0000000..1b95b1e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.ipc.namesrv ========
+ *
+ *  The NameServerRemote proxy for MessageQ over Rpmsg.
+ *
+ */
+
+package ti.ipc.namesrv [1,0,0,0] {
+    module NameServerRemoteRpmsg;
+}
diff --git a/packages/ti/ipc/namesrv/package.xs b/packages/ti/ipc/namesrv/package.xs
new file mode 100644 (file)
index 0000000..dadaae8
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== close ========
+ */
+function close()
+{
+    /* bring in modules we use in this package */
+    xdc.useModule('ti.sysbios.gates.GateMutex');
+    xdc.useModule('ti.sysbios.knl.Semaphore');
+}
+
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var name = this.$name + ".a" + suffix;
+    var lib = "lib/" + this.profile + "/" + name;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/" + name;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/ipc/package.bld b/packages/ti/ipc/package.bld
new file mode 100644 (file)
index 0000000..5c7d1f6
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+Pkg.otherFiles = [
+    "GateMP.h",
+    "HeapBufMP.h",
+    "HeapMemMP.h",
+    "HeapMultiBufMP.h",
+    "Ipc.h",
+    "ListMP.h",
+    "MessageQ.h",
+    "MultiProc.h",
+    "NameServer.h",
+    "Notify.h",
+    "SharedRegion.h",
+    "package.bld",
+];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
diff --git a/packages/ti/ipc/package.xdc b/packages/ti/ipc/package.xdc
new file mode 100644 (file)
index 0000000..61cbda3
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.ipc ========
+ *  Inter processor communication common headers
+ *
+ *  This is a package that serves as a container for common header files
+ *  for various IPC modules supplied with the IPC product.
+ *
+ *  @p(html)
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../doxygen/html/files.html">Doxygen documentation</A>
+ *  for the IPC product.  However, the documentation presented in RTSC cdoc
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ *  The following table shows a list of all IPC modules that have common header
+ *  files.  Follow the corresponding links for doxygen or cdoc documentation
+ *  for each of the modules.
+ *
+ *  @p(html)
+ *  <TABLE BORDER="1">
+ *  <COLGROUP STYLE="font-weight: bold; color: rgb(0,127,102);"></COLGROUP>
+ *  <COLGROUP></COLGROUP>
+ *  <COLGROUP></COLGROUP>
+ *  <COLGROUP></COLGROUP>
+ *  <TR>
+ *      <TD>GateMP</TD>
+ *      <TD>Multiple processor gate that provides local and remote context protection</TD>
+ *      <TD><A HREF="../../../doxygen/html/_gate_m_p_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/GateMP.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>HeapBufMP</TD>
+ *      <TD>Multi-processor fixed-size buffer heap</TD>
+ *      <TD><A HREF="../../../doxygen/html/_heap_buf_m_p_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/heaps/HeapBufMP.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>HeapMemMP</TD>
+ *      <TD>Multi-processor variable size buffer heap </TD>
+ *      <TD><A HREF="../../../doxygen/html/_heap_mem_m_p_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/heaps/HeapMemMP.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>HeapMultiBufMP</TD>
+ *      <TD>Multiple fixed size buffer heap</TD>
+ *      <TD><A HREF="../../../doxygen/html/_heap_multi_buf_m_p_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/heaps/HeapMultiBufMP.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>Ipc</TD>
+ *      <TD>Ipc Manager</TD>
+ *      <TD><A HREF="../../../doxygen/html/_ipc_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/Ipc.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>ListMP</TD>
+ *      <TD>Multiple processor shared memory list</TD>
+ *      <TD><A HREF="../../../doxygen/html/_list_m_p_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/ListMP.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>MessageQ</TD>
+ *      <TD>Message-passing with queuing</TD>
+ *      <TD><A HREF="../../../doxygen/html/_message_q_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/MessageQ.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>MultiProc</TD>
+ *      <TD>Processor id manager</TD>
+ *      <TD><A HREF="../../../doxygen/html/_multi_proc_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/utils/MultiProc.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>NameServer</TD>
+ *      <TD>Name manager</TD>
+ *      <TD><A HREF="../../../doxygen/html/_name_server_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/utils/NameServer.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>Notify</TD>
+ *      <TD>Notification manager for IPC</TD>
+ *      <TD><A HREF="../../../doxygen/html/_notify_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/Notify.html">cdoc</A></TD>
+ *  </TR>
+ *  <TR>
+ *      <TD>SharedRegion</TD>
+ *      <TD>Shared memory manager and address translator </TD>
+ *      <TD><A HREF="../../../doxygen/html/_shared_region_8h.html">Doxygen</A></TD>
+ *      <TD><A HREF="../sdo/ipc/SharedRegion.html">cdoc</A></TD>
+ *  </TR>
+ *
+ *  </TABLE>
+ *  @p
+ *
+ */
+
+package ti.ipc [1,0,0,0] {
+
+}
diff --git a/packages/ti/ipc/remoteproc/Resource.c b/packages/ti/ipc/remoteproc/Resource.c
new file mode 100644 (file)
index 0000000..03d568e
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== Resource.c ========
+ *
+ */
+
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Startup.h>
+
+#include "rsc_types.h"
+#include "package/internal/Resource.xdc.h"
+
+
+/*
+ *  ======== Resource_getTraceBufPtr ========
+ */
+Ptr Resource_getTraceBufPtr()
+{
+    UInt32 i;
+    UInt32 offset;
+    UInt32 type;
+    struct fw_rsc_trace *entry = NULL;
+    Resource_RscTable *table = (Resource_RscTable *)
+                                            (Resource_module->pTable);
+
+    for (i = 0; i < module->pTable->num; i++) {
+        offset = (UInt32)((Char *)table + table->offset[i]);
+        type = *(UInt32 *)offset;
+        if (type == TYPE_TRACE) {
+            entry = (struct fw_rsc_trace *)offset;
+            return ((Ptr)entry->da);
+        }
+    }
+
+    return (NULL);
+}
+
+/*
+ *  ======== Resource_getEntry ========
+ */
+Resource_MemEntry *Resource_getEntry(UInt index)
+{
+    UInt32 offset;
+    UInt32 *type;
+    Resource_MemEntry *entry = NULL;
+    Resource_RscTable *table = (Resource_RscTable *)
+                                            (Resource_module->pTable);
+
+    if (index >= table->num) {
+        return (NULL);
+    }
+
+    offset = (UInt32)((Char *)table + table->offset[index]);
+    type = (UInt32 *)offset;
+    if (*type == TYPE_CARVEOUT || *type == TYPE_DEVMEM) {
+        entry = (Resource_MemEntry *) ((Char *)offset);
+    }
+
+    return (entry);
+}
+
+/*
+ *************************************************************************
+ *                      Module wide functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Resource_Module_startup ========
+ */
+Int Resource_Module_startup(Int phase)
+{
+    Resource_init();
+    return (Startup_DONE);
+}
+
+/*
+ *  ======== Resource_virtToPhys ========
+ */
+Int Resource_virtToPhys(UInt32 va, UInt32 *pa)
+{
+    UInt32 i;
+    UInt32 offset;
+    Resource_MemEntry *entry;
+
+    *pa = NULL;
+
+    for (i = 0; i < module->pTable->num; i++) {
+        entry = Resource_getEntry(i);
+        if (entry && va >= entry->da && va < (entry->da + entry->len)) {
+                offset = va - entry->da;
+                *pa = entry->pa + offset;
+                return (Resource_S_SUCCESS);
+        }
+    }
+
+    return (Resource_E_NOTFOUND);
+}
+
+/*
+ *  ======== Resource_physToVirt ========
+ */
+Int Resource_physToVirt(UInt32 pa, UInt32 *va)
+{
+    UInt32 i;
+    UInt32 offset;
+    Resource_MemEntry *entry;
+
+    *va = NULL;
+
+    for (i = 0; i < module->pTable->num; i++) {
+        entry = Resource_getEntry(i);
+        if (entry && pa >= entry->pa && pa < (entry->pa + entry->len)) {
+                offset = pa - entry->pa;
+                *va = entry->da + offset;
+                return (Resource_S_SUCCESS);
+        }
+    }
+
+    return (Resource_E_NOTFOUND);
+}
diff --git a/packages/ti/ipc/remoteproc/Resource.xdc b/packages/ti/ipc/remoteproc/Resource.xdc
new file mode 100644 (file)
index 0000000..fc966d2
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== Resource.xdc ========
+ */
+
+/*!
+ *  ======== Resource ========
+ *  Resource Module
+ */
+
+@Template("./Resource.xdt")
+@ModuleStartup
+module Resource {
+
+    /*!
+     *  @def    Resource_loadAddr
+     *  @brief  Default load address for the Resource table
+     */
+    metaonly config UInt loadAddr = 0x3000;
+
+    /*!
+     *  @def    Resource_loadSegment
+     *  @brief  If loadSegment is defined, loadAddr is overriden with the base
+     *          address of the loadSegment
+     */
+    metaonly config String loadSegment;
+
+    /*!
+     *  @def    Resource_S_SUCCESS
+     *  @brief  Operation is successful.
+     */
+    const Int S_SUCCESS  = 0;
+
+    /*!
+     *  @def    Resource_E_NOTFOUND
+     *  @brief  Element was not found in table
+     */
+    const Int E_NOTFOUND = -1;
+
+    /*!
+     *  @def       Resource_RscTable
+     *
+     *  @brief     An open-ended type-length-value based resource table
+     */
+    struct RscTable {
+        UInt32 ver;
+        UInt32 num;
+        UInt32 reserved[2];
+        UInt32 offset[1];
+    };
+
+    /*!
+     *  @def       Resource_MemEntry
+     *
+     *  @brief     A Resource Table memory type record
+     */
+    struct MemEntry {
+        UInt32 type;
+        UInt32 da;       /* Device Virtual Address */
+        UInt32 pa;       /* Physical Address */
+        UInt32 len;
+        UInt32 flags;
+        UInt32 reserved;
+        Char   name[32];
+    };
+
+    /*!
+     *  @brief      Virtual to Physical address translation function
+     *
+     *  @sa         Resource_physToVirt
+     */
+    @DirectCall
+    Int virtToPhys(UInt32 da, UInt32 *pa);
+
+    /*!
+     *  @brief      Physical to Virtual address translation function
+     *
+     *  @sa         Resource_virtToPhys
+     */
+    @DirectCall
+    Int physToVirt(UInt32 pa, UInt32 *da);
+
+    @DirectCall
+    Ptr getTraceBufPtr();
+
+internal:   /* not for client use */
+
+    /*!
+     *  @brief      Use resource and resourceLen so table could be properly
+     *              allocated
+     *
+     */
+    Void init();
+
+    /*!
+     *  @brief      Return the i-th entry in the resource table
+     *
+     */
+    MemEntry *getEntry(UInt index);
+
+    struct Module_State {
+        RscTable    *pTable;  /* Resource Resource Table pointer */
+    };
+}
diff --git a/packages/ti/ipc/remoteproc/Resource.xdt b/packages/ti/ipc/remoteproc/Resource.xdt
new file mode 100644 (file)
index 0000000..b2edb6c
--- /dev/null
@@ -0,0 +1,68 @@
+%%{
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 <xdc/runtime/System.h>
+
+%var prog = xdc.om['xdc.cfg.Program'];
+%var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
+
+%if (prog.platformName.match(/OMAPL138/)) {
+#include <ti/ipc/remoteproc/rsc_table_omapl138.h>
+%}
+%if (prog.platformName.match(/evm6614/)) {
+#include <ti/ipc/remoteproc/rsc_table_tci6614.h>
+//#include <ti/ipc/remoteproc/rsc_table_tci6614_v3.3.h> // Test with v3.3 Linux.
+%}
+%if (prog.platformName.match(/Kepler/)) {
+#include <ti/ipc/remoteproc/rsc_table_tci6638.h>
+%}
+
+Void ti_ipc_remoteproc_Resource_init__I()
+{
+%if (prog.platformName.match(/evm6614/)) {
+// Uncomment to test for v3.3 Linux...
+//    xdc_runtime_System_printf("Resource Table: 0x%lx\n", resources);
+//  ...and comment out this:
+    xdc_runtime_System_printf("%d Resource entries at 0x%x\n",
+            ti_ipc_remoteproc_ResourceTable.num,
+            &ti_ipc_remoteproc_ResourceTable);
+%}
+%else {
+    xdc_runtime_System_printf("%d Resource entries at 0x%x\n",
+            ti_ipc_remoteproc_ResourceTable.num,
+            &ti_ipc_remoteproc_ResourceTable);
+%}
+
+    return;
+}
diff --git a/packages/ti/ipc/remoteproc/Resource.xdt.v33 b/packages/ti/ipc/remoteproc/Resource.xdt.v33
new file mode 100644 (file)
index 0000000..34ccf02
--- /dev/null
@@ -0,0 +1,70 @@
+%%{
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 <xdc/runtime/System.h>
+
+%var prog = xdc.om['xdc.cfg.Program'];
+%var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
+
+%if (prog.platformName.match(/OMAPL138/)) {
+#include <ti/ipc/remoteproc/rsc_table_omapl138.h>
+%}
+%if (prog.platformName.match(/evm6614/)) {
+//#include <ti/ipc/remoteproc/rsc_table_tci6614.h>
+#include <ti/ipc/remoteproc/rsc_table_tci6614_v3.3.h> // Test with v3.3 Linux.
+%}
+%if (prog.platformName.match(/Kepler/)) {
+#include <ti/ipc/remoteproc/rsc_table_tci6638.h>
+%}
+
+Void ti_ipc_remoteproc_Resource_init__I()
+{
+%if (prog.platformName.match(/evm6614/)) {
+// Uncomment to test for v3.3 Linux...
+    xdc_runtime_System_printf("Resource Table: 0x%lx\n", resources);
+//  ...and comment out this:
+/*
+    xdc_runtime_System_printf("%d Resource entries at 0x%x\n",
+            ti_ipc_remoteproc_ResourceTable.num,
+            &ti_ipc_remoteproc_ResourceTable);
+*/
+%}
+%else {
+    xdc_runtime_System_printf("%d Resource entries at 0x%x\n",
+            ti_ipc_remoteproc_ResourceTable.num,
+            &ti_ipc_remoteproc_ResourceTable);
+%}
+
+    return;
+}
diff --git a/packages/ti/ipc/remoteproc/Resource.xs b/packages/ti/ipc/remoteproc/Resource.xs
new file mode 100644 (file)
index 0000000..e94baf5
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== IpcMemory.xs ========
+ *
+ */
+var IpcMemory;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$use()
+{
+    IpcMemory = this;
+
+    var memmap = Program.cpu.memoryMap;
+    var segment = null;
+    var addr = IpcMemory.loadAddr;
+
+    if (IpcMemory.loadSegment != undefined) {
+        for (var i=0; i < memmap.length; i++) {
+            if (memmap[i].name == IpcMemory.loadSegment) {
+                segment = memmap[i];
+            }
+        }
+        if (segment == null) {
+            this.$logError("IpcMemory.loadSegment not found", this);
+        }
+        addr = segment.base;
+    }
+
+    /* The .resource_table section should always be at the segment base */
+    Program.sectMap[".resource_table"] = new Program.SectionSpec();
+    Program.sectMap[".resource_table"].type = "NOINIT";
+    Program.sectMap[".resource_table"].loadAddress = addr;
+}
+
+function module$static$init(obj, params)
+{
+    var memmap = Program.cpu.memoryMap;
+    var segment = null;
+    var addr = IpcMemory.loadAddr;
+
+    if (IpcMemory.loadSegment != undefined) {
+        for (var i=0; i < memmap.length; i++) {
+            if (memmap[i].name == IpcMemory.loadSegment) {
+                segment = memmap[i];
+            }
+        }
+        if (null == segment) {
+            this.$logError("IpcMemory.loadSegment not found", this);
+        }
+//        print("IpcMemory.loadSegment", IpcMemory.loadSegment);
+        addr = segment.base;
+    }
+
+    /* Assign the addresses for the module state variables */
+    obj.pTable = addr;
+}
diff --git a/packages/ti/ipc/remoteproc/package.bld b/packages/ti/ipc/remoteproc/package.bld
new file mode 100644 (file)
index 0000000..bbfb923
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld", "rsc_types.h", "rsc_table_omapl138.h", "rsc_table_tci6614.h", "rsc_table_tci6614_v3.3.h", "rsc_table_tci6638.h" ];
+
+var SRCS = ["Resource.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+
+//    print("targ.name = " + targ.name);
+
+    /* Build for all profiles */
+    for (var profile in targ.profiles) {
+
+        Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+            profile: profile
+        }).addObjects(SRCS);
+    }
+}
diff --git a/packages/ti/ipc/remoteproc/package.xdc b/packages/ti/ipc/remoteproc/package.xdc
new file mode 100644 (file)
index 0000000..a79ed66
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.remoteproc ========
+ *  Slave-side remoteproc support.
+ */
+
+package ti.ipc.remoteproc [1,0,0] {
+    module Resource;
+}
diff --git a/packages/ti/ipc/remoteproc/package.xs b/packages/ti/ipc/remoteproc/package.xs
new file mode 100644 (file)
index 0000000..42a355a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var name = this.$name + ".a" + suffix;
+    var lib = "lib/" + this.profile + "/" + name;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/" + name;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/ipc/remoteproc/rsc_table_omapl138.h b/packages/ti/ipc/remoteproc/rsc_table_omapl138.h
new file mode 100644 (file)
index 0000000..2268a3f
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rsc_table_omapl138.h ========
+ *
+ *  Include this table in each base image, which is read from remoteproc on
+ *  host side.
+ *
+ */
+
+#ifndef _RSC_TABLE_OMAPL138_H_
+#define _RSC_TABLE_OMAPL138_H_
+
+#include "rsc_types.h"
+
+#define DATA_DA                 0xc3100000
+
+#ifndef DATA_SIZE
+#  define DATA_SIZE  (SZ_1M * 15)
+#endif
+
+#define RPMSG_VRING0_DA         0xc3000000
+#define RPMSG_VRING1_DA         0xc3004000
+
+#define CONSOLE_VRING0_DA       0xc3008000
+#define CONSOLE_VRING1_DA       0xc300C000
+
+#define BUFS0_DA                0xc3040000
+#define BUFS1_DA                0xc3080000
+
+/*
+ * sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define RPMSG_VQ0_SIZE          256
+#define RPMSG_VQ1_SIZE          256
+
+#define CONSOLE_VQ0_SIZE        256
+#define CONSOLE_VQ1_SIZE        256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_IPU_C0_FEATURES         1
+
+struct resource_table {
+    UInt32 version;
+    UInt32 num;
+    UInt32 reserved[2];
+    UInt32 offset[13];
+
+    /* rpmsg vdev entry */
+    struct fw_rsc_vdev rpmsg_vdev;
+    struct fw_rsc_vdev_vring rpmsg_vring0;
+    struct fw_rsc_vdev_vring rpmsg_vring1;
+
+    /* data carveout entry */
+    struct fw_rsc_carveout data_cout;
+
+    /* trace entry */
+    struct fw_rsc_trace trace;
+};
+
+#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
+#define TRACEBUFSIZE 0x8000
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct resource_table ti_ipc_remoteproc_ResourceTable = {
+    1, /* we're the first version that implements this */
+    3, /* number of entries in the table */
+    0, 0, /* reserved, must be zero */
+    /* offsets to entries */
+    {
+        offsetof(struct resource_table, rpmsg_vdev),
+        offsetof(struct resource_table, data_cout),
+        offsetof(struct resource_table, trace),
+    },
+
+    /* rpmsg vdev entry */
+    {
+        TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+        RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+        /* no config data */
+    },
+    /* the two vrings */
+    { RPMSG_VRING0_DA, 4096, RPMSG_VQ0_SIZE, 1, 0 },
+    { RPMSG_VRING1_DA, 4096, RPMSG_VQ1_SIZE, 2, 0 },
+
+    {
+        TYPE_CARVEOUT, DATA_DA, DATA_DA, DATA_SIZE, 0, 0, "IPU_MEM_DATA",
+    },
+
+    {
+        TYPE_TRACE, TRACEBUFADDR, TRACEBUFSIZE, 0, "trace:dsp",
+    },
+};
+
+#endif /* _RSC_TABLE_OMAPL138_H_ */
diff --git a/packages/ti/ipc/remoteproc/rsc_table_tci6614.h b/packages/ti/ipc/remoteproc/rsc_table_tci6614.h
new file mode 100644 (file)
index 0000000..7c6a03f
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rsc_table_tci6614.h ========
+ *
+ *  Include this table in each base image, which is read from remoteproc on
+ *  host side.
+ *
+ */
+
+#ifndef _RSC_TABLE_TCI6614_H_
+#define _RSC_TABLE_TCI6614_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* virtio ids: keep in sync with the linux "include/linux/virtio_ids.h" */
+#define VIRTIO_ID_RPMSG         7 /* virtio remote processor messaging */
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_IPU_C0_FEATURES         1
+
+#define RPMSG_VRING0_DA     0xA0000000
+#define RPMSG_VRING1_DA     0xA0004000
+
+/*
+ * sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define RPMSG_VQ0_SIZE          256
+#define RPMSG_VQ1_SIZE          256
+
+struct resource_table {
+        UInt32 version;
+        UInt32 num;
+        UInt32 reserved[2];
+        UInt32 offset[13];
+
+        /* rpmsg vdev entry */
+        struct fw_rsc_vdev rpmsg_vdev;
+        struct fw_rsc_vdev_vring rpmsg_vring0;
+        struct fw_rsc_vdev_vring rpmsg_vring1;
+
+        /* data carveout entry */
+        struct fw_rsc_carveout data_cout;
+
+        /* trace entry */
+        struct fw_rsc_trace trace;
+};
+
+/* Add trace buffer information to the resource table */
+#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
+#define TRACEBUFSIZE 0x8000
+
+#define CARVEOUTADDR TRACEBUFADDR
+#define CARVEOUTSIZE TRACEBUFSIZE
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct resource_table ti_ipc_remoteproc_ResourceTable = {
+    1, /* we're the first version that implements this */
+    3, /* number of entries in the table */
+    0, 0, /* reserved, must be zero */
+    /* offsets to entries */
+    {
+        offsetof(struct resource_table, rpmsg_vdev),
+        offsetof(struct resource_table, data_cout),
+        offsetof(struct resource_table, trace),
+    },
+
+    /* rpmsg vdev entry */
+    {
+        TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+        RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+        /* no config data */
+    },
+    /* the two vrings */
+    { RPMSG_VRING0_DA, 4096, RPMSG_VQ0_SIZE, 1, 0 },
+    { RPMSG_VRING1_DA, 4096, RPMSG_VQ1_SIZE, 2, 0 },
+
+    {
+        TYPE_CARVEOUT, CARVEOUTADDR, CARVEOUTADDR, CARVEOUTSIZE, 0, 0, "carveout:dsp",
+    },
+
+    {
+        TYPE_TRACE, TRACEBUFADDR, TRACEBUFSIZE, 0, "trace:dsp",
+    },
+};
+
+#endif /* _RSC_TABLE_TCI6614_H_ */
diff --git a/packages/ti/ipc/remoteproc/rsc_table_tci6614_v3.3.h b/packages/ti/ipc/remoteproc/rsc_table_tci6614_v3.3.h
new file mode 100644 (file)
index 0000000..ccdf896
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rsc_table_tci6614_v3.3.h ========
+ *
+ *  Linux v3.3 remoteproc version of the resource table.
+ *
+ *  Include this table in each base image, which is read from remoteproc on
+ *  host side.
+ *
+ */
+
+#ifndef _RSC_TABLE_TCI6614_H_
+#define _RSC_TABLE_TCI6614_H_
+
+#include <xdc/cfg/global.h>
+
+struct resource {
+    uint32_t type;
+    uint32_t id;
+    uint32_t da_low;
+    uint32_t da_high;
+    uint32_t pa_low;
+    uint32_t pa_high;
+    uint32_t len;
+    uint32_t flags;
+    uint32_t pad1;
+    uint32_t pad2;
+    uint32_t pad3;
+    uint32_t pad4;
+    char name[48];
+};
+
+/* virtio ids: keep in sync with the linux "include/linux/virtio_ids.h" */
+#define VIRTIO_ID_RPMSG         7 /* virtio remote processor messaging */
+
+/* Indices of rpmsg virtio features we support */
+#define VIRTIO_RPMSG_F_NS       0 /* RP supports name service notifications */
+
+#define IPU_C0_FEATURES         1
+
+#define TYPE_CARVEOUT    0
+#define TYPE_DEVMEM      1
+#define TYPE_TRACE       2
+#define TYPE_VRING       3
+#define TYPE_VIRTIO_DEV  4
+
+/* Size constants must match those used on host: include/asm-generic/sizes.h */
+#define SZ_1M                           0x00100000
+#define SZ_2M                           0x00200000
+#define SZ_4M                           0x00400000
+#define SZ_8M                           0x00800000
+#define SZ_16M                          0x01000000
+#define SZ_32M                          0x02000000
+#define SZ_64M                          0x04000000
+#define SZ_128M                         0x08000000
+#define SZ_256M                         0x10000000
+#define SZ_512M                         0x20000000
+
+#define VRING0_DA               0xA0000000
+#define VRING1_DA               0xA0004000
+
+/*
+ * sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define VQ0_SIZE                256
+#define VQ1_SIZE                256
+
+
+/* Add trace buffer information to the resource table */
+#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
+#define TRACEBUFSIZE sysMinBufSize
+
+#pragma DATA_SECTION(resources, ".resource_table")
+#pragma DATA_ALIGN(resources, 4096)
+struct resource resources[] = {
+    /*
+     * Virtio entries must come first.
+     */
+#ifndef TRACE_RESOURCE_ONLY
+    {TYPE_VIRTIO_DEV,0,IPU_C0_FEATURES,0,0,0,0,VIRTIO_ID_RPMSG,0,0,0,0,"vdev:rpmsg"},
+    {TYPE_VRING, 0, VRING0_DA, 0, 0, 0,VQ0_SIZE,0,0,0,0,0,"vring:dsp->arm"},
+    {TYPE_VRING, 1, VRING1_DA, 0, 0, 0,VQ1_SIZE,0,0,0,0,0,"vring:mpu->dsp"},
+#endif
+    {TYPE_TRACE, 0, TRACEBUFADDR,0,0,0, TRACEBUFSIZE, 0,0,0,0,0,"trace:dsp"},
+};
+
+#endif /* _RSC_TABLE_TCI6614_H_ */
diff --git a/packages/ti/ipc/remoteproc/rsc_table_tci6638.h b/packages/ti/ipc/remoteproc/rsc_table_tci6638.h
new file mode 100644 (file)
index 0000000..f4b5407
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rsc_table_tci6638.h ========
+ *
+ *  Include this table in each base image, which is read from remoteproc on
+ *  host side.
+ *
+ */
+
+#ifndef _RSC_TABLE_TCI6638_H_
+#define _RSC_TABLE_TCI6638_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* virtio ids: keep in sync with the linux "include/linux/virtio_ids.h" */
+#define VIRTIO_ID_RPMSG         7 /* virtio remote processor messaging */
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_IPU_C0_FEATURES         1
+
+#define RPMSG_VRING0_DA     0xA0000000
+#define RPMSG_VRING1_DA     0xA0004000
+
+/*
+ * sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define RPMSG_VQ0_SIZE          256
+#define RPMSG_VQ1_SIZE          256
+
+struct resource_table {
+        UInt32 version;
+        UInt32 num;
+        UInt32 reserved[2];
+        UInt32 offset[13];
+
+#ifndef TRACE_RESOURCE_ONLY
+        /* rpmsg vdev entry */
+        struct fw_rsc_vdev rpmsg_vdev;
+        struct fw_rsc_vdev_vring rpmsg_vring0;
+        struct fw_rsc_vdev_vring rpmsg_vring1;
+#endif
+        /* data carveout entry */
+        struct fw_rsc_carveout data_cout;
+
+        /* trace entry */
+        struct fw_rsc_trace trace;
+};
+
+/* Add trace buffer information to the resource table */
+#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
+#define TRACEBUFSIZE 0x8000
+
+#define CARVEOUTADDR TRACEBUFADDR
+#define CARVEOUTSIZE TRACEBUFSIZE
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct resource_table ti_ipc_remoteproc_ResourceTable = {
+    1, /* we're the first version that implements this */
+#ifndef TRACE_RESOURCE_ONLY
+    3, /* number of entries in the table */
+#else
+    2,
+#endif
+    0, 0, /* reserved, must be zero */
+    /* offsets to entries */
+    {
+#ifndef TRACE_RESOURCE_ONLY
+        offsetof(struct resource_table, rpmsg_vdev),
+#endif
+        offsetof(struct resource_table, data_cout),
+        offsetof(struct resource_table, trace),
+    },
+
+#ifndef TRACE_RESOURCE_ONLY
+    /* rpmsg vdev entry */
+    {
+        TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+        RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+        /* no config data */
+    },
+    /* the two vrings */
+    { RPMSG_VRING0_DA, 4096, RPMSG_VQ0_SIZE, 1, 0 },
+    { RPMSG_VRING1_DA, 4096, RPMSG_VQ1_SIZE, 2, 0 },
+#endif
+
+    {
+        TYPE_CARVEOUT, CARVEOUTADDR, CARVEOUTADDR, CARVEOUTSIZE, 0, 0, "carveout:dsp",
+    },
+
+    {
+    TYPE_TRACE, TRACEBUFADDR, TRACEBUFSIZE, 0, "trace:dsp",
+    },
+};
+
+#endif /* _RSC_TABLE_TCI6638_H_ */
diff --git a/packages/ti/ipc/remoteproc/rsc_types.h b/packages/ti/ipc/remoteproc/rsc_types.h
new file mode 100644 (file)
index 0000000..ee4d65d
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rsc_types.h ========
+ *
+ *  Include common definitions for sizes and type of resources
+ *  used by the the resource table in each base image, which is
+ *  read from remoteproc on host side.
+ *
+ */
+
+#ifndef _RSC_TYPES_H_
+#define _RSC_TYPES_H_
+
+#include <xdc/std.h>
+
+/* Size constants must match those used on host: include/asm-generic/sizes.h */
+#define SZ_64K                          0x00010000
+#define SZ_128K                         0x00020000
+#define SZ_256K                         0x00040000
+#define SZ_512K                         0x00080000
+#define SZ_1M                           0x00100000
+#define SZ_2M                           0x00200000
+#define SZ_4M                           0x00400000
+#define SZ_8M                           0x00800000
+#define SZ_16M                          0x01000000
+#define SZ_32M                          0x02000000
+#define SZ_64M                          0x04000000
+#define SZ_128M                         0x08000000
+#define SZ_256M                         0x10000000
+#define SZ_512M                         0x20000000
+
+/* Virtio Ids: keep in sync with the linux "include/linux/virtio_ids.h" */
+#define VIRTIO_ID_CONSOLE       3 /* virtio console */
+#define VIRTIO_ID_RPMSG         7 /* virtio remote processor messaging */
+
+/* Indices of rpmsg virtio features we support */
+#define VIRTIO_RPMSG_F_NS       0  /* RP supports name service notifications */
+#define VIRTIO_RING_F_SYMMETRIC 30 /* We support symmetric vring */
+
+/* Resource info: Must match include/linux/remoteproc.h: */
+#define TYPE_CARVEOUT    0
+#define TYPE_DEVMEM      1
+#define TYPE_TRACE       2
+#define TYPE_VDEV        3
+#define TYPE_CRASHDUMP   4
+
+/* Common Resource Structure Types */
+struct fw_rsc_carveout {
+    UInt32  type;
+    UInt32  da;
+    UInt32  pa;
+    UInt32  len;
+    UInt32  flags;
+    UInt32  reserved;
+    Char    name[32];
+};
+
+struct fw_rsc_devmem {
+    UInt32  type;
+    UInt32  da;
+    UInt32  pa;
+    UInt32  len;
+    UInt32  flags;
+    UInt32  reserved;
+    Char    name[32];
+};
+
+struct fw_rsc_trace {
+    UInt32  type;
+    UInt32  da;
+    UInt32  len;
+    UInt32  reserved;
+    Char    name[32];
+};
+
+struct fw_rsc_vdev_vring {
+    UInt32  da; /* device address */
+    UInt32  align;
+    UInt32  num;
+    UInt32  notifyid;
+    UInt32  reserved;
+};
+
+struct fw_rsc_vdev {
+    UInt32  type;
+    UInt32  id;
+    UInt32  notifyid;
+    UInt32  dfeatures;
+    UInt32  gfeatures;
+    UInt32  config_len;
+    Char    status;
+    Char    num_of_vrings;
+    Char    reserved[2];
+};
+
+#endif /* _RSC_TYPES_H_ */
diff --git a/packages/ti/ipc/rpmsg/Rpmsg.h b/packages/ti/ipc/rpmsg/Rpmsg.h
new file mode 100644 (file)
index 0000000..f4670ef
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       Rpmsg.h
+ *
+ *  @brief      Rpmsg and related structures.
+ *
+ */
+
+
+#ifndef ti_ipc_Rpmsg__include
+#define ti_ipc_Rpmsg__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+enum Rpmsg_nsFlags {
+    RPMSG_NS_CREATE = 0,
+    RPMSG_NS_DESTROY = 1
+};
+
+#define RPMSG_NAME_SIZE 32
+
+
+typedef struct Rpmsg_NsMsg {
+    char name[RPMSG_NAME_SIZE]; /* name of service including 0 */
+    UInt32 addr;                /* address of the service */
+    UInt32 flags;               /* see below */
+} Rpmsg_NsMsg;
+
+
+#define RPMSG_NAMESERVICE_PORT   53
+
+/* Message Header: Must match rp_msg_hdr in virtio_rp_msg.h on Linux side. */
+typedef struct Rpmsg_Header {
+    Bits32 srcAddr;                 /* source endpoint addr               */
+    Bits32 dstAddr;                 /* destination endpoint addr          */
+    Bits32 reserved;                /* reserved                           */
+    Bits16 dataLen;                 /* data length                        */
+    Bits16 flags;                   /* bitmask of different flags         */
+    UInt8  payload[];               /* Data payload                       */
+} Rpmsg_Header;
+
+typedef Rpmsg_Header *Rpmsg_Msg;
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* ti_ipc_Rpmsg__include */
diff --git a/packages/ti/ipc/rpmsg/package.bld b/packages/ti/ipc/rpmsg/package.bld
new file mode 100644 (file)
index 0000000..6795985
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/* This package doesn't build any libraries, just exports some headers */
+Pkg.otherFiles = ["package.bld", "Rpmsg.h", "virtio_ring.h"];
diff --git a/packages/ti/ipc/rpmsg/package.xdc b/packages/ti/ipc/rpmsg/package.xdc
new file mode 100644 (file)
index 0000000..3f37323
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.rpmsg ========
+ *  Inter processor communication.
+ *
+ *  Contains modules are that OS independent and support
+ *  streaming messaging between threads and/or processors.
+ *
+ */
+
+package ti.ipc.rpmsg [1,0,0,0] {
+}
diff --git a/packages/ti/ipc/rpmsg/virtio_ring.h b/packages/ti/ipc/rpmsg/virtio_ring.h
new file mode 100644 (file)
index 0000000..dc06f96
--- /dev/null
@@ -0,0 +1,163 @@
+#ifndef _LINUX_VIRTIO_RING_H
+#define _LINUX_VIRTIO_RING_H
+/* An interface for efficient virtio implementation, currently for use by KVM
+ * and lguest, but hopefully others soon.  Do NOT change this since it will
+ * break existing servers and clients.
+ *
+ * This header is BSD licensed so anyone can use the definitions to implement
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    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 IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Copyright Rusty Russell IBM Corporation 2007. */
+#include <xdc/std.h>
+
+/* This marks a buffer as continuing via the next field. */
+#define VRING_DESC_F_NEXT   1
+/* This marks a buffer as write-only (otherwise read-only). */
+#define VRING_DESC_F_WRITE  2
+
+/* The Host uses this in used->flags to advise the Guest: don't kick me when
+ * you add a buffer.  It's unreliable, so it's simply an optimization.  Guest
+ * will still kick if it's out of buffers. */
+#define VRING_USED_F_NO_NOTIFY  1
+/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
+ * when you consume a buffer.  It's unreliable, so it's simply an
+ * optimization.  */
+#define VRING_AVAIL_F_NO_INTERRUPT  1
+
+/* Virtio ring descriptors: 16 bytes.  These can chain together via "next". */
+struct vring_desc
+{
+    /* Address (guest-physical). */
+    UInt32 addr;
+
+    UInt32 padding; /* Because 64 bits is originally used for addr */
+
+    /* Length. */
+    UInt32 len;
+    /* The flags as indicated above. */  //Optional for now!
+    UInt16 flags;
+    /* We chain unused descriptors via this, too */
+    UInt16 next;
+};
+
+struct vring_avail
+{
+    UInt16 flags;
+    UInt16 idx;
+    UInt16 ring[256];
+};
+
+/* u32 is used here for ids for padding reasons. */
+struct vring_used_elem
+{
+    /* Index of start of used descriptor chain. */
+    UInt32 id;
+    /* Total length of the descriptor chain which was used (written to) */
+    UInt32 len;
+};
+
+struct vring_used
+{
+    UInt16 flags;
+    UInt16 idx;
+    struct vring_used_elem ring[256];
+};
+
+struct vring {
+    unsigned int num;
+
+    struct vring_desc *desc;
+
+    struct vring_avail *avail;
+
+    struct vring_used *used;
+};
+
+/*
+ * When you boot you have to add all the buffers to your own A8
+ * - Call add buf repeatedly
+ * - When we take the buffer from the available list, you should have the pointer in the descriptor address
+ *
+ */
+
+/* The standard layout for the ring is a continuous chunk of memory which looks
+ * like this.  We assume num is a power of 2.
+ *
+ * struct vring
+ * {
+ *    // The actual descriptors (16 bytes each)
+ *    struct vring_desc desc[num];
+ *
+ *    // A ring of available descriptor heads with free-running index.
+ *    UInt16 avail_flags;
+ *    UInt16 avail_idx;
+ *    UInt16 available[num];
+ *
+ *    // Padding to the next page boundary.
+ *    char pad[];
+ *
+ *    // A ring of used descriptor heads with free-running index.
+ *    UInt16 used_flags;
+ *    UInt16 used_idx;
+ *    struct vring_used_elem used[num];
+ * };
+ */
+static inline void vring_init(struct vring *vr, unsigned int num, void *p,
+                              unsigned long pagesize)
+{
+    vr->num = num;
+    vr->desc = p;
+    vr->avail = (struct vring_avail *)
+                    ((unsigned)p + (num * sizeof(struct vring_desc)));
+    vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1)
+                & ~(pagesize - 1));
+}
+
+static inline unsigned vring_size(unsigned int num, unsigned long pagesize)
+{
+    return ((sizeof(struct vring_desc) * num + sizeof(UInt16) * (2 + num)
+                + pagesize - 1) & ~(pagesize - 1))
+                + sizeof(UInt16) * 2 + sizeof(struct vring_used_elem) * num;
+}
+
+#ifdef __KERNEL__
+#include <linux/interrupt.h>
+struct virtio_device;
+struct virtqueue;
+
+struct virtqueue *vring_new_virtqueue(unsigned int num,
+                                      struct virtio_device *vdev,
+                                      void *pages,
+                                      void (*notify)(struct virtqueue *vq),
+                                      void (*callback)(struct virtqueue *vq));
+
+void vring_del_virtqueue(struct virtqueue *vq);
+/* Filter out transport-specific feature bits. */
+void vring_transport_features(struct virtio_device *vdev);
+
+irqreturn_t vring_interrupt(int irq, void *_vq);
+#endif /* __KERNEL__ */
+#endif /* _LINUX_VIRTIO_RING_H */
diff --git a/packages/ti/ipc/tests/dual_transports.c b/packages/ti/ipc/tests/dual_transports.c
new file mode 100644 (file)
index 0000000..13e975f
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== dual_transports.c ========
+ *  Multiprocessor MessageQ example, demonstrating TransportVirtio and
+ *  TransportShm coexistence.
+ *
+ *  Task1 uses MessageQ to pass a message in a ring between DSP CORES.
+ *
+ *  Task2 responds the the Host MessageQApp or MessageQBench.
+ *
+ *  A semaphore synchronizes Task1 to wait until Task2 starts it, which
+ *  is initiated by a sync message from the host.
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+
+/*  -----------------------------------XDC.RUNTIME module Headers    */
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Assert.h>
+
+/*  ----------------------------------- IPC module Headers           */
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/MultiProc.h>
+
+/*  ----------------------------------- BIOS6 module Headers         */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/family/c66/Cache.h>
+
+/*  ----------------------------------- To get globals from .cfg Header */
+#include <xdc/cfg/global.h>
+
+/* Used by multicoreMsgqFxn: */
+#define HEAP_NAME   "myHeapBuf"
+#define HEAPID      1
+#define NUMLOOPS    10
+
+/* Used by hostMsgqFxn: */
+#define SLAVE_MESSAGEQNAME "SLAVE"
+#define MessageQ_payload(m) ((void *)((char *)(m) + sizeof(MessageQ_MsgHeader)))
+
+extern volatile cregister Uns DNUM;
+
+/*
+ *  ======== hostMsgqFxn ========
+ *  Receive and return messages to HOST.
+ *
+ *  When sync received from host, signal multicoreMesgqFxn to proceed.
+ */
+Void hostMsgqFxn(UArg arg0, UArg arg1)
+{
+    MessageQ_Msg msg;
+    MessageQ_Handle  messageQ;
+    MessageQ_QueueId remoteQueueId;
+    Char             localQueueName[64];
+    UInt16 procId;
+    Int status;
+    UInt16 msgId;
+    UInt32 start;
+    UInt32 end;
+    Uint32 numLoops;
+    UInt32 print;
+    UInt32 *params;
+
+    /* Construct a MessageQ name adorned with core name: */
+    System_sprintf(localQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
+                   MultiProc_getName(MultiProc_self()));
+
+    messageQ = MessageQ_create(localQueueName, NULL);
+    if (messageQ == NULL) {
+        System_abort("MessageQ_create failed\n" );
+    }
+
+    System_printf("hostMsgqFxn: created MessageQ: %s; QueueID: 0x%x\n",
+        localQueueName, MessageQ_getQueueId(messageQ));
+
+    while (1) {
+        /* handshake with host to get starting parameters */
+        System_printf("Awaiting sync message from host...\n");
+        MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+
+        params = MessageQ_payload(msg);
+        numLoops = params[0];
+        print = params[1];
+
+        remoteQueueId = MessageQ_getReplyQueue(msg);
+        procId = MessageQ_getProcId(remoteQueueId);
+
+        System_printf("Received msg from (procId:remoteQueueId): 0x%x:0x%x\n"
+            "\tpayload: %d bytes; loops: %d %s printing.\n",
+            procId, remoteQueueId,
+            (MessageQ_getMsgSize(msg) - sizeof(MessageQ_MsgHeader)),
+            numLoops, print ? "with" : "without");
+
+        MessageQ_put(remoteQueueId, msg);
+
+        /* ==> If CORE0, Kick multicoreMsgqFxn to start running */
+        if (DNUM == 0) {
+            Semaphore_post(semStartMultiCoreTest);
+        }
+
+        start = Clock_getTicks();
+        for (msgId = 0; msgId < numLoops; msgId++) {
+            status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+            Assert_isTrue(status == MessageQ_S_SUCCESS, NULL);
+
+            if (print) {
+                System_printf("Got msg #%d (%d bytes) from procId %d\n",
+                    MessageQ_getMsgId(msg), MessageQ_getMsgSize(msg), procId);
+            }
+
+            Assert_isTrue(MessageQ_getMsgId(msg) == msgId, NULL);
+
+            if (print) {
+                System_printf("Sending msg Id #%d to procId %d\n", msgId,
+                              procId);
+            }
+
+            status = MessageQ_put(remoteQueueId, msg);
+            Assert_isTrue(status == MessageQ_S_SUCCESS, NULL);
+        }
+        end = Clock_getTicks();
+
+        if (!print) {
+            System_printf("%d iterations took %d ticks or %d usecs/msg\n",
+                          numLoops,
+            end - start, ((end - start) * Clock_tickPeriod) / numLoops);
+        }
+    }
+}
+
+/*
+ *  ======== multicoreFxn ========
+ *  Allocates a message and ping-pongs the message around the processors.
+ *  A local message queue is created and a remote message queue is opened.
+ *  Messages are sent to the remote message queue and retrieved from the
+ *  local MessageQ.
+ */
+Void multicoreFxn(UArg arg0, UArg arg1)
+{
+    MessageQ_Msg     msg;
+    MessageQ_Handle  messageQ;
+    MessageQ_QueueId remoteQueueId;
+    Int              status;
+    UInt16           msgId = 0;
+    HeapBufMP_Handle              heapHandle;
+    HeapBufMP_Params              heapBufParams;
+    Char localQueueName[10];
+    Char nextQueueName[10];
+    UInt16 nextProcId;
+
+    System_printf("multicoreFxn: Entered...\n");
+
+    nextProcId = (MultiProc_self() + 1) % MultiProc_getNumProcessors();
+    if (nextProcId == MultiProc_getId("HOST")) {
+        nextProcId = 1;  /* Skip the host: Assumes host id is 0. */
+    }
+
+    /* Generate queue names based on own proc ID and total number of procs */
+    System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self()));
+    System_sprintf(nextQueueName, "%s",  MultiProc_getName(nextProcId));
+
+    if (MultiProc_self() == MultiProc_getId("CORE0")) {
+        /*
+         *  Create the heap that will be used to allocate messages.
+         */
+        System_printf("multicoreFxn: Creating HeapBufMP...\n");
+        HeapBufMP_Params_init(&heapBufParams);
+        heapBufParams.regionId       = 0;
+        heapBufParams.name           = HEAP_NAME;
+        heapBufParams.numBlocks      = 1;
+        heapBufParams.blockSize      = sizeof(MessageQ_MsgHeader);
+        heapHandle = HeapBufMP_create(&heapBufParams);
+        if (heapHandle == NULL) {
+            System_abort("HeapBufMP_create failed\n" );
+        }
+    }
+    else {
+        System_printf("multicoreFxn: Opening HeapBufMP...\n");
+        /* Open the heap created by the other processor. Loop until opened. */
+        do {
+            status = HeapBufMP_open(HEAP_NAME, &heapHandle);
+            /*
+             *  Sleep for 1 clock tick to avoid inundating remote processor
+             *  with interrupts if open failed
+             */
+            if (status < 0) {
+                Task_sleep(1);
+            }
+        } while (status < 0);
+    }
+
+    /* Register this heap with MessageQ */
+    MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
+
+    /* Create the local message queue */
+    messageQ = MessageQ_create(localQueueName, NULL);
+    if (messageQ == NULL) {
+        System_abort("MessageQ_create failed\n" );
+    }
+
+    /* Open the remote message queue. Spin until it is ready. */
+    System_printf("multicoreFxn: Opening Remote Queue: %s...\n", nextQueueName);
+    do {
+        status = MessageQ_open(nextQueueName, &remoteQueueId);
+        /*
+         *  Sleep for 1 clock tick to avoid inundating remote processor
+         *  with interrupts if open failed
+         */
+        if (status < 0) {
+            Task_sleep(1);
+        }
+    } while (status < 0);
+
+    if (MultiProc_self() == MultiProc_getId("CORE0")) {
+        /* Allocate a message to be ping-ponged around the processors */
+        msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
+        if (msg == NULL) {
+           System_abort("MessageQ_alloc failed\n" );
+        }
+
+        while (1) {
+
+        /* ==> If CORE0, wait for signal from hostMsgqFxn to start loop: */
+        if (DNUM == 0) {
+            Semaphore_pend(semStartMultiCoreTest, BIOS_WAIT_FOREVER);
+        }
+
+        /*
+         *  Send the message to the next processor and wait for a message
+         *  from the previous processor.
+         */
+        System_printf("multicoreFxn: Sender: Start the main loop\n");
+        for (msgId = 0; msgId < NUMLOOPS; msgId++) {
+            /* Increment...the remote side will check this */
+            MessageQ_setMsgId(msg, msgId);
+
+            System_printf("Sending message #%d to %s\n", msgId, nextQueueName);
+
+            /* send the message to the next processor */
+            status = MessageQ_put(remoteQueueId, msg);
+            if (status < 0) {
+               System_abort("MessageQ_put had a failure/error\n");
+            }
+
+            /* Get a message */
+            status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+            if (status < 0) {
+               System_abort("This should not happen as timeout is forever\n");
+            }
+        }
+        }
+    }
+    else {
+
+        /*
+         *  Wait for a message from the previous processor and
+         *  send it to the next processor
+         */
+        System_printf("multicoreFxn: Receiver: Start the main loop\n");
+        while (TRUE) {
+            /* Get a message */
+            status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+            if (status < 0) {
+               System_abort("This should not happen since timeout is forever\n");
+            }
+
+            /* Get the message id */
+            msgId = MessageQ_getMsgId(msg);
+
+            System_printf("Sending a message #%d to %s\n", msgId,
+                nextQueueName);
+
+            /* send the message to the remote processor */
+            status = MessageQ_put(remoteQueueId, msg);
+            if (status < 0) {
+               System_abort("MessageQ_put had a failure/error\n");
+            }
+
+            /* test done */
+            if (msgId >= NUMLOOPS) {
+                System_printf("multicore loop test is complete\n");
+            }
+        }
+    }
+}
+
+/*
+ *  ======== main ========
+ *  Creates thread and calls BIOS_start
+ */
+Int main(Int argc, Char* argv[])
+{
+    /* Put CCS breakpoint for CORE0 */
+#if 0
+    if (DNUM == 0) {
+       /* Wait until we connect CCS; write 1 to var spin to continue: */
+       volatile int spin = 1;
+       while(spin);
+    }
+#endif
+
+    System_printf("main: MultiProc id: %d\n", MultiProc_self());
+
+    Task_create(multicoreFxn, NULL, NULL);
+    Task_create(hostMsgqFxn, NULL, NULL);
+
+    BIOS_start();
+
+    return (0);
+}
diff --git a/packages/ti/ipc/tests/dual_transports.cfg b/packages/ti/ipc/tests/dual_transports.cfg
new file mode 100644 (file)
index 0000000..60d2dd1
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+
+
+/*
+ * We don't use MultiProcSetup, but we have to pull it in first to shut it
+ * up so it doesn't causes MultiProc ids to be set in a Startup_first fxn.
+ */
+if (Program.platformName.match(/6614/)) {
+    MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.c647x.MultiProcSetup');
+}
+else if (Program.platformName.match(/simKepler/)) {
+    MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.tci663x.MultiProcSetup');
+}
+MultiProcSetup.configureProcId = false;
+
+/* Nothing in here uses IPC tree Settings.xs: */
+xdc.loadCapsule("messageq_common.cfg.xs");
+
+/*
+ * Plug shared Interrupt used in TransportVirtio into NotifyDriverShm, before
+ * Settings.xs does it:
+ */
+if (Program.platformName.match(/6614/)) {
+    var NotifyDriverShm =
+        xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
+    NotifyDriverShm.InterruptProxy = xdc.useModule(Interrupt);
+}
+else if (Program.platformName.match(/simKepler/)) {
+    var NotifyDriverCirc =
+       xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+    NotifyDriverCirc.InterruptProxy = xdc.useModule(Interrupt);
+}
+
+/*
+ * Notify brings in the ti.sdo.ipc.family.Settings module, which does
+ * lots of config magic which will need to be UNDONE later, or setup earlier,
+ * to get the necessary overrides to various IPC module proxies!
+ */
+var Notify                  = xdc.module('ti.sdo.ipc.Notify');
+var Ipc                     = xdc.useModule('ti.sdo.ipc.Ipc');
+
+/* Note: Must call this to override what's done in Settings.xs ! */
+if (Program.platformName.match(/6614/)) {
+    Notify.SetupProxy = xdc.module('ti.ipc.family.tci6614.NotifySetup');
+}
+else if (Program.platformName.match(/simKepler/)) {
+    Notify.SetupProxy = xdc.module('ti.ipc.family.tci6638.NotifyCircSetup');
+}
+
+/* Synchronize all processors (this will be done in Ipc_start()) */
+Ipc.procSync = Ipc.ProcSync_ALL;
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_callIpcStart');
+
+/* Shared Memory base address and length */
+var SHAREDMEM           = 0x0C000000;
+var SHAREDMEMSIZE       = 0x00200000;
+
+/*
+ *  Need to define the shared region. The IPC modules use this
+ *  to make portable pointers. All processors need to add this
+ *  call with their base address of the shared memory region.
+ *  If the processor cannot access the memory, do not add it.
+ */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+SharedRegion.setEntryMeta(0,
+    { base: SHAREDMEM,
+      len:  SHAREDMEMSIZE,
+      ownerProcId: 1,  /* Ensure CORE0 SR0 is owner, NOT HOST! */
+      isValid: true,
+      name: "MSMC SRAM",
+    });
+
+/* TBD: Application specific: move out of here to yet another .cfg file: */
+
+/* Modules explicitly used in the application */
+var HeapBufMP   = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+
+var Semaphore   = xdc.useModule('ti.sysbios.knl.Semaphore');
+Program.global.semStartMultiCoreTest = Semaphore.create(0);
diff --git a/packages/ti/ipc/tests/messageq_common.cfg.xs b/packages/ti/ipc/tests/messageq_common.cfg.xs
new file mode 100644 (file)
index 0000000..b0da703
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.heapSize = 0x20000;
+BIOS.libType = BIOS.LibType_Custom;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.deleteTerminatedTasks = true;
+
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+System.SupportProxy = SysMin;
+
+var Diags = xdc.useModule('xdc.runtime.Diags');
+
+xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+
+print ("Program.cpu.deviceName = " + Program.cpu.deviceName);
+print ("Program.platformName = " + Program.platformName);
+if (Program.cpu.deviceName == "OMAPL138") {
+    xdc.useModule('ti.ipc.family.omapl138.VirtQueue');
+    xdc.useModule('ti.sdo.ipc.family.da830.InterruptDsp');
+
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig("DSP", ["HOST", "DSP"]);
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "DDR";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
+    /* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
+    Cache.MAR192_223 = 0x00000010;
+
+    var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
+    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+    Timer.timerSettings[1].master = true;
+    Timer.defaultHalf = Timer.Half_LOWER;
+    Clock.timerId = 1;
+
+    SysMin.bufSize  = 0x8000;
+}
+else if (Program.platformName.match(/6614/)) {
+    var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
+
+    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
+
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+       We assume the rest is to be left cacheable.
+       Per sprugw0b.pdf
+        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+    */
+    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+    /*  This doesn't work:
+         Cache.MAR160_191 = 0xFFFFFFFC;
+         So, need to do this:
+    */
+    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+    Program.global.sysMinBufSize = 0x8000;
+    SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+    /*
+    Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.transports.TransportVirtio",
+        Diags.INFO|Diags.USER1|Diags.STATUS,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+        Diags.ALWAYS_ON);
+    */
+}
+else if (Program.platformName.match(/simKepler/)) {
+    var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
+                               "CORE4", "CORE5", "CORE6", "CORE7"]);
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+       We assume the rest is to be left cacheable.
+       Per sprugw0b.pdf
+        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+    */
+    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+    /*  This doesn't work:
+         Cache.MAR160_191 = 0xFFFFFFFC;
+         So, need to do this:
+    */
+    /* TBD: Update for Kepler: */
+    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+    Program.global.sysMinBufSize = 0x8000;
+    SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+    /*
+    Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.transports.TransportVirtio",
+        Diags.INFO|Diags.USER1|Diags.STATUS,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+        Diags.ALWAYS_ON);
+    */
+}
+else {
+    throw("messageq_common.cfg: Did not match any platform!");
+}
+
+Hwi.enableException = true;
+
+xdc.loadPackage('ti.ipc.ipcmgr');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ  = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var Assert = xdc.useModule('xdc.runtime.Assert');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+var Text = xdc.useModule('xdc.runtime.Text');
+Text.isLoaded = true;
+
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_INFO = Diags.RUNTIME_ON;
+Main.common$.diags_ENTRY = Diags.RUNTIME_ON;
+Main.common$.diags_EXIT = Diags.RUNTIME_ON;
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportVirtioSetup');
+VirtioSetup.common$.diags_INFO = Diags.RUNTIME_OFF;
+
+xdc.loadPackage('ti.ipc.transports').profile = 'release';
diff --git a/packages/ti/ipc/tests/messageq_multi.c b/packages/ti/ipc/tests/messageq_multi.c
new file mode 100644 (file)
index 0000000..ea2f272
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== messageq_multi.c ========
+ *
+ *  Test for messageq operating in multiple simultaneous threads.
+ *
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/heaps/HeapBuf.h>
+
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+#define SLAVE_MESSAGEQNAME "SLAVE"
+#define HOST_MESSAGEQNAME "HOST"
+#define NUMTHREADS 10
+#define NUMLOOPS 1000
+
+static int numTests = 0;
+
+/*
+ *  ======== loopbackFxn========
+ *  Receive and return messages.
+ *  Run at priority lower than tsk1Fxn above.
+ *  Inputs:
+ *     - arg0: number of the thread, appended to MessageQ host and slave names.
+ */
+Void loopbackFxn(UArg arg0, UArg arg1)
+{
+    MessageQ_Msg     getMsg;
+    MessageQ_Handle  messageQ;
+    MessageQ_QueueId remoteQueueId;
+    Int              status;
+    UInt16           msgId = 0;
+    Char             localQueueName[64];
+    Char             hostQueueName[64];
+
+    System_printf("Thread loopbackFxn: %d\n", arg0);
+
+    System_sprintf(localQueueName, "%s_%d", SLAVE_MESSAGEQNAME, arg0);
+    System_sprintf(hostQueueName,  "%s_%d", HOST_MESSAGEQNAME,  arg0);
+
+    /* Create a message queue. */
+    messageQ = MessageQ_create(localQueueName, NULL);
+    if (messageQ == NULL) {
+        System_abort("MessageQ_create failed\n");
+    }
+
+    System_printf("loopbackFxn: created MessageQ: %s; QueueID: 0x%x\n",
+        localQueueName, MessageQ_getQueueId(messageQ));
+
+    System_printf("Start the main loop: %d\n", arg0);
+    while (msgId < NUMLOOPS) {
+        /* Get a message */
+        status = MessageQ_get(messageQ, &getMsg, MessageQ_FOREVER);
+        if (status != MessageQ_S_SUCCESS) {
+           System_abort("This should not happen since timeout is forever\n");
+        }
+        remoteQueueId = MessageQ_getReplyQueue(getMsg);
+
+#ifndef BENCHMARK
+        System_printf("%d: Received message #%d from core %d\n",
+                arg0, MessageQ_getMsgId(getMsg),
+                MessageQ_getProcId(remoteQueueId));
+#endif
+        /* test id of message received */
+        if (MessageQ_getMsgId(getMsg) != msgId) {
+            System_abort("The id received is incorrect!\n");
+        }
+
+#ifndef BENCHMARK
+        /* Send it back */
+        System_printf("%d: Sending message Id #%d to core %d\n",
+                      arg0, msgId, MessageQ_getProcId(remoteQueueId));
+#endif
+        status = MessageQ_put(remoteQueueId, getMsg);
+        if (status != MessageQ_S_SUCCESS) {
+           System_abort("MessageQ_put had a failure/error\n");
+        }
+        msgId++;
+    }
+
+    MessageQ_delete(&messageQ);
+    numTests += NUMLOOPS;
+
+    System_printf("Test thread %d complete!\n", arg0);
+}
+
+/*
+ *  ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+    Task_Params params;
+    Int i;
+
+    System_printf("%s:main: MultiProc id = %d\n", __FILE__, MultiProc_self());
+
+    /* Create N threads to correspond with host side N thread test app: */
+    Task_Params_init(&params);
+    params.priority = 3;
+    for (i = 0; i < NUMTHREADS; i++) {
+        params.arg0 = i;
+        Task_create(loopbackFxn, &params, NULL);
+    }
+
+    BIOS_start();
+
+    return (0);
+ }
diff --git a/packages/ti/ipc/tests/messageq_multicore.c b/packages/ti/ipc/tests/messageq_multicore.c
new file mode 100644 (file)
index 0000000..3bd6959
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== message_multicore.c ========
+ *  Multiprocessor MessageQ example
+ *
+ *  This is an example program that uses MessageQ to pass a message
+ *  from one processor to another.
+ *
+ *  Each processor creates its own MessageQ first and then will try to open
+ *  a remote processor's MessageQ.
+ *
+ *  See message_multicore.k file for expected output.
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+
+/*  -----------------------------------XDC.RUNTIME module Headers    */
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/IHeap.h>
+
+/*  ----------------------------------- IPC module Headers           */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/MultiProc.h>
+
+/*  ----------------------------------- BIOS6 module Headers         */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/family/c66/Cache.h>
+
+/*  ----------------------------------- To get globals from .cfg Header */
+#include <xdc/cfg/global.h>
+
+/* Define this to eliminate VIRTIO DEV and VRINGS from rsc_table: */
+#define  TRACE_RESOURCE_ONLY 1
+extern char * xdc_runtime_SysMin_Module_State_0_outbuf__A;
+#if defined(TCI6614)
+#include <ti/ipc/remoteproc/rsc_table_tci6614.h>
+#elif defined(TCI6614_v33)
+#include <ti/ipc/remoteproc/rsc_table_tci6614_v3.3.h>
+#elif defined(TCI6638)
+#include <ti/ipc/remoteproc/rsc_table_tci6638.h>
+#endif
+
+#define HEAP_NAME   "myHeapBuf"
+#define HEAPID      0
+#define NUMLOOPS    10
+
+Char localQueueName[10];
+Char nextQueueName[10];
+UInt16 nextProcId;
+
+/*
+ *  ======== tsk0_func ========
+ *  Allocates a message and ping-pongs the message around the processors.
+ *  A local message queue is created and a remote message queue is opened.
+ *  Messages are sent to the remote message queue and retrieved from the
+ *  local MessageQ.
+ */
+Void tsk0_func(UArg arg0, UArg arg1)
+{
+    MessageQ_Msg     msg;
+    MessageQ_Handle  messageQ;
+    MessageQ_QueueId remoteQueueId;
+    Int              status;
+    UInt16           msgId = 0;
+    HeapBufMP_Handle              heapHandle;
+    HeapBufMP_Params              heapBufParams;
+
+    if (MultiProc_self() == 0) {
+        /*
+         *  Create the heap that will be used to allocate messages.
+         */
+        HeapBufMP_Params_init(&heapBufParams);
+        heapBufParams.regionId       = 0;
+        heapBufParams.name           = HEAP_NAME;
+        heapBufParams.numBlocks      = 1;
+        heapBufParams.blockSize      = sizeof(MessageQ_MsgHeader);
+        heapHandle = HeapBufMP_create(&heapBufParams);
+        if (heapHandle == NULL) {
+            System_abort("HeapBufMP_create failed\n" );
+        }
+    }
+    else {
+        /* Open the heap created by the other processor. Loop until opened. */
+        do {
+            status = HeapBufMP_open(HEAP_NAME, &heapHandle);
+            /*
+             *  Sleep for 1 clock tick to avoid inundating remote processor
+             *  with interrupts if open failed
+             */
+            if (status < 0) {
+                Task_sleep(1);
+            }
+        } while (status < 0);
+    }
+
+    /* Register this heap with MessageQ */
+    MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
+
+    /* Create the local message queue */
+    messageQ = MessageQ_create(localQueueName, NULL);
+    if (messageQ == NULL) {
+        System_abort("MessageQ_create failed\n" );
+    }
+
+    /* Open the remote message queue. Spin until it is ready. */
+    do {
+        status = MessageQ_open(nextQueueName, &remoteQueueId);
+        /*
+         *  Sleep for 1 clock tick to avoid inundating remote processor
+         *  with interrupts if open failed
+         */
+        if (status < 0) {
+            Task_sleep(1);
+        }
+    } while (status < 0);
+
+    if (MultiProc_self() == 0) {
+        /* Allocate a message to be ping-ponged around the processors */
+        msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
+        if (msg == NULL) {
+           System_abort("MessageQ_alloc failed\n" );
+        }
+
+        /*
+         *  Send the message to the next processor and wait for a message
+         *  from the previous processor.
+         */
+        System_printf("Start the main loop\n");
+        while (msgId < NUMLOOPS) {
+            /* Increment...the remote side will check this */
+            msgId++;
+            MessageQ_setMsgId(msg, msgId);
+
+            System_printf("Sending a message #%d to %s\n", msgId, nextQueueName);
+
+            /* send the message to the remote processor */
+            status = MessageQ_put(remoteQueueId, msg);
+            if (status < 0) {
+               System_abort("MessageQ_put had a failure/error\n");
+            }
+
+            /* Get a message */
+            status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+            if (status < 0) {
+               System_abort("This should not happen since timeout is forever\n");
+            }
+        }
+    }
+    else {
+        /*
+         *  Wait for a message from the previous processor and
+         *  send it to the next processor
+         */
+        System_printf("Start the main loop\n");
+        while (TRUE) {
+            /* Get a message */
+            status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+            if (status < 0) {
+               System_abort("This should not happen since timeout is forever\n");
+            }
+
+            System_printf("Sending a message #%d to %s\n", MessageQ_getMsgId(msg),
+                nextQueueName);
+
+            /* Get the message id */
+            msgId = MessageQ_getMsgId(msg);
+
+            /* send the message to the remote processor */
+            status = MessageQ_put(remoteQueueId, msg);
+            if (status < 0) {
+               System_abort("MessageQ_put had a failure/error\n");
+            }
+
+            /* test done */
+            if (msgId >= NUMLOOPS) {
+                break;
+            }
+        }
+    }
+
+    System_printf("The test is complete\n");
+    BIOS_exit(0);
+}
+
+#define CACHE_WB_TICK_PERIOD    5
+
+/*
+ * ======== VirtQueue_cacheWb ========
+ *
+ * Used for flushing SysMin trace buffer.
+ */
+Void traceBuf_cacheWb()
+{
+    static UInt32 oldticks = 0;
+    UInt32 newticks;
+
+    newticks = Clock_getTicks();
+    if (newticks - oldticks < (UInt32)CACHE_WB_TICK_PERIOD) {
+        /* Don't keep flushing cache */
+        return;
+    }
+
+    oldticks = newticks;
+
+    Cache_wbAll();
+
+}
+
+/*
+ *  ======== main ========
+ *  Synchronizes all processors (in Ipc_start) and calls BIOS_start
+ */
+Int main(Int argc, Char* argv[])
+{
+    Int status;
+
+#if defined(TCI6614_v33)
+    /* Reference resource table, until IpcMemory.xdt is enabled for TCI66xx */
+    System_printf("Resource Table: 0x%lx\n", resources);
+#elif defined (TCI6614) || defined(TCI6638)
+    System_printf("%d Resource Table entries at 0x%x\n",
+                  ti_ipc_remoteproc_ResourceTable.num,
+                  &ti_ipc_remoteproc_ResourceTable);
+#endif
+
+    nextProcId = (MultiProc_self() + 1) % MultiProc_getNumProcessors();
+
+    /* Generate queue names based on own proc ID and total number of procs */
+    System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self()));
+    System_sprintf(nextQueueName, "%s",  MultiProc_getName(nextProcId));
+
+    /*
+     *  Ipc_start() calls Ipc_attach() to synchronize all remote processors
+     *  because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
+     */
+    status = Ipc_start();
+    if (status < 0) {
+        System_abort("Ipc_start failed\n");
+    }
+
+    BIOS_start();
+
+    return (0);
+}
+/*
+ *  @(#) ti.sdo.ipc.examples.multicore.evm667x; 1, 0, 0, 0,2; 10-19-2011 10:53:19; /db/vtree/library/trees/ipc/ipc.git/src/ null
+ */
diff --git a/packages/ti/ipc/tests/messageq_multicore.cfg b/packages/ti/ipc/tests/messageq_multicore.cfg
new file mode 100644 (file)
index 0000000..89eb673
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+
+switch (Program.platformName) {
+    case "ti.platforms.evm6614:DSP":
+        var nameList = ["CORE0", "CORE1", "CORE2", "CORE3"];
+        break;
+    case "ti.platforms.simKepler":
+        var nameList = ["CORE0", "CORE1", "CORE2", "CORE3",
+                        "CORE4", "CORE5", "CORE6", "CORE7"];
+        break;
+    default:
+        throw("Platform " + Program.platformName + " not supported by this example");
+        break;
+}
+
+/*
+ *  Since this is a single-image example, we don't know (at build-time) which
+ *  processor we're building for.  We therefore supply 'null'
+ *  as the local procName and allow IPC to set the local procId at runtime.
+ */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(null, nameList);
+
+var System   = xdc.useModule('xdc.runtime.System');
+
+/* Modules explicitly used in the application */
+var MessageQ    = xdc.useModule('ti.sdo.ipc.MessageQ');
+var Ipc         = xdc.useModule('ti.sdo.ipc.Ipc');
+var HeapBufMP   = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+var MultiProc   = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/* BIOS/XDC modules */
+var BIOS        = xdc.useModule('ti.sysbios.BIOS');
+BIOS.heapSize   = 0x8000;
+var Task        = xdc.useModule('ti.sysbios.knl.Task');
+
+var tsk0 = Task.create('&tsk0_func');
+tsk0.instance.name = "tsk0";
+
+/* Synchronize all processors (this will be done in Ipc_start) */
+Ipc.procSync = Ipc.ProcSync_ALL;
+
+/* Shared Memory base address and length */
+var SHAREDMEM           = 0x0C000000;
+var SHAREDMEMSIZE       = 0x00200000;
+
+/*
+ *  Need to define the shared region. The IPC modules use this
+ *  to make portable pointers. All processors need to add this
+ *  call with their base address of the shared memory region.
+ *  If the processor cannot access the memory, do not add it.
+ */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+SharedRegion.setEntryMeta(0,
+    { base: SHAREDMEM,
+      len:  SHAREDMEMSIZE,
+      ownerProcId: 0,
+      isValid: true,
+      name: "DDR2 RAM",
+    });
+
+/* Taken from messageq_common.cfg: */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+System.SupportProxy = SysMin;
+Program.global.sysMinBufSize = 0x8000;
+SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+/* BIOS Resource Table: */
+Program.sectMap[".resource_table"] = new Program.SectionSpec();
+Program.sectMap[".resource_table"].type = "NOINIT";
+Program.sectMap[".resource_table"] = "L2SRAM";
+
+/* Get the trace buffer to show up! */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&traceBuf_cacheWb');
diff --git a/packages/ti/ipc/tests/messageq_single.c b/packages/ti/ipc/tests/messageq_single.c
new file mode 100644 (file)
index 0000000..9e229de
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== messageq_single.c ========
+ *
+ *  Single threaded test of messageq over rpmsg.
+ *
+ *  See:
+ *      MessageQApp in Linux user space
+ *
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/knl/Clock.h>
+
+#include <ti/ipc/MessageQ.h>
+
+#define SLAVE_MESSAGEQNAME "SLAVE"
+
+#define MessageQ_payload(m) ((void *)((char *)(m) + sizeof(MessageQ_MsgHeader)))
+
+/*
+ *  ======== tsk1Fxn ========
+ *  Receive and return messages
+ */
+Void tsk1Fxn(UArg arg0, UArg arg1)
+{
+    MessageQ_Msg msg;
+    MessageQ_Handle  messageQ;
+    MessageQ_QueueId remoteQueueId;
+    Char             localQueueName[64];
+    UInt16 procId;
+    Int status;
+    UInt16 msgId;
+    UInt32 start;
+    UInt32 end;
+    Uint32 numLoops;
+    UInt32 print;
+    UInt32 *params;
+
+    /* Construct a MessageQ name adorned with core name: */
+    System_sprintf(localQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
+                   MultiProc_getName(MultiProc_self()));
+
+    messageQ = MessageQ_create(localQueueName, NULL);
+    if (messageQ == NULL) {
+        System_abort("MessageQ_create failed\n");
+    }
+
+    System_printf("tsk1Fxn: created MessageQ: %s; QueueID: 0x%x\n",
+        localQueueName, MessageQ_getQueueId(messageQ));
+
+    while (1) {
+        /* handshake with host to get starting parameters */
+        System_printf("Awaiting sync message from host...\n");
+        MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+
+        params = MessageQ_payload(msg);
+        numLoops = params[0];
+        print = params[1];
+
+        remoteQueueId = MessageQ_getReplyQueue(msg);
+        procId = MessageQ_getProcId(remoteQueueId);
+
+        System_printf("Received msg from (procId:remoteQueueId): 0x%x:0x%x\n"
+            "\tpayload: %d bytes; loops: %d %s printing.\n",
+            procId, remoteQueueId,
+            (MessageQ_getMsgSize(msg) - sizeof(MessageQ_MsgHeader)),
+            numLoops, print ? "with" : "without");
+
+        MessageQ_put(remoteQueueId, msg);
+
+        start = Clock_getTicks();
+        for (msgId = 0; msgId < numLoops; msgId++) {
+            status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
+            Assert_isTrue(status == MessageQ_S_SUCCESS, NULL);
+
+            if (print) {
+                System_printf("Got msg #%d (%d bytes) from procId %d\n",
+                    MessageQ_getMsgId(msg), MessageQ_getMsgSize(msg), procId);
+            }
+
+            Assert_isTrue(MessageQ_getMsgId(msg) == msgId, NULL);
+
+            if (print) {
+                System_printf("Sending msg Id #%d to procId %d\n", msgId,
+                              procId);
+            }
+
+            status = MessageQ_put(remoteQueueId, msg);
+            Assert_isTrue(status == MessageQ_S_SUCCESS, NULL);
+        }
+        end = Clock_getTicks();
+
+        if (!print) {
+            System_printf("%d iterations took %d ticks or %d usecs/msg\n",
+                          numLoops,
+            end - start, ((end - start) * Clock_tickPeriod) / numLoops);
+        }
+    }
+}
+
+/*
+ *  ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+    System_printf("%s:main: MultiProc id = %d\n", __FILE__, MultiProc_self());
+
+    Task_create(tsk1Fxn, NULL, NULL);
+
+    BIOS_start();
+
+    return (0);
+}
diff --git a/packages/ti/ipc/tests/nano_test.c b/packages/ti/ipc/tests/nano_test.c
new file mode 100644 (file)
index 0000000..b6875ce
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== nano_test.c ========
+ *
+ *  Test for a particular customer use case.
+ *
+ *  See <syslink3_repo>/src/tests/nano_test.c for usage.
+ *
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/knl/Clock.h>
+
+#include <ti/ipc/MessageQ.h>
+
+#define NUM_SLAVE_MSGS_PER_HOST_MSG   4
+
+#define SLAVE_MESSAGEQNAME "SLAVE"
+
+#define INPUT_MSG_DATASIZE  (8192)
+#define OUTPUT_MSG_DATASIZE (INPUT_MSG_DATASIZE / NUM_SLAVE_MSGS_PER_HOST_MSG)
+
+/* Application message structures: */
+typedef struct {
+    MessageQ_MsgHeader  hdr;
+    Char                *inBuf;
+} InputMsg;
+
+typedef struct {
+    MessageQ_MsgHeader  hdr;
+    Char                *outBuf;
+} OutputMsg;
+
+static OutputMsg        outMsg;
+
+/*
+ *  ======== tsk1Fxn ========
+ *  Receive and return messages
+ */
+Void tsk1Fxn(UArg arg0, UArg arg1)
+{
+    InputMsg         *inMsg;
+    MessageQ_Handle  messageQ;
+    MessageQ_QueueId remoteQueueId;
+    Int              status;
+    int              i;
+
+    /* Create a message queue. */
+    messageQ = MessageQ_create(SLAVE_MESSAGEQNAME, NULL);
+    if (messageQ == NULL) {
+        System_abort("MessageQ_create failed\n" );
+    }
+
+    System_printf("tsk1Fxn: created MessageQ: %s; QueueID: 0x%x\n",
+        SLAVE_MESSAGEQNAME, MessageQ_getQueueId(messageQ));
+
+    /* Use a static message for outMsg: no need to call MessageQ_alloc(): */
+    MessageQ_staticMsgInit((MessageQ_Msg)&outMsg, sizeof(OutputMsg));
+
+    System_printf("Start the main loop\n");
+    while (1) {
+        /* Get one block (8Kb) of data passed as a pointer to shared memory */
+        status = MessageQ_get(messageQ, (MessageQ_Msg *)&inMsg,
+                              MessageQ_FOREVER);
+        if (status != MessageQ_S_SUCCESS) {
+           System_abort("This should not happen since timeout is forever\n");
+        }
+        remoteQueueId = MessageQ_getReplyQueue(inMsg);
+
+        for (i = 0; i < NUM_SLAVE_MSGS_PER_HOST_MSG; i++) {
+            /* Send back the data in 4 chunks: */
+            MessageQ_setMsgId ((MessageQ_Msg)&outMsg, i);
+
+            /* Return pointer to ith chunk of data: */
+            outMsg.outBuf = inMsg->inBuf + i * OUTPUT_MSG_DATASIZE;
+
+            status = MessageQ_put(remoteQueueId, (MessageQ_Msg)&outMsg);
+            if (status != MessageQ_S_SUCCESS) {
+               System_abort("MessageQ_put had a failure/error\n");
+            }
+        }
+        MessageQ_free ((MessageQ_Msg)inMsg);
+    }
+}
+
+/*
+ *  ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+    System_printf("%s:main: MultiProc id = %d\n", __FILE__, MultiProc_self());
+
+    Task_create(tsk1Fxn, NULL, NULL);
+
+    BIOS_start();
+
+    return (0);
+}
diff --git a/packages/ti/ipc/tests/package.bld b/packages/ti/ipc/tests/package.bld
new file mode 100644 (file)
index 0000000..41f152e
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/* when constructing a release, release everything */
+Pkg.attrs.exportAll = true;
+
+/* Uncomment this to build the app with debug support */
+Pkg.attrs.profile = "debug";
+
+/* bin/ is a generated directory that 'xdc clean' should remove */
+Pkg.generatedFiles.$add("bin/");
+
+/* define the platform instances we support - currently only OMAPL138 */
+var evmOMAPL138_ExtMemMap = {
+    DDR: {
+        name: "DDR",
+        base: 0xc3100000,
+        len:  0x00800000,
+        space: "code/data"
+    }
+};
+
+Build.platformTable["ti.platforms.evmOMAPL138:DSP"] = {
+    externalMemoryMap: [
+        [ "DDR", evmOMAPL138_ExtMemMap.DDR ]
+    ],
+    codeMemory: "DDR",
+    dataMemory: "DDR",
+    stackMemory: "DDR",
+    l2Mode: "32k"
+};
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+
+//    print("building for target " + targ.name + " ...");
+
+    /* currently only build for OMAPL138, Appleton and Kepler */
+    if (!((targ.isa == "674") || (targ.isa == "66"))) {
+        continue;
+    }
+
+    /* Platforms were added to targ.platforms[] in config.bld */
+    for (var j = 0; j < targ.platforms.length; j++) {
+        var platform = targ.platforms[j];
+
+        /* currently only build for OMAPL138, Appleton and Kepler */
+        if (!((platform.match(/^ti\.platforms\.evm6614\:DSP/)) ||
+              (platform.match(/^ti\.platforms\.simKepler/)) ||
+              (platform.match(/^ti\.platforms\.evmOMAPL138\:DSP/)))) {
+             continue;
+        }
+
+        print("  platform:  " + platform);
+        // name = bin/platform/name.x+suffix
+        var name = "bin/" +
+                // replace all ':' and '.' with '_' in platform name
+                platform.replace(/\:/g, "_").replace(/\./g, "_");
+
+        /* Only build this for our multicore platforms: */
+        if (platform.match(/^ti\.platforms\.simKepler/) ||
+            platform.match(/^ti\.platforms\.evm6614\:DSP/)) {
+                Pkg.addExecutable(name + "/messageq_multicore",targ,platform, {
+                    cfgScript: "messageq_multicore",
+                    //defs: "-D TCI6614_v33"
+                    //defs: "-D TCI6614"
+                    defs: "-D TCI6638"
+                }).addObjects(["messageq_multicore.c"]);
+
+                Pkg.addExecutable(name + "/dual_transports",targ,platform, {
+                    cfgScript: "dual_transports",
+                }).addObjects(["dual_transports.c"]);
+        }
+
+
+        Pkg.addExecutable(name + "/messageq_multi", targ, platform, {
+            cfgScript: "rpmsg_transport",
+            defs: "-D BENCHMARK "
+        }).addObjects(["messageq_multi.c"]);
+
+        Pkg.addExecutable(name + "/messageq_single", targ, platform, {
+            cfgScript: "rpmsg_transport",
+            defs: "-D BENCHMARK "
+        }).addObjects(["messageq_single.c"]);
+
+        if (platform.match(/^ti\.platforms\.evmOMAPL138\:DSP/)) {
+                Pkg.addExecutable(name + "/nano_test", targ, platform, {
+                    cfgScript: "rpmsg_transport"
+                }).addObjects(["nano_test.c"]);
+        }
+    }
+}
diff --git a/packages/ti/ipc/tests/package.bld.no_host_kepler b/packages/ti/ipc/tests/package.bld.no_host_kepler
new file mode 100644 (file)
index 0000000..23f4722
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/* when constructing a release, release everything */
+Pkg.attrs.exportAll = true;
+
+/* Uncomment this to build the app with debug support */
+Pkg.attrs.profile = "debug";
+
+/* bin/ is a generated directory that 'xdc clean' should remove */
+Pkg.generatedFiles.$add("bin/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+
+//    print("building for target " + targ.name + " ...");
+
+    /* Platforms were added to targ.platforms[] in config.bld */
+    for (var j = 0; j < targ.platforms.length; j++) {
+        var platform = targ.platforms[j];
+
+        // print("  platform:  " + platform);
+        // name = bin/platform/name.x+suffix
+        var name = "bin/" +
+                // replace all ':' and '.' with '_' in platform name
+                platform.replace(/\:/g, "_").replace(/\./g, "_");
+
+        var defines = "";
+        if (platform.match(/^ti\.platforms\.evm6614\:DSP/)) {
+                defines = "-D TCI6614";
+                //defines = "-D TCI6614_v36";
+        }
+        if (platform.match(/^ti\.platform\.simKepler/) ||
+            platform.match(/^ti\.platforms\.simKepler/)) {
+                defines = "-D TCI6638";
+        }
+
+        if (platform.match(/^ti\.platforms\.simKepler/) ||
+            platform.match(/^ti\.platforms\.evm6614\:DSP/)) {
+                Pkg.addExecutable(name + "/messageq_multicore",targ,platform, {
+                    cfgScript: "messageq_multicore",
+                    defs: defines
+                }).addObjects(["messageq_multicore.c"]);
+        }
+
+/*
+        Pkg.addExecutable(name + "/dual_transports",targ,platform, {
+            cfgScript: "dual_transports",
+            defs: defines
+        }).addObjects(["dual_transports.c"]);
+
+        Pkg.addExecutable(name + "/remoteproc_example",targ,platform, {
+            cfgScript: "remoteproc_example",
+        }).addObjects(["remoteproc_example.c"]);
+
+        Pkg.addExecutable(name + "/messageq_multi", targ, platform, {
+            cfgScript: "messageq_common",
+            defs: "-D BENCHMARK " + defines
+        }).addObjects(["messageq_multi.c"]);
+
+        Pkg.addExecutable(name + "/messageq_single", targ, platform, {
+            cfgScript: "messageq_common",
+              defs: "-D BENCHMARK " + defines
+        }).addObjects(["messageq_single.c"]);
+*/
+/*
+        Pkg.addExecutable(name + "/nano_test", targ, platform, {
+            cfgScript: "messageq_common"
+        }).addObjects(["nano_test.c"]);
+*/
+    }
+}
diff --git a/packages/ti/ipc/tests/package.xdc b/packages/ti/ipc/tests/package.xdc
new file mode 100644 (file)
index 0000000..cc03678
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.ipc.tests ========
+ *  Currently not shipping these modules
+ */
+
+package ti.ipc.tests [1,0,0,0] {
+}
diff --git a/packages/ti/ipc/tests/rpmsg_transport.cfg b/packages/ti/ipc/tests/rpmsg_transport.cfg
new file mode 100644 (file)
index 0000000..f0004bf
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+xdc.loadCapsule("messageq_common.cfg.xs");
+
+var MessageQ  = xdc.useModule('ti.sdo.ipc.MessageQ');
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportVirtioSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+var TransportVirtio = xdc.useModule('ti.ipc.transports.TransportVirtio');
diff --git a/packages/ti/ipc/transports/TransportVirtio.c b/packages/ti/ipc/transports/TransportVirtio.c
new file mode 100644 (file)
index 0000000..1befb58
--- /dev/null
@@ -0,0 +1,641 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportVirtio.c ========
+ *
+ *  Notes:
+ *  - The logic in the functions for sending (_put()) and receiving _swiFxn()
+ *    depend on the role (host or slave) the processor is playing in the
+ *    asymmetric virtio I/O.
+ *  - The host always adds *available* buffers to send/receive, while the slave
+ *    always adds *used* buffers to send/receive.
+ *  - The logic is summarized below:
+ *
+ *    Host:
+ *    - Prime vq_host with avail bufs, and kick vq_host so slave can send.
+ *    - To send a buffer to the slave processor:
+ *          allocate a tx buffer, or get_used_buf(vq_slave);
+ *               >> copy data into buf <<
+ *          add_avail_buf(vq_slave);
+ *          kick(vq_slave);
+ *    - To receive buffer from slave processor:
+ *          get_used_buf(vq_host);
+ *              >> empty data from buf <<
+ *          add_avail_buf(vq_host);
+ *          kick(vq_host);
+ *
+ *    Slave:
+ *    - To receive buffer from the host:
+ *          get_avail_buf(vq_slave);
+ *              >> empty data from buf <<
+ *          add_used_buf(vq_slave);
+ *          kick(vq_slave);
+ *    - To send buffer to the host:
+ *          get_avail_buf(vq_host);
+ *              >> copy data into buf <<
+ *          add_used_buf(vq_host);
+ *          kick(vq_host);
+ *
+ */
+
+#include <string.h>
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Main.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+
+#include <ti/sysbios/knl/Swi.h>
+#include <ti/sysbios/gates/GateSwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+
+#include <ti/ipc/rpmsg/virtio_ring.h>
+#include <ti/ipc/rpmsg/Rpmsg.h>
+
+/* TBD: VirtQueue.h needs to live in a common directory, not family specific.*/
+#if defined(OMAPL138)
+#include <ti/ipc/family/omapl138/VirtQueue.h>
+#elif defined(TCI6614)
+#include <ti/ipc/family/tci6614/VirtQueue.h>
+#elif defined(TCI6638)
+#include <ti/ipc/family/tci6638/VirtQueue.h>
+#else
+#error unknown processor!
+#endif
+
+#include <ti/ipc/namesrv/_NameServerRemoteRpmsg.h>
+
+#include "_TransportVirtio.h"
+#include "package/internal/TransportVirtio.xdc.h"
+
+/* TBD: until NameMap built over a new rpmsg API: */
+static VirtQueue_Handle vq_host;
+
+/* Maximum RPMSG payload: */
+#define MAX_PAYLOAD (VirtQueue_RP_MSG_BUF_SIZE - sizeof(Rpmsg_Header))
+
+/* Addresses below this are assumed to be bound to MessageQ objects: */
+#define RPMSG_RESERVED_ADDRESSES     (1024)
+
+/* Name of the rpmsg socket on host: */
+#define RPMSG_SOCKET_NAME  "rpmsg-proto"
+
+#define FXNN "callback_usedBufReady"
+static Void callback_usedBufReady(VirtQueue_Handle vq)
+{
+    Log_print2(Diags_INFO, FXNN": vq %d kicked; VirtQueue_isHost: 0x%x",
+            VirtQueue_getId(vq), VirtQueue_isHost(vq));
+    if (VirtQueue_isHost(vq))  {
+        /* Post a SWI to process all incoming messages */
+        Swi_post(VirtQueue_getSwiHandle(vq));
+    }
+    else {
+        /* Note: We post nothing for vq_slave. */
+       Log_print0(Diags_INFO, FXNN": Not posting SWI");
+    }
+}
+#undef FXNN
+
+
+#define FXNN "callback_availBufReady"
+static Void callback_availBufReady(VirtQueue_Handle vq)
+{
+    Log_print2(Diags_INFO, FXNN": vq %d kicked; VirtQueue_isSlave: 0x%x",
+            VirtQueue_getId(vq), VirtQueue_isSlave(vq));
+    if (VirtQueue_isSlave(vq))  {
+        /* Post a SWI to process all incoming messages */
+        Swi_post(VirtQueue_getSwiHandle(vq));
+    }
+    else {
+       /* Note: We post nothing for vq_host, as we assume the
+        * host has already made all buffers available for slave to send.
+        */
+       Log_print0(Diags_INFO, FXNN": Not posting SWI");
+    }
+}
+#undef FXNN
+
+/* Allocate a buffer for sending: */
+#define FXNN "getTxBuf"
+static Void *getTxBuf(TransportVirtio_Object *obj, VirtQueue_Handle vq)
+{
+        Void     *buf;
+
+        /*
+         * either pick the next unused tx buffer
+         * (half of our buffers are used for sending messages)
+         */
+        if (obj->last_sbuf < VirtQueue_RP_MSG_NUM_BUFS)  {
+           Log_print1(Diags_INFO, FXNN": last_sbuf: %d", obj->last_sbuf);
+           buf = (Char *)obj->sbufs + VirtQueue_RP_MSG_BUF_SIZE * obj->last_sbuf++;
+        }
+        else {
+           /* or recycle a used one */
+           buf = VirtQueue_getUsedBuf(vq);
+        }
+        return (buf);
+}
+#undef FXNN
+
+
+/*  --------------  TEMP NameService over VirtQueue ----------------------- */
+
+/* -------------- TEMP NameService over rpmsg ----------------------- */
+#define FXNN "nameService_register"
+static void nameService_register(UInt16 dstProc, char * name, UInt32 port, enum Rpmsg_nsFlags flags)
+{
+    struct Rpmsg_NsMsg nsMsg;
+    UInt16 len = sizeof(nsMsg);
+    UInt32 dstEndpt = RPMSG_NAMESERVICE_PORT;
+    UInt32 srcEndpt = port;
+    Ptr data = &nsMsg;
+
+    strncpy(nsMsg.name, name, RPMSG_NAME_SIZE);
+    nsMsg.name[RPMSG_NAME_SIZE - 1] = '\0'; /* ensure NULL termination */
+
+    nsMsg.addr = port;
+    nsMsg.flags = flags;
+
+    Log_print3(Diags_INFO, FXNN": %sing service %s on port %d",
+           (IArg)(flags == RPMSG_NS_CREATE? "creat":"destroy"),
+           (IArg)name, (IArg)port);
+    sendRpmsg(dstProc, dstEndpt, srcEndpt, data, len);
+}
+#undef FXNN
+
+void sendRpmsg(UInt16 dstProc, UInt32 dstEndpt, UInt32 srcEndpt,
+              Ptr data, UInt16 len)
+{
+    Int16             token = 0;
+    Rpmsg_Msg             msg;
+    IArg              key;
+
+    if (dstProc != MultiProc_self()) {
+        /* Send to remote processor: */
+        /* Protect vring structs. */
+        key = GateSwi_enter(TransportVirtio_module->gateSwiHandle);
+        token = VirtQueue_getAvailBuf(vq_host, (Void **)&msg);
+        GateSwi_leave(TransportVirtio_module->gateSwiHandle, key);
+
+        if (token >= 0) {
+            /* Copy the payload and set message header: */
+            memcpy(msg->payload, data, len);
+            msg->dataLen = len;
+            msg->dstAddr = dstEndpt;
+            msg->srcAddr = srcEndpt;
+            msg->flags = 0;
+            msg->reserved = 0;
+
+            key = GateSwi_enter(TransportVirtio_module->gateSwiHandle);
+            VirtQueue_addUsedBuf(vq_host, token);
+            VirtQueue_kick(vq_host);
+            GateSwi_leave(TransportVirtio_module->gateSwiHandle, key);
+        }
+        else {
+            System_abort("sendRpmsg: getAvailBuf failed!");
+        }
+    }
+}
+
+
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportVirtio_Instance_init ========
+ *
+ */
+#define FXNN "TransportVirtio_Instance_init"
+Int TransportVirtio_Instance_init(TransportVirtio_Object *obj,
+        UInt16 remoteProcId, const TransportVirtio_Params *params,
+        Error_Block *eb)
+{
+    Bool        flag;
+    Swi_Handle  swiHandle;
+    Swi_Params  swiParams;
+    GateSwi_Params gatePrms;
+    VirtQueue_Params vqParams;
+
+    /* set object fields */
+    obj->priority     = params->priority;
+    obj->remoteProcId = remoteProcId;
+
+    /* From the remoteProcId, we must determine if this Virtio Transport is
+     * acting as host or a slave.
+     */
+#if 0
+    /* Linux side currently assumes HOST is lowest ID core in the system:
+     */
+    if ((MultiProc_self() == MultiProc_getId("HOST")) ||
+         ((remoteProcId != MultiProc_getId("HOST")) &&
+          (MultiProc_self() < remoteProcId)))
+    {
+      /* This processor is Host in pair if it's own ID is the "HOST" id according
+        * to the MultiProc names or if the remote processor is not the host and
+        * the remote processor has an ID greater than its own ID */
+      obj->isHost = TRUE;
+    }
+#else
+    /* Hardcoded below until constraint mentioned above is lifted: */
+    obj->isHost = (MultiProc_self() == MultiProc_getId("HOST"));
+#endif
+
+    Log_print2(Diags_INFO, FXNN": remoteProc: %d, isHost: %d",
+                  obj->remoteProcId, obj->isHost);
+
+    swiHandle = TransportVirtio_Instance_State_swiObj(obj);
+
+    /* construct the Swi to process incoming messages: */
+    Swi_Params_init(&swiParams);
+    swiParams.arg0 = (UArg)obj;
+    Swi_construct(Swi_struct(swiHandle),
+                 (Swi_FuncPtr)TransportVirtio_swiFxn,
+                 &swiParams, eb);
+
+    /* Construct a GateSwi to protect our vrings: */
+    GateSwi_Params_init(&gatePrms);
+    TransportVirtio_module->gateSwiHandle = GateSwi_create(&gatePrms, NULL);
+
+    /*
+     * Create a pair VirtQueues (one for sending, one for receiving).
+     * Note: First one gets an even, second gets odd vq ID.
+     */
+    VirtQueue_Params_init(&vqParams);
+    vqParams.host = obj->isHost;
+    vqParams.swiHandle = swiHandle;
+    vqParams.intVectorId = params->intVectorId;
+    if (obj->isHost)  {
+      vqParams.callback = (Fxn) callback_usedBufReady;
+    }
+    else {
+      vqParams.callback = (Fxn) callback_availBufReady;
+    }
+
+    vq_host = obj->vq_host = (Ptr)VirtQueue_create(remoteProcId, &vqParams, eb);
+    obj->vq_slave  = (Ptr)VirtQueue_create(remoteProcId, &vqParams, eb);
+
+    if (obj->isHost)  {
+#if 0  /* This code is broken for multicore, and case where obj->isHost */
+       /* Initialize fields used by getTxBuf(): */
+            obj->sbufs = (Char *)buf_addr + VirtQueue_RP_MSG_NUM_BUFS * VirtQueue_RP_MSG_BUF_SIZE;
+        obj->last_sbuf = 0;
+
+       /* Host needs to prime his vq with some buffers for receiving: */
+       for (i = 0; i < VirtQueue_RP_MSG_NUM_BUFS; i++) {
+            VirtQueue_addAvailBuf(obj->vq_host,
+                                  ((Char *)buf_addr + i * VirtQueue_RP_MSG_BUF_SIZE));
+       }
+       VirtQueue_kick(obj->vq_host);
+#else
+       Assert_isTrue(FALSE, NULL);
+#endif
+    }
+
+    /* Plug Vring Interrupts, and wait for host ready to recv kick: */
+    VirtQueue_startup(remoteProcId, obj->isHost);
+
+    /* Announce our "MessageQ" service to other side: */
+    nameService_register(remoteProcId, RPMSG_SOCKET_NAME, RPMSG_MESSAGEQ_PORT,
+                         RPMSG_NS_CREATE);
+
+    /* Register the transport with MessageQ */
+    flag = ti_sdo_ipc_MessageQ_registerTransport(
+        TransportVirtio_Handle_upCast(obj), remoteProcId, params->priority);
+
+    if (flag == FALSE) {
+        return (2);
+    }
+
+    return (0);
+}
+#undef FXNN
+
+/*
+ *  ======== TransportVirtio_Instance_finalize ========
+ */
+#define FXNN "TransportVirtio_Instance_finalize"
+Void TransportVirtio_Instance_finalize(TransportVirtio_Object *obj, Int status)
+{
+    Swi_Handle  swiHandle;
+
+    Log_print0(Diags_ENTRY, "--> "FXNN);
+
+
+    /* Announce our "MessageQ" service is going away: */
+    nameService_register(obj->remoteProcId, RPMSG_SOCKET_NAME,
+                         RPMSG_MESSAGEQ_PORT, RPMSG_NS_DESTROY);
+
+    /* Destruct the swi */
+    swiHandle = TransportVirtio_Instance_State_swiObj(obj);
+    if (swiHandle != NULL) {
+      Swi_destruct(Swi_struct(swiHandle));
+    }
+
+    GateSwi_delete(&(TransportVirtio_module->gateSwiHandle));
+
+    /* Delete the VirtQueue instance */
+    if (obj->isHost) {
+       VirtQueue_delete(obj->vq_slave);
+    }
+    else{
+       VirtQueue_delete(obj->vq_host);
+    }
+
+    switch(status) {
+        case 0: /* MessageQ_registerTransport succeeded */
+            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId,
+                obj->priority);
+
+            /* fall thru OK */
+        case 1: /* NOT USED: Notify_registerEventSingle failed */
+        case 2: /* MessageQ_registerTransport failed */
+            break;
+    }
+#undef FXNN
+}
+
+/*
+ *  ======== TransportVirtio_put ========
+ *
+ *  Notes: In keeping with the semantics of IMessageQTransport_put(), we
+ *  simply return FALSE if the remote proc has made no buffers available in the
+ *  vring.
+ *  Otherwise, we could block here, waiting for the remote proc to add a buffer.
+ *  This implies that the remote proc must always have buffers available in the
+ *  vring in order for this side to send without failing!
+ *
+ *  Also, this is a copy-transport, to match the Linux side rpmsg.
+ */
+#define FXNN "TransportVirtio_put"
+Bool TransportVirtio_put(TransportVirtio_Object *obj, Ptr msg)
+{
+    Int          status = MessageQ_S_SUCCESS;
+    UInt         msgSize;
+    Int16        token = (-1);
+    IArg         key;
+    Rpmsg_Msg    rpMsg = NULL;
+
+    Log_print1(Diags_ENTRY, "--> "FXNN": Entered: isHost: %d",
+                 obj->isHost);
+
+    /* Send to remote processor: */
+    key = GateSwi_enter(TransportVirtio_module->gateSwiHandle);
+    if (obj->isHost)  {
+       rpMsg = getTxBuf(obj, obj->vq_slave);
+    }
+    else {
+       token = VirtQueue_getAvailBuf(obj->vq_host, (Void **)&rpMsg);
+    }
+    GateSwi_leave(TransportVirtio_module->gateSwiHandle, key);
+
+    if ((obj->isHost && rpMsg) || token >= 0) {
+        /* Assert msg->msgSize <= vring's max fixed buffer size */
+        msgSize = MessageQ_getMsgSize(msg);
+
+        Assert_isTrue(msgSize <= MAX_PAYLOAD, NULL);
+
+        /* Copy the payload and set message header: */
+        memcpy(rpMsg->payload, (Ptr)msg, msgSize);
+        rpMsg->dataLen  = msgSize;
+        rpMsg->dstAddr  = (((MessageQ_Msg)msg)->dstId & 0x0000FFFF);
+        rpMsg->srcAddr  = RPMSG_MESSAGEQ_PORT;
+        rpMsg->flags    = 0;
+        rpMsg->reserved = 0;
+
+        /* free the app's message */
+        if (((MessageQ_Msg)msg)->heapId != ti_sdo_ipc_MessageQ_STATICMSG) {
+            MessageQ_free(msg);
+        }
+
+        Log_print4(Diags_INFO, FXNN": sending rpMsg: 0x%x from: %d, "
+                   "to: %d, dataLen: %d",
+                  (IArg)rpMsg, (IArg)rpMsg->srcAddr, (IArg)rpMsg->dstAddr,
+                  (IArg)rpMsg->dataLen);
+
+        key = GateSwi_enter(TransportVirtio_module->gateSwiHandle);
+        if (obj->isHost)  {
+            VirtQueue_addAvailBuf(obj->vq_slave, rpMsg);
+            VirtQueue_kick(obj->vq_slave);
+        }
+        else {
+            VirtQueue_addUsedBuf(obj->vq_host, token);
+            VirtQueue_kick(obj->vq_host);
+        }
+        GateSwi_leave(TransportVirtio_module->gateSwiHandle, key);
+    }
+    else {
+        status = MessageQ_E_FAIL;
+        Log_print1(Diags_STATUS, FXNN": %s failed!",
+                      (IArg)(obj->isHost? "getTxBuf" : "getAvailBuf"));
+    }
+
+    return (status == MessageQ_S_SUCCESS? TRUE: FALSE);
+}
+#undef FXNN
+
+/*
+ *  ======== TransportVirtio_control ========
+ */
+Bool TransportVirtio_control(TransportVirtio_Object *obj, UInt cmd,
+    UArg cmdArg)
+{
+    return (FALSE);
+}
+
+/*
+ *  ======== TransportVirtio_getStatus ========
+ */
+Int TransportVirtio_getStatus(TransportVirtio_Object *obj)
+{
+    return (0);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportVirtio_swiFxn ========
+ *
+ */
+#define FXNN "TransportVirtio_swiFxn"
+Void TransportVirtio_swiFxn(UArg arg0, UArg arg1)
+{
+    Int16             token;
+    Bool              bufAdded = FALSE;
+    UInt32            queueId;
+    MessageQ_Msg      msg;
+    MessageQ_Msg      buf = NULL;
+    Rpmsg_Msg         rpMsg;
+    UInt              msgSize;
+    TransportVirtio_Object      *obj;
+    Bool              buf_avail = FALSE;
+    Rpmsg_NsMsg       * nsMsg; /* Name Service Message */
+    NameServerRemote_Msg * nsrMsg;  /* Name Server Message */
+    Int               nsPort = NAME_SERVER_PORT_INVALID;
+
+    Log_print0(Diags_ENTRY, "--> "FXNN);
+
+    obj = (TransportVirtio_Object *)arg0;
+
+    /* Process all available buffers: */
+    if (obj->isHost)  {
+        rpMsg = VirtQueue_getUsedBuf(obj->vq_host);
+        buf_avail = (rpMsg != NULL);
+    }
+    else {
+        token = VirtQueue_getAvailBuf(obj->vq_slave, (Void **)&rpMsg);
+        buf_avail = (token >= 0);
+    }
+
+    while (buf_avail) {
+        Log_print4(Diags_INFO, FXNN": \n\tReceived rpMsg: 0x%x from: %d, "
+                   "to: %d, dataLen: %d",
+                  (IArg)rpMsg, (IArg)rpMsg->srcAddr, (IArg)rpMsg->dstAddr,
+                  (IArg)rpMsg->dataLen);
+
+        /* See if this is an rpmsg ns announcment... : */
+        if (rpMsg->dstAddr != RPMSG_MESSAGEQ_PORT) {
+            if (rpMsg->dstAddr == RPMSG_NAMESERVICE_PORT) {
+                nsMsg = (Rpmsg_NsMsg *)rpMsg->payload;
+                Log_print3(Diags_USER1, FXNN": ns announcement "
+                  "from %d: %s, flag: %s\n",
+                  nsMsg->addr, (IArg)nsMsg->name,
+                  (IArg)(nsMsg->flags == RPMSG_NS_CREATE? "create":"destroy"));
+                /* ... and if it is from our rpmsg-proto socket, save
+                 * the rpmsg src address as the NameServer reply address:
+                 */
+                if (!strcmp(nsMsg->name, RPMSG_SOCKET_NAME) &&
+                    rpMsg->srcAddr == NAME_SERVER_RPMSG_ADDR) {
+                    if (nsMsg->flags == RPMSG_NS_CREATE) {
+                        nsPort = NAME_SERVER_RPMSG_ADDR;
+                    }
+                    else if (nsMsg->flags  == RPMSG_NS_DESTROY) {
+                        nsPort = NAME_SERVER_PORT_INVALID;
+                    }
+                    NameServerRemote_SetNameServerPort(nsPort);
+                }
+            }
+            goto skip;
+        }
+        else if (rpMsg->srcAddr >= RPMSG_RESERVED_ADDRESSES) {
+            /*
+             * This could either be a NameServer request or a MessageQ.
+             * Check the NameServerRemote_Msg reserved field to distinguish.
+             */
+            nsrMsg = (NameServerRemote_Msg *)rpMsg->payload;
+            if (nsrMsg->reserved == NAMESERVER_MSG_TOKEN) {
+                /* Process the NameServer request/reply message: */
+                NameServerRemote_processMessage(nsrMsg);
+                goto skip;
+            }
+        }
+
+        /* Convert Rpmsg payload into a MessageQ_Msg: */
+        msg = (MessageQ_Msg)rpMsg->payload;
+
+        Log_print4(Diags_INFO, FXNN": \n\tmsg->heapId: %d, "
+                   "msg->msgSize: %d, msg->dstId: %d, msg->msgId: %d\n",
+                   msg->heapId, msg->msgSize, msg->dstId, msg->msgId);
+
+        /* Alloc a message from msg->heapId to copy the msg */
+        msgSize = MessageQ_getMsgSize(msg);
+        buf = MessageQ_alloc(msg->heapId, msgSize);
+
+        /* Make sure buf is not NULL */
+        Assert_isTrue(buf != NULL, NULL);
+
+        /* copy the message to the buffer allocated. */
+        memcpy((Ptr)buf, (Ptr)msg, msgSize);
+
+        /*
+         * If the message received was statically allocated, reset the
+         * heapId, so the app can free it.
+         */
+         if (msg->heapId == ti_sdo_ipc_MessageQ_STATICMSG)  {
+             msg->heapId = 0;  /* for a copy transport, heap id is 0. */
+         }
+
+        /* get the queue id */
+        queueId = MessageQ_getDstQueue(msg);
+
+        /* Pass to destination queue: */
+        MessageQ_put(queueId, buf);
+
+skip:
+        if (obj->isHost)  {
+            VirtQueue_addAvailBuf(obj->vq_host, rpMsg);
+        }
+        else {
+            VirtQueue_addUsedBuf(obj->vq_slave, token);
+        }
+        bufAdded = TRUE;
+
+        /* See if there is another one: */
+        if (obj->isHost)  {
+            rpMsg = VirtQueue_getUsedBuf(obj->vq_host);
+            buf_avail = (rpMsg != NULL);
+        }
+        else {
+            token = VirtQueue_getAvailBuf(obj->vq_slave, (Void **)&rpMsg);
+            buf_avail = (token >= 0);
+        }
+    }
+
+    if (bufAdded)  {
+       /* Tell host/slave we've processed the buffers: */
+       VirtQueue_kick(obj->isHost? obj->vq_host: obj->vq_slave);
+    }
+    Log_print0(Diags_EXIT, "<-- "FXNN);
+}
+
+/*
+ *  ======== TransportVirtio_setErrFxn ========
+ */
+Void TransportVirtio_setErrFxn(TransportVirtio_ErrFxn errFxn)
+{
+    /* Ignore the errFxn */
+}
diff --git a/packages/ti/ipc/transports/TransportVirtio.xdc b/packages/ti/ipc/transports/TransportVirtio.xdc
new file mode 100644 (file)
index 0000000..5c01038
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportVirtio.xdc ================
+ */
+
+import ti.sysbios.knl.Swi;
+import ti.sysbios.gates.GateSwi;
+
+/*!
+ *  ======== TransportVirtio ========
+ *  Transport for MessageQ that uses vring structures.
+ *
+ *  This is a {@link ti.sdo.ipc.MessageQ} transport that utilizes
+ *  a pair of vrings (see Linux virtio) to communicate with a remote processor.
+ *
+ */
+
+@InstanceFinalize
+@InstanceInitError
+
+
+module TransportVirtio inherits ti.sdo.ipc.interfaces.IMessageQTransport
+{
+
+instance:
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Address in shared memory where this instance will be placed
+     *
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== intVectorId ========
+     *  Interrupt vector ID to be used by the driver.
+     *
+     *  This parameter is only used by C64x+ targets
+     */
+    config UInt intVectorId = ~1u;
+
+internal:
+
+    /*!
+     *  ======== swiFxn ========
+     */
+    Void swiFxn(UArg arg0, UArg arg1);
+
+    struct Module_State
+    {
+        GateSwi.Handle gateSwiHandle;
+    }
+
+    /*! Instance state structure */
+    struct Instance_State {
+        UInt16       priority;           /* priority to register             */
+        UInt16       remoteProcId;       /* dst proc id                      */
+        Bool         isHost;             /* self proc id acts as a host.     */
+        Swi.Object   swiObj;             /* Each instance has a swi          */
+        Ptr          vq_slave;           /* Slave's VirtQueue Handle         */
+        Ptr          vq_host;            /* Host's VirtQueue Handle          */
+        Ptr          sbufs;              /* Buffers for sending              */
+        UInt16       last_sbuf;          /* Index of last send buffer used   */
+    }
+}
diff --git a/packages/ti/ipc/transports/TransportVirtio.xs b/packages/ti/ipc/transports/TransportVirtio.xs
new file mode 100644 (file)
index 0000000..e8a4872
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportVirtio.xs ================
+ */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    var TransportVirtio = this;
+    xdc.useModule("ti.sdo.utils.MultiProc");
+    xdc.useModule("ti.sdo.ipc.MessageQ");
+    xdc.useModule("ti.sysbios.knl.Swi");
+    xdc.useModule("ti.ipc.transports.TransportVirtioSetup");
+    xdc.loadPackage("ti.ipc.namesrv");
+
+    if (Program.cpu.deviceName == "OMAPL138") {
+        xdc.useModule("ti.ipc.family.omapl138.VirtQueue");
+    }
+    else if (Program.platformName.match(/6614/)) {
+        xdc.useModule("ti.ipc.family.tci6614.VirtQueue");
+    }
+    else if (Program.platformName.match(/Kepler/)) {
+        xdc.useModule("ti.ipc.family.tci6638.VirtQueue");
+    }
+    else
+    {
+        print("TransportVirtio.xs: Did not match any platform!");
+    }
+}
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+  /* Init Virtio Transport params */
+  mod.gateSwiHandle = null;
+}
diff --git a/packages/ti/ipc/transports/TransportVirtioSetup.c b/packages/ti/ipc/transports/TransportVirtioSetup.c
new file mode 100644 (file)
index 0000000..e235703
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportVirtioSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Diags.h>
+
+#include <ti/ipc/transports/TransportVirtio.h>
+
+#include "package/internal/TransportVirtioSetup.xdc.h"
+
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/*
+ *  ======== TransportVirtioSetup_attach ========
+ */
+Int TransportVirtioSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    TransportVirtio_Handle handle;
+    TransportVirtio_Params params;
+    Int status = MessageQ_E_FAIL;
+    Error_Block eb;
+
+    Log_print1(Diags_INFO, "TransportVirtioSetup_attach: remoteProcId: %d",
+                   remoteProcId);
+
+    Error_init(&eb);
+
+    /* init the transport parameters */
+    TransportVirtio_Params_init(&params);
+    params.intVectorId     = TransportVirtioSetup_dspIntVectId;
+    params.sharedAddr = sharedAddr;  /* Not used yet */
+
+    handle = TransportVirtio_create(remoteProcId, &params, &eb);
+
+    if (handle != NULL) {
+       TransportVirtioSetup_module->handles[remoteProcId] = handle;
+       status = MessageQ_S_SUCCESS;
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== TransportVirtioSetup_detach ========
+ */
+Int TransportVirtioSetup_detach(UInt16 remoteProcId)
+{
+    TransportVirtio_Handle handle;
+
+    System_printf("TransportVirtioSetup_detach: remoteProcId: %d\n",
+                   remoteProcId);
+
+    handle = TransportVirtioSetup_module->handles[remoteProcId];
+
+    /* Trying to detach an un-attached processor should fail */
+    if (handle == NULL) {
+        return (MessageQ_E_FAIL);
+    }
+
+    /* Unregister the instance */
+    TransportVirtioSetup_module->handles[remoteProcId] = NULL;
+
+    TransportVirtio_delete(&handle);
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== TransportVirtioSetup_isRegistered ========
+ */
+Bool TransportVirtioSetup_isRegistered(UInt16 remoteProcId)
+{
+    Bool registered;
+
+    registered = (TransportVirtioSetup_module->handles[remoteProcId] != NULL);
+
+    return (registered);
+}
diff --git a/packages/ti/ipc/transports/TransportVirtioSetup.xdc b/packages/ti/ipc/transports/TransportVirtioSetup.xdc
new file mode 100644 (file)
index 0000000..032c80e
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportVirtioSetup.xdc ========
+ */
+
+/*!
+ *  ======== TransportVirtioSetup ========
+ *  Manages the setup of TransportVirtio instances.
+ *
+ *  create or open the TransportVirtio for each pair of devices.
+ */
+
+module TransportVirtioSetup inherits ti.sdo.ipc.interfaces.ITransportSetup
+{
+
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 0;  /* Used where interrupts used vs mailboxes */
+
+internal:
+
+    /* Module Status object */
+    struct Module_State {
+        TransportVirtio.Handle handles[]; /* handle per remote proc */
+    }
+}
diff --git a/packages/ti/ipc/transports/TransportVirtioSetup.xs b/packages/ti/ipc/transports/TransportVirtioSetup.xs
new file mode 100644 (file)
index 0000000..eef1ec5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportVirtioSetup.xs ========
+ */
+
+var TransportVirtioSetup = null;
+var TransportVirtio      = null;
+var MultiProc            = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportVirtioSetup = this;
+    TransportVirtio =
+            xdc.useModule("ti.ipc.transports.TransportVirtio");
+    MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* set the length of handles to the number of processors */
+    mod.handles.length = MultiProc.numProcessors;
+
+    /* init the remote processor handles to null */
+    for (var i=0; i < mod.handles.length; i++) {
+        mod.handles[i] = null;
+    }
+}
diff --git a/packages/ti/ipc/transports/_TransportVirtio.h b/packages/ti/ipc/transports/_TransportVirtio.h
new file mode 100644 (file)
index 0000000..282a9ce
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 _TransportVirtio__include
+#define _TransportVitio__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* That special per processor RPMSG channel reserved to multiplex MessageQ */
+#define RPMSG_MESSAGEQ_PORT         61
+#define NAME_SERVER_RPMSG_ADDR      0
+
+extern void sendRpmsg(UInt16 dstProc, UInt32 dstEndpt, UInt32 srcEndpt,
+              Ptr data, UInt16 len);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* _TransportVitio__include */
diff --git a/packages/ti/ipc/transports/package.bld b/packages/ti/ipc/transports/package.bld
new file mode 100644 (file)
index 0000000..c217aae
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/*
+ * This package distributes its sources in the default release.  This is to
+ * enable better understanding by the customer/field, as well as enable
+ * modification and profiling techniques in the field.
+ */
+Pkg.attrs.exportSrc = true;
+
+Pkg.otherFiles = ["package.bld", "_TransportVirtio.h"];
+
+var SRCS = ["TransportVirtioSetup.c", "TransportVirtio.c"];
+
+/* remove this output directory during a clean */
+Pkg.generatedFiles.$add("lib/");
+
+for (var i = 0; i < Build.targets.length; i++) {
+    var targ = Build.targets[i];
+    var isaDefs = "";
+
+    /* Yuck, yuck, yuck! */
+    if (targ.isa == "674") {
+        isaDefs = "-DOMAPL138";
+// OMAP4 not yet supported
+//    } else if ((targ.isa == "v7M") || (targ.isa == "64T")) {
+//        isaDefs = "-DOMAP4430";
+    } else if (targ.isa == "66") {
+        /* TBD: Only one of Appleton or Kepler can build for now: */
+        isaDefs = "-DTCI6638";
+        //isaDefs = "-DTCI6614";
+    } else {
+        continue;
+    }
+
+    /* Build for all profiles */
+    for (var profile in targ.profiles) {
+
+        Pkg.addLibrary("lib/" + profile + "/" + Pkg.name, targ, {
+            profile: profile,
+            copts: "--gcc",   /* b/c Rpmsg.h requires gcc-isms */
+            defs: isaDefs
+        }).addObjects(SRCS);
+    }
+}
diff --git a/packages/ti/ipc/transports/package.xdc b/packages/ti/ipc/transports/package.xdc
new file mode 100644 (file)
index 0000000..f114a4d
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.ipc.transports ========
+ */
+
+package ti.ipc.transports [1,0,0,0] {
+    module    TransportVirtio;
+    module    TransportVirtioSetup;
+}
diff --git a/packages/ti/ipc/transports/package.xs b/packages/ti/ipc/transports/package.xs
new file mode 100644 (file)
index 0000000..9c00a9d
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        /* no matching lib found in this package, return "" */
+        $trace("Unable to locate a compatible library, returning none.",
+                1, ['getLibs']);
+        return ("");
+    }
+
+    /* the location of the libraries are in lib/<profile>/* */
+    var name = this.$name + ".a" + suffix;
+    var lib = "lib/" + this.profile + "/" + name;
+
+
+    /*
+     * If the requested profile doesn't exist, we return the 'release' library.
+     */
+    if (!java.io.File(this.packageBase + lib).exists()) {
+        $trace("Unable to locate lib for requested '" + this.profile +
+                "' profile.  Using 'release' profile.", 1, ['getLibs']);
+        lib = "lib/release/" + name;
+    }
+
+    return (lib);
+}
diff --git a/packages/ti/sdo/ipc/Build.xdc b/packages/ti/sdo/ipc/Build.xdc
new file mode 100644 (file)
index 0000000..d0cf318
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== Build.xdc ========
+ *  metaonly module to support building various package/product libraries
+ *
+ */
+
+/*!
+ *  ======== Build ========
+ */
+
+@Template("./Build.xdt")
+metaonly module Build
+{
+
+    /*!
+     *  ======== libDir ========
+     */
+    metaonly config String libDir = null;
+
+    /*!
+     *  ======== getDefs ========
+     *  Get the compiler -D options necessary to build
+     */
+    metaonly String getDefs();
+
+    /*!
+     *  ======== getCFiles ========
+     *  Get the library C source files.
+     */
+    metaonly String getCFiles(String target);
+
+    /*!
+     *  ======== getAsmFiles ========
+     *  Get the library Asm source files.
+     */
+    metaonly Any getAsmFiles(String target);
+
+    /*
+     *  ======== buildLibs ========
+     *  This function generates the makefile goals for the libraries
+     *  produced by a ti.sysbios package.
+     */
+    function buildLibs(objList, relList, filter, xdcArgs);
+
+    /*!
+     *  ======== getLibs ========
+     *  Common getLibs() for all ipc packages.
+     */
+    function getLibs(pkg);
+}
diff --git a/packages/ti/sdo/ipc/Build.xdt b/packages/ti/sdo/ipc/Build.xdt
new file mode 100644 (file)
index 0000000..002749d
--- /dev/null
@@ -0,0 +1,68 @@
+%%{
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%/*
+% *  ======== Build.xdt ========
+% */
+%var BIOS = xdc.module("ti.sysbios.BIOS");
+%var Build = xdc.module("ti.sdo.ipc.Build");
+%if (BIOS.libType == BIOS.LibType_Custom) {
+%%{
+    /* get the specified output directory (saved when BIOS was "used") */
+    var outputDir = this.$private.outputDir;
+
+    /* generate makefile from makefile.xdt
+     *    $args[0] = the RTSC target, so the makefile knows how to run the
+     *               compiler and archiver
+     */
+    print("generating custom ti.sdo.ipc library makefile ... ");
+%%}
+
+%if (Program.build.target.$name.match(/gnu/) &&
+%    (Program.build.target.name.match(/A15/) ||
+%     Program.build.target.name.match(/A9/)  ||
+%     Program.build.target.name.match(/A8/))) {
+%%{
+    var tplt = xdc.loadTemplate(this.$package.packageBase + "/makefile_gccArmLto.xdt");
+%%}
+%}
+%else {
+%%{
+    var tplt = xdc.loadTemplate(this.$package.packageBase + "/makefile.xdt");
+%%}
+%}
+
+%%{
+    tplt.genFile(outputDir + "/makefile", this, [Program.build.target]);
+%%}
+%}
diff --git a/packages/ti/sdo/ipc/Build.xs b/packages/ti/sdo/ipc/Build.xs
new file mode 100644 (file)
index 0000000..e0aca19
--- /dev/null
@@ -0,0 +1,675 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== Build.xs ========
+ */
+
+var BIOS = null;
+var Build = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    BIOS = xdc.module("ti.sysbios.BIOS");
+    Build = this;
+
+    /* inform getLibs() about location of library */
+    switch (BIOS.libType) {
+        case BIOS.LibType_Instrumented:
+            this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
+            this.$private.outputDir = this.$package.packageBase + "lib/"
+                        + (BIOS.smpEnabled ? "smpipc/instrumented/" : "ipc/instrumented/");
+            break;
+
+        case BIOS.LibType_NonInstrumented:
+            this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
+            this.$private.outputDir = this.$package.packageBase + "lib/"
+                        + (BIOS.smpEnabled ? "smpipc/nonInstrumented/" : "ipc/nonInstrumented/");
+            break;
+
+        case BIOS.LibType_Custom:
+            this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
+            var SourceDir = xdc.useModule("xdc.cfg.SourceDir");
+            /* if building a pre-built library */
+            if (BIOS.buildingAppLib == false) {
+                var appName = Program.name.substring(0, Program.name.lastIndexOf('.'));
+                this.$private.libDir = this.$package.packageBase + Build.libDir;
+                if (!java.io.File(this.$private.libDir).exists()) {
+                    java.io.File(this.$private.libDir).mkdir();
+                }
+            }
+            /*
+             * If building an application in CCS or package.bld world
+             * and libDir has been specified
+             */
+            if ((BIOS.buildingAppLib == true) && (Build.libDir !== null)) {
+                SourceDir.outputDir = Build.libDir;
+                var src = SourceDir.create("ipc");
+                src.libraryName = this.$private.libraryName.substring(1);
+                this.$private.outputDir = src.getGenSourceDir();
+            }
+            else {
+                var curPath = java.io.File(".").getCanonicalPath();
+                /* If package.bld world AND building an application OR pre-built lib */
+                if (java.io.File(curPath).getName() != "configPkg") {
+                    var appName = Program.name.substring(0, Program.name.lastIndexOf('.'));
+                    appName = appName + "_p" + Program.build.target.suffix + ".src";
+                    SourceDir.outputDir = "package/cfg/" + appName;
+                    SourceDir.toBuildDir = ".";
+                    var src = SourceDir.create("ipc");
+                    src.libraryName = this.$private.libraryName.substring(1);
+                    this.$private.outputDir = src.getGenSourceDir();
+                }
+                /* Here ONLY if building an application in CCS world */
+                else {
+                    /* request output source directory for generated files */
+                    var appName = Program.name.substring(0, Program.name.lastIndexOf('.'));
+                    appName = appName + "_" + Program.name.substr(Program.name.lastIndexOf('.')+1);
+                    SourceDir.toBuildDir = "..";
+                    var src = SourceDir.create("ipc/");
+                    src.libraryName = this.$private.libraryName.substring(1);
+
+                    /* save this directory in our private state (to be read during
+                    * generation, see Gen.xdt)
+                    */
+                    this.$private.outputDir = src.getGenSourceDir();
+                }
+            }
+            break;
+    }
+}
+
+/*
+ * Add pre-built Instrumented and Non-Intrumented release libs
+ */
+
+var ipcSources  =  "ipc/GateMP.c " +
+                   "ipc/ListMP.c " +
+                   "ipc/SharedRegion.c " +
+                   "ipc/MessageQ.c " +
+                   "ipc/Notify.c ";
+
+var gatesSources = "ipc/gates/GatePeterson.c " +
+                   "ipc/gates/GatePetersonN.c " +
+                   "ipc/gates/GateMPSupportNull.c ";
+
+var heapsSources = "ipc/heaps/HeapBufMP.c " +
+                   "ipc/heaps/HeapMemMP.c " +
+                   "ipc/heaps/HeapMultiBufMP.c ";
+
+var notifyDriverSources =
+                   "ipc/notifyDrivers/NotifyDriverCirc.c " +
+                   "ipc/notifyDrivers/NotifySetupNull.c " +
+                   "ipc/notifyDrivers/NotifyDriverShm.c ";
+
+var nsremoteSources =
+                   "ipc/nsremote/NameServerRemoteNotify.c " +
+                   "ipc/nsremote/NameServerMessageQ.c ";
+
+var transportsSources =
+                   "ipc/transports/TransportShm.c " +
+                   "ipc/transports/TransportShmCircSetup.c " +
+                   "ipc/transports/TransportShmNotifySetup.c " +
+                   "ipc/transports/TransportShmCirc.c " +
+                   "ipc/transports/TransportShmNotify.c " +
+                   "ipc/transports/TransportShmSetup.c " +
+                   "ipc/transports/TransportNullSetup.c " ;
+
+var utilsSources = "utils/MultiProc.c " +
+                   "utils/List.c " +
+                   "utils/NameServerRemoteNull.c " +
+                   "utils/NameServer.c ";
+
+var commonSources = ipcSources +
+                    gatesSources +
+                    heapsSources +
+                    notifyDriverSources +
+                    nsremoteSources +
+                    transportsSources +
+                    utilsSources;
+
+var C64PSources  =
+                   "ipc/gates/GateAAMonitor.c " +
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/gates/GateHWSem.c " +
+                   "ipc/family/dm6446/NotifySetup.c " +
+                   "ipc/family/dm6446/NotifyCircSetup.c " +
+                   "ipc/family/dm6446/InterruptDsp.c " +
+                   "ipc/family/omap3530/NotifySetup.c " +
+                   "ipc/family/omap3530/NotifyCircSetup.c " +
+                   "ipc/family/omap3530/InterruptDsp.c ";
+
+var C66Sources   = "ipc/gates/GateHWSem.c " +
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/tci663x/Interrupt.c " +
+                   "ipc/family/tci663x/MultiProcSetup.c " +
+                   "ipc/family/tci663x/NotifyCircSetup.c " +
+                   "ipc/family/tci663x/NotifySetup.c " +
+                   "ipc/family/vayu/InterruptDsp.c " +
+                   "ipc/family/vayu/NotifySetup.c ";
+
+var C674Sources  =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/da830/NotifySetup.c " +
+                   "ipc/family/da830/NotifyCircSetup.c " +
+                   "ipc/family/da830/InterruptDsp.c " +
+                   "ipc/family/arctic/NotifySetup.c " +
+                   "ipc/family/arctic/NotifyCircSetup.c " +
+                   "ipc/family/arctic/InterruptDsp.c " +
+                   "ipc/family/ti81xx/NotifySetup.c " +
+                   "ipc/family/ti81xx/NotifyCircSetup.c " +
+                   "ipc/family/ti81xx/InterruptDsp.c " +
+                   "ipc/family/ti81xx/NotifyMbxSetup.c " +
+                   "ipc/family/ti81xx/NotifyDriverMbx.c " +
+                   "ipc/family/c6a8149/NotifySetup.c " +
+                   "ipc/family/c6a8149/NotifyCircSetup.c " +
+                   "ipc/family/c6a8149/InterruptDsp.c " +
+                   "ipc/family/c6a8149/NotifyMbxSetup.c " +
+                   "ipc/family/c6a8149/NotifyDriverMbx.c ";
+
+
+var C647xSources = "ipc/family/c647x/Interrupt.c " +
+                   "ipc/family/c647x/NotifyCircSetup.c " +
+                   "ipc/family/c647x/MultiProcSetup.c " +
+                   "ipc/family/c647x/NotifySetup.c ";
+
+var C64TSources  =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/omap4430/NotifyCircSetup.c " +
+                   "ipc/family/omap4430/NotifySetup.c " +
+                   "ipc/family/omap4430/InterruptDsp.c ";
+
+var C28Sources   = "ipc/family/f28m35x/NotifyDriverCirc.c " +
+                   "ipc/family/f28m35x/IpcMgr.c " +
+                   "ipc/family/f28m35x/TransportCirc.c " +
+                   "ipc/family/f28m35x/NameServerBlock.c ";
+
+var M3Sources    =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/omap4430/NotifySetup.c " +
+                   "ipc/family/omap4430/NotifyCircSetup.c " +
+                   "ipc/family/omap4430/InterruptDucati.c " +
+                   "ipc/family/ti81xx/NotifySetup.c " +
+                   "ipc/family/ti81xx/NotifyCircSetup.c " +
+                   "ipc/family/ti81xx/InterruptDucati.c " +
+                   "ipc/family/ti81xx/NotifyMbxSetup.c " +
+                   "ipc/family/ti81xx/NotifyDriverMbx.c " +
+                   "ipc/family/c6a8149/NotifySetup.c " +
+                   "ipc/family/c6a8149/NotifyCircSetup.c " +
+                   "ipc/family/c6a8149/InterruptDucati.c " +
+                   "ipc/family/c6a8149/NotifyMbxSetup.c " +
+                   "ipc/family/c6a8149/NotifyDriverMbx.c " +
+                   "ipc/family/f28m35x/IpcMgr.c " +
+                   "ipc/family/f28m35x/NotifyDriverCirc.c " +
+                   "ipc/family/f28m35x/TransportCirc.c " +
+                   "ipc/family/f28m35x/NameServerBlock.c " +
+                   "ipc/family/vayu/InterruptIpu.c " +
+                   "ipc/family/vayu/NotifySetup.c ";
+
+var M4Sources    =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/vayu/InterruptIpu.c " +
+                   "ipc/family/vayu/NotifySetup.c ";
+
+var Arm9Sources  = "ipc/family/dm6446/NotifySetup.c " +
+                   "ipc/family/dm6446/NotifyCircSetup.c " +
+                   "ipc/family/dm6446/InterruptArm.c " +
+                   "ipc/family/da830/NotifySetup.c " +
+                   "ipc/family/da830/NotifyCircSetup.c " +
+                   "ipc/family/da830/InterruptArm.c ";
+
+var A8FSources   =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/ti81xx/NotifySetup.c " +
+                   "ipc/family/ti81xx/NotifyCircSetup.c " +
+                   "ipc/family/ti81xx/InterruptHost.c " +
+                   "ipc/family/ti81xx/NotifyMbxSetup.c " +
+                   "ipc/family/ti81xx/NotifyDriverMbx.c " +
+                   "ipc/family/c6a8149/NotifySetup.c " +
+                   "ipc/family/c6a8149/NotifyCircSetup.c " +
+                   "ipc/family/c6a8149/InterruptHost.c " +
+                   "ipc/family/c6a8149/NotifyMbxSetup.c " +
+                   "ipc/family/c6a8149/NotifyDriverMbx.c " +
+                   "ipc/family/omap3530/NotifySetup.c " +
+                   "ipc/family/omap3530/NotifyCircSetup.c " +
+                   "ipc/family/omap3530/InterruptHost.c ";
+
+var A8gSources  =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/ti81xx/NotifySetup.c " +
+                   "ipc/family/ti81xx/NotifyCircSetup.c " +
+                   "ipc/family/ti81xx/InterruptHost.c " +
+                   "ipc/family/ti81xx/NotifyMbxSetup.c " +
+                   "ipc/family/ti81xx/NotifyDriverMbx.c " +
+                   "ipc/family/c6a8149/NotifySetup.c " +
+                   "ipc/family/c6a8149/NotifyCircSetup.c " +
+                   "ipc/family/c6a8149/InterruptHost.c " +
+                   "ipc/family/c6a8149/NotifyMbxSetup.c " +
+                   "ipc/family/c6a8149/NotifyDriverMbx.c " +
+                   "ipc/family/omap3530/NotifySetup.c " +
+                   "ipc/family/omap3530/NotifyCircSetup.c " +
+                   "ipc/family/omap3530/InterruptHost.c ";
+
+
+var A15gSources  = "ipc/family/vayu/InterruptHost.c " +
+                   "ipc/family/vayu/NotifySetup.c " +
+                   "ipc/gates/GateHWSpinlock.c ";
+
+var ARP32Sources   =
+                   "ipc/gates/GateHWSpinlock.c " +
+                   "ipc/family/arctic/NotifySetup.c " +
+                   "ipc/family/arctic/NotifyCircSetup.c " +
+                   "ipc/family/arctic/InterruptArp32.c " +
+                   "ipc/family/c6a8149/NotifySetup.c " +
+                   "ipc/family/c6a8149/NotifyCircSetup.c " +
+                   "ipc/family/c6a8149/InterruptEve.c " +
+                   "ipc/family/vayu/InterruptArp32.c " +
+                   "ipc/family/vayu/NotifySetup.c ";
+
+var cList = {
+    "ti.targets.C28_large"              : commonSources + C28Sources,
+    "ti.targets.C28_float"              : commonSources + C28Sources,
+
+    "ti.targets.C64P"                   : commonSources + C647xSources + C64PSources,
+    "ti.targets.C64P_big_endian"        : commonSources + C647xSources + C64PSources,
+    "ti.targets.C674"                   : commonSources + C674Sources,
+
+    "ti.targets.elf.C64P"               : commonSources + C647xSources + C64PSources,
+    "ti.targets.elf.C64P_big_endian"    : commonSources + C647xSources + C64PSources,
+    "ti.targets.elf.C674"               : commonSources + C674Sources,
+    "ti.targets.elf.C64T"               : commonSources + C64TSources,
+    "ti.targets.elf.C66"                : commonSources + C647xSources + C66Sources,
+    "ti.targets.elf.C66_big_endian"     : commonSources + C647xSources + C66Sources,
+
+    "ti.targets.arp32.elf.ARP32"        : commonSources + ARP32Sources,
+    "ti.targets.arp32.elf.ARP32_far"    : commonSources + ARP32Sources,
+
+    "ti.targets.arm.elf.Arm9"           : commonSources + Arm9Sources,
+    "ti.targets.arm.elf.A8F"            : commonSources + A8FSources,
+    "ti.targets.arm.elf.A8Fnv"          : commonSources + A8FSources,
+    "ti.targets.arm.elf.M3"             : commonSources + M3Sources,
+    "ti.targets.arm.elf.M4"             : commonSources + M4Sources,
+    "ti.targets.arm.elf.M4F"            : commonSources + M4Sources,
+
+    "gnu.targets.arm.A15F"              : commonSources + A15gSources,
+    "gnu.targets.arm.A8F"               : commonSources + A8gSources,
+    "gnu.targets.arm.M3"                : commonSources + M3Sources,
+    "gnu.targets.arm.M4"                : commonSources + M4Sources,
+    "gnu.targets.arm.M4F"               : commonSources + M4Sources,
+};
+
+var ipcPackages = [
+    "ti.sdo.ipc",
+    "ti.sdo.ipc.family.omap4430",
+    "ti.sdo.ipc.family.omap3530",
+    "ti.sdo.ipc.family.da830",
+    "ti.sdo.ipc.family.dm6446",
+    "ti.sdo.ipc.family.ti81xx",
+    "ti.sdo.ipc.family.arctic",
+    "ti.sdo.ipc.family.f28m35x",
+    "ti.sdo.ipc.family.c647x",
+    "ti.sdo.ipc.family.c6a8149",
+    "ti.sdo.ipc.family.tci663x",
+    "ti.sdo.ipc.family.vayu",
+    "ti.sdo.ipc.gates",
+    "ti.sdo.ipc.heaps",
+    "ti.sdo.ipc.notifyDrivers",
+    "ti.sdo.ipc.nsremote",
+    "ti.sdo.ipc.transports",
+    "ti.sdo.utils",
+];
+
+var asmListNone = [
+];
+
+var asmList64P = [
+    "ipc/gates/GateAAMonitor_asm.s64P",
+];
+
+var asmList = {
+    "ti.targets.C28_large"              : asmListNone,
+    "ti.targets.C28_float"              : asmListNone,
+
+    "ti.targets.C64P"                   : asmList64P,
+    "ti.targets.C64P_big_endian"        : asmList64P,
+    "ti.targets.C674"                   : asmList64P,
+
+    "ti.targets.elf.C64P"               : asmList64P,
+    "ti.targets.elf.C64P_big_endian"    : asmList64P,
+    "ti.targets.elf.C674"               : asmList64P,
+
+    "ti.targets.elf.C64T"               : asmListNone,
+    "ti.targets.elf.C66"                : asmListNone,
+    "ti.targets.elf.C66_big_endian"     : asmListNone,
+
+    "ti.targets.arp32.elf.ARP32"        : asmListNone,
+    "ti.targets.arp32.elf.ARP32_far"    : asmListNone,
+
+    "ti.targets.arm.elf.Arm9"           : asmListNone,
+    "ti.targets.arm.elf.A8F"            : asmListNone,
+    "ti.targets.arm.elf.A8Fnv"          : asmListNone,
+    "ti.targets.arm.elf.M3"             : asmListNone,
+    "ti.targets.arm.elf.M4"             : asmListNone,
+    "ti.targets.arm.elf.M4F"            : asmListNone,
+
+    "gnu.targets.arm.M3"                : asmListNone,
+    "gnu.targets.arm.M4"                : asmListNone,
+    "gnu.targets.arm.M4F"               : asmListNone,
+    "gnu.targets.arm.A8F"               : asmListNone,
+    "gnu.targets.arm.A9F"               : asmListNone,
+    "gnu.targets.arm.A15F"              : asmListNone,
+};
+
+var cFiles = {};
+
+/*
+ *  ======== getCFiles ========
+ */
+function getCFiles(target)
+{
+    var localSources = "ipc/Ipc.c ";
+
+    /*
+     * logic to trim the C files down to just what the application needs
+     * 3/2/11 disabled for now ...
+     */
+    if (BIOS.buildingAppLib == true) {
+        for each (var mod in Program.targetModules()) {
+            var mn = mod.$name;
+            var pn = mn.substring(0, mn.lastIndexOf("."));
+
+            /* sanity check package path */
+            var packageMatch = false;
+
+            for (var i = 0; i < ipcPackages.length; i++) {
+                if (pn == ipcPackages[i]) {
+                    packageMatch = true;
+                    break;
+                }
+            }
+
+            if (packageMatch && !mn.match(/Proxy/) &&
+               (mn != "ti.sdo.ipc.Ipc")) {
+                if (cFiles[mn] === undefined) {
+                    var prefix = mn.substr(mn.indexOf("sdo")+4);
+                    var mod = mn.substr(mn.lastIndexOf(".")+1);
+                    prefix = prefix.substring(0, prefix.lastIndexOf('.')+1);
+                    prefix = prefix.replace(/\./g, "/");
+                    localSources += prefix + mod + ".c ";
+                }
+                else {
+                    for (i in cFiles[mn].cSources) {
+                        var prefix = mn.substr(mn.indexOf("sdo")+8);
+                        prefix = prefix.substring(0, prefix.lastIndexOf('.')+1);
+                        prefix = prefix.replace(/\./g, "/");
+                        localSources += prefix + cFiles[mn].cSources[i] + " ";
+                    }
+                }
+            }
+        }
+    }
+    else {
+        localSources += cList[target];
+    }
+
+    /* remove trailing " " */
+    localSources = localSources.substring(0, localSources.length-1);
+
+    return (localSources);
+}
+
+/*
+ *  ======== getAsmFiles ========
+ */
+function getAsmFiles(target)
+{
+    return (asmList[target]);
+}
+
+/*
+ *  ======== getDefs ========
+ */
+function getDefs()
+{
+    var Defaults = xdc.module('xdc.runtime.Defaults');
+    var Diags = xdc.module("xdc.runtime.Diags");
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+    var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
+
+    var defs = "";
+
+    if ((BIOS.assertsEnabled == false) ||
+        ((Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF)
+            && (Defaults.common$.diags_INTERNAL == Diags.ALWAYS_OFF))) {
+        defs += " -Dxdc_runtime_Assert_DISABLE_ALL";
+    }
+
+    if (BIOS.logsEnabled == false) {
+        defs += " -Dxdc_runtime_Log_DISABLE_ALL";
+    }
+
+    defs += " -Dti_sdo_ipc_MessageQ_traceFlag__D=" + (MessageQ.traceFlag ? "TRUE" : "FALSE");
+
+    var InterruptDucati = xdc.module("ti.sdo.ipc.family.ti81xx.InterruptDucati");
+
+    /*
+     * If we truely know which platform we're building against,
+     * add these application specific -D's
+     */
+    if (BIOS.buildingAppLib == true) {
+        defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_videoProcId__D=" + InterruptDucati.videoProcId;
+        defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_hostProcId__D=" + InterruptDucati.hostProcId;
+        defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_vpssProcId__D=" + InterruptDucati.vpssProcId;
+        defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_dspProcId__D=" + InterruptDucati.dspProcId;
+        defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_ducatiCtrlBaseAddr__D=" + InterruptDucati.ducatiCtrlBaseAddr;
+        defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_mailboxBaseAddr__D=" + InterruptDucati.mailboxBaseAddr;
+    }
+
+    return (defs);
+}
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(pkg)
+{
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+
+    if (BIOS.libType != BIOS.LibType_Debug) {
+        return null;
+    }
+
+    var lib = "";
+    var name = pkg.$name + ".a" + prog.build.target.suffix;
+
+    if (BIOS.smpEnabled == true) {
+        lib = "lib/smpipc/debug/" + name;
+    }
+    else {
+        lib = "lib/ipc/debug/" + name;
+    }
+
+    if (java.io.File(pkg.packageBase + lib).exists()) {
+        return lib;
+    }
+
+    /* could not find any library, throw exception */
+    throw Error("Library not found: " + name);
+}
+
+
+/*
+ *  ======== getProfiles ========
+ *  Determines which profiles to build for.
+ *
+ *  Any argument in XDCARGS which does not contain platform= is treated
+ *  as a profile. This way multiple build profiles can be specified by
+ *  separating them with a space.
+ */
+function getProfiles(xdcArgs)
+{
+    /*
+     * cmdlProf[1] gets matched to "whole_program,debug" if
+     * ["abc", "profile=whole_program,debug"] is passed in as xdcArgs
+     */
+    var cmdlProf = (" " + xdcArgs.join(" ") + " ").match(/ profile=([^ ]+) /);
+
+    if (cmdlProf == null) {
+        /* No profile=XYZ found */
+        return [];
+    }
+
+    /* Split "whole_program,debug" into ["whole_program", "debug"] */
+    var profiles = cmdlProf[1].split(',');
+
+    return profiles;
+}
+
+/*
+ *  ======== buildLibs ========
+ *  This function generates the makefile goals for the libraries
+ *  produced by a ti.sysbios package.
+ */
+function buildLibs(objList, relList, filter, xdcArgs)
+{
+    for (var i = 0; i < xdc.module('xdc.bld.BuildEnvironment').targets.length; i++) {
+        var targ = xdc.module('xdc.bld.BuildEnvironment').targets[i];
+
+        /* skip target if not supported */
+        if (!supportsTarget(targ, filter)) {
+            continue;
+        }
+
+        var profiles = getProfiles(xdcArgs);
+
+        /* If no profiles were assigned, use only the default one. */
+        if (profiles.length == 0) {
+            profiles[0] = "debug";
+        }
+
+        for (var j = 0; j < profiles.length; j++) {
+            var ccopts = "";
+            var asmopts = "";
+
+            if (profiles[j] == "smp") {
+                var libPath = "lib/smpipc/debug/";
+                ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
+                asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
+            }
+            else {
+                var libPath = "lib/ipc/debug/";
+                /* build all package libs using Hwi macros */
+                ccopts += " -Dti_sysbios_Build_useHwiMacros";
+                ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
+                asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
+            }
+
+            /* confirm that this target supports this profile */
+            if (targ.profiles[profiles[j]] !== undefined) {
+                var profile = profiles[j];
+                var lib = Pkg.addLibrary(libPath + Pkg.name,
+                                targ, {
+                                profile: profile,
+                                copts: ccopts,
+                                aopts: asmopts,
+                                releases: relList
+                                });
+                lib.addObjects(objList);
+            }
+        }
+    }
+}
+
+
+/*
+ *  ======== supportsTarget ========
+ *  Returns true if target is in the filter object. If filter
+ *  is null or empty, that's taken to mean all targets are supported.
+ */
+function supportsTarget(target, filter)
+{
+    var list, field;
+
+    if (filter == null) {
+        return true;
+    }
+
+    /*
+     * For backwards compatibility, we support filter as an array of
+     * target names.  The preferred approach is to specify filter as
+     * an object with 'field' and 'list' elements.
+     *
+     * Old form:
+     *     var trgFilter = [ "Arm9", "Arm9t", "Arm9t_big_endian" ]
+     *
+     * New (preferred) form:
+     *
+     *     var trgFilter = {
+     *         field: "isa",
+     *         list: [ "v5T", "v7R" ]
+     *     };
+     *
+     */
+    if (filter instanceof Array) {
+        list = filter;
+        field = "name";
+    }
+    else {
+        list = filter.list;
+        field = filter.field;
+    }
+
+    if (list == null || field == null) {
+        throw("invalid filter parameter, must specify list and field!");
+    }
+
+    if (field == "noIsa") {
+        if (String(','+list.toString()+',').match(','+target["isa"]+',')) {
+            return (false);
+        }
+        return (true);
+    }
+
+    /*
+     * add ',' at front and and tail of list and field strings to allow
+     * use of simple match API.  For example, the string is updated to:
+     * ',v5T,v7R,' to allow match of ',v5t,'.
+     */
+    if (String(','+list.toString()+',').match(','+target[field]+',')) {
+        return (true);
+    }
+
+    return (false);
+}
diff --git a/packages/ti/sdo/ipc/GateMP.c b/packages/ti/sdo/ipc/GateMP.c
new file mode 100644 (file)
index 0000000..f53e845
--- /dev/null
@@ -0,0 +1,1458 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateMP.c ========
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Log.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include <ti/sysbios/gates/GateMutexPri.h>
+#include <ti/sysbios/gates/GateSwi.h>
+#include <ti/sysbios/gates/GateAll.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/hal/Hwi.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+#include "package/internal/GateMP.xdc.h"
+
+/* Helper macros */
+#define GETREMOTE(mask) ((ti_sdo_ipc_GateMP_RemoteProtect)((mask) >> 8))
+#define GETLOCAL(mask)  ((ti_sdo_ipc_GateMP_LocalProtect)((mask) & 0xFF))
+#define SETMASK(remoteProtect, localProtect) \
+                        ((Bits32)((remoteProtect) << 8 | (localProtect)))
+
+/* Values used to populate the resource 'inUse' arrays */
+#define UNUSED          ((UInt8)0)
+#define USED            ((UInt8)1)
+#define RESERVED        ((UInt8)-1)
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(GateMP_Params_init);
+    #pragma FUNC_EXT_CALLED(GateMP_create);
+    #pragma FUNC_EXT_CALLED(GateMP_close);
+    #pragma FUNC_EXT_CALLED(GateMP_delete);
+    #pragma FUNC_EXT_CALLED(GateMP_enter);
+    #pragma FUNC_EXT_CALLED(GateMP_getDefaultRemote);
+    #pragma FUNC_EXT_CALLED(GateMP_getLocalProtect);
+    #pragma FUNC_EXT_CALLED(GateMP_getRemoteProtect);
+    #pragma FUNC_EXT_CALLED(GateMP_leave);
+    #pragma FUNC_EXT_CALLED(GateMP_open);
+    #pragma FUNC_EXT_CALLED(GateMP_openByAddr);
+    #pragma FUNC_EXT_CALLED(GateMP_sharedMemReq);
+#endif
+
+/*
+ *  ======== GateMP_getSharedParams ========
+ */
+static Void GateMP_getSharedParams(GateMP_Params *sparams,
+        const ti_sdo_ipc_GateMP_Params *params)
+{
+    sparams->name             = params->name;
+    sparams->regionId         = params->regionId;
+    sparams->sharedAddr       = params->sharedAddr;
+    sparams->localProtect     = (GateMP_LocalProtect)
+        params->localProtect;
+    sparams->remoteProtect    = (GateMP_RemoteProtect)
+        params->remoteProtect;
+}
+
+/*
+ *  ======== GateMP_getRTSCParams ========
+ */
+static Void GateMP_getRTSCParams(ti_sdo_ipc_GateMP_Params *params,
+        const GateMP_Params *sparams)
+{
+
+    ti_sdo_ipc_GateMP_Params_init(params);
+
+    params->name             = sparams->name;
+    params->regionId         = sparams->regionId;
+    params->sharedAddr       = sparams->sharedAddr;
+    params->localProtect     = (ti_sdo_ipc_GateMP_LocalProtect)
+        sparams->localProtect;
+    params->remoteProtect    = (ti_sdo_ipc_GateMP_RemoteProtect)
+        sparams->remoteProtect;
+}
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateMP_Params_init ========
+ */
+Void GateMP_Params_init(GateMP_Params *sparams)
+{
+    ti_sdo_ipc_GateMP_Params params;
+
+    ti_sdo_ipc_GateMP_Params_init(&params);
+    GateMP_getSharedParams(sparams, &params);
+}
+
+/*
+ *  ======== GateMP_create ========
+ */
+GateMP_Handle GateMP_create(const GateMP_Params *sparams)
+{
+    ti_sdo_ipc_GateMP_Params params;
+    ti_sdo_ipc_GateMP_Object *obj;
+    Error_Block eb;
+
+    GateMP_getRTSCParams(&params, (Ptr)sparams);
+
+    Error_init(&eb);
+
+    /* call the module create */
+    obj = ti_sdo_ipc_GateMP_create(&params, &eb);
+
+    return ((GateMP_Handle)obj);
+}
+
+/*
+ *  ======== GateMP_close ========
+ */
+Int GateMP_close(GateMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_GateMP_Object *obj = (ti_sdo_ipc_GateMP_Object *)*handlePtr;
+    UInt key;
+    Int count;
+
+    /*
+     *  Cannot call with the numOpens equal to zero.  This is either
+     *  a created handle or been closed already.
+     */
+    Assert_isTrue((obj->numOpens != 0), ti_sdo_ipc_GateMP_A_invalidClose);
+
+    key = Hwi_disable();
+    count = --obj->numOpens;
+    Hwi_restore(key);
+
+    /*
+     *  if the count is zero and the gate is opened, then this
+     *  object was created in the open (i.e. the create happened
+     *  on a remote processor.
+     */
+    if ((count == 0) && (obj->objType == ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC)) {
+        GateMP_delete(handlePtr);
+    }
+
+    *handlePtr = NULL;
+
+    return (GateMP_S_SUCCESS);
+}
+
+/*
+ *  ======== GateMP_delete ========
+ */
+Int GateMP_delete(GateMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_GateMP_delete((ti_sdo_ipc_GateMP_Handle *)handlePtr);
+
+    return (GateMP_S_SUCCESS);
+}
+
+/*
+ *  ======== GateMP_enter ========
+ */
+IArg GateMP_enter(GateMP_Handle handle)
+{
+    IArg key;
+    ti_sdo_ipc_GateMP_Object *obj = (ti_sdo_ipc_GateMP_Object *)handle;
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    key = IGateProvider_enter(obj->gateHandle);
+
+    Log_write3(ti_sdo_ipc_GateMP_LM_enter,(UArg)obj->remoteProtect,
+            (UArg)obj->resourceId, key);
+
+    return (key);
+}
+
+/*
+ *  ======== GateMP_leave ========
+ */
+Void GateMP_leave(GateMP_Handle handle, IArg key)
+{
+    ti_sdo_ipc_GateMP_Object *obj = (ti_sdo_ipc_GateMP_Object *)handle;
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    IGateProvider_leave(obj->gateHandle, key);
+
+    Log_write3(ti_sdo_ipc_GateMP_LM_leave, (UArg)obj->remoteProtect,
+        (UArg)obj->resourceId, key);
+}
+
+/*
+ *  ======== GateMP_open ========
+ */
+Int GateMP_open(String name, GateMP_Handle *handlePtr)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Int status;
+    UInt32 len;
+    Ptr sharedAddr;
+    UInt32 nsValue[2];
+
+    /* Assert that a pointer has been supplied */
+    Assert_isTrue(handlePtr != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    len = sizeof(nsValue);
+
+    /*
+     *  Get the Attrs out of the NameServer instance.
+     *  Search all processors.
+     */
+    status = NameServer_get((NameServer_Handle)GateMP_module->nameServer, name,
+            &nsValue, &len, ti_sdo_utils_MultiProc_procIdList);
+
+    if (status < 0) {
+        *handlePtr = NULL;
+        return (GateMP_E_NOTFOUND);
+    }
+
+    /*
+     * The least significant bit of nsValue[1] == 0 means its a
+     * local GateMP, otherwise its a remote GateMP.
+     */
+    if (((nsValue[1] & 0x1) == 0) &&
+        ((nsValue[1] >> 16) != MultiProc_self())) {
+        /* Trying to open a local GateMP remotely */
+        *handlePtr = NULL;
+        return (GateMP_E_FAIL);
+    }
+
+    if ((nsValue[1] & 0x1) == 0) {
+        /*
+         * Opening a local GateMP locally. The GateMP is created
+         * from a local heap so don't do SharedRegion Ptr conversion.
+         */
+        sharedAddr = (Ptr)nsValue[0];
+    }
+    else {
+        /* Opening a remote GateMP. Need to do SharedRegion Ptr conversion. */
+        sharedShmBase = (SharedRegion_SRPtr)nsValue[0];
+        sharedAddr = SharedRegion_getPtr(sharedShmBase);
+    }
+
+    status = GateMP_openByAddr(sharedAddr, handlePtr);
+
+    return (status);
+}
+
+/*
+ *  ======== GateMP_openByAddr ========
+ */
+Int GateMP_openByAddr(Ptr sharedAddr, GateMP_Handle *handlePtr)
+{
+    Int status = GateMP_S_SUCCESS;
+    UInt key;
+    ti_sdo_ipc_GateMP_Object *obj;
+    ti_sdo_ipc_GateMP_Params params;
+    ti_sdo_ipc_GateMP_Attrs *attrs;
+    UInt16 regionId;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    attrs = (ti_sdo_ipc_GateMP_Attrs *)sharedAddr;
+
+    /* get the region id and invalidate attrs is needed */
+    regionId = SharedRegion_getId(sharedAddr);
+    if (regionId != SharedRegion_INVALIDREGIONID) {
+        if (SharedRegion_isCacheEnabled(regionId)) {
+            Cache_inv(attrs, sizeof(ti_sdo_ipc_GateMP_Attrs), Cache_Type_ALL,
+                    TRUE);
+        }
+    }
+
+    if (attrs->status != ti_sdo_ipc_GateMP_CREATED) {
+        *handlePtr = NULL;
+        status = GateMP_E_NOTFOUND;
+    }
+    else {
+        /* Local gate */
+        if (GETREMOTE(attrs->mask) == GateMP_RemoteProtect_NONE) {
+            if (attrs->creatorProcId != MultiProc_self()) {
+                Error_raise(&eb, ti_sdo_ipc_GateMP_E_localGate, 0, 0);
+                return (GateMP_E_FAIL);
+            }
+
+            /* need to atomically increment number of opens */
+            key = Hwi_disable();
+
+            obj = (ti_sdo_ipc_GateMP_Object *)attrs->arg;
+            *handlePtr = (GateMP_Handle)obj;
+            obj->numOpens++;
+
+            /* restore hwi mask */
+            Hwi_restore(key);
+
+            return (GateMP_S_SUCCESS);
+        }
+
+        /*  need to track number of opens atomically */
+        key = Hwi_disable();
+
+        /* Remote case */
+        switch (GETREMOTE(attrs->mask)) {
+            case GateMP_RemoteProtect_SYSTEM:
+                obj = GateMP_module->remoteSystemGates[attrs->arg];
+                break;
+
+            case GateMP_RemoteProtect_CUSTOM1:
+                obj = GateMP_module->remoteCustom1Gates[attrs->arg];
+                break;
+
+            case GateMP_RemoteProtect_CUSTOM2:
+                obj = GateMP_module->remoteCustom2Gates[attrs->arg];
+                break;
+
+            default:
+                obj = NULL;
+                status = GateMP_E_FAIL;
+                break;
+        }
+
+        if (status == GateMP_S_SUCCESS) {
+            /*
+             *  If the object is NULL, then it must have been created on a
+             *  remote processor. Need to create a local object. This is
+             *  accomplished by setting the openFlag to TRUE.
+             */
+            if (obj == NULL) {
+                /* Create a GateMP object with the openFlag set to true */
+                ti_sdo_ipc_GateMP_Params_init(&params);
+                params.openFlag = TRUE;
+                params.sharedAddr = sharedAddr;
+                params.resourceId = attrs->arg;
+                params.localProtect = GETLOCAL(attrs->mask);
+                params.remoteProtect = GETREMOTE(attrs->mask);
+
+                obj = ti_sdo_ipc_GateMP_create(&params, &eb);
+                if (obj == NULL) {
+                    status = GateMP_E_FAIL;
+                }
+            }
+            else {
+                obj->numOpens++;
+            }
+        }
+
+        /* Return the GateMP instance  */
+        *handlePtr = (GateMP_Handle)obj;
+
+        /* restore hwi mask */
+        Hwi_restore(key);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== GateMP_sharedMemReq ========
+ */
+SizeT GateMP_sharedMemReq(const GateMP_Params *params)
+{
+    SizeT memReq, minAlign;
+    UInt16 regionId;
+    ti_sdo_ipc_GateMP_RemoteSystemProxy_Params systemParams;
+    ti_sdo_ipc_GateMP_RemoteCustom1Proxy_Params custom1Params;
+    ti_sdo_ipc_GateMP_RemoteCustom2Proxy_Params custom2Params;
+
+    if (params->sharedAddr) {
+        regionId = SharedRegion_getId(params->sharedAddr);
+    }
+    else {
+        regionId = params->regionId;
+    }
+
+    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    memReq = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
+
+    /* add the amount of shared memory required by proxy */
+    if (params->remoteProtect == GateMP_RemoteProtect_SYSTEM) {
+        ti_sdo_ipc_GateMP_RemoteSystemProxy_Params_init(&systemParams);
+        systemParams.regionId = regionId;
+        memReq += ti_sdo_ipc_GateMP_RemoteSystemProxy_sharedMemReq(
+                (IGateMPSupport_Params *)&systemParams);
+    }
+    else if (params->remoteProtect == GateMP_RemoteProtect_CUSTOM1) {
+        ti_sdo_ipc_GateMP_RemoteCustom1Proxy_Params_init(&custom1Params);
+        custom1Params.regionId = regionId;
+        memReq += ti_sdo_ipc_GateMP_RemoteCustom1Proxy_sharedMemReq(
+                (IGateMPSupport_Params *)&custom1Params);
+    }
+    else if (params->remoteProtect == GateMP_RemoteProtect_CUSTOM2) {
+        ti_sdo_ipc_GateMP_RemoteCustom2Proxy_Params_init(&custom2Params);
+        custom2Params.regionId = regionId;
+        memReq += ti_sdo_ipc_GateMP_RemoteCustom2Proxy_sharedMemReq(
+                (IGateMPSupport_Params *)&custom2Params);
+    }
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_createLocal ========
+ */
+IGateProvider_Handle ti_sdo_ipc_GateMP_createLocal(
+    ti_sdo_ipc_GateMP_LocalProtect localProtect)
+{
+    IGateProvider_Handle gateHandle;
+
+    /* Create the local gate. */
+    switch (localProtect) {
+        case GateMP_LocalProtect_NONE:
+            /* Plug with the GateNull singleton */
+            gateHandle = GateMP_module->gateNull;
+            break;
+
+        case GateMP_LocalProtect_INTERRUPT:
+            /* Plug with the GateAll singleton */
+            gateHandle = GateMP_module->gateAll;
+            break;
+
+        case GateMP_LocalProtect_TASKLET:
+            /* Plug with the GateSwi singleton */
+            gateHandle = GateMP_module->gateSwi;
+            break;
+
+        case GateMP_LocalProtect_THREAD:
+        case GateMP_LocalProtect_PROCESS:
+            /* Plug with the GateMutexPri singleton */
+            gateHandle = GateMP_module->gateMutexPri;
+            break;
+
+        default:
+            /* Invalid local protection level encountered */
+            Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+            break;
+    }
+
+    return (gateHandle);
+}
+
+/*
+ *  ======== GateMP_getDefaultRemote ========
+ */
+GateMP_Handle GateMP_getDefaultRemote()
+{
+    return ((GateMP_Handle)GateMP_module->defaultGate);
+}
+
+/*
+ *  ======== GateMP_getLocalProtect ========
+ */
+GateMP_LocalProtect GateMP_getLocalProtect(GateMP_Handle handle)
+{
+    ti_sdo_ipc_GateMP_Object *obj = (ti_sdo_ipc_GateMP_Object *)handle;
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    return ((GateMP_LocalProtect)obj->localProtect);
+}
+
+/*
+ *  ======== GateMP_getRemoteProtect ========
+ */
+GateMP_RemoteProtect GateMP_getRemoteProtect(GateMP_Handle handle)
+{
+    ti_sdo_ipc_GateMP_Object *obj = (ti_sdo_ipc_GateMP_Object *)handle;
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    return ((GateMP_RemoteProtect)obj->remoteProtect);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_getRegion0ReservedSize ========
+ */
+SizeT ti_sdo_ipc_GateMP_getRegion0ReservedSize(Void)
+{
+    SizeT reserved, minAlign;
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+
+    if (SharedRegion_getCacheLineSize(0) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(0);
+    }
+
+    reserved = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Reserved), minAlign);
+
+    reserved += _Ipc_roundup(GateMP_module->numRemoteSystem, minAlign);
+
+    if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1] ==
+        ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1) {
+            reserved += _Ipc_roundup(GateMP_module->numRemoteCustom1, minAlign);
+    }
+
+    if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2] ==
+        ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2) {
+            reserved += _Ipc_roundup(GateMP_module->numRemoteCustom2, minAlign);
+    }
+
+    return (reserved);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_setRegion0Reserved ========
+ */
+Void ti_sdo_ipc_GateMP_setRegion0Reserved(Ptr sharedAddr)
+{
+    ti_sdo_ipc_GateMP_Reserved *reserve;
+    SizeT minAlign, offset;
+    UInt i;
+    Bits32 *delegateReservedMask;
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(0) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(0);
+    }
+
+    /* setup ti_sdo_ipc_GateMP_Reserved fields */
+    reserve = (ti_sdo_ipc_GateMP_Reserved *)sharedAddr;
+    reserve->version = ti_sdo_ipc_GateMP_VERSION;
+
+    if (SharedRegion_isCacheEnabled(0)) {
+        Cache_wbInv(sharedAddr, sizeof(ti_sdo_ipc_GateMP_Reserved),
+            Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  initialize the in-use array in shared memory for the system gates.
+     */
+    offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Reserved), minAlign);
+    GateMP_module->remoteSystemInUse =
+        (Ptr)((UInt32)sharedAddr + offset);
+
+    memset(GateMP_module->remoteSystemInUse, 0,
+        GateMP_module->numRemoteSystem * sizeof(UInt8));
+    delegateReservedMask =
+            ti_sdo_ipc_GateMP_RemoteSystemProxy_getReservedMask();
+    if (delegateReservedMask != NULL) {
+        for (i = 0; i < GateMP_module->numRemoteSystem; i++) {
+            if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
+                GateMP_module->remoteSystemInUse[i] = RESERVED;
+            }
+        }
+    }
+
+    if (SharedRegion_isCacheEnabled(0)) {
+        Cache_wbInv(GateMP_module->remoteSystemInUse,
+            GateMP_module->numRemoteSystem * sizeof(UInt8),
+            Cache_Type_ALL,
+            TRUE);
+    }
+
+    /*
+     *  initialize the in-use array in shared memory for the custom1 gates.
+     *  Need to check if this proxy is the same as system
+     */
+    offset = _Ipc_roundup(GateMP_module->numRemoteSystem, minAlign);
+    if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1] ==
+        ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1) {
+        if (GateMP_module->numRemoteCustom1 != 0) {
+            GateMP_module->remoteCustom1InUse =
+                GateMP_module->remoteSystemInUse + offset;
+        }
+
+        memset(GateMP_module->remoteCustom1InUse, 0,
+            GateMP_module->numRemoteCustom1 * sizeof(UInt8));
+        delegateReservedMask =
+                ti_sdo_ipc_GateMP_RemoteCustom1Proxy_getReservedMask();
+        if (delegateReservedMask != NULL) {
+            for (i = 0; i < GateMP_module->numRemoteCustom1; i++) {
+                if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
+                    GateMP_module->remoteCustom1InUse[i] = RESERVED;
+                }
+            }
+        }
+        if (SharedRegion_isCacheEnabled(0)) {
+            Cache_wbInv(GateMP_module->remoteCustom1InUse,
+                 GateMP_module->numRemoteCustom1 * sizeof(UInt8),
+                 Cache_Type_ALL,
+                 TRUE);
+        }
+    }
+    else {
+        GateMP_module->remoteCustom1InUse = GateMP_module->remoteSystemInUse;
+        GateMP_module->remoteCustom1Gates = GateMP_module->remoteSystemGates;
+    }
+
+    /*
+     *  initialize the in-use array in shared memory for the custom2 gates.
+     *  Need to check if this proxy is the same as system or custom1
+     */
+    offset = _Ipc_roundup(GateMP_module->numRemoteCustom1, minAlign);
+    if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2] ==
+        ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2) {
+        if (GateMP_module->numRemoteCustom2 != 0) {
+                GateMP_module->remoteCustom2InUse =
+                    GateMP_module->remoteCustom1InUse + offset;
+        }
+
+        memset(GateMP_module->remoteCustom2InUse, 0,
+            GateMP_module->numRemoteCustom2 * sizeof(UInt8));
+        delegateReservedMask =
+                ti_sdo_ipc_GateMP_RemoteCustom2Proxy_getReservedMask();
+        if (delegateReservedMask != NULL) {
+            for (i = 0; i < GateMP_module->numRemoteCustom2; i++) {
+                if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
+                    GateMP_module->remoteCustom2InUse[i] = RESERVED;
+                }
+            }
+        }
+
+        if (SharedRegion_isCacheEnabled(0)) {
+            Cache_wbInv(GateMP_module->remoteCustom2InUse,
+                 GateMP_module->numRemoteCustom2 * sizeof(UInt8),
+                 Cache_Type_ALL,
+                 TRUE);
+        }
+    }
+    else if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2] ==
+             ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1) {
+        GateMP_module->remoteCustom2InUse =
+            GateMP_module->remoteCustom1InUse;
+        GateMP_module->remoteCustom2Gates =
+            GateMP_module->remoteCustom1Gates;
+    }
+    else {
+        GateMP_module->remoteCustom2InUse = GateMP_module->remoteSystemInUse;
+        GateMP_module->remoteCustom2Gates = GateMP_module->remoteSystemGates;
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_openRegion0Reserved ========
+ */
+Void ti_sdo_ipc_GateMP_openRegion0Reserved(Ptr sharedAddr)
+{
+    ti_sdo_ipc_GateMP_Reserved *reserve;
+    SizeT minAlign, offset;
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(0) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(0);
+    }
+
+
+    /* setup ti_sdo_ipc_GateMP_Reserved fields */
+    reserve = (ti_sdo_ipc_GateMP_Reserved *)sharedAddr;
+
+    if (reserve->version != ti_sdo_ipc_GateMP_VERSION) {
+        /* Version mismatch: return an error */
+        Error_raise(NULL, ti_sdo_ipc_Ipc_E_versionMismatch, reserve->version,
+                    ti_sdo_ipc_GateMP_VERSION);
+        return;
+    }
+
+    offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Reserved), minAlign);
+    GateMP_module->remoteSystemInUse =
+        (Ptr)((UInt32)sharedAddr + offset);
+
+    /*
+     *  initialize the in-use array in shared memory for the custom1 gates.
+     *  Need to check if this proxy is the same as system
+     */
+    offset = _Ipc_roundup(GateMP_module->numRemoteSystem, minAlign);
+    if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1] ==
+        ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1) {
+        if (GateMP_module->numRemoteCustom1 != 0) {
+            GateMP_module->remoteCustom1InUse =
+                GateMP_module->remoteSystemInUse + offset;
+        }
+    }
+    else {
+        GateMP_module->remoteCustom1InUse = GateMP_module->remoteSystemInUse;
+        GateMP_module->remoteCustom1Gates = GateMP_module->remoteSystemGates;
+    }
+
+    offset = _Ipc_roundup(GateMP_module->numRemoteCustom1, minAlign);
+    if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2] ==
+        ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2) {
+        if (GateMP_module->numRemoteCustom2 != 0) {
+            GateMP_module->remoteCustom2InUse =
+                GateMP_module->remoteCustom1InUse + offset;
+        }
+    }
+    else if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2] ==
+             ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM1) {
+        GateMP_module->remoteCustom2InUse =
+            GateMP_module->remoteCustom1InUse;
+        GateMP_module->remoteCustom2Gates =
+            GateMP_module->remoteCustom1Gates;
+    }
+    else {
+        GateMP_module->remoteCustom2InUse = GateMP_module->remoteSystemInUse;
+        GateMP_module->remoteCustom2Gates = GateMP_module->remoteSystemGates;
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_attach ========
+ */
+Int ti_sdo_ipc_GateMP_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    Ptr gateMPsharedAddr;
+    SharedRegion_Entry entry;
+    ti_sdo_ipc_GateMP_Handle defaultGate;
+    Int status = GateMP_S_SUCCESS;
+
+    /* If default gate is not NULL return since its already set */
+    if (GateMP_getDefaultRemote() != NULL) {
+        return(GateMP_S_ALREADYSETUP);
+    }
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    gateMPsharedAddr = (Ptr)((UInt32)sharedAddr +
+                       ti_sdo_ipc_GateMP_getRegion0ReservedSize());
+
+    if ((entry.ownerProcId != MultiProc_self()) &&
+        (entry.ownerProcId != MultiProc_INVALIDID)) {
+        /* if not the owner of the SharedRegion */
+        ti_sdo_ipc_GateMP_openRegion0Reserved(sharedAddr);
+
+        /* open the gate by address */
+        status = GateMP_openByAddr(gateMPsharedAddr,
+                (GateMP_Handle *)&defaultGate);
+
+        /* openByAddr should always succeed */
+        Assert_isTrue(status >= 0, ti_sdo_ipc_Ipc_A_internal);
+
+        /* set the default GateMP for opener */
+        ti_sdo_ipc_GateMP_setDefaultRemote(defaultGate);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_detach ========
+ */
+Int ti_sdo_ipc_GateMP_detach(UInt16 remoteProcId)
+{
+    SharedRegion_Entry entry;
+    GateMP_Handle gate;
+    Int status = GateMP_S_SUCCESS;
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    if ((entry.isValid) &&
+        (entry.ownerProcId == remoteProcId)) {
+        /* get the default gate */
+        gate = GateMP_getDefaultRemote();
+
+        if (gate != NULL) {
+            /* close the gate */
+            status = GateMP_close(&gate);
+
+            /* set the default remote gate to NULL */
+            ti_sdo_ipc_GateMP_setDefaultRemote(NULL);
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_start ========
+ */
+Int ti_sdo_ipc_GateMP_start(Ptr sharedAddr)
+{
+    SharedRegion_Entry       entry;
+    ti_sdo_ipc_GateMP_Params gateMPParams;
+    ti_sdo_ipc_GateMP_Handle defaultGate;
+    Int status = GateMP_S_SUCCESS;
+    Error_Block eb;
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    /* if entry owner proc is not specified return */
+    if (entry.ownerProcId == MultiProc_INVALIDID) {
+        return (status);
+    }
+
+    if (entry.ownerProcId == MultiProc_self()) {
+        /* if owner of the SharedRegion */
+        ti_sdo_ipc_GateMP_setRegion0Reserved(sharedAddr);
+
+        /* create default GateMP */
+        ti_sdo_ipc_GateMP_Params_init(&gateMPParams);
+        gateMPParams.sharedAddr = (Ptr)((UInt32)sharedAddr +
+                ti_sdo_ipc_GateMP_getRegion0ReservedSize());
+        gateMPParams.localProtect  = ti_sdo_ipc_GateMP_LocalProtect_TASKLET;
+
+        if (ti_sdo_utils_MultiProc_numProcessors > 1) {
+            gateMPParams.remoteProtect = ti_sdo_ipc_GateMP_RemoteProtect_SYSTEM;
+        }
+        else {
+            gateMPParams.remoteProtect = ti_sdo_ipc_GateMP_RemoteProtect_NONE;
+        }
+
+        Error_init(&eb);
+        defaultGate = ti_sdo_ipc_GateMP_create(&gateMPParams, &eb);
+        if (defaultGate != NULL) {
+            /* set the default GateMP for creator */
+            ti_sdo_ipc_GateMP_setDefaultRemote(defaultGate);
+        }
+        else {
+            status = GateMP_E_FAIL;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_stop ========
+ */
+Int ti_sdo_ipc_GateMP_stop()
+{
+    SharedRegion_Entry entry;
+    GateMP_Handle gate;
+    Int status = GateMP_S_SUCCESS;
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    if ((entry.isValid) &&
+        (entry.createHeap) &&
+        (entry.ownerProcId == MultiProc_self())) {
+        /* get the default GateMP */
+        gate = GateMP_getDefaultRemote();
+
+        if (gate != NULL) {
+            /* set the default GateMP to NULL */
+            ti_sdo_ipc_GateMP_setDefaultRemote(NULL);
+
+            /* delete the default GateMP */
+            status = GateMP_delete(&gate);
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_Instance_init ========
+ */
+Int ti_sdo_ipc_GateMP_Instance_init(ti_sdo_ipc_GateMP_Object *obj,
+        const ti_sdo_ipc_GateMP_Params *params,
+        Error_Block *eb)
+{
+    UInt key;
+    IGateMPSupport_Handle remoteHandle;
+    IGateProvider_Handle localHandle;
+    ti_sdo_ipc_GateMP_RemoteSystemProxy_Params systemParams;
+    ti_sdo_ipc_GateMP_RemoteCustom1Proxy_Params custom1Params;
+    ti_sdo_ipc_GateMP_RemoteCustom2Proxy_Params custom2Params;
+    SizeT minAlign, offset;
+    SharedRegion_SRPtr sharedShmBase;
+    GateMP_Params sparams;
+    UInt32 nsValue[2];
+    IHeap_Handle regionHeap;
+
+    /* Initialize resourceId to an invalid value */
+    obj->resourceId = (UInt)-1;
+
+    localHandle = ti_sdo_ipc_GateMP_createLocal(params->localProtect);
+
+    /* Open GateMP instance */
+    if (params->openFlag == TRUE) {
+        /* all open work done here except for remote gateHandle */
+        obj->localProtect   = params->localProtect;
+        obj->remoteProtect  = params->remoteProtect;
+        obj->nsKey          = 0;
+        obj->numOpens       = 0; /* Will be set to 1 after init() complete */
+        obj->attrs          = (ti_sdo_ipc_GateMP_Attrs *)params->sharedAddr;
+        obj->regionId       = SharedRegion_getId((Ptr)obj->attrs);
+        obj->cacheEnabled   = SharedRegion_isCacheEnabled(obj->regionId);
+
+        /* Assert that the buffer is in a valid shared region */
+        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+        obj->allocSize      = 0;
+        obj->objType        = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+
+        minAlign = Memory_getMaxDefaultTypeAlign();
+
+        if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+            minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+        }
+
+        offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
+
+        obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+    }
+    /* Create GateMP instance */
+    else {
+        obj->localProtect  = params->localProtect;
+        obj->remoteProtect = params->remoteProtect;
+        obj->nsKey         = 0;
+        obj->numOpens      = 0;
+
+        if (obj->remoteProtect == GateMP_RemoteProtect_NONE) {
+            obj->gateHandle = ti_sdo_ipc_GateMP_createLocal(obj->localProtect);
+            if (params->sharedAddr != NULL) {
+                /* Create a local gate using shared memory */
+                obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+                obj->attrs = params->sharedAddr;
+                obj->regionId = SharedRegion_getId((Ptr)obj->attrs);
+                obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+            }
+            else {
+                /* Create a local gate allocating from the local heap */
+                obj->objType = ti_sdo_ipc_Ipc_ObjType_LOCAL;
+                obj->regionId = ti_sdo_ipc_SharedRegion_INVALIDREGIONID;
+                obj->cacheEnabled  = FALSE; /* local */
+                obj->attrs = Memory_alloc(NULL,
+                        sizeof(ti_sdo_ipc_GateMP_Attrs), 0, eb);
+                if (obj->attrs == NULL) {
+                    return (2);
+                }
+
+            }
+
+            obj->attrs->arg = (Bits32)obj;
+            obj->attrs->mask = SETMASK(obj->remoteProtect, obj->localProtect);
+            obj->attrs->creatorProcId = MultiProc_self();
+            obj->attrs->status = ti_sdo_ipc_GateMP_CREATED;
+            if (obj->cacheEnabled) {
+                /*
+                 *  Need to write back memory if cache is enabled because cache
+                 *  will be invalidated during openByAddr
+                 */
+                Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_GateMP_Attrs),
+                        Cache_Type_ALL, TRUE);
+            }
+
+            if (params->name) {
+                nsValue[0] = (UInt32)obj->attrs;
+                /*
+                 *  Top 16 bits = procId of creator
+                 *  Bottom 16 bits = '0' if local, '1' otherwise
+                 */
+                nsValue[1] = ((UInt32)MultiProc_self()) << 16;
+                obj->nsKey = NameServer_add((NameServer_Handle)
+                        GateMP_module->nameServer, params->name, &nsValue,
+                        2 * sizeof(UInt32));
+
+                if (obj->nsKey == NULL) {
+                    Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name,
+                        0);
+                    return (3);
+                }
+            }
+
+            /* Nothing else to do for local gates */
+            return (0);
+        }
+
+        if (params->sharedAddr == NULL) {
+            /* Need to allocate from heap */
+            obj->objType        = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
+            obj->regionId       = params->regionId;
+            GateMP_getSharedParams(&sparams, params);
+            obj->allocSize      = GateMP_sharedMemReq(&sparams);
+            obj->cacheEnabled   = SharedRegion_isCacheEnabled(obj->regionId);
+
+            /* The region heap will do the alignment */
+            regionHeap = SharedRegion_getHeap(obj->regionId);
+            Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);
+            obj->attrs = Memory_alloc(regionHeap, obj->allocSize, 0, eb);
+            if (obj->attrs == NULL) {
+                return (3);
+            }
+
+            minAlign = Memory_getMaxDefaultTypeAlign();
+
+            if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+                minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+            }
+
+            offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
+
+            obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+        }
+        else {
+            /* creating using sharedAddr */
+            obj->regionId = SharedRegion_getId(params->sharedAddr);
+            /* Assert that the buffer is in a valid shared region */
+            Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                          ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+            obj->attrs = (ti_sdo_ipc_GateMP_Attrs *)params->sharedAddr;
+            obj->cacheEnabled  = SharedRegion_isCacheEnabled(obj->regionId);
+            obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+
+            minAlign = Memory_getMaxDefaultTypeAlign();
+
+            if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+                minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+            }
+
+            /* Assert that sharedAddr has correct alignment */
+            Assert_isTrue(minAlign == 0 ||
+                          ((UInt32)params->sharedAddr % minAlign) == 0,
+                          ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+            offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
+
+            obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+        }
+    }
+
+    /* Proxy work for open and create done here */
+    switch (obj->remoteProtect) {
+        case GateMP_RemoteProtect_SYSTEM:
+            if (obj->objType != ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) {
+                /* Created Instance */
+                obj->resourceId = GateMP_getFreeResource(
+                    GateMP_module->remoteSystemInUse,
+                             GateMP_module->numRemoteSystem, eb);
+                if (Error_check(eb) == TRUE) {
+                    return (4);
+                }
+            }
+            else {
+                /* resourceId set by open call */
+                obj->resourceId = params->resourceId;
+            }
+
+            /* Create the proxy object */
+            ti_sdo_ipc_GateMP_RemoteSystemProxy_Params_init(&systemParams);
+            systemParams.resourceId = obj->resourceId;
+            systemParams.openFlag =
+                    (obj->objType == ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC);
+            systemParams.sharedAddr = obj->proxyAttrs;
+            systemParams.regionId = obj->regionId;
+            remoteHandle = ti_sdo_ipc_GateMP_RemoteSystemProxy_create(
+                    localHandle, &systemParams, eb);
+
+            if (remoteHandle == NULL) {
+                return (5);
+            }
+
+            /* Finish filling in the object */
+            obj->gateHandle = IGateMPSupport_Handle_upCast(remoteHandle);
+
+            /* Fill in the local array because it is cooked */
+            key = Hwi_disable();
+            GateMP_module->remoteSystemGates[obj->resourceId] = obj;
+            Hwi_restore(key);
+            break;
+
+        case GateMP_RemoteProtect_CUSTOM1:
+            if (obj->objType != ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) {
+                obj->resourceId = GateMP_getFreeResource(
+                             GateMP_module->remoteCustom1InUse,
+                             GateMP_module->numRemoteCustom1, eb);
+                if (Error_check(eb) == TRUE) {
+                    return (4);
+                }
+            }
+            else {
+                /* resourceId set by open call */
+                obj->resourceId = params->resourceId;
+            }
+
+            /* Create the proxy object */
+            ti_sdo_ipc_GateMP_RemoteCustom1Proxy_Params_init(&custom1Params);
+            custom1Params.resourceId = obj->resourceId;
+            custom1Params.openFlag =
+                    (obj->objType == ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC);
+            custom1Params.sharedAddr = obj->proxyAttrs;
+            custom1Params.regionId = obj->regionId;
+            remoteHandle = ti_sdo_ipc_GateMP_RemoteCustom1Proxy_create(
+                    localHandle, &custom1Params, eb);
+            if (remoteHandle == NULL) {
+                return (5);
+            }
+
+            /* Fill in the local array because it is cooked */
+            key = Hwi_disable();
+            GateMP_module->remoteCustom1Gates[obj->resourceId] = obj;
+            Hwi_restore(key);
+            break;
+
+        case GateMP_RemoteProtect_CUSTOM2:
+            if (obj->objType != ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) {
+                obj->resourceId = GateMP_getFreeResource(
+                             GateMP_module->remoteCustom2InUse,
+                             GateMP_module->numRemoteCustom2, eb);
+                if (Error_check(eb) == TRUE) {
+                    return (4);
+                }
+            }
+            else {
+                /* resourceId set by open call */
+                obj->resourceId = params->resourceId;
+            }
+
+            /* Create the proxy object */
+            ti_sdo_ipc_GateMP_RemoteCustom2Proxy_Params_init(&custom2Params);
+            custom2Params.resourceId = obj->resourceId;
+            custom2Params.openFlag =
+                    (obj->objType == ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC);
+            custom2Params.sharedAddr = obj->proxyAttrs;
+            custom2Params.regionId = obj->regionId;
+            remoteHandle = ti_sdo_ipc_GateMP_RemoteCustom2Proxy_create(
+                    localHandle, &custom2Params, eb);
+            if (remoteHandle == NULL) {
+                return (5);
+            }
+
+            /* Fill in the local array because it is cooked */
+            key = Hwi_disable();
+            GateMP_module->remoteCustom2Gates[obj->resourceId] = obj;
+            Hwi_restore(key);
+            break;
+
+        default:
+            /* Should never be here */
+            Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+            return (5);  /* keep Coverity happy */
+    }
+
+    obj->gateHandle = IGateMPSupport_Handle_upCast(remoteHandle);
+
+    /* Place Name/Attrs into NameServer table */
+    if (obj->objType != ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) {
+        /* Fill in the attrs */
+        obj->attrs->arg = obj->resourceId;
+        obj->attrs->mask = SETMASK(obj->remoteProtect, obj->localProtect);
+        obj->attrs->creatorProcId = MultiProc_self();
+        obj->attrs->status = ti_sdo_ipc_GateMP_CREATED;
+
+        if (obj->cacheEnabled) {
+            Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_GateMP_Attrs),
+                    Cache_Type_ALL, TRUE);
+        }
+
+        if (params->name != NULL) {
+            sharedShmBase = SharedRegion_getSRPtr(obj->attrs, obj->regionId);
+            nsValue[0] = (UInt32)sharedShmBase;
+            /*
+             *  Top 16 bits = procId of creator
+             *  Bottom 16 bits = '0' if local, '1' otherwise
+             */
+            nsValue[1] = ((UInt32)MultiProc_self() << 16) | 1;
+            obj->nsKey = NameServer_add(
+                    (NameServer_Handle)GateMP_module->nameServer, params->name,
+                    &nsValue, 2 * sizeof(UInt32));
+
+            if (obj->nsKey == NULL) {
+                Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
+                return (6);
+            }
+        }
+
+        Log_write2(ti_sdo_ipc_GateMP_LM_create,
+                (UArg)obj->remoteProtect, (UArg)obj->resourceId);
+    }
+    else {
+        obj->numOpens = 1;
+
+        Log_write2(ti_sdo_ipc_GateMP_LM_open,
+            (UArg)obj->remoteProtect, (UArg)obj->resourceId);
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_Instance_finalize ========
+ */
+Void ti_sdo_ipc_GateMP_Instance_finalize(
+        ti_sdo_ipc_GateMP_Object *obj, Int status)
+{
+    UInt systemKey;
+    ti_sdo_ipc_GateMP_RemoteSystemProxy_Handle systemHandle;
+    ti_sdo_ipc_GateMP_RemoteCustom1Proxy_Handle custom1Handle;
+    ti_sdo_ipc_GateMP_RemoteCustom2Proxy_Handle custom2Handle;
+
+    ti_sdo_ipc_GateMP_Handle *remoteHandles;
+    UInt8 *inUseArray;
+    UInt numResources;
+
+    /* Cannot call when numOpen is non-zero. */
+    Assert_isTrue(obj->numOpens == 0, ti_sdo_ipc_GateMP_A_invalidDelete);
+
+    /* Removed from NameServer */
+    if (obj->nsKey != 0) {
+        NameServer_removeEntry((NameServer_Handle)GateMP_module->nameServer,
+                obj->nsKey);
+    }
+
+    /* Set the status to 0 */
+    if (obj->objType != ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) {
+        obj->attrs->status = 0;
+        if (obj->cacheEnabled) {
+            Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_GateMP_Attrs),
+                    Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /*
+     *  If ObjType_LOCAL, memory was allocated from the local system heap.
+     *  obj->attrs might be NULL if the Memory_alloc failed in Instance_init
+     */
+    if (obj->objType == ti_sdo_ipc_Ipc_ObjType_LOCAL && obj->attrs != NULL) {
+        Memory_free(NULL, obj->attrs, sizeof(ti_sdo_ipc_GateMP_Attrs));
+    }
+
+    switch (obj->remoteProtect) {
+        case GateMP_RemoteProtect_SYSTEM:
+            if (obj->gateHandle) {
+                systemHandle =
+                ti_sdo_ipc_GateMP_RemoteSystemProxy_Handle_downCast2(
+                        obj->gateHandle);
+                ti_sdo_ipc_GateMP_RemoteSystemProxy_delete(&systemHandle);
+            }
+
+            inUseArray = GateMP_module->remoteSystemInUse;
+            remoteHandles = GateMP_module->remoteSystemGates;
+            numResources = GateMP_module->numRemoteSystem;
+            break;
+
+        case GateMP_RemoteProtect_CUSTOM1:
+            if (obj->gateHandle) {
+                custom1Handle =
+                        ti_sdo_ipc_GateMP_RemoteCustom1Proxy_Handle_downCast2(
+                            obj->gateHandle);
+                ti_sdo_ipc_GateMP_RemoteCustom1Proxy_delete(&custom1Handle);
+            }
+
+            inUseArray = GateMP_module->remoteCustom1InUse;
+            remoteHandles = GateMP_module->remoteCustom1Gates;
+            numResources = GateMP_module->numRemoteCustom1;
+            break;
+
+        case GateMP_RemoteProtect_CUSTOM2:
+            if (obj->gateHandle) {
+                custom2Handle =
+                        ti_sdo_ipc_GateMP_RemoteCustom2Proxy_Handle_downCast2(
+                            obj->gateHandle);
+                ti_sdo_ipc_GateMP_RemoteCustom2Proxy_delete(&custom2Handle);
+            }
+
+            inUseArray = GateMP_module->remoteCustom2InUse;
+            remoteHandles = GateMP_module->remoteCustom2Gates;
+            numResources = GateMP_module->numRemoteCustom2;
+            break;
+        case GateMP_RemoteProtect_NONE:
+            /*
+             *  Nothing else to finalize. Any alloc'ed memory has already been
+             *  freed
+             */
+            Log_write2(ti_sdo_ipc_GateMP_LM_delete, (UArg)obj->remoteProtect,
+                (UArg)obj->resourceId);
+            return;
+        default:
+            /* Should never be here */
+            Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+            break;
+    }
+
+    /* Clear the handle array entry in local memory */
+    if (obj->resourceId != (UInt)-1) {
+        remoteHandles[obj->resourceId] = NULL;
+    }
+
+    if ((obj->objType != ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) &&
+        (obj->resourceId != (UInt)-1)) {
+        /* Clear the resource used flag in shared memory */
+        if (GateMP_module->defaultGate != NULL) {
+            systemKey = GateMP_enter((GateMP_Handle)GateMP_module->defaultGate);
+        }
+        else {
+            /* this should only be done when deleting the very last GateMP */
+            systemKey = Hwi_disable();
+        }
+
+        /* update the GateMP resource tracker */
+        inUseArray[obj->resourceId] = UNUSED;
+        if (obj->cacheEnabled) {
+            Cache_wbInv(inUseArray,
+                        numResources * sizeof(UInt8),
+                        Cache_Type_ALL,
+                        TRUE);
+        }
+
+        if (GateMP_module->defaultGate != NULL) {
+            GateMP_leave((GateMP_Handle)GateMP_module->defaultGate, systemKey);
+        }
+        else {
+            Hwi_restore(systemKey);
+        }
+    }
+
+    if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION) {
+        /* Free memory allocated from the region heap */
+        if (obj->attrs) {
+            Memory_free(SharedRegion_getHeap(obj->regionId), obj->attrs,
+                obj->allocSize);
+        }
+    }
+
+    Log_write2(ti_sdo_ipc_GateMP_LM_delete, (UArg)obj->remoteProtect,
+            (UArg)obj->resourceId);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_getSharedAddr ========
+ */
+SharedRegion_SRPtr ti_sdo_ipc_GateMP_getSharedAddr(
+        ti_sdo_ipc_GateMP_Object *obj)
+{
+    SharedRegion_SRPtr srPtr;
+
+    srPtr = SharedRegion_getSRPtr(obj->attrs, obj->regionId);
+
+    return (srPtr);
+}
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_setDefaultRemote ========
+ */
+Void ti_sdo_ipc_GateMP_setDefaultRemote(ti_sdo_ipc_GateMP_Object *obj)
+{
+    GateMP_module->defaultGate = obj;
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_GateMP_getFreeResource ========
+ */
+UInt ti_sdo_ipc_GateMP_getFreeResource(UInt8 *inUse, Int num, Error_Block *eb)
+{
+    UInt key;
+    Bool flag = FALSE;
+    UInt resourceId;
+    GateMP_Handle defaultGate;
+
+    /* Need to look at shared memory. Enter default gate */
+    defaultGate = GateMP_getDefaultRemote();
+
+    if (defaultGate){
+        key = GateMP_enter(defaultGate);
+    }
+
+    /* Invalidate cache before looking at the in-use flags */
+    if (SharedRegion_isCacheEnabled(0)) {
+        Cache_inv(inUse, num * sizeof(UInt8), Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  Find a free resource id. Note: zero is reserved on the
+     *  system proxy for the default gate.
+     */
+    for (resourceId = 0; resourceId < num; resourceId++) {
+        /*
+         *  If not in-use, set the inUse to TRUE to prevent other
+         *  creates from getting this one.
+         */
+        if (inUse[resourceId] == UNUSED) {
+           flag = TRUE;
+
+           /* Denote in shared memory that the resource is used */
+           inUse[resourceId] = USED;
+           break;
+       }
+    }
+
+    /* Write-back if a in-use flag was changed */
+    if (flag == TRUE && SharedRegion_isCacheEnabled(0)) {
+        Cache_wbInv(inUse, num * sizeof(UInt8), Cache_Type_ALL, TRUE);
+    }
+
+    /* Done with the critical section */
+    if (defaultGate) {
+        GateMP_leave(defaultGate, key);
+    }
+
+    if (flag == FALSE) {
+        resourceId = (UInt)-1;
+        Error_raise(eb, ti_sdo_ipc_GateMP_E_gateUnavailable, 0, 0);
+    }
+
+    return (resourceId);
+}
diff --git a/packages/ti/sdo/ipc/GateMP.xdc b/packages/ti/sdo/ipc/GateMP.xdc
new file mode 100644 (file)
index 0000000..dd7a5d2
--- /dev/null
@@ -0,0 +1,506 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateMP.xdc ========
+ *
+ */
+
+package ti.sdo.ipc;
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.IGateProvider;
+import xdc.runtime.Log;
+import xdc.runtime.Diags;
+
+import ti.sdo.utils.NameServer;
+import ti.sdo.ipc.interfaces.IGateMPSupport;
+
+/*!
+ *  ======== GateMP ========
+ *  Multiple processor gate that provides local and remote context protection.
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/GateMP.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>GateMP = xdc.useModule('ti.sdo.ipc.GateMP');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ */
+
+@InstanceInitError
+@InstanceFinalize
+
+module GateMP
+{
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     */
+    metaonly struct BasicView {
+        String  name;
+        String  remoteProtect;
+        String  remoteStatus;
+        String  localProtect;
+        UInt    numOpens;
+        Bits32  resourceId;
+        UInt    creatorProcId;
+        String  objType;
+    }
+
+    /*!
+     *  ======== ModuleView ========
+     *  @_nodoc
+     */
+    metaonly struct ModuleView {
+        UInt    numGatesSystem;
+        UInt    numUsedSystem;
+        UInt    numGatesCustom1;
+        UInt    numUsedCustom1;
+        UInt    numGatesCustom2;
+        UInt    numUsedCustom2;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Gate Resources',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE,
+                        viewInitFxn: 'viewInitModule',
+                        structName: 'ModuleView'
+                    }
+                ]
+            ]
+        });
+
+    /*!
+     *  ======== Reserved space at the top of SharedRegion0 ========
+     */
+    struct Reserved {
+        Bits32  version;
+    };
+
+    /*!
+     *  ======== E_gateUnavailable ========
+     *  Error raised no gates of the requested type are available
+     */
+    config Error.Id E_gateUnavailable  = {
+        msg: "E_gateUnavailable: No gates of requested type are available"
+    };
+
+    /*!
+     *  ======== E_localGate ========
+     *  Error raised when remote side tried to open local gate
+     */
+    config Error.Id E_localGate  = {
+        msg: "E_localGate: Only creator can open local Gate"
+    };
+
+    /*!
+     *  Assert raised when calling GateMP_close with the wrong handle
+     */
+    config Assert.Id A_invalidClose  = {
+        msg: "A_invalidContext: Calling GateMP_close with the wrong handle"
+    };
+
+    /*!
+     *  Assert raised when calling GateMP_delete incorrectly
+     */
+    config Assert.Id A_invalidDelete  = {
+        msg: "A_invalidDelete: Calling GateMP_delete incorrectly"
+    };
+
+    /*!
+     *  ======== LM_enter ========
+     *  Logged on gate enter
+     */
+    config Log.Event LM_enter = {
+        mask: Diags.USER1,
+        msg: "LM_enter: Gate (remoteGate = %d, resourceId = %d) entered, returning key = %d"
+    };
+
+    /*!
+     *  ======== LM_leave ========
+     *  Logged on gate leave
+     */
+    config Log.Event LM_leave = {
+        mask: Diags.USER1,
+        msg: "LM_leave: Gate (remoteGate = %d, resourceId = %d) left using key = %d"
+    };
+
+    /*!
+     *  ======== LM_create ========
+     *  Logged on gate create
+     */
+    config Log.Event LM_create = {
+        mask: Diags.USER1,
+        msg: "LM_create: Gate (remoteGate = %d, resourceId = %d) created"
+    };
+
+    /*!
+     *  ======== LM_open ========
+     *  Logged on gate open
+     */
+    config Log.Event LM_open = {
+        mask: Diags.USER1,
+        msg: "LM_open: Remote gate (remoteGate = %d, resourceId = %d) opened"
+    };
+
+    /*!
+     *  ======== LM_delete ========
+     *  Logged on gate deletion
+     */
+    config Log.Event LM_delete = {
+        mask: Diags.USER1,
+        msg: "LM_delete: Gate (remoteGate = %d, resourceId = %d) deleted"
+    };
+
+    /*!
+     *  ======== LM_close ========
+     *  Logged on gate close
+     */
+    config Log.Event LM_close = {
+        mask: Diags.USER1,
+        msg: "LM_close: Gate (remoteGate = %d, resourceId = %d) closed"
+    };
+
+    /*!
+     *  A set of local context protection levels
+     *
+     *  Each member corresponds to a specific local processor gates used for
+     *  local protection.
+     *
+     *  For SYS/BIOS users, the following are the mappings for the constants
+     *  @p(blist)
+     * -INTERRUPT -> GateAll: disables interrupts
+     * -TASKLET   -> GateSwi: disables Swis (software interrupts)
+     * -THREAD    -> GateMutexPri: based on Semaphores
+     * -PROCESS   -> GateMutexPri: based on Semaphores
+     *  @p
+     */
+    enum LocalProtect {
+        LocalProtect_NONE      = 0,
+        LocalProtect_INTERRUPT = 1,
+        LocalProtect_TASKLET   = 2,
+        LocalProtect_THREAD    = 3,
+        LocalProtect_PROCESS   = 4
+    };
+
+    /*!
+     *  Type of remote Gate
+     *
+     *  Each member corresponds to a specific type of remote gate.
+     *  Each enum value corresponds to the following remote protection levels:
+     *  @p(blist)
+     * -NONE      -> No remote protection (the GateMP instance will exclusively
+     *               offer local protection configured in {@link #localProtect})
+     * -SYSTEM    -> Use the SYSTEM remote protection level (default for remote
+     *               protection
+     * -CUSTOM1   -> Use the CUSTOM1 remote protection level
+     * -CUSTOM2   -> Use the CUSTOM2 remote protection level
+     *  @p
+     */
+    enum RemoteProtect {
+        RemoteProtect_NONE     = 0,
+        RemoteProtect_SYSTEM   = 1,
+        RemoteProtect_CUSTOM1  = 2,
+        RemoteProtect_CUSTOM2  = 3
+    };
+
+    /*!
+     *  ======== maxRuntimeEntries ========
+     *  Maximum runtime entries
+     *
+     *  Maximum number of GateMP's that can be dynamically created and
+     *  added to the NameServer.
+     *
+     *  To minimize the amount of runtime allocation, this parameter allows
+     *  the pre-allocation of memory for the GateMP's NameServer table.
+     *  The default is to allow growth (i.e. memory allocation when
+     *  creating a new instance).
+     */
+    metaonly config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+
+    /*!
+     *  ======== maxNameLen ========
+     *  Maximum length for names
+     */
+    config UInt maxNameLen = 32;
+
+    /*!
+     *  ======== tableSection ========
+     *  Section name is used to place the names table
+     */
+    metaonly config String tableSection = null;
+
+    /*!
+     *  ======== remoteSystemProxy ========
+     *  System remote gate proxy
+     *
+     *  By default, GateMP instances use the 'System' proxy for locking between
+     *  multiple processors by setting the 'localProtect' setting to .  This
+     *  remote gate proxy defaults to a device-specific remote GateMP delegate
+     *  and typically should not be modified.
+     */
+    proxy RemoteSystemProxy inherits IGateMPSupport;
+
+    /*!
+     *  ======== remoteCustom1Proxy ========
+     *  Custom1 remote gate proxy
+     *
+     *  GateMP instances may use the 'Custom1' proxy for locking between
+     *  multiple processors.  This proxy defaults to
+     *  {@link ti.sdo.ipc.gates.GatePeterson}.
+     */
+    proxy RemoteCustom1Proxy inherits IGateMPSupport;
+
+    /*!
+     *  ======== remoteCustom2Proxy ========
+     *  Custom2 remote gate proxy
+     *
+     *  GateMP instances may use the 'Custom2' proxy for locking between
+     *  multiple processors.  This proxy defaults to
+     *  {@link ti.sdo.ipc.gates.GateMPSupportNull}.
+     */
+    proxy RemoteCustom2Proxy inherits IGateMPSupport;
+
+    /*!
+     *  ======== createLocal ========
+     *  @_nodoc
+     *  Get a local IGateProvider instance
+     *
+     *  This function is designed to be used by the IGateMPSupport modules
+     *  to get a local Gate easily.
+     */
+    IGateProvider.Handle createLocal(LocalProtect localProtect);
+
+    /*! @_nodoc
+     *  ======== attach ========
+     */
+    Int attach(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*! @_nodoc
+     *  ======== detach ========
+     */
+    Int detach(UInt16 remoteProcId);
+
+    /*!
+     *  ======== getRegion0ReservedSize ========
+     *  @_nodoc
+     *  Amount of shared memory to be reserved for GateMP in region 0.
+     */
+    SizeT getRegion0ReservedSize();
+
+    /*!
+     *  ======== setRegion0Reserved ========
+     *  @_nodoc
+     *  Set and initialize GateMP reserved memory in Region 0.
+     */
+    Void setRegion0Reserved(Ptr sharedAddr);
+
+    /*!
+     *  ======== openRegion0Reserved ========
+     *  @_nodoc
+     *  Open shared memory reserved for GateP in region 0.
+     */
+    Void openRegion0Reserved(Ptr sharedAddr);
+
+    /*!
+     *  ======== setDefaultRemote ========
+     *  @_nodoc
+     *  Set the default Remote Gate. Called by SharedRegion_start().
+     */
+     Void setDefaultRemote(Handle handle);
+
+    /*! @_nodoc
+     *  ======== start ========
+     */
+    Int start(Ptr sharedAddr);
+
+    /*! @_nodoc
+     *  ======== stop ========
+     */
+    Int stop();
+
+instance:
+
+    /*!
+     *  ======== name ========
+     *  Name of the instance
+     *
+     *  Name needs to be unique. Used only if {@link #useNameServer}
+     *  is set to TRUE.
+     */
+    config String name = null;
+
+    /*! @_nodoc
+     *  Set to true by the open() call. No one else should touch this!
+     */
+    config Bool openFlag = false;
+
+    /*! @_nodoc
+     *  Set by the open() call. No one else should touch this!
+     */
+    config Bits32 resourceId = 0;
+
+    /*!
+     *  Shared Region Id
+     *
+     *  The ID corresponding to the shared region in which this shared instance
+     *  is to be placed.
+     */
+    config UInt16 regionId = 0;
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Physical address of the shared memory
+     *
+     *  The creator must supply the shared memory that will be used
+     *  for maintaining shared state information.  This parameter is used
+     *  only when {@link #Type} is set to {@link #Type_SHARED}
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== localProtect ========
+     */
+    config LocalProtect localProtect = LocalProtect_THREAD;
+
+    /*!
+     *  ======== localProtect ========
+     */
+    config RemoteProtect remoteProtect = RemoteProtect_SYSTEM;
+
+    /*!
+     *  ======== getSharedAddr ========
+     *  @_nodoc
+     *  Return the SRPtr that points to a GateMP instance's shared memory
+     *
+     *  getSharedAddr is typically used internally by other IPC modules to save
+     *  the shared address to a GateMP instance in the other modules' shared
+     *  state.  This allows the other module's open() call to open the GateMP
+     *  instance by address.
+     */
+    SharedRegion.SRPtr getSharedAddr();
+
+internal:
+    const UInt32 VERSION = 1;
+    const UInt32 CREATED = 0x11202009;
+
+    const Int ProxyOrder_SYSTEM  = 0;
+    const Int ProxyOrder_CUSTOM1 = 1;
+    const Int ProxyOrder_CUSTOM2 = 2;
+    const Int ProxyOrder_NUM     = 3;
+
+    /*!
+     *  ======== nameSrvPrms ========
+     *  This Params object is used for temporary storage of the
+     *  module wide parameters that are for setting the NameServer instance.
+     */
+    metaonly config NameServer.Params nameSrvPrms;
+
+    UInt getFreeResource(UInt8 *inUse, Int num, Error.Block *eb);
+
+    struct LocalGate {
+        IGateProvider.Handle    localGate;
+        Int                     refCount;
+    }
+
+    /* Structure of attributes in shared memory */
+    struct Attrs {
+        Bits16 mask;
+        Bits16 creatorProcId;
+        Bits32 arg;
+        Bits32 status;                  /* Created stamp                 */
+    };
+
+    struct Instance_State {
+        RemoteProtect           remoteProtect;
+        LocalProtect            localProtect;
+        Ptr                     nsKey;
+        Int                     numOpens;
+        Bool                    cacheEnabled;
+        Attrs                   *attrs;
+        UInt16                  regionId;
+        SizeT                   allocSize;
+        Ipc.ObjType             objType;
+        Ptr                     proxyAttrs;
+        UInt                    resourceId;
+        IGateProvider.Handle    gateHandle;
+    };
+
+    struct Module_State {
+        NameServer.Handle       nameServer;
+        Int                     numRemoteSystem;
+        Int                     numRemoteCustom1;
+        Int                     numRemoteCustom2;
+        UInt8                   remoteSystemInUse[];
+        UInt8                   remoteCustom1InUse[];
+        UInt8                   remoteCustom2InUse[];
+        Handle                  remoteSystemGates[];
+        Handle                  remoteCustom1Gates[];
+        Handle                  remoteCustom2Gates[];
+        IGateProvider.Handle    gateAll;
+        IGateProvider.Handle    gateSwi;
+        IGateProvider.Handle    gateMutexPri;
+        IGateProvider.Handle    gateNull;
+        Handle                  defaultGate;
+        Int                     proxyMap[ProxyOrder_NUM];
+    };
+}
diff --git a/packages/ti/sdo/ipc/GateMP.xs b/packages/ti/sdo/ipc/GateMP.xs
new file mode 100644 (file)
index 0000000..2bbb4da
--- /dev/null
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateMP.xs ========
+ *
+ */
+
+var GateMP       = null;
+var NameServer   = null;
+var MultiProc    = null;
+var GateAll      = null;
+var GateSwi      = null;
+var GateMutexPri = null;
+var GateNull     = null;
+var SharedRegion = null;
+var Ipc          = null;
+var Settings     = null;
+
+var instCount = 0;  /* use to determine if processing last instance */
+
+/*!
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    GateMP       = this;
+    NameServer   = xdc.useModule("ti.sdo.utils.NameServer");
+    MultiProc    = xdc.useModule("ti.sdo.utils.MultiProc");
+    SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Settings     = xdc.useModule("ti.sdo.ipc.family.Settings");
+
+    /* For local protection */
+    GateMutexPri = xdc.useModule('ti.sysbios.gates.GateMutexPri');
+    GateSwi      = xdc.useModule('ti.sysbios.gates.GateSwi');
+    GateAll      = xdc.useModule('ti.sysbios.gates.GateAll');
+    GateNull     = xdc.useModule('xdc.runtime.GateNull');
+
+    /* Asserts, errors, etc */
+    Ipc          = xdc.useModule('ti.sdo.ipc.Ipc');
+
+    if (GateMP.RemoteSystemProxy == null) {
+        var gateDel = Settings.getHWGate();
+        GateMP.RemoteSystemProxy = xdc.module(gateDel);
+    }
+
+    if (GateMP.RemoteCustom1Proxy == null) {
+        GateMP.RemoteCustom1Proxy
+            = xdc.module('ti.sdo.ipc.gates.GatePeterson');
+    }
+
+    if (GateMP.RemoteCustom2Proxy == null) {
+        GateMP.RemoteCustom2Proxy
+            = xdc.module('ti.sdo.ipc.gates.GateMPSupportNull');
+    }
+}
+
+/*!
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* Might be changed below */
+    mod.nameServer = null;
+    for (var i = 0; i < GateMP.ProxyOrder_NUM; i++) {
+        mod.proxyMap[i] = i;
+    }
+
+    /* See if any of the proxies are the same */
+    if (GateMP.RemoteCustom1Proxy.delegate$.$name ==
+        GateMP.RemoteSystemProxy.delegate$.$name) {
+        mod.proxyMap[GateMP.ProxyOrder_CUSTOM1] =
+            mod.proxyMap[GateMP.ProxyOrder_SYSTEM];
+    }
+
+    if (GateMP.RemoteCustom2Proxy.delegate$.$name ==
+        GateMP.RemoteSystemProxy.delegate$.$name) {
+        mod.proxyMap[GateMP.ProxyOrder_CUSTOM2] =
+            mod.proxyMap[GateMP.ProxyOrder_SYSTEM];
+    }
+    else if (GateMP.RemoteCustom2Proxy.delegate$.$name ==
+             GateMP.RemoteCustom1Proxy.delegate$.$name) {
+        mod.proxyMap[GateMP.ProxyOrder_CUSTOM2] =
+            mod.proxyMap[GateMP.ProxyOrder_CUSTOM1];
+    }
+
+    /* Setup nameserver */
+    /* initialize the NameServer param to be used now or later */
+    GateMP.nameSrvPrms.maxRuntimeEntries = params.maxRuntimeEntries;
+    GateMP.nameSrvPrms.tableSection      = params.tableSection;
+    GateMP.nameSrvPrms.maxNameLen        = params.maxNameLen;
+
+    var Program = xdc.module('xdc.cfg.Program');
+    var target  = Program.build.target;
+
+    /*
+     *  Need 2 words:
+     *    1 word for the SharedRegion Ptr.
+     *    1 word for the proc id of creator and if remote is allowed.
+     */
+    GateMP.nameSrvPrms.maxValueLen       = 2 * target.stdTypes["t_Int32"].size;
+
+    /*
+     *  Get the current number of created static instances of this module.
+     *  Note: if user creates a static instance after this point and
+     *        expects to use NameServer, this is a problem.
+     */
+    var instCount = this.$instances.length;
+
+    /* create NameServer here only if no static instances are created */
+    if (instCount == 0) {
+        mod.nameServer = NameServer.create("GateMP",
+                                           GateMP.nameSrvPrms);
+    }
+
+    /* Create the GateAll, GateSwi, and GateNull singletons */
+    mod.gateAll  = GateAll.create();
+    mod.gateSwi  = GateSwi.create();
+    mod.gateMutexPri = GateMutexPri.create();
+    mod.gateNull = GateNull.create();
+
+    mod.numRemoteSystem  = GateMP.RemoteSystemProxy.delegate$.getNumResources();
+    mod.numRemoteCustom1 = GateMP.RemoteCustom1Proxy.delegate$.getNumResources();
+    mod.numRemoteCustom2 = GateMP.RemoteCustom2Proxy.delegate$.getNumResources();
+    mod.remoteSystemGates.length  = mod.numRemoteSystem;
+
+    /*
+     *  If the proxies are not unique, plug these pointers in GateMP_start
+     *  accordingly.
+     */
+    if (mod.proxyMap[GateMP.ProxyOrder_CUSTOM1] == GateMP.ProxyOrder_CUSTOM1) {
+        mod.remoteCustom1Gates.length = mod.numRemoteCustom1;
+    }
+    else {
+        mod.remoteCustom1Gates.length = 0;
+    }
+
+    if (mod.proxyMap[GateMP.ProxyOrder_CUSTOM2] == GateMP.ProxyOrder_CUSTOM2) {
+        mod.remoteCustom2Gates.length = mod.numRemoteCustom2;
+    }
+    else {
+        mod.remoteCustom2Gates.length = 0;
+    }
+
+    mod.defaultGate = null;
+
+    mod.remoteSystemGates[0] = mod.defaultGate;
+
+    /* Initialize the rest of the proxy gate arrays */
+    for (var i = 1; i < mod.remoteSystemGates.length; i++) {
+        mod.remoteSystemGates[i] = null;
+    }
+
+    for (var i = 0; i < mod.remoteCustom1Gates.length; i++) {
+        mod.remoteCustom1Gates[i] = null;
+    }
+
+    for (var i = 0; i < mod.remoteCustom2Gates.length; i++) {
+        mod.remoteCustom2Gates[i] = null;
+    }
+}
+
+/*
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    var rc = false;
+
+    return (rc);
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    var GateMP          = xdc.useModule('ti.sdo.ipc.GateMP');
+
+    /* view.name */
+    try {
+        if (obj.nsKey != 0x0) {
+            view.name = NameServer.getNameByKey$view(obj.nsKey);
+        }
+    }
+    catch(e) {
+        Program.displayError(view, "name",
+            "Error retrieving name from NameServer: " + e);
+    }
+
+    var GateSupportProxy;
+
+    /* view.remoteProtect & view.remoteStatus */
+    switch(obj.remoteProtect) {
+        case GateMP.RemoteProtect_NONE:
+            view.remoteProtect = "NONE";
+            GateSupportProxy = null;
+            break;
+        case GateMP.RemoteProtect_SYSTEM:
+            view.remoteProtect = "SYSTEM";
+            GateSupportProxy =
+                Program.$modules['ti.sdo.ipc.GateMP'].RemoteSystemProxy;
+            break;
+        case GateMP.RemoteProtect_CUSTOM1:
+            view.remoteProtect = "CUSTOM1";
+            GateSupportProxy =
+                Program.$modules['ti.sdo.ipc.GateMP'].RemoteCustom1Proxy;
+            break;
+        case GateMP.RemoteProtect_CUSTOM2:
+            view.remoteProtect = "CUSTOM2";
+            GateSupportProxy =
+                Program.$modules['ti.sdo.ipc.GateMP'].RemoteCustom2Proxy;
+            break;
+        default:
+            Program.displayError(view, "remoteProtect",
+                "Corrupted state: The value of 'obj->remoteProtect' is not " +
+                "one of known types");
+    }
+
+    if (GateSupportProxy == null) {
+        view.remoteStatus = "[none]";
+    }
+    else {
+        try {
+            var GateDelegate = xdc.useModule(GateSupportProxy.$name);
+            view.remoteStatus
+                = GateDelegate.getRemoteStatus$view(obj.gateHandle);
+        }
+        catch (e) {
+            Program.displayError(view, "remoteStatus",
+                "Error obtaining remote gate (resourceId = " +
+                obj.resourceId + ") status: " + e);
+        }
+    }
+
+    /* view.localProtect */
+    switch(obj.localProtect) {
+        case GateMP.LocalProtect_NONE:
+            view.localProtect = "NONE";
+            break;
+        case GateMP.LocalProtect_INTERRUPT:
+            view.localProtect = "INTERRUPT";
+            break;
+        case GateMP.LocalProtect_TASKLET:
+            view.localProtect = "TASKLET";
+            break;
+        case GateMP.LocalProtect_THREAD:
+            view.localProtect = "THREAD";
+            break;
+        case GateMP.LocalProtect_PROCESS:
+            view.localProtect = "PROCESS";
+            break;
+        default:
+            Program.displayError(view, "localProtect",
+                "Corrupted state: The value of 'obj->localProtect' is not " +
+                "one of known types");
+    }
+
+    /* view.numOpens */
+    view.numOpens = obj.numOpens;
+
+    /* view.resourceId; Ensure that it isn't equal to ((UInt)-1) */
+    if (obj.resourceId != 0xFFFFFFFF) {
+        view.resourceId = obj.resourceId;
+    }
+
+    /* view.creatorProcId */
+    try {
+        var attrs = Program.fetchStruct(GateMP.Attrs$fetchDesc,
+                                        obj.attrs.$addr, false);
+
+        view.creatorProcId = attrs.creatorProcId;
+    }
+    catch (e) {
+        Program.displayError(view, 'creatorProcId',
+            "Error: could not fetch shared memory structure: " + e);
+    }
+
+    /* view.objType */
+    try {
+        view.objType = Ipc.getObjTypeStr$view(obj.objType);
+    }
+    catch (e) {
+        Program.displayError(view, "objType", "Corrupted state: " + e);
+    }
+}
+
+/*
+ *  ======== viewInitModule ========
+ */
+function viewInitModule(view, mod)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    view.numGatesSystem = mod.numRemoteSystem;
+
+    if (mod.defaultGate == 0) {
+        /* GateMP not started yet */
+        view.numUsedSystem = 0;
+        return;
+    }
+
+    try {
+        var remoteSystemInUse = Program.fetchArray(
+            mod.remoteSystemInUse$fetchDesc,
+            mod.remoteSystemInUse.$addr,
+            mod.numRemoteSystem);
+    }
+    catch (e) {
+        throw("Problem fetching remoteSystemInUse" + e); //TODO
+    }
+
+    view.numUsedSystem = 0;
+    for each (var isUsed in remoteSystemInUse) {
+        if (isUsed) {
+            view.numUsedSystem++;
+        }
+    }
+
+    if (mod.proxyMap[1] == 1) {
+        view.numGatesCustom1 = mod.numRemoteCustom1;
+
+        try {
+            var remoteCustom1InUse = Program.fetchArray(
+                mod.remoteCustom1InUse$fetchDesc,
+                mod.remoteCustom1InUse.$addr,
+                mod.numRemoteCustom1);
+        }
+        catch (e) {
+            throw("Problem fetching remoteCustom1InUse" + e); //TODO
+        }
+
+
+        view.numUsedCustom1 = 0;
+        for each (var isUsed in remoteCustom1InUse) {
+            if (isUsed) {
+                view.numUsedCustom1++;
+            }
+        }
+    }
+
+    if (mod.proxyMap[2] == 2) {
+        view.numGatesCustom2 = mod.numRemoteCustom2;
+
+        try {
+            var remoteCustom2InUse = Program.fetchArray(
+                mod.remoteCustom2InUse$fetchDesc,
+                mod.remoteCustom2InUse.$addr,
+                mod.numRemoteCustom2);
+        }
+        catch (e) {
+            throw("Problem fetching remoteCustom1InUse" + e); //TODO
+        }
+
+
+        view.numUsedCustom2 = 0;
+        for each (var isUsed in remoteCustom2InUse) {
+            if (isUsed) {
+                view.numUsedCustom2++;
+            }
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/Ipc.c b/packages/ti/sdo/ipc/Ipc.c
new file mode 100644 (file)
index 0000000..d5e4832
--- /dev/null
@@ -0,0 +1,1227 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Ipc.c ========
+ */
+
+#include <string.h>     /* for memcpy() */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+
+#include "package/internal/Ipc.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(Ipc_attach);
+    #pragma FUNC_EXT_CALLED(Ipc_detach);
+    #pragma FUNC_EXT_CALLED(Ipc_isAttached);
+    #pragma FUNC_EXT_CALLED(Ipc_readConfig);
+    #pragma FUNC_EXT_CALLED(Ipc_start);
+    #pragma FUNC_EXT_CALLED(Ipc_stop);
+    #pragma FUNC_EXT_CALLED(Ipc_writeConfig);
+#endif
+
+/*
+ *  For no MMU case, it should be set to TRUE always.
+ *  For MMU, it would be set by IPC link between local and HOST processors.
+ */
+extern __FAR__ Bits32 Ipc_sr0MemorySetup;
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Ipc_attach ========
+ */
+Int Ipc_attach(UInt16 remoteProcId)
+{
+    Int i;
+    Ptr sharedAddr;
+    SizeT memReq;
+    volatile ti_sdo_ipc_Ipc_Reserved *slave;
+    ti_sdo_ipc_Ipc_ProcEntry *ipc;
+    Error_Block eb;
+    SharedRegion_Entry entry;
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    Int status;
+    UInt hwiKey;
+
+    /* Assert remoteProcId is in our cluster and isn't our own */
+    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
+                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+    Assert_isTrue(remoteProcId != MultiProc_self(),
+                  ti_sdo_ipc_Ipc_A_invArgument);
+
+    /* Check whether Ipc_start has been called.  If not, fail. */
+    if (Ipc_module->ipcSharedAddr == NULL) {
+        return (Ipc_E_FAIL);
+    }
+
+    /* for checking and incrementing attached below */
+    hwiKey = Hwi_disable();
+
+    /* Make sure its not already attached */
+    if (Ipc_module->procEntry[clusterId].attached) {
+        Ipc_module->procEntry[clusterId].attached++;
+        /* restore interrupts and return */
+        Hwi_restore(hwiKey);
+        return (Ipc_S_ALREADYSETUP);
+    }
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    /* Make sure we've attached to owner of SR0 if we're not owner */
+    if ((MultiProc_self() != entry.ownerProcId) &&
+        (remoteProcId != entry.ownerProcId) &&
+        !(Ipc_module->procEntry[ti_sdo_utils_MultiProc_getClusterId(
+            entry.ownerProcId)].attached)) {
+        return (Ipc_E_FAIL);
+    }
+
+    /* Init error block */
+    Error_init(&eb);
+
+    /* determine the slave's slot */
+    slave = Ipc_getSlaveAddr(remoteProcId, Ipc_module->ipcSharedAddr);
+
+    if (cacheEnabled) {
+        Cache_inv((Ptr)slave, reservedSize, Cache_Type_ALL, TRUE);
+    }
+
+    /* Synchronize the processors. */
+    status = Ipc_procSyncStart(remoteProcId, Ipc_module->ipcSharedAddr);
+    if (status < 0) {
+        return (status);
+    }
+
+    /* must be called before SharedRegion_attach */
+    status = ti_sdo_ipc_GateMP_attach(remoteProcId,
+            Ipc_module->gateMPSharedAddr);
+    if (status < 0) {
+        return (status);
+    }
+
+    /* retrieves the SharedRegion Heap handles */
+    status = ti_sdo_ipc_SharedRegion_attach(remoteProcId);
+    if (status < 0) {
+        return (status);
+    }
+
+    /* get the attach parameters associated with remoteProcId */
+    ipc = &(Ipc_module->procEntry[clusterId]);
+
+    /* attach Notify if not yet attached and specified to set internal setup */
+    if (!(Notify_intLineRegistered(remoteProcId, 0)) &&
+        (ipc->entry.setupNotify)) {
+        /* call Notify_attach */
+        memReq = Notify_sharedMemReq(remoteProcId, Ipc_module->ipcSharedAddr);
+        if (memReq != 0) {
+            if (MultiProc_self() < remoteProcId) {
+                /*
+                 *  calloc required here due to race condition.  Its possible
+                 *  that the slave, who creates the instance, tries a sendEvent
+                 *  before the master has created its instance because the
+                 *  state of memory was enabled from a previous run.
+                 */
+                sharedAddr = Memory_calloc(SharedRegion_getHeap(0),
+                                       memReq,
+                                       SharedRegion_getCacheLineSize(0),
+                                       &eb);
+
+                /* make sure alloc did not fail */
+                if (sharedAddr == NULL) {
+                    return (Ipc_E_MEMORY);
+                }
+
+                /* if cache enabled, wbInv the calloc above */
+                if (cacheEnabled) {
+                    Cache_wbInv(sharedAddr, memReq, Cache_Type_ALL, TRUE);
+                }
+
+                /* set the notify SRPtr */
+                slave->notifySRPtr = SharedRegion_getSRPtr(sharedAddr, 0);
+            }
+            else {
+                /* get the notify SRPtr */
+                sharedAddr = SharedRegion_getPtr(slave->notifySRPtr);
+            }
+        }
+        else {
+            sharedAddr = NULL;
+            slave->notifySRPtr = 0;
+        }
+
+        /* call attach to remote processor */
+        status = Notify_attach(remoteProcId, sharedAddr);
+
+        if (status < 0) {
+            if (MultiProc_self() < remoteProcId && sharedAddr != NULL) {
+                /* free the memory back to SharedRegion 0 heap */
+                Memory_free(SharedRegion_getHeap(0), sharedAddr, memReq);
+            }
+
+            return (Ipc_E_FAIL);
+        }
+    }
+
+    /* Must come after GateMP_start because depends on default GateMP */
+    if (!(ti_sdo_utils_NameServer_isRegistered(remoteProcId)) &&
+        (ipc->entry.setupNotify)) {
+        memReq = ti_sdo_utils_NameServer_SetupProxy_sharedMemReq(
+            Ipc_module->ipcSharedAddr);
+        if (memReq != 0) {
+            if (MultiProc_self() < remoteProcId) {
+                sharedAddr = Memory_alloc(SharedRegion_getHeap(0),
+                                     memReq,
+                                     SharedRegion_getCacheLineSize(0),
+                                     &eb);
+
+                /* make sure alloc did not fail */
+                if (sharedAddr == NULL) {
+                    return (Ipc_E_MEMORY);
+                }
+
+                /* set the NSRN SRPtr */
+                slave->nsrnSRPtr = SharedRegion_getSRPtr(sharedAddr, 0);
+            }
+            else {
+                /* get the NSRN SRPtr */
+                sharedAddr = SharedRegion_getPtr(slave->nsrnSRPtr);
+            }
+        }
+        else {
+            sharedAddr = NULL;
+            slave->nsrnSRPtr = 0;
+        }
+
+        /* call attach to remote processor */
+        status = ti_sdo_utils_NameServer_SetupProxy_attach(remoteProcId,
+                                                           sharedAddr);
+
+        if (status < 0) {
+            if (MultiProc_self() < remoteProcId && sharedAddr != NULL) {
+                /* free the memory back to SharedRegion 0 heap */
+                Memory_free(SharedRegion_getHeap(0), sharedAddr, memReq);
+            }
+
+            return (Ipc_E_FAIL);
+        }
+    }
+
+    /* Must come after GateMP_start because depends on default GateMP */
+    if (!(ti_sdo_ipc_MessageQ_SetupTransportProxy_isRegistered(remoteProcId)) &&
+        (ipc->entry.setupMessageQ)) {
+        memReq = ti_sdo_ipc_MessageQ_SetupTransportProxy_sharedMemReq(
+            Ipc_module->ipcSharedAddr);
+
+        if (memReq != 0) {
+            if (MultiProc_self() < remoteProcId) {
+                sharedAddr = Memory_alloc(SharedRegion_getHeap(0),
+                    memReq, SharedRegion_getCacheLineSize(0), &eb);
+
+                /* make sure alloc did not fail */
+                if (sharedAddr == NULL) {
+                    return (Ipc_E_MEMORY);
+                }
+
+                /* set the transport SRPtr */
+                slave->transportSRPtr = SharedRegion_getSRPtr(sharedAddr, 0);
+            }
+            else {
+                /* get the transport SRPtr */
+                sharedAddr = SharedRegion_getPtr(slave->transportSRPtr);
+            }
+        }
+        else {
+            sharedAddr = NULL;
+            slave->transportSRPtr = 0;
+        }
+
+        /* call attach to remote processor */
+        status = ti_sdo_ipc_MessageQ_SetupTransportProxy_attach(remoteProcId,
+            sharedAddr);
+
+        if (status < 0) {
+            if (MultiProc_self() < remoteProcId && sharedAddr != NULL) {
+                /* free the memory back to SharedRegion 0 heap */
+                Memory_free(SharedRegion_getHeap(0), sharedAddr, memReq);
+            }
+
+            return (Ipc_E_FAIL);
+        }
+    }
+
+    /* writeback invalidate slave's shared memory if cache enabled */
+    if (cacheEnabled) {
+        if (MultiProc_self() < remoteProcId) {
+            Cache_wbInv((Ptr)slave, reservedSize, Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /* Call user attach fxns */
+    for (i = 0; i < ti_sdo_ipc_Ipc_numUserFxns; i++) {
+        if (ti_sdo_ipc_Ipc_userFxns[i].userFxn.attach) {
+            status = ti_sdo_ipc_Ipc_userFxns[i].userFxn.attach(
+                ti_sdo_ipc_Ipc_userFxns[i].arg, remoteProcId);
+
+            if (status < 0) {
+                return (status);
+            }
+        }
+    }
+
+    /* Finish the processor synchronization */
+    status = ti_sdo_ipc_Ipc_procSyncFinish(remoteProcId,
+        Ipc_module->ipcSharedAddr);
+
+    if (status < 0) {
+        return (status);
+    }
+
+    /* for atomically incrementing attached */
+    hwiKey = Hwi_disable();
+
+    /* now attached to remote processor */
+    Ipc_module->procEntry[clusterId].attached++;
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    return (status);
+}
+
+/*
+ *  ======== Ipc_isAttached ========
+ */
+Bool Ipc_isAttached(UInt16 remoteProcId)
+{
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+
+    /* Assert remoteProcId is in our cluster */
+    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
+                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    if (remoteProcId == MultiProc_self()) {
+        return (FALSE);
+    }
+    else {
+        return (Ipc_module->procEntry[clusterId].attached);
+    }
+}
+
+/*
+ *  ======== Ipc_detach ========
+ */
+Int Ipc_detach(UInt16 remoteProcId)
+{
+    Int i;
+    UInt16 baseId = MultiProc_getBaseIdOfCluster();
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    Ptr notifySharedAddr;
+    Ptr nsrnSharedAddr;
+    Ptr msgqSharedAddr;
+    volatile ti_sdo_ipc_Ipc_Reserved *slave, *master;
+    SharedRegion_Entry entry;
+    ti_sdo_ipc_Ipc_ProcEntry *ipc;
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
+    Int status = Ipc_S_SUCCESS;
+    UInt hwiKey;
+
+    /* Assert remoteProcId is in our cluster and isn't our own */
+    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
+                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+    Assert_isTrue(remoteProcId != MultiProc_self(),
+                  ti_sdo_ipc_Ipc_A_invArgument);
+
+    /* for checking and incrementing attached below */
+    hwiKey = Hwi_disable();
+
+    if (Ipc_module->procEntry[clusterId].attached > 1) {
+        /* only detach if attach count reaches 1 */
+        Ipc_module->procEntry[clusterId].attached--;
+        Hwi_restore(hwiKey);
+        return (Ipc_S_BUSY);
+    }
+    else if (Ipc_module->procEntry[clusterId].attached == 0) {
+        /* already detached, restore interrupts and return success */
+        Hwi_restore(hwiKey);
+        return (Ipc_S_SUCCESS);
+    }
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    /*
+     *  Make sure we detach from all other procs in cluster before
+     *  detaching from owner of SR 0.
+     */
+    if (remoteProcId == entry.ownerProcId) {
+        for (i = 0; i < ti_sdo_utils_MultiProc_numProcsInCluster; i++, baseId++) {
+            if ((baseId != MultiProc_self()) && (baseId != entry.ownerProcId) &&
+                (Ipc_module->procEntry[i].attached)) {
+                return (Ipc_E_FAIL);
+            }
+        }
+    }
+
+    /* get the paramters associated with remoteProcId */
+    ipc = &(Ipc_module->procEntry[clusterId]);
+
+    /* determine the slave's slot */
+    slave = Ipc_getSlaveAddr(remoteProcId, Ipc_module->ipcSharedAddr);
+
+    /* determine the master's slot */
+    master = ti_sdo_ipc_Ipc_getMasterAddr(remoteProcId,
+        Ipc_module->ipcSharedAddr);
+
+    if (cacheEnabled) {
+        Cache_inv((Ptr)slave, reservedSize, Cache_Type_ALL, TRUE);
+        Cache_inv((Ptr)master, reservedSize, Cache_Type_ALL, TRUE);
+    }
+
+    if (MultiProc_self() < remoteProcId) {
+        /* check to make sure master is not trying to attach */
+        if (master->startedKey == ti_sdo_ipc_Ipc_PROCSYNCSTART) {
+            return (Ipc_E_NOTREADY);
+        }
+    }
+    else {
+        /* check to make sure slave is not trying to attach */
+        if (slave->startedKey == ti_sdo_ipc_Ipc_PROCSYNCSTART) {
+            return (Ipc_E_NOTREADY);
+        }
+    }
+
+    /* The slave processor waits for master to finish its detach sequence */
+    if (MultiProc_self() < remoteProcId) {
+        if (master->startedKey != ti_sdo_ipc_Ipc_PROCSYNCDETACH) {
+            return (Ipc_E_NOTREADY);
+        }
+    }
+
+    /* Call user detach fxns */
+    for (i = 0; i < ti_sdo_ipc_Ipc_numUserFxns; i++) {
+        if (ti_sdo_ipc_Ipc_userFxns[i].userFxn.detach) {
+            status = ti_sdo_ipc_Ipc_userFxns[i].userFxn.detach(
+                ti_sdo_ipc_Ipc_userFxns[i].arg, remoteProcId);
+
+            if (status < 0) {
+                return (status);
+            }
+        }
+    }
+
+    if ((ipc->entry.setupMessageQ) &&
+       (ti_sdo_ipc_MessageQ_SetupTransportProxy_isRegistered(remoteProcId))) {
+        /* call MessageQ_detach for remote processor */
+        status = ti_sdo_ipc_MessageQ_SetupTransportProxy_detach(remoteProcId);
+        if (status < 0) {
+            return (Ipc_E_FAIL);
+        }
+
+        if (slave->transportSRPtr) {
+            /* free the memory if slave processor */
+            if (MultiProc_self() < remoteProcId) {
+                /* get the pointer to MessageQ transport instance */
+                msgqSharedAddr = SharedRegion_getPtr(slave->transportSRPtr);
+
+                /* free the memory back to SharedRegion 0 heap */
+                Memory_free(SharedRegion_getHeap(0),
+                    msgqSharedAddr,
+                    ti_sdo_ipc_MessageQ_SetupTransportProxy_sharedMemReq(
+                        msgqSharedAddr));
+
+                /* set pointer for MessageQ transport instance back to NULL */
+                slave->transportSRPtr = NULL;
+            }
+        }
+    }
+
+    if ((ipc->entry.setupNotify) &&
+        (ti_sdo_utils_NameServer_isRegistered(remoteProcId))) {
+        /* call NameServer_SetupProxy_detach for remote processor */
+        status = ti_sdo_utils_NameServer_SetupProxy_detach(remoteProcId);
+        if (status < 0) {
+            return (Ipc_E_FAIL);
+        }
+
+        if (slave->nsrnSRPtr) {
+            /* free the memory if slave processor */
+            if (MultiProc_self() < remoteProcId) {
+                /* get the pointer to NSRN instance */
+                nsrnSharedAddr = SharedRegion_getPtr(slave->nsrnSRPtr);
+
+                /* free the memory back to SharedRegion 0 heap */
+                Memory_free(SharedRegion_getHeap(0),
+                            nsrnSharedAddr,
+                            ti_sdo_utils_NameServer_SetupProxy_sharedMemReq(
+                                nsrnSharedAddr));
+
+                /* set pointer for NSRN instance back to NULL */
+                slave->nsrnSRPtr = NULL;
+            }
+        }
+    }
+
+    if ((ipc->entry.setupNotify) &&
+        (Notify_intLineRegistered(remoteProcId, 0))) {
+        /* call Notify_detach for remote processor */
+        status = ti_sdo_ipc_Notify_detach(remoteProcId);
+        if (status < 0) {
+            return (Ipc_E_FAIL);
+        }
+
+        if (slave->notifySRPtr) {
+            /* free the memory if slave processor */
+            if (MultiProc_self() < remoteProcId) {
+                /* get the pointer to Notify instance */
+                notifySharedAddr = SharedRegion_getPtr(slave->notifySRPtr);
+
+                /* free the memory back to SharedRegion 0 heap */
+                Memory_free(SharedRegion_getHeap(0),
+                            notifySharedAddr,
+                            Notify_sharedMemReq(remoteProcId, notifySharedAddr));
+
+                /* set pointer for Notify instance back to NULL */
+                slave->notifySRPtr = NULL;
+            }
+        }
+    }
+
+    /* close any HeapMemMP which may have been opened */
+    status = ti_sdo_ipc_SharedRegion_detach(remoteProcId);
+    if (status < 0) {
+        return (status);
+    }
+
+    /* close any GateMP which may have been opened */
+    status = ti_sdo_ipc_GateMP_detach(remoteProcId);
+    if (status < 0) {
+        return (status);
+    }
+
+    if (MultiProc_self() < remoteProcId) {
+        slave->configListHead = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+        slave->startedKey = ti_sdo_ipc_Ipc_PROCSYNCDETACH;
+        if (cacheEnabled) {
+            Cache_wbInv((Ptr)slave, reservedSize, Cache_Type_ALL, TRUE);
+        }
+    }
+    else {
+        master->configListHead = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+        master->startedKey = ti_sdo_ipc_Ipc_PROCSYNCDETACH;
+        if (cacheEnabled) {
+            Cache_wbInv((Ptr)master, reservedSize, Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /* attached must be decremented atomically */
+    hwiKey = Hwi_disable();
+
+    /* now detached from remote processor */
+    Ipc_module->procEntry[clusterId].attached--;
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    return (status);
+}
+
+/*
+ *  ======== Ipc_readConfig ========
+ */
+Int Ipc_readConfig(UInt16 remoteProcId, UInt32 tag, Ptr cfg, SizeT size)
+{
+    Int status = Ipc_E_FAIL;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    volatile ti_sdo_ipc_Ipc_ConfigEntry *entry;
+    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
+
+    /* Assert that the remoteProc in our cluster and isn't our own */
+    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
+                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    if (cacheEnabled) {
+        Cache_inv(Ipc_module->procEntry[clusterId].remoteConfigList,
+                  SharedRegion_getCacheLineSize(0),
+                  Cache_Type_ALL,
+                  TRUE);
+    }
+
+    entry = (ti_sdo_ipc_Ipc_ConfigEntry *)
+            *Ipc_module->procEntry[clusterId].remoteConfigList;
+
+    while ((SharedRegion_SRPtr)entry != ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
+        entry = (ti_sdo_ipc_Ipc_ConfigEntry *)
+                SharedRegion_getPtr((SharedRegion_SRPtr)entry);
+
+        /* Traverse the list to find the tag */
+        if (cacheEnabled) {
+            Cache_inv((Ptr)entry,
+                      size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
+                      Cache_Type_ALL,
+                      TRUE);
+        }
+
+        if ((entry->remoteProcId == MultiProc_self()) &&
+            (entry->localProcId == remoteProcId) &&
+            (entry->tag == tag)) {
+
+            if (size == entry->size) {
+                memcpy(cfg, (Ptr)((UInt32)entry + sizeof(ti_sdo_ipc_Ipc_ConfigEntry)),
+                        entry->size);
+                return (Ipc_S_SUCCESS);
+            }
+            else {
+                return (Ipc_E_FAIL);
+            }
+        }
+
+        entry = (ti_sdo_ipc_Ipc_ConfigEntry *)entry->next;
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== Ipc_start ========
+ */
+Int Ipc_start()
+{
+    Int i;
+    UInt16 baseId = MultiProc_getBaseIdOfCluster();
+    SharedRegion_Entry entry;
+    Ptr ipcSharedAddr;
+    Ptr gateMPSharedAddr;
+    GateMP_Params gateMPParams;
+    Int status;
+
+    /* Check whether Ipc_start has been called.  If so, succeed. */
+    if (Ipc_module->ipcSharedAddr != NULL) {
+        return (Ipc_S_ALREADYSETUP);
+    }
+
+    if (ti_sdo_ipc_Ipc_generateSlaveDataForHost) {
+        /* get Ipc_sr0MemorySetup out of the cache */
+        Cache_inv(&Ipc_sr0MemorySetup,
+              sizeof(Ipc_sr0MemorySetup),
+              Cache_Type_ALL,
+              TRUE);
+
+        /* check Ipc_sr0MemorySetup variable */
+        if (Ipc_sr0MemorySetup == 0x0) {
+            return (Ipc_E_NOTREADY);
+        }
+    }
+
+    /* get region 0 information */
+    SharedRegion_getEntry(0, &entry);
+
+    /* if entry is not valid then return */
+    if (entry.isValid == FALSE) {
+        return (Ipc_E_NOTREADY);
+    }
+
+    /*
+     *  Need to reserve memory in region 0 for processor synchronization.
+     *  This must done before SharedRegion_start().
+     */
+    ipcSharedAddr = ti_sdo_ipc_SharedRegion_reserveMemory(
+            0, Ipc_getRegion0ReservedSize());
+
+    /* must reserve memory for GateMP before SharedRegion_start() */
+    gateMPSharedAddr = ti_sdo_ipc_SharedRegion_reserveMemory(0,
+            ti_sdo_ipc_GateMP_getRegion0ReservedSize());
+
+    /* Init params for default gate (must match those in GateMP_start()) */
+    GateMP_Params_init(&gateMPParams);
+    gateMPParams.localProtect  = GateMP_LocalProtect_TASKLET;
+
+    if (ti_sdo_utils_MultiProc_numProcessors > 1) {
+        gateMPParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+    }
+    else {
+        gateMPParams.remoteProtect = GateMP_RemoteProtect_NONE;
+    }
+
+    /* reserve memory for default gate before SharedRegion_start() */
+    ti_sdo_ipc_SharedRegion_reserveMemory(0, GateMP_sharedMemReq(&gateMPParams));
+
+    /* clear the reserved memory */
+    ti_sdo_ipc_SharedRegion_clearReservedMemory();
+
+    /* Set shared addresses */
+    Ipc_module->ipcSharedAddr = ipcSharedAddr;
+    Ipc_module->gateMPSharedAddr = gateMPSharedAddr;
+
+    /* create default GateMP, must be called before SharedRegion start */
+    status = ti_sdo_ipc_GateMP_start(Ipc_module->gateMPSharedAddr);
+    if (status < 0) {
+        return (status);
+    }
+
+    /* create HeapMemMP in each SharedRegion */
+    status = ti_sdo_ipc_SharedRegion_start();
+    if (status < 0) {
+        return (status);
+    }
+
+    /* Call attach for all procs if procSync is ALL */
+    if (ti_sdo_ipc_Ipc_procSync == ti_sdo_ipc_Ipc_ProcSync_ALL) {
+        /* Must attach to owner first to get default GateMP and HeapMemMP */
+        if (MultiProc_self() != entry.ownerProcId) {
+            do {
+                status = Ipc_attach(entry.ownerProcId);
+            } while (status == Ipc_E_NOTREADY);
+
+            if (status < 0) {
+                /* Ipc_attach failed. Get out of Ipc_start */
+                return (status);
+            }
+        }
+
+        /* Loop to attach to all other processors in cluster */
+        for (i = 0; i < ti_sdo_utils_MultiProc_numProcsInCluster; i++, baseId++) {
+            if ((baseId == MultiProc_self()) || (baseId == entry.ownerProcId)) {
+                continue;
+            }
+
+            /* Skip the processor if there are no interrupt lines to it */
+            if (Notify_numIntLines(baseId) == 0) {
+                continue;
+            }
+
+            /* call Ipc_attach for every remote processor */
+            do {
+                status = Ipc_attach(baseId);
+            } while (status == Ipc_E_NOTREADY);
+
+            if (status < 0) {
+                /* Ipc_attach failed. Get out of Ipc_start */
+                return (status);
+            }
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== Ipc_stop ========
+ */
+Int Ipc_stop()
+{
+    Int status;
+
+    /* clear local module state */
+    Ipc_module->gateMPSharedAddr = NULL;
+    Ipc_module->ipcSharedAddr = NULL;
+
+    /* reset Shared Region 0 reservedSize and heap handle */
+    ti_sdo_ipc_SharedRegion_resetInternalFields(0);
+
+    /* delete any HeapMemMP created by owner of SR0 */
+    status = ti_sdo_ipc_SharedRegion_stop();
+    if (status < 0) {
+        return (status);
+    }
+
+    /* delete default GateMP created by owner of SR0 */
+    status = ti_sdo_ipc_GateMP_stop();
+    if (status < 0) {
+        return (status);
+    }
+
+    /* set sr0MemorySetup back to 0 if needed by Host */
+    if ((ti_sdo_ipc_Ipc_generateSlaveDataForHost) &&
+        !(ti_sdo_ipc_Ipc_sr0MemorySetup)) {
+        Ipc_sr0MemorySetup = 0;
+        Cache_wbInv(&Ipc_sr0MemorySetup,
+              sizeof(Ipc_sr0MemorySetup),
+              Cache_Type_ALL,
+              TRUE);
+    }
+
+    return (Ipc_S_SUCCESS);
+}
+
+/*
+ *  ======== Ipc_writeConfig ========
+ */
+Int Ipc_writeConfig(UInt16 remoteProcId, UInt32 tag, Ptr cfg, SizeT size)
+{
+    Int status = Ipc_S_SUCCESS;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    SharedRegion_SRPtr curSRPtr, *prevSRPtr;
+    ti_sdo_ipc_Ipc_ConfigEntry *entry;
+    Error_Block eb;
+    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
+
+    /* Assert that the remoteProc in our cluster */
+    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
+                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    Error_init(&eb);
+
+    if (cfg == NULL) {
+        status = Ipc_E_FAIL;
+
+        /* get head of local config list and set prevSRPtr to it */
+        prevSRPtr = (Ipc_module->procEntry[clusterId].localConfigList);
+
+        /*
+         *  When cfg is NULL, the last memory allocated from a previous
+         *  Ipc_writeConfig call with the same remoteProcId, tag, and size
+         *  is freed.
+         */
+        curSRPtr = *prevSRPtr;
+
+        /* loop through list of config entries until matching entry is found */
+        while (curSRPtr != ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
+            /* convert Ptr associated with curSRPtr */
+            entry = (ti_sdo_ipc_Ipc_ConfigEntry *)
+                    (SharedRegion_getPtr(curSRPtr));
+
+            /* make sure entry matches remoteProcId, tag, and size */
+            if ((entry->remoteProcId == remoteProcId) &&
+                (entry->tag == tag) &&
+                (entry->size == size)) {
+                /* Update the 'prev' next ptr */
+                *prevSRPtr = (SharedRegion_SRPtr)entry->next;
+
+                /* writeback the 'prev' ptr */
+                if (cacheEnabled) {
+                    Cache_wb(prevSRPtr,
+                        sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
+                        Cache_Type_ALL,
+                        FALSE);
+                }
+
+                /* free entry's memory back to shared heap */
+                Memory_free(SharedRegion_getHeap(0),
+                    entry,
+                    size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry));
+
+                /* set the status to success */
+                status = Ipc_S_SUCCESS;
+                break;
+            }
+
+            /* set the 'prev' to the 'cur' SRPtr */
+            prevSRPtr = (SharedRegion_SRPtr *)(&entry->next);
+
+            /* point to next config entry */
+            curSRPtr = (SharedRegion_SRPtr)entry->next;
+        }
+
+        /* return that status */
+        return (status);
+    }
+
+    /* Allocate memory from the shared heap (System Heap) */
+    entry = Memory_alloc(SharedRegion_getHeap(0),
+                         size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
+                         SharedRegion_getCacheLineSize(0),
+                         &eb);
+
+    if (entry == NULL) {
+        return (Ipc_E_FAIL);
+    }
+
+    /* set the entry */
+    entry->remoteProcId = remoteProcId;
+    entry->localProcId = MultiProc_self();
+    entry->tag = tag;
+    entry->size = size;
+    memcpy((Ptr)((UInt32)entry + sizeof(ti_sdo_ipc_Ipc_ConfigEntry)), cfg,
+                  size);
+
+    /* point the entry's next to the first entry in the list */
+    entry->next = *Ipc_module->procEntry[clusterId].localConfigList;
+
+    /* first write-back the entry if cache is enabled */
+    if (cacheEnabled) {
+        Cache_wb(entry, size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
+                 Cache_Type_ALL,
+                 FALSE);
+    }
+
+    /* set the entry as the new first in the list */
+    *Ipc_module->procEntry[clusterId].localConfigList =
+        SharedRegion_getSRPtr(entry, 0);
+
+    /* write-back the config list */
+    if (cacheEnabled) {
+        Cache_wb(Ipc_module->procEntry[clusterId].localConfigList,
+                 SharedRegion_getCacheLineSize(0),
+                 Cache_Type_ALL,
+                 FALSE);
+    }
+
+    return (status);
+}
+
+/*
+ *************************************************************************
+ *                       Module Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_dummy ========
+ */
+Void ti_sdo_ipc_Ipc_dummy()
+{
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_getEntry ========
+ */
+Void ti_sdo_ipc_Ipc_getEntry(ti_sdo_ipc_Ipc_Entry *entry)
+{
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(entry->remoteProcId);
+
+    /* Assert remoteProcId is in our cluster */
+    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
+                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    /* Get the setupNotify flag */
+    entry->setupNotify =
+        Ipc_module->procEntry[clusterId].entry.setupNotify;
+
+    /* Get the setupMessageQ flag */
+    entry->setupMessageQ =
+        Ipc_module->procEntry[clusterId].entry.setupMessageQ;
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_setEntry ========
+ */
+Void ti_sdo_ipc_Ipc_setEntry(ti_sdo_ipc_Ipc_Entry *entry)
+{
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(entry->remoteProcId);
+
+    /* Set the setupNotify flag */
+    Ipc_module->procEntry[clusterId].entry.setupNotify =
+        entry->setupNotify;
+
+    /* Set the setupMessageQ flag */
+    Ipc_module->procEntry[clusterId].entry.setupMessageQ =
+        entry->setupMessageQ;
+}
+
+/*
+ *************************************************************************
+ *                       Internal Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_getMasterAddr ========
+ */
+Ptr ti_sdo_ipc_Ipc_getMasterAddr(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    Int slot;
+    UInt16 masterId;
+    volatile ti_sdo_ipc_Ipc_Reserved *master;
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+
+    /* determine the master's procId and slot */
+    if (MultiProc_self() < remoteProcId) {
+        masterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+        slot = ti_sdo_utils_MultiProc_getClusterId(MultiProc_self());
+    }
+    else {
+        masterId = ti_sdo_utils_MultiProc_getClusterId(MultiProc_self());
+        slot = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    }
+
+    /* determine the reserve address for master between self and remote */
+    master = (ti_sdo_ipc_Ipc_Reserved *)((UInt32)sharedAddr +
+             ((masterId * reservedSize) +
+             (slot * sizeof(ti_sdo_ipc_Ipc_Reserved))));
+
+    return ((Ptr)master);
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_getRegion0ReservedSize ========
+ */
+SizeT ti_sdo_ipc_Ipc_getRegion0ReservedSize(Void)
+{
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+
+    /* Calculate the total amount to reserve */
+    reservedSize = reservedSize * ti_sdo_utils_MultiProc_numProcsInCluster;
+
+    return (reservedSize);
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_getSlaveAddr ========
+ */
+Ptr ti_sdo_ipc_Ipc_getSlaveAddr(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    Int slot;
+    UInt16 slaveId;
+    volatile ti_sdo_ipc_Ipc_Reserved *slave;
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+
+    /* determine the slave's procId and slot */
+    if (MultiProc_self() < remoteProcId) {
+        slaveId = ti_sdo_utils_MultiProc_getClusterId(MultiProc_self());
+        slot = ti_sdo_utils_MultiProc_getClusterId(remoteProcId) - 1;
+    }
+    else {
+        slaveId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+        slot = ti_sdo_utils_MultiProc_getClusterId(MultiProc_self()) - 1;
+    }
+
+    /* determine the reserve address for slave between self and remote */
+    slave = (ti_sdo_ipc_Ipc_Reserved *)((UInt32)sharedAddr +
+            ((slaveId * reservedSize) +
+            (slot * sizeof(ti_sdo_ipc_Ipc_Reserved))));
+
+    return ((Ptr)slave);
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_procSyncStart ========
+ *  The owner of SharedRegion 0 writes to its reserve memory address
+ *  in region 0 to let the other processors know it has started.
+ *  It then spins until the other processors start.
+ *  The other processors write their reserve memory address in
+ *  region 0 to let the owner processor know they've started.
+ *  The other processors then spin until the owner processor writes
+ *  to let them know that its finished the process of synchronization
+ *  before continuing.
+ */
+Int ti_sdo_ipc_Ipc_procSyncStart(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    volatile ti_sdo_ipc_Ipc_Reserved *self, *remote;
+    ti_sdo_ipc_Ipc_ProcEntry *ipc;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
+
+    /* don't do any synchronization if procSync is NONE */
+    if (ti_sdo_ipc_Ipc_procSync == ti_sdo_ipc_Ipc_ProcSync_NONE) {
+        return (Ipc_S_SUCCESS);
+    }
+
+    /* determine self and remote pointers */
+    if (MultiProc_self() < remoteProcId) {
+        self = Ipc_getSlaveAddr(remoteProcId, sharedAddr);
+        remote = ti_sdo_ipc_Ipc_getMasterAddr(remoteProcId, sharedAddr);
+    }
+    else {
+        self = ti_sdo_ipc_Ipc_getMasterAddr(remoteProcId, sharedAddr);
+        remote = Ipc_getSlaveAddr(remoteProcId, sharedAddr);
+    }
+
+    /* construct the config list */
+    ipc = &(Ipc_module->procEntry[clusterId]);
+
+    ipc->localConfigList = (Ptr)&self->configListHead;
+    ipc->remoteConfigList = (Ptr)&remote->configListHead;
+
+    *ipc->localConfigList = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+
+    if (cacheEnabled) {
+        Cache_wbInv(ipc->localConfigList, reservedSize, Cache_Type_ALL, TRUE);
+    }
+
+    if (MultiProc_self() < remoteProcId) {
+        /* set my processor's reserved key to start */
+        self->startedKey = ti_sdo_ipc_Ipc_PROCSYNCSTART;
+
+        /* write back my processor's reserve key */
+        if (cacheEnabled) {
+            Cache_wbInv((Ptr)self, reservedSize, Cache_Type_ALL, TRUE);
+        }
+
+        /* wait for remote processor to start */
+        if (cacheEnabled) {
+            Cache_inv((Ptr)remote, reservedSize, Cache_Type_ALL, TRUE);
+        }
+
+        if (remote->startedKey != ti_sdo_ipc_Ipc_PROCSYNCSTART) {
+            return (Ipc_E_NOTREADY);
+        }
+    }
+    else {
+        /*  wait for remote processor to start */
+        if (cacheEnabled) {
+            Cache_inv((Ptr)remote, reservedSize, Cache_Type_ALL, TRUE);
+        }
+
+        if ((self->startedKey != ti_sdo_ipc_Ipc_PROCSYNCSTART) &&
+            (remote->startedKey != ti_sdo_ipc_Ipc_PROCSYNCSTART)) {
+            return (Ipc_E_NOTREADY);
+        }
+
+        /* set my processor's reserved key to start */
+        self->startedKey = ti_sdo_ipc_Ipc_PROCSYNCSTART;
+
+        /* write my processor's reserve key back */
+        if (cacheEnabled) {
+            Cache_wbInv((Ptr)self, reservedSize, Cache_Type_ALL, TRUE);
+
+            /* wait for remote processor to finish */
+            Cache_inv((Ptr)remote, reservedSize, Cache_Type_ALL, TRUE);
+        }
+
+        if (remote->startedKey != ti_sdo_ipc_Ipc_PROCSYNCFINISH) {
+            return (Ipc_E_NOTREADY);
+        }
+    }
+
+    return (Ipc_S_SUCCESS);
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_procSyncFinish ========
+ *  Each processor writes its reserve memory address in SharedRegion 0
+ *  to let the other processors know its finished the process of
+ *  synchronization.
+ */
+Int ti_sdo_ipc_Ipc_procSyncFinish(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    volatile ti_sdo_ipc_Ipc_Reserved *self, *remote;
+    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
+    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
+    UInt oldPri;
+
+    /* don't do any synchronization if procSync is NONE */
+    if (ti_sdo_ipc_Ipc_procSync == ti_sdo_ipc_Ipc_ProcSync_NONE) {
+        return (Ipc_S_SUCCESS);
+    }
+
+    /* determine self and remote pointers */
+    if (MultiProc_self() < remoteProcId) {
+        self = Ipc_getSlaveAddr(remoteProcId, sharedAddr);
+        remote = ti_sdo_ipc_Ipc_getMasterAddr(remoteProcId, sharedAddr);
+    }
+    else {
+        self = ti_sdo_ipc_Ipc_getMasterAddr(remoteProcId, sharedAddr);
+        remote = Ipc_getSlaveAddr(remoteProcId, sharedAddr);
+    }
+
+    /* set my processor's reserved key to finish */
+    self->startedKey = ti_sdo_ipc_Ipc_PROCSYNCFINISH;
+
+    /* write back my processor's reserve key */
+    if (cacheEnabled) {
+        Cache_wbInv((Ptr)self, reservedSize, Cache_Type_ALL, TRUE);
+    }
+
+    /* if slave processor, wait for remote to finish sync */
+    if (MultiProc_self() < remoteProcId) {
+        if (BIOS_getThreadType() == BIOS_ThreadType_Task) {
+            oldPri = Task_getPri(Task_self());
+        }
+
+        /* wait for remote processor to finish */
+        while (remote->startedKey != ti_sdo_ipc_Ipc_PROCSYNCFINISH &&
+                remote->startedKey != ti_sdo_ipc_Ipc_PROCSYNCDETACH) {
+            /* Set self priority to 1 [lowest] and yield cpu */
+            if (BIOS_getThreadType() == BIOS_ThreadType_Task) {
+                Task_setPri(Task_self(), 1);
+                Task_yield();
+            }
+
+            /* Check the remote's sync flag */
+            if (cacheEnabled) {
+                Cache_inv((Ptr)remote, reservedSize, Cache_Type_ALL, TRUE);
+            }
+        }
+
+        /* Restore self priority */
+        if (BIOS_getThreadType() == BIOS_ThreadType_Task) {
+            Task_setPri(Task_self(), oldPri);
+        }
+    }
+
+    return (Ipc_S_SUCCESS);
+}
+
+/*
+ *  ======== ti_sdo_ipc_Ipc_reservedSizePerProc ========
+ */
+SizeT ti_sdo_ipc_Ipc_reservedSizePerProc(Void)
+{
+    SizeT reservedSize = sizeof(ti_sdo_ipc_Ipc_Reserved) *
+            ti_sdo_utils_MultiProc_numProcsInCluster;
+    SizeT cacheLineSize = SharedRegion_getCacheLineSize(0);
+
+    /* Calculate amount to reserve per processor */
+    if (cacheLineSize > reservedSize) {
+        /* Use cacheLineSize if larger than reservedSize */
+        reservedSize = cacheLineSize;
+    }
+    else {
+        /* Round reservedSize to cacheLineSize */
+        reservedSize = _Ipc_roundup(reservedSize, cacheLineSize);
+    }
+
+    return (reservedSize);
+}
diff --git a/packages/ti/sdo/ipc/Ipc.xdc b/packages/ti/sdo/ipc/Ipc.xdc
new file mode 100644 (file)
index 0000000..90db521
--- /dev/null
@@ -0,0 +1,533 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Ipc.xdc ========
+ *
+ */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.rov.ViewInfo;
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== Ipc ========
+ *  IPC Master Manager
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/Ipc.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg):
+ *
+ *  <PRE>Ipc = xdc.useModule('ti.sdo.ipc.Ipc');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ *  The most common static configuration that is required of the Ipc module
+ *  is the {@link #procSync} configuration that affects the behavior of the
+ *  Ipc_start and Ipc_attach runtime APIs.
+ *
+ *  Additionally, certain subsystems of IPC (such as Notify and MessageQ) can
+ *  be disabled to save resources on a per-connection basis by configuring Ipc
+ *  using {@link #setEntryMeta}.
+ *
+ */
+
+@Template ("./Ipc.xdt")
+module Ipc
+{
+    /*!
+     *  ======== ModuleView ========
+     *  @_nodoc
+     */
+    metaonly struct ModuleView {
+        UInt16  remoteProcId;
+        Bool    attached;
+        Bool    setupNotify;
+        Bool    setupMessageQ;
+    };
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Module',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitModule',
+                        structName: 'ModuleView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  Various configuration options for {@link #procSync}
+     *
+     *  The values in this enum affect the behavior of the Ipc_start and
+     *  Ipc_attach runtime APIs.
+     *
+     *  ProcSync_ALL:  Calling Ipc_start will also internally Ipc_attach to
+     *  each remote processor.  The application should never call Ipc_attach.
+     *  This type of startup and synchronization should be used if all IPC
+     *  processors on a device start up at the same time and connections should
+     *  be established between every possible pair of processors.
+     *
+     *  ProcSync_PAIR (default):  Calling Ipc_start will perform system-wide IPC
+     *  initialization required on all processor, but connections to remote
+     *  processors will not be established (i.e. Ipc_attach will never be
+     *  called).  This configuration should be chosen if synchronization is
+     *  required and some/all these conditions are true:
+     *  @p(blist)
+     *  - It is necessary to control when synchronization with each remote
+     *    processor occurs
+     *  - Useful work can be done while trying to synchronize with a remote
+     *    processor by yielding a thread after each attempt to Ipc_attach
+     *    to the processor.
+     *  - Connections to all remote processors are unnecessary and connections
+     *    should selectively be made to save memory
+     *  @p
+     *  NOTE: A connection should be made to the owner of region 0 (usually the
+     *  processor with id = 0) before any connection to any other remote
+     *  processor can be made. For example, if there are three processors
+     *  configured with MultiProc, #1 should attach to #0 before it can attach
+     *  to #2.
+     *
+     *  ProcSync_NONE:  This should be selected with caution.  Ipc_start will
+     *  work exactly as it does with ProcSync_PAIR.  However, Ipc_attach will
+     *  not synchronize with the remote processor.  Callers of Ipc_attach are
+     *  bound by the same restrictions imposed by using ProcSync_PAIR.
+     *  Additionally, an Ipc_attach to a remote processor whose id is less than
+     *  our own has to occur *after* the corresponding remote processor has
+     *  called attach to the original processor.  For example, processor #2
+     *  can call
+     *  @p(code)
+     *  Ipc_attach(1);
+     *  @p
+     *  only after processor #1 has called:
+     *  @p(code)
+     *  Ipc_attach(2);
+     *  @p
+     *
+     */
+    enum ProcSync {
+        ProcSync_NONE,          /*! ProcSync_PAIR with no synchronization   */
+        ProcSync_PAIR,          /*! Ipc_start does not Ipc_attach           */
+        ProcSync_ALL            /*! Ipc_start attach to all remote procs    */
+    };
+
+    /*!
+     *  Struct used for configuration via {@link #setEntryMeta}
+     *
+     *  This structure defines the fields that are to be configured
+     *  between the executing processor and a remote processor.
+     */
+    struct Entry {
+        UInt16 remoteProcId;    /*! Remote processor id                     */
+        Bool   setupNotify;     /*! Whether to setup Notify                 */
+        Bool   setupMessageQ;   /*! Whether to setup MessageQ               */
+    };
+
+    /*! struct for attach/detach plugs. */
+    struct UserFxn {
+        Int (*attach)(UArg, UInt16);
+        Int (*detach)(UArg, UInt16);
+    };
+
+    /*
+     *************************************************************************
+     *                       Generic IPC Errors/Asserts
+     *************************************************************************
+     */
+
+    /*!
+     *  ======== A_addrNotInSharedRegion ========
+     *  Assert raised when an address lies outside all known shared regions
+     */
+    config Assert.Id A_addrNotInSharedRegion  = {
+        msg: "A_addrNotInSharedRegion: Address not in any shared region"
+    };
+
+    /*!
+     *  ======== A_addrNotCacheAligned ========
+     *  Assert raised when an address is not cache-aligned
+     */
+    config Assert.Id A_addrNotCacheAligned  = {
+        msg: "A_addrNotCacheAligned: Address is not cache aligned"
+    };
+
+    /*!
+     *  ======== A_nullArgument ========
+     *  Assert raised when a required argument is null
+     */
+    config Assert.Id A_nullArgument  = {
+        msg: "A_nullArgument: Required argument is null"
+    };
+
+    /*!
+     *  ======== A_nullPointer ========
+     *  Assert raised when a pointer is null
+     */
+    config Assert.Id A_nullPointer  = {
+        msg: "A_nullPointer: Pointer is null"
+    };
+
+    /*!
+     *  ======== A_invArgument ========
+     *  Assert raised when an argument is invalid
+     */
+    config Assert.Id A_invArgument  = {
+        msg: "A_invArgument: Invalid argument supplied"
+    };
+
+    /*!
+     *  ======== A_invParam ========
+     *  Assert raised when a parameter is invalid
+     */
+    config Assert.Id A_invParam  = {
+        msg: "A_invParam: Invalid configuration parameter supplied"
+    };
+
+    /*!
+     *  ======== A_internal ========
+     *  Assert raised when an internal error is encountered
+     */
+    config Assert.Id A_internal = {
+        msg: "A_internal: An internal error has occurred"
+    };
+
+    /*!
+     *  ======== E_nameFailed ========
+     *  Error raised when a name failed to be added to the NameServer
+     *
+     *  Error raised in a create call when a name fails to be added
+     *  to the NameServer table.  This can be because the name already
+     *  exists, the table has reached its max length, or out of memory.
+     */
+    config Error.Id E_nameFailed  = {
+        msg: "E_nameFailed: '%s' name failed to be added to NameServer"
+    };
+
+    /*!
+     *  ======== E_internal ========
+     *  Error raised when an internal error occured
+     */
+    config Error.Id E_internal  = {
+        msg: "E_internal: An internal error occurred"
+    };
+
+    /*!
+     *  ======== E_versionMismatch ========
+     *  Error raised when a version mismatch occurs
+     *
+     *  Error raised in an open call because there is
+     *  a version mismatch between the opener and the creator
+     */
+    config Error.Id E_versionMismatch  = {
+        msg: "E_versionMismatch: IPC Module version mismatch: creator: %d, opener: %d"
+    };
+
+    /*
+     *************************************************************************
+     *                       Module-wide Config Parameters
+     *************************************************************************
+     */
+
+    /*!
+     *  ======== sr0MemorySetup ========
+     *  Whether Shared Region 0 memory is accessible
+     *
+     *  Certain devices have a slave MMU that needs to be configured by the
+     *  host core before the slave core can access shared region 0.  If
+     *  the host core is also running BIOS, it is necessary to set this
+     *  configuration to 'true', otherwise {@link #start} will always fail.
+     *
+     *  This configuration should not be used for devices that don't have
+     *  a slave MMU and don't run Linux.
+     */
+    config Bool sr0MemorySetup;
+
+    /*! @_nodoc
+     *  ======== hostProcId ========
+     *  Host processor identifier.
+     *
+     *  Used to specify the host processor's id.  This parameter is only used
+     *  in a Syslink system.
+     */
+    metaonly config UInt16 hostProcId = MultiProc.INVALIDID;
+
+    /*!
+     *  ======== procSync ========
+     *  Affects how Ipc_start and Ipc_attach behave
+     *
+     *  Refer to the documentation for the {@link #ProcSync} enum for
+     *  information about the various ProcSync options.
+     */
+    config ProcSync procSync = Ipc.ProcSync_PAIR;
+
+    /*! @_nodoc
+     *  ======== generateSlaveDataForHost ========
+     *  generates the slave's data into a section for the host.
+     */
+    config Bool generateSlaveDataForHost;
+
+    /*!@_nodoc
+     *  ======== userFxn ========
+     *  Attach and Detach hooks.
+     */
+    config UserFxn userFxn;
+
+    /*
+     *************************************************************************
+     *                       IPC Functions
+     *************************************************************************
+     */
+
+     /*!
+     *  ======== addUserFxn ========
+     *  Add a function that gets called during Ipc_attach/detach.
+     *
+     *  The user added functions must be non-blocking and must run
+     *  to completion. The functions need to check to make sure it
+     *  is not called multiple times when more than one thread calls
+     *  Ipc_attach() for the same processor.  It is safe to use IPC
+     *  APIs in a user function as long as the IPC APIs satisfy these
+     *  requirements.
+     *
+     *  @p(code)
+     *      var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+     *      var fxn = new Ipc.UserFxn;
+     *      fxn.attach = '&userAttachFxn';
+     *      fxn.detach = '&userDetachFxn';
+     *      Ipc.addUserFxn(fxn, arg);
+     *  @p
+     *
+     *  @param(fxn)     The user function to call during attach/detach.
+     *  @param(arg)     The argument to the function.
+     */
+    metaonly Void addUserFxn(UserFxn fxn, UArg arg);
+
+     /*!
+     *  ======== getEntry ========
+     *  Gets the properties for attaching to a remote processor.
+     *
+     *  This function must be called before Ipc_attach().  The
+     *  parameter entry->remoteProcId field must be set prior to calling
+     *  the function.
+     *
+     *  @param(entry)       Properties between a pair of processors.
+     */
+    Void getEntry(Entry *entry);
+
+    /*!
+     *  ======== setEntryMeta ========
+     *  Statically sets the properties for attaching to a remote processor.
+     *
+     *  This function allows the user to configure whether Notify and/or
+     *  MessageQ is setup during Ipc_attach().  If 'setupNotify' is set
+     *  to 'false', neither the Notify or NameServerRemoteNotify instances
+     *  are created.  If 'setupMessageQ' is set to 'false', the MessageQ
+     *  transport instances are not created.  By default, both flags are
+     *  set to 'true'.
+     *
+     *  Note: For any pair of processors, the flags must be the same
+     *
+     *  @param(entry)       Properties between a pair of processors.
+     */
+    metaonly Void setEntryMeta(Entry entry);
+
+    /*!
+     *  ======== setEntry ========
+     *  Sets the properties for attaching to a remote processor.
+     *
+     *  This function must be called before Ipc_attach().  It allows
+     *  the user to configure whether Notify and/or MessageQ is setup
+     *  during Ipc_attach().  If 'setupNotify' is set to 'FALSE',
+     *  neither the Notify or NameServerRemoteNotify instances are
+     *  created.  If 'setupMessageQ' is set to 'FALSE', the MessageQ
+     *  transport instances are not created.  By default, both flags are
+     *  set to 'TRUE'.
+     *
+     *  Note: For any pair of processors, the flags must be the same
+     *
+     *  @param(entry)       Properties between a pair of processors.
+     */
+    Void setEntry(Entry *entry);
+
+    /*! @_nodoc
+     *  This is needed to prevent the Ipc module from being optimized away
+     *  during the whole_program[_debug] partial link.
+     */
+    Void dummy();
+
+
+internal:
+
+    /* flag for starting processor synchronization */
+    const UInt32 PROCSYNCSTART  = 1;
+
+    /* flag for finishing processor synchronization */
+    const UInt32 PROCSYNCFINISH = 2;
+
+    /* flag for detaching */
+    const UInt32 PROCSYNCDETACH = 3;
+
+    /* Type of Ipc object. Each value needs to be a power of two. */
+    enum ObjType {
+        ObjType_CREATESTATIC            = 0x1,
+        ObjType_CREATESTATIC_REGION     = 0x2,
+        ObjType_CREATEDYNAMIC           = 0x4,  /* Created by sharedAddr      */
+        ObjType_CREATEDYNAMIC_REGION    = 0x8,  /* Created by regionId        */
+        ObjType_OPENDYNAMIC             = 0x10, /* Opened instance            */
+        ObjType_LOCAL                   = 0x20  /* Local-only instance        */
+    };
+
+    /*
+     *  This structure captures Configuration details of a module/instance
+     *  written by a slave to synchornize with a remote slave/HOST
+     */
+    struct ConfigEntry {
+        Bits32 remoteProcId;
+        Bits32 localProcId;
+        Bits32 tag;
+        Bits32 size;
+        Bits32 next;
+    };
+
+    struct ProcEntry {
+        SharedRegion.SRPtr *localConfigList;
+        SharedRegion.SRPtr *remoteConfigList;
+        UInt   attached;
+        Entry  entry;
+    };
+
+    /* The structure used for reserving memory in SharedRegion */
+    struct Reserved {
+        volatile Bits32    startedKey;
+        SharedRegion.SRPtr notifySRPtr;
+        SharedRegion.SRPtr nsrnSRPtr;
+        SharedRegion.SRPtr transportSRPtr;
+        SharedRegion.SRPtr configListHead;
+    };
+
+    /* The structure used for reserving memory in SharedRegion */
+    struct UserFxnAndArg {
+        UserFxn userFxn;
+        UArg    arg;
+    };
+
+    /* Storage for setup of processors */
+    metaonly config Entry entry[];
+
+    config UInt numUserFxns = 0;
+
+    /*!
+     *  ======== userFxns ========
+     *  Attach and Detach hooks.
+     */
+    config UserFxnAndArg userFxns[] = [];
+
+    /*!
+     *  ======== getMasterAddr() ========
+     */
+    Ptr getMasterAddr(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*!
+     *  ======== getRegion0ReservedSize ========
+     *  Returns the amount of memory to be reserved for Ipc in SharedRegion 0.
+     *
+     *  This is used for synchronizing processors.
+     */
+    SizeT getRegion0ReservedSize();
+
+    /*!
+     *  ======== getSlaveAddr() ========
+     */
+    Ptr getSlaveAddr(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*!
+     *  ======== procSyncStart ========
+     *  Starts the process of synchronizing processors.
+     *
+     *  Shared memory in region 0 will be used.  The processor which owns
+     *  SharedRegion 0 writes its reserve memory address in region 0
+     *  to let the other processors know it has started.  It then spins
+     *  until the other processors start.  The other processors write their
+     *  reserve memory address in region 0 to let the owner processor
+     *  know they've started.  The other processors then spin until the
+     *  owner processor writes to let them know its finished the process
+     *  of synchronization before continuing.
+     */
+    Int procSyncStart(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*!
+     *  ======== procSyncFinish ========
+     *  Finishes the process of synchronizing processors.
+     *
+     *  Each processor writes its reserve memory address in SharedRegion 0
+     *  to let the other processors know its finished the process of
+     *  synchronization.
+     */
+    Int procSyncFinish(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*!
+     *  ======== reservedSizePerProc ========
+     *  The amount of memory required to be reserved per processor.
+     */
+    SizeT reservedSizePerProc();
+
+    /*! Used for populated the 'objType' field in ROV views*/
+    metaonly String getObjTypeStr$view(ObjType type);
+
+    /* Module state */
+    struct Module_State {
+        Ptr       ipcSharedAddr;
+        Ptr       gateMPSharedAddr;
+        ProcEntry procEntry[];
+    };
+}
diff --git a/packages/ti/sdo/ipc/Ipc.xdt b/packages/ti/sdo/ipc/Ipc.xdt
new file mode 100644 (file)
index 0000000..ad0220d
--- /dev/null
@@ -0,0 +1,187 @@
+%%{
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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       Ipc.xdt
+ *
+ *  @brief      Template to generate the embedded config section.
+ *
+ *  @ver        0001
+ *
+ *  @date       18 Jan, 2010
+ *
+ *  @internal   18 Jan, 2010, Samir Das, Revision 0001:
+ *              [1] Original version.
+ *
+ */
+
+var SharedRegion = xdc.module("ti.sdo.ipc.SharedRegion");
+var Ipc          = xdc.module("ti.sdo.ipc.Ipc");
+var regions      = SharedRegion.$object.regions;
+
+/* Calculate the offset of branch insn */
+var align = 0;
+
+if ((Program.build.target.$name.match(/C64P/)) ||
+    (Program.build.target.$name.match(/C674/)) ||
+    (Program.build.target.$name.match(/C64T/)) ||
+    (Program.build.target.$name.match(/C67P/))) {
+    align = SharedRegion.cacheLineSize > 0x400 ?
+            SharedRegion.cacheLineSize : 0x400;
+}
+else {
+    align = SharedRegion.cacheLineSize;
+}
+
+var b_gap  = 0;
+
+var offset = (3 * 4); /* cacheLineSize, offset, sr0Setup member */
+offset    += (3 * 4); /* setupMessageQ, setupNotify, procSync members */
+offset    += (1 * 4); /* numSRs */
+for (var i = 0; i < regions.length; i++) {
+    if (regions[i].entry.isValid == true) {
+        offset += (4 * 6); /* Shared region details */
+    }
+}
+
+/* align the offset to cpu required entry point restriction */
+if ((Program.build.target.$name.match(/C64P/)) ||
+    (Program.build.target.$name.match(/C674/)) ||
+    (Program.build.target.$name.match(/C64T/)) ||
+    (Program.build.target.$name.match(/C67P/))) {
+    b_gap   = (align - (offset % align));
+    offset += (align - (offset % align));
+}
+%%}
+
+%     if (!(Ipc.generateSlaveDataForHost)) {
+Bits32 Ipc_sr0MemorySetup;
+%     }
+%     else {
+asm ("\t.sect ti_sdo_ipc_init");
+asm ("\t.align `align`");
+
+%         if (Program.build.target.$name.match(/elf/)) {
+asm ("Ipc_ResetVector:");
+asm ("_Ipc_ResetVector:");
+%         }
+%         else {
+asm ("\t.global _Ipc_ResetVector");
+asm ("_Ipc_ResetVector:");
+%         }
+
+/* First word is cacheLine Size */
+asm ("\t.word `utils.toHex(Number(SharedRegion.cacheLineSize))`");
+
+/* Second word is the offset of branch to _c_int00 insn */
+asm ("\t.word `utils.toHex(offset)`");
+
+/* sr0 memory setup */
+%         if (Program.build.target.$name.match(/elf/)) {
+asm ("Ipc_sr0MemorySetup:");
+asm ("_Ipc_sr0MemorySetup:");
+%         }
+%         else {
+asm ("\t.global _Ipc_sr0MemorySetup");
+asm ("_Ipc_sr0MemorySetup:");
+%         }
+%         if (this.sr0MemorySetup) {
+asm ("\t.word 0x1");
+%         }
+%         else {
+asm ("\t.word 0x0");
+%         }
+
+/* Ipc Module configuration shared with HOST */
+%         for (var i = 0; i < Ipc.entry.length; i++) {
+%             if (Ipc.entry[i].remoteProcId == Ipc.hostProcId) {
+asm ("\t.word `utils.toHex(Number(Ipc.entry[i].setupMessageQ))`");
+asm ("\t.word `utils.toHex(Number(Ipc.entry[i].setupNotify))`");
+asm ("\t.word `utils.toHex(Number(Ipc.procSync))`");
+%             }
+%         }
+
+/* find the number of valid SharedRegions */
+%         var numSRs = 0;
+%         for (var i = 0; i < regions.length; i++) {
+%             if (regions[i].entry.isValid == true) {
+%                 numSRs++;
+%             }
+%         }
+%
+%         /*
+%          *  This section must be padded to a cache line size.
+%          *  Assume the worst case cache line (128 bytes or 32 words).
+%          *  First 4 words (cacheLine size, offset, sr0MemorySetup, number SRs)
+%          *  Each SharedRegion contributes 6 words.  If the number of
+%          *  SharedRegion is more than 4, we do not need any padding.
+%          */
+%         if (numSRs > 4) {
+%             var numWordToPad = 0;
+%         }
+%         else {
+%             var numWordToPad = 32 - (4 + (numSRs * 6))
+%         }
+
+/* Generate the static shared regions details */
+asm ("\t.word `utils.toHex(numSRs)`");
+
+%         for (var i = 0; i < regions.length; i++) {
+%             if (regions[i].entry.isValid == true) {
+/* Shared region `i` memory address */
+asm ("\t.word `utils.toHex(Number(regions[i].entry.base))`");
+/* Shared region `i` memory size */
+asm ("\t.word `utils.toHex(Number(regions[i].entry.len))`");
+/* Shared region `i` owner procId */
+asm ("\t.word `regions[i].entry.ownerProcId`");
+/* Shared region `i` entryId  */
+asm ("\t.word `utils.toHex(Number(i))`");
+/* Shared region `i` createHeap  */
+asm ("\t.word `utils.toHex(Number(regions[i].entry.createHeap))`");
+/* Shared region `i` cacheLineSize  */
+asm ("\t.word `utils.toHex(regions[i].entry.cacheLineSize)`");
+%             }
+%         }
+
+%         /* Generate the cache line pad */
+%         for (var i = 0; i < numWordToPad; i++) {
+asm ("\t.word 0x0");
+%         }
+
+/* .export keyword needed here to ensure symbols go into ELF .dynsym table. */
+%         if (Program.build.target.$name.match(/elf/)) {
+asm ("      .export _Ipc_ResetVector");
+asm ("      .export Ipc_sr0MemorySetup");
+%         }
+%     }
diff --git a/packages/ti/sdo/ipc/Ipc.xs b/packages/ti/sdo/ipc/Ipc.xs
new file mode 100644 (file)
index 0000000..900bf58
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Ipc.xs ========
+ *
+ */
+
+var Ipc                    = null;
+var Notify                 = null;
+var SharedRegion           = null;
+var MessageQ               = null;
+var MultiProc              = null;
+var NameServer             = null;
+var Settings               = null;
+var Cache                  = null;
+var Hwi                    = null;
+
+var initEntryDone = false;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    Ipc = this;
+
+    Ipc.entry.length = 0;
+
+    Settings = xdc.module("ti.sdo.ipc.family.Settings");
+
+    /* determine if slave data is needed to be generated for host */
+    Ipc.generateSlaveDataForHost = Settings.generateSlaveDataForHost();
+
+    /* Set Ipc.sr0MemorySetup based on device defaults */
+    var sr0MemorySetup = Settings.getIpcSR0Setup();
+    if (sr0MemorySetup) {
+        Ipc.sr0MemorySetup = true;
+    }
+    else {
+        Ipc.sr0MemorySetup = false;
+    }
+}
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Cache           = xdc.useModule("ti.sysbios.hal.Cache");
+    Hwi             = xdc.useModule("ti.sysbios.hal.Hwi");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    MessageQ        = xdc.useModule("ti.sdo.ipc.MessageQ");
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    NameServer      = xdc.useModule("ti.sdo.utils.NameServer");
+    Settings        = xdc.useModule("ti.sdo.ipc.family.Settings");
+
+    if (!(NameServer.SetupProxy.$written("delegate$"))) {
+        NameServer.SetupProxy =
+            xdc.useModule(Settings.getNameServerRemoteDelegate());
+    }
+
+    /* get the host processor id */
+    Ipc.hostProcId = Settings.getHostProcId();
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    /* this array will be setup below with internal array */
+    mod.procEntry.length = MultiProc.numProcsInCluster;
+    var fxn = new Ipc.UserFxn;
+    var userFxnSet = false;
+
+    /* set user's default attach/detach funtions */
+    if (Ipc.userFxn.attach == undefined) {
+        Ipc.userFxn.attach = null;
+        fxn.attach = null;
+    }
+    else {
+        fxn.attach = Ipc.userFxn.attach;
+        userFxnSet = true;
+    }
+
+    if (Ipc.userFxn.detach == undefined) {
+        Ipc.userFxn.detach = null;
+        fxn.detach = null;
+    }
+    else {
+        fxn.detach = Ipc.userFxn.detach;
+        userFxnSet = true;
+    }
+
+    if (userFxnSet) {
+        Ipc.$logWarning("Ipc.userFxn is deprecated.  The recommended way " +
+            "to add an attach/detach function is by using " +
+            "Ipc.addUserFxn(fxn, arg).", Ipc);
+        addUserFxn(fxn, null);
+    }
+
+    /* init Ipc.entry */
+    initEntryArray();
+
+    /* init the module state */
+    for (var i=0; i < MultiProc.numProcsInCluster; i++) {
+        mod.procEntry[i].entry = Ipc.entry[i];
+        mod.procEntry[i].localConfigList     = null;
+        mod.procEntry[i].remoteConfigList    = null;
+        mod.procEntry[i].attached            = 0;
+    }
+
+    mod.ipcSharedAddr = null;
+    mod.gateMPSharedAddr = null;
+    Ipc.numUserFxns = Ipc.userFxns.length;
+}
+
+/*
+ *  ======== addUserFxn ========
+ */
+function addUserFxn(fxn, arg)
+{
+    Ipc.userFxns.$add({userFxn: fxn, arg: arg});
+}
+
+/*
+ *  ======== setEntryMeta ========
+ *  MultiProc.numProcessors must be set before calling this function
+ */
+function setEntryMeta(entry)
+{
+    var MultiProc = xdc.module("ti.sdo.utils.MultiProc");
+
+    if (entry.remoteProcId == undefined) {
+        Ipc.$logError("Ipc.setEntryMeta: remoteProcId was not specified.\n",
+                      Ipc);
+    }
+
+    /* Log an error if the specified remoteProcId is invalid */
+    if (entry.remoteProcId > MultiProc.numProcessors) {
+        Ipc.$logError("Ipc.setEntryMeta: Invalid remoteProcId was " +
+                      "specified.\n", Ipc);
+    }
+
+    /* init Ipc.entry */
+    initEntryArray();
+
+    if (entry.setupNotify != undefined) {
+        Ipc.entry[entry.remoteProcId].setupNotify = entry.setupNotify;
+    }
+
+    if (entry.setupMessageQ != undefined) {
+        Ipc.entry[entry.remoteProcId].setupMessageQ = entry.setupMessageQ;
+    }
+}
+
+/*
+ *  ======== initEntryArray ========
+ *  This is an internal function. This function is called from
+ *  setEntryMeta and module$static$init
+ */
+function initEntryArray()
+{
+    var MultiProc = xdc.module("ti.sdo.utils.MultiProc");
+
+    /* init Ipc.entry if its not already initialized */
+    if (!(initEntryDone)) {
+        Ipc.entry.length = MultiProc.numProcsInCluster;
+
+        for (var i=0; i < MultiProc.numProcsInCluster; i++) {
+            Ipc.entry[i].remoteProcId     = MultiProc.baseIdOfCluster + i;
+            Ipc.entry[i].setupNotify      = true;
+            Ipc.entry[i].setupMessageQ    = true;
+        }
+
+        initEntryDone = true;
+    }
+}
+
+/*
+ *  ======== getObjTypeStr$view ========
+ */
+function getObjTypeStr$view(type)
+{
+    var typeStr;
+
+    switch(type) {
+        case this.ObjType_CREATESTATIC:
+            typeStr = "CREATESTATIC";
+            break;
+        case this.ObjType_CREATESTATIC_REGION:
+            typeStr = "CREATESTATIC";
+            break;
+        case this.ObjType_CREATEDYNAMIC:
+            typeStr = "CREATEDYNAMIC";
+            break;
+        case this.ObjType_CREATEDYNAMIC_REGION:
+            typeStr = "CREATEDYNAMIC_REGION";
+            break;
+        case this.ObjType_OPENDYNAMIC:
+            typeStr = "OPENDYNAMIC";
+            break;
+        case this.ObjType_LOCAL:
+            typeStr = "LOCAL";
+            break;
+        default:
+            typeStr = null;
+    }
+
+    return (typeStr);
+}
+
+/*
+ *  ======== viewInitModule ========
+ */
+function viewInitModule(view)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+    var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    var MultiProc = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+
+    /* Scan the raw view in order to obtain the module state. */
+    var rawView;
+    try {
+        rawView = Program.scanRawView('ti.sdo.ipc.Ipc');
+    }
+    catch (e) {
+        var entryView = Program.newViewStruct('ti.sdo.ipc.Ipc',
+                'Module');
+        Program.displayError(entryView, 'remoteProcId',
+            "Problem retrieving raw view: " + e);
+        view.elements.$add(entryView);
+        return;
+    }
+
+    var mod = rawView.modState;
+
+    /* Retrieve the processor entry table */
+    try {
+        var entries = Program.fetchArray(Ipc.ProcEntry$fetchDesc,
+                                         mod.procEntry,
+                                         MultiProc.numProcsInCluster);
+    }
+    catch (e) {
+        var entryView = Program.newViewStruct('ti.sdo.ipc.Ipc',
+                'Module');
+        Program.displayError(entryView, 'remoteProcId',
+            "Caught exception while trying to retrieve entry table: " + e);
+        view.elements.$add(entryView);
+        return;
+    }
+
+    /* Display each of the remote entries */
+    for (var i = 0; i < entries.length; i++) {
+        if (i != MultiProc.id) {
+            var entry = entries[i].entry;
+
+            var entryView = Program.newViewStruct('ti.sdo.ipc.Ipc',
+                                                  'Module');
+
+            entryView.remoteProcId = entry.remoteProcId;
+            if (entries[i].attached) {
+                entryView.attached = true;
+            }
+            else {
+                entryView.attached = false;
+            }
+            entryView.setupNotify = entry.setupNotify;
+            entryView.setupMessageQ = entry.setupMessageQ;
+
+            view.elements.$add(entryView);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/ListMP.c b/packages/ti/sdo/ipc/ListMP.c
new file mode 100644 (file)
index 0000000..d0b9e7b
--- /dev/null
@@ -0,0 +1,958 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== ListMP.c ========
+ *  Implementation of functions specified in ListMP.xdc.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/IHeap.h>
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/ipc/_ListMP.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+#include "package/internal/ListMP.xdc.h"
+
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(ListMP_Params_init);
+    #pragma FUNC_EXT_CALLED(ListMP_create);
+    #pragma FUNC_EXT_CALLED(ListMP_close);
+    #pragma FUNC_EXT_CALLED(ListMP_delete);
+    #pragma FUNC_EXT_CALLED(ListMP_open);
+    #pragma FUNC_EXT_CALLED(ListMP_openByAddr);
+    #pragma FUNC_EXT_CALLED(ListMP_sharedMemReq);
+    #pragma FUNC_EXT_CALLED(ListMP_empty);
+    #pragma FUNC_EXT_CALLED(ListMP_getGate);
+    #pragma FUNC_EXT_CALLED(ListMP_getHead);
+    #pragma FUNC_EXT_CALLED(ListMP_getTail);
+    #pragma FUNC_EXT_CALLED(ListMP_insert);
+    #pragma FUNC_EXT_CALLED(ListMP_next);
+    #pragma FUNC_EXT_CALLED(ListMP_prev);
+    #pragma FUNC_EXT_CALLED(ListMP_putHead);
+    #pragma FUNC_EXT_CALLED(ListMP_putTail);
+    #pragma FUNC_EXT_CALLED(ListMP_remove);
+#endif
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ListMP_Params_init ========
+ */
+Void ListMP_Params_init(ListMP_Params *params)
+{
+    /* init the params to the defaults */
+    params->gate       = NULL;
+    params->sharedAddr = 0;
+    params->name       = NULL;
+    params->regionId   = 0;
+}
+
+/*
+ *  ======== ListMP_create ========
+ */
+ListMP_Handle ListMP_create(const ListMP_Params *params)
+{
+    ti_sdo_ipc_ListMP_Params mpParams;
+    ti_sdo_ipc_ListMP_Object *obj;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    if (params != NULL) {
+        /* init the module params struct */
+        ti_sdo_ipc_ListMP_Params_init(&mpParams);
+        mpParams.gate       = (ti_sdo_ipc_GateMP_Handle)params->gate;
+        mpParams.openFlag   = FALSE;
+        mpParams.sharedAddr = params->sharedAddr;
+        mpParams.name       = params->name;
+        mpParams.regionId   = params->regionId;
+
+        /* call the module create */
+        obj = ti_sdo_ipc_ListMP_create(&mpParams, &eb);
+    }
+    else {
+        obj = ti_sdo_ipc_ListMP_create(NULL, &eb);
+    }
+
+    return ((ListMP_Handle)obj);
+}
+
+/*
+ *  ======== ListMP_close ========
+ */
+Int ListMP_close(ListMP_Handle *handlePtr)
+{
+    ListMP_delete(handlePtr);
+
+    return (ListMP_S_SUCCESS);
+}
+
+/*
+ *  ======== ListMP_delete ========
+ */
+Int ListMP_delete(ListMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_ListMP_delete((ti_sdo_ipc_ListMP_Handle *)handlePtr);
+
+    return (ListMP_S_SUCCESS);
+}
+
+/*
+ *  ======== ListMP_open ========
+ */
+Int ListMP_open(String name, ListMP_Handle *handlePtr)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Ptr sharedAddr;
+    Int status;
+
+    /* Assert that a pointer has been supplied */
+    Assert_isTrue(handlePtr != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /* Assert that we have enough information to open the gate */
+    Assert_isTrue(name != NULL, ti_sdo_ipc_Ipc_A_invParam);
+
+    /* Search NameServer */
+    status = NameServer_getUInt32((NameServer_Handle)ListMP_module->nameServer,
+                                  name,
+                                  &sharedShmBase,
+                                  ti_sdo_utils_MultiProc_procIdList);
+
+    if (status < 0) {
+        /* Name was not found */
+        *handlePtr = NULL;
+        return (ListMP_E_NOTFOUND);
+    }
+
+    sharedAddr = SharedRegion_getPtr(sharedShmBase);
+
+    status = ListMP_openByAddr(sharedAddr, handlePtr);
+
+    return (status);
+}
+
+/*
+ *  ======== ListMP_openByAddr ========
+ */
+Int ListMP_openByAddr(Ptr sharedAddr, ListMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_ListMP_Params params;
+    ti_sdo_ipc_ListMP_Attrs *attrs;
+    Error_Block eb;
+    Int status;
+    UInt16 id;
+
+    Error_init(&eb);
+
+    ti_sdo_ipc_ListMP_Params_init(&params);
+
+    /* Tell Instance_init() that we're opening */
+    params.openFlag = TRUE;
+
+    attrs = (ti_sdo_ipc_ListMP_Attrs *)sharedAddr;
+    params.sharedAddr = sharedAddr;
+    id = SharedRegion_getId(sharedAddr);
+
+    if (SharedRegion_isCacheEnabled(id)) {
+        Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+    }
+
+    if (attrs->status != ti_sdo_ipc_ListMP_CREATED) {
+        *handlePtr = NULL;
+        status = ListMP_E_NOTFOUND;
+    }
+    else {
+        /* Create the object */
+        *handlePtr = (ListMP_Handle)ti_sdo_ipc_ListMP_create(&params, &eb);
+        if (*handlePtr == NULL) {
+            status = ListMP_E_FAIL;
+        }
+        else {
+            status = ListMP_S_SUCCESS;
+        }
+    }
+
+    if (SharedRegion_isCacheEnabled(id)) {
+        Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== ListMP_sharedMemReq ========
+ */
+SizeT ListMP_sharedMemReq(const ListMP_Params *params)
+{
+    SizeT  memReq, minAlign;
+    UInt16 regionId;
+
+    if (params->sharedAddr == NULL) {
+        regionId = params->regionId;
+    }
+    else {
+        regionId = SharedRegion_getId(params->sharedAddr);
+    }
+
+    /* Assert that the region is valid */
+    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID,
+                  ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    memReq = _Ipc_roundup(sizeof(ti_sdo_ipc_ListMP_Attrs), minAlign);
+
+    return (memReq);
+}
+
+/*
+ *  ======== ListMP_empty ========
+ */
+Bool ListMP_empty(ListMP_Handle handle)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    Bool flag = FALSE;
+    IArg key;
+    SharedRegion_SRPtr sharedHead;
+
+    /* prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        /* get the SRPtr for the head */
+        sharedHead = (SharedRegion_SRPtr)&(obj->attrs->head);
+    }
+    else {
+        /* get the SRPtr for the head */
+        sharedHead = SharedRegion_getSRPtr(&(obj->attrs->head), obj->regionId);
+    }
+
+    /* if 'next' is ourself, then the ListMP must be empty */
+    if (obj->attrs->head.next == sharedHead) {
+        flag = TRUE;
+    }
+
+    if (obj->cacheEnabled) {
+        /* invalidate the head to make sure we are not getting stale data */
+        Cache_inv(&(obj->attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL,
+                  TRUE);
+    }
+
+    /* leave the gate */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (flag);
+}
+
+/*
+ *  ======== ListMP_getGate ========
+ */
+GateMP_Handle ListMP_getGate(ListMP_Handle handle)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+
+    return ((GateMP_Handle)obj->gate);
+}
+
+/*
+ *  ======== ListMP_getHead ========
+ */
+Ptr ListMP_getHead(ListMP_Handle handle)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    ListMP_Elem *elem;
+    ListMP_Elem *localHeadNext;
+    ListMP_Elem *localNext;
+    Bool localNextIsCached;
+    UInt key;
+
+    /* prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        localHeadNext = (ListMP_Elem *)obj->attrs->head.next;
+    }
+    else {
+        localHeadNext = SharedRegion_getPtr(obj->attrs->head.next);
+    }
+
+    /* Assert that pointer is not NULL */
+    Assert_isTrue(localHeadNext != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
+
+    /* See if the ListMP was empty */
+    if (localHeadNext == (ListMP_Elem *)(&(obj->attrs->head))) {
+        /* Empty, return NULL */
+        elem = NULL;
+    }
+    else {
+        if (SharedRegion_isCacheEnabled(SharedRegion_getId(localHeadNext))) {
+            /* invalidate elem */
+            Cache_inv(localHeadNext, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+        }
+
+        if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+            localNext = (ListMP_Elem *)localHeadNext->next;
+        }
+        else {
+            localNext = SharedRegion_getPtr(localHeadNext->next);
+        }
+
+        /* Assert that pointer is not NULL */
+        Assert_isTrue(localNext != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
+
+        /* Elem to return */
+        elem = localHeadNext;
+        localNextIsCached = SharedRegion_isCacheEnabled(
+                SharedRegion_getId(localNext));
+        if (localNextIsCached) {
+            Cache_inv(localNext, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+        }
+
+        /* Fix the head of the list next pointer */
+        obj->attrs->head.next = elem->next;
+
+        /* Fix the prev pointer of the new first elem on the list */
+        localNext->prev = localHeadNext->prev;
+        if (localNextIsCached) {
+            Cache_wbInv(localNext, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+        }
+    }
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (elem);
+}
+
+/*
+ *  ======== ListMP_getTail ========
+ */
+Ptr ListMP_getTail(ListMP_Handle handle)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    ListMP_Elem *elem;
+    ListMP_Elem *localHeadPrev;
+    ListMP_Elem *localPrev;
+    Bool localPrevIsCached;
+    UInt key;
+
+    /* prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        localHeadPrev = (ListMP_Elem *)obj->attrs->head.prev;
+    }
+    else {
+        localHeadPrev = SharedRegion_getPtr(obj->attrs->head.prev);
+    }
+
+    /* Assert that pointer is not NULL */
+    Assert_isTrue(localHeadPrev != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
+
+    /* See if the ListMP was empty */
+    if (localHeadPrev == (ListMP_Elem *)(&(obj->attrs->head))) {
+        /* Empty, return NULL */
+        elem = NULL;
+    }
+    else {
+        if (SharedRegion_isCacheEnabled(SharedRegion_getId(localHeadPrev))) {
+            /* invalidate elem */
+            Cache_inv(localHeadPrev, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+        }
+
+        if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+            localPrev = (ListMP_Elem *)localHeadPrev->prev;
+        }
+        else {
+            localPrev = SharedRegion_getPtr(localHeadPrev->prev);
+        }
+
+        /* Assert that pointer is not NULL */
+        Assert_isTrue(localPrev != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
+
+        /* Elem to return */
+        elem = localHeadPrev;
+        localPrevIsCached = SharedRegion_isCacheEnabled(
+                SharedRegion_getId(localPrev));
+        if (localPrevIsCached) {
+            Cache_inv(localPrev, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+        }
+
+        /* Fix the head of the list prev pointer */
+        obj->attrs->head.prev = elem->prev;
+
+        /* Fix the next pointer of the new last elem on the list */
+        localPrev->next = localHeadPrev->next;
+        if (localPrevIsCached) {
+            Cache_wbInv(localPrev, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+        }
+    }
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (elem);
+}
+
+/*
+ *  ======== ListMP_insert ========
+ */
+Int ListMP_insert(ListMP_Handle handle, ListMP_Elem *newElem,
+                  ListMP_Elem *curElem)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    UInt key;
+    Int  id;
+    ListMP_Elem *localPrevElem;
+    SharedRegion_SRPtr sharedNewElem;
+    SharedRegion_SRPtr sharedCurElem;
+    Bool curElemIsCached, localPrevElemIsCached;
+
+    /* prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        sharedNewElem = (SharedRegion_SRPtr)newElem;
+        sharedCurElem = (SharedRegion_SRPtr)curElem;
+        localPrevElem = (ListMP_Elem *)(curElem->prev);
+    }
+    else {
+        /* get SRPtr for newElem */
+        id = SharedRegion_getId(newElem);
+        sharedNewElem = SharedRegion_getSRPtr(newElem, id);
+
+        /* get SRPtr for curElem */
+        id = SharedRegion_getId(curElem);
+        sharedCurElem = SharedRegion_getSRPtr(curElem, id);
+    }
+
+    curElemIsCached = SharedRegion_isCacheEnabled(SharedRegion_getId(curElem));
+    if (curElemIsCached) {
+        Cache_inv(curElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    /* get Ptr for curElem->prev */
+    localPrevElem = SharedRegion_getPtr(curElem->prev);
+
+    localPrevElemIsCached = SharedRegion_isCacheEnabled(
+            SharedRegion_getId(localPrevElem));
+    if (localPrevElemIsCached) {
+        Cache_inv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    newElem->next       = sharedCurElem;
+    newElem->prev       = curElem->prev;
+    localPrevElem->next = sharedNewElem;
+    curElem->prev       = sharedNewElem;
+
+    if (localPrevElemIsCached) {
+        Cache_wbInv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  The next two Cache_wbInv needs to be done because curElem
+     *  and newElem are passed in and maybe already in the cache
+     */
+    if (curElemIsCached) {
+        /* writeback invalidate current elem structure */
+        Cache_wbInv(curElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    if (SharedRegion_isCacheEnabled(SharedRegion_getId(newElem))) {
+        /* writeback invalidate new elem structure  */
+        Cache_wbInv(newElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (ListMP_S_SUCCESS);
+}
+
+/*
+ *  ======== ListMP_next ========
+ */
+Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    ListMP_Elem *retElem;  /* returned elem */
+    Bool elemIsCached;
+
+    /* elem == NULL -> start at the head */
+    if (elem == NULL) {
+        /* Keep track of whether an extra Cache_inv is needed */
+        elemIsCached = obj->cacheEnabled;
+        elem = (ListMP_Elem *)&(obj->attrs->head);
+
+    }
+    else {
+        elemIsCached = SharedRegion_isCacheEnabled(SharedRegion_getId(elem));
+    }
+
+    if (elemIsCached) {
+        Cache_inv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    retElem = SharedRegion_getPtr(elem->next);
+
+    if (retElem == (ListMP_Elem *)(&obj->attrs->head)) {
+        retElem = NULL;
+    }
+
+    if (elemIsCached) {
+        /* Invalidate because elem pulled into cache && elem != head. */
+        Cache_inv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    return (retElem);
+}
+
+/*
+ *  ======== ListMP_prev ========
+ */
+Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    ListMP_Elem *retElem;  /* returned elem */
+    Bool elemIsCached;
+
+    /* elem == NULL -> start at the head */
+    if (elem == NULL) {
+        elemIsCached = obj->cacheEnabled;
+        elem = (ListMP_Elem *)&(obj->attrs->head);
+    }
+    else {
+        elemIsCached = SharedRegion_isCacheEnabled(SharedRegion_getId(elem));
+    }
+
+    if (elemIsCached) {
+        Cache_inv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    retElem = SharedRegion_getPtr(elem->prev);
+
+    if (retElem == (ListMP_Elem *)(&(obj->attrs->head))) {
+        retElem = NULL;
+    }
+
+    if (elemIsCached) {
+        /* Invalidate because elem pulled into cache && elem != head. */
+        Cache_inv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    return (retElem);
+}
+
+/*
+ *  ======== ListMP_putHead ========
+ */
+Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    UInt key;
+    UInt16 id;
+    ListMP_Elem *localNextElem;
+    SharedRegion_SRPtr sharedElem;
+    SharedRegion_SRPtr sharedHead;
+    Bool localNextElemIsCached;
+
+    /* prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    id = SharedRegion_getId(elem);
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        sharedElem = (SharedRegion_SRPtr)elem;
+        sharedHead = (SharedRegion_SRPtr)&(obj->attrs->head);
+        localNextElem = (ListMP_Elem *)obj->attrs->head.next;
+    }
+    else {
+        sharedElem = SharedRegion_getSRPtr(elem, id);
+        sharedHead = SharedRegion_getSRPtr(&(obj->attrs->head), obj->regionId);
+        localNextElem = SharedRegion_getPtr(obj->attrs->head.next);
+    }
+
+    /* Assert that pointer is not NULL */
+    Assert_isTrue(localNextElem != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
+
+    localNextElemIsCached = SharedRegion_isCacheEnabled(
+        SharedRegion_getId(localNextElem));
+    if (localNextElemIsCached) {
+        Cache_inv(localNextElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    /* add the new elem into the list */
+    elem->next = obj->attrs->head.next;
+    elem->prev = sharedHead;
+    localNextElem->prev = sharedElem;
+    obj->attrs->head.next = sharedElem;
+
+    if (localNextElemIsCached) {
+        /* Write-back because localNextElem->prev changed */
+        Cache_wbInv(localNextElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+    if (obj->cacheEnabled) {
+        /* Write-back because obj->attrs->head.next changed */
+        Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL,
+                    TRUE);
+    }
+    if (SharedRegion_isCacheEnabled(id)) {
+        /* Write-back because elem->next & elem->prev changed */
+        Cache_wbInv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (ListMP_S_SUCCESS);
+}
+
+/*
+ *  ======== ListMP_putTail ========
+ */
+Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    UInt key;
+    UInt16  id;
+    ListMP_Elem *localPrevElem;
+    SharedRegion_SRPtr sharedElem;
+    SharedRegion_SRPtr sharedHead;
+    Bool localPrevElemIsCached;
+
+    /* prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    id = SharedRegion_getId(elem);
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        sharedElem = (SharedRegion_SRPtr)elem;
+        sharedHead = (SharedRegion_SRPtr)&(obj->attrs->head);
+        localPrevElem = (ListMP_Elem *)obj->attrs->head.prev;
+    }
+    else {
+        sharedElem = SharedRegion_getSRPtr(elem, id);
+        sharedHead = SharedRegion_getSRPtr(&(obj->attrs->head), obj->regionId);
+        localPrevElem = SharedRegion_getPtr(obj->attrs->head.prev);
+    }
+
+    /* Assert that pointer is not NULL */
+    Assert_isTrue(localPrevElem != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
+
+    localPrevElemIsCached = SharedRegion_isCacheEnabled(
+        SharedRegion_getId(localPrevElem));
+    if (localPrevElemIsCached) {
+        Cache_inv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    /* add the new elem into the list */
+    elem->next = sharedHead;
+    elem->prev = obj->attrs->head.prev;
+    localPrevElem->next = sharedElem;
+    obj->attrs->head.prev = sharedElem;
+
+    if (localPrevElemIsCached) {
+        /* Write-back because localPrevElem->next changed */
+        Cache_wbInv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+    if (obj->cacheEnabled) {
+        /* Write-back because obj->attrs->head.prev changed */
+        Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL,
+                TRUE);
+    }
+    if (SharedRegion_isCacheEnabled(id)) {
+        /* Write-back because elem->next & elem->prev changed */
+        Cache_wbInv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (ListMP_S_SUCCESS);
+}
+
+/*
+ *  ======== ListMP_remove ========
+ */
+Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem)
+{
+    ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+    UInt key;
+    ListMP_Elem *localPrevElem;
+    ListMP_Elem *localNextElem;
+    Bool localPrevElemIsCached, localNextElemIsCached;
+
+    /* Prevent another thread or processor from modifying the ListMP */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        localPrevElem = (ListMP_Elem *)(elem->prev);
+        localNextElem = (ListMP_Elem *)(elem->next);
+    }
+    else {
+        localPrevElem = SharedRegion_getPtr(elem->prev);
+        localNextElem = SharedRegion_getPtr(elem->next);
+    }
+
+    localPrevElemIsCached = SharedRegion_isCacheEnabled(
+            SharedRegion_getId(localPrevElem));
+    localNextElemIsCached = SharedRegion_isCacheEnabled(
+            SharedRegion_getId(localNextElem));
+
+    if (localPrevElemIsCached) {
+        Cache_inv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+    if (localNextElemIsCached) {
+        Cache_inv(localNextElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    localPrevElem->next = elem->next;
+    localNextElem->prev = elem->prev;
+
+    if (localPrevElemIsCached) {
+        Cache_wbInv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+    if (localNextElemIsCached) {
+        Cache_wbInv(localNextElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (ListMP_S_SUCCESS);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_ListMP_Instance_init ========
+ */
+Int ti_sdo_ipc_ListMP_Instance_init(ti_sdo_ipc_ListMP_Object *obj,
+        const ti_sdo_ipc_ListMP_Params *params,
+        Error_Block *eb)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Ptr localAddr;
+    Int status;
+    ListMP_Params sparams;
+    IHeap_Handle regionHeap;
+
+    if (params->openFlag == TRUE) {
+        /* Open by sharedAddr */
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+        obj->attrs = (ti_sdo_ipc_ListMP_Attrs *)params->sharedAddr;
+        obj->regionId = SharedRegion_getId(&(obj->attrs->head));
+        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+        obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
+
+        /* get the local address of the SRPtr */
+        localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
+
+        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&(obj->gate));
+        if (status != GateMP_S_SUCCESS) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (1);
+        }
+
+        return (0);
+    }
+
+    /* init the gate */
+    if (params->gate != NULL) {
+        obj->gate = params->gate;
+    }
+    else {
+        obj->gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+    }
+
+    if (params->sharedAddr == NULL) {
+        /* Creating using a shared region ID */
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
+        obj->regionId = params->regionId;
+        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+        obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
+
+        /* Need to allocate from the heap */
+        ListMP_Params_init(&sparams);
+        sparams.regionId = params->regionId;
+        obj->allocSize = ListMP_sharedMemReq(&sparams);
+
+        regionHeap = SharedRegion_getHeap(obj->regionId);
+        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);
+
+        /* The region heap will take care of the alignment */
+        obj->attrs = Memory_alloc(regionHeap, obj->allocSize, 0, eb);
+
+        if (obj->attrs == NULL) {
+            return (2);
+        }
+    }
+    else {
+        /* Creating using sharedAddr */
+        obj->regionId = SharedRegion_getId(params->sharedAddr);
+
+        /* Assert that the buffer is in a valid shared region */
+        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+        /* set object's cacheEnabled, objType, and attrs  */
+        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+        obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+        obj->attrs = (ti_sdo_ipc_ListMP_Attrs *)params->sharedAddr;
+
+        /* Assert that sharedAddr is cache aligned */
+        Assert_isTrue((obj->cacheLineSize == 0) ||
+                      ((UInt32)params->sharedAddr % obj->cacheLineSize == 0),
+                      ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+    }
+
+    /* init the head (to be empty) */
+    ListMP_elemClear(&(obj->attrs->head));
+
+    /* store the GateMP sharedAddr in the Attrs */
+    obj->attrs->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
+
+    /* last thing, set the status */
+    obj->attrs->status = ti_sdo_ipc_ListMP_CREATED;
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_ListMP_Attrs),
+                Cache_Type_ALL, TRUE);
+    }
+
+    /* add to NameServer if name not NULL */
+    if (params->name != NULL) {
+        sharedShmBase = SharedRegion_getSRPtr(obj->attrs, obj->regionId);
+        obj->nsKey = NameServer_addUInt32(
+            (NameServer_Handle)ListMP_module->nameServer, params->name,
+            (UInt32)sharedShmBase);
+
+        if (obj->nsKey == NULL) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
+            return (3);
+        }
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== ti_sdo_ipc_ListMP_Instance_finalize ========
+ */
+Void ti_sdo_ipc_ListMP_Instance_finalize(ti_sdo_ipc_ListMP_Object *obj,
+        Int status)
+{
+    if (obj->objType & (ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC |
+                        ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION)) {
+        /* List is being deleted */
+        /* Remove entry from NameServer */
+        if (obj->nsKey != NULL) {
+            NameServer_removeEntry((NameServer_Handle)ListMP_module->nameServer,
+                    obj->nsKey);
+        }
+
+        /* Set status to 'not created' */
+        if (obj->attrs != NULL) {
+            obj->attrs->status = 0;
+            if (obj->cacheEnabled == TRUE) {
+                Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_ListMP_Attrs),
+                    Cache_Type_ALL, TRUE);
+            }
+        }
+
+        /*
+         *  Free the shared memory back to the region heap. If NULL, then the
+         *  Memory_alloc failed.
+         */
+        if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION &&
+            obj->attrs != NULL) {
+            Memory_free(SharedRegion_getHeap(obj->regionId), obj->attrs,
+                        obj->allocSize);
+        }
+    }
+    else {
+        /* List is being closed */
+        /* Close the gate. If NULL, then GateMP_openByAddr failed. */
+        if (obj->gate != NULL) {
+            GateMP_close((GateMP_Handle *)&(obj->gate));
+        }
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+/*
+ *  ======== ti_sdo_ipc_ListMP_elemClear ========
+ */
+Void ti_sdo_ipc_ListMP_elemClear(ti_sdo_ipc_ListMP_Elem *elem)
+{
+    SharedRegion_SRPtr sharedElem;
+    UInt16 id;
+
+    id = SharedRegion_getId(elem);
+    sharedElem = SharedRegion_getSRPtr(elem, id);
+
+    elem->next = elem->prev = sharedElem;
+    if (SharedRegion_isCacheEnabled(id)) {
+        Cache_wbInv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
+    }
+}
diff --git a/packages/ti/sdo/ipc/ListMP.xdc b/packages/ti/sdo/ipc/ListMP.xdc
new file mode 100644 (file)
index 0000000..ff94314
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== ListMP.xdc ========
+ *
+ */
+
+import xdc.runtime.Error;
+import ti.sdo.utils.NameServer;
+
+/*!
+ *  ======== ListMP ========
+ *  Shared memory linked list
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/ListMP.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg):
+ *
+ *  <PRE>ListMP = xdc.useModule('ti.sdo.ipc.ListMP');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ */
+@InstanceInitError /* Initialization may throw errors */
+@InstanceFinalize
+
+module ListMP
+{
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     *  ROV view structure representing a ListMP instance.
+     */
+    metaonly struct BasicView {
+        String      label;
+        String      type;
+        String      gate;
+    }
+
+    /*!
+     *  ======== ElemView ========
+     *  @_nodoc
+     *  ROV view structure representing a single list element.
+     */
+    metaonly struct ElemView {
+        Int        index;
+        String     srPtr;
+        String     addr;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Lists',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitLists',
+                        structName: 'ElemView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== maxRuntimeEntries ========
+     *  Maximum number of ListMP's that can be dynamically created
+     *  and added to the NameServer.
+     */
+    metaonly config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+
+    /*!
+     *  ======== maxNameLen ========
+     *  Maximum length for names.
+     */
+    metaonly config UInt maxNameLen = 32;
+
+    /*!
+     *  ======== tableSection ========
+     *  Section name is used to place the names table
+     */
+    metaonly config String tableSection = null;
+
+
+instance:
+
+    /*!
+     *  ======== gate ========
+     *  GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in the default GateMP
+     *  being used for context protection.
+     */
+    config GateMP.Handle gate = null;
+
+    /*! @_nodoc
+     *  ======== openFlag ========
+     *  Set to 'true' by the {@link #open}.
+     */
+    config Bool openFlag = false;
+
+    /*! @_nodoc
+     *  ======== sharedAddr ========
+     *  Physical address of the shared memory
+     *
+     *  The shared memory that will be used for maintaining shared state
+     *  information.  This is an optional parameter to create.  If value
+     *  is null, then the shared memory for the new instance will be
+     *  allocated from the heap in {@link #regionId}.
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== name ========
+     *  Name of the instance
+     *
+     *  The name must be unique among all ListMP instances in the sytem.
+     *  When using {@link #regionId} to create a new instance, the name must
+     *  not be null.
+     */
+    config String name = null;
+
+    /*!
+     *  ======== regionId ========
+     *  SharedRegion ID.
+     *
+     *  The ID corresponding to the index of the shared region in which this
+     *  shared instance is to be placed.  This is used in create() only when
+     *  {@link #name} is not null.
+     */
+    config UInt16 regionId = 0;
+
+    /*! @_nodoc
+     *  ======== metaListMP ========
+     *  Used to store elem before the object is initialized.
+     */
+    metaonly config any metaListMP[];
+
+
+internal:    /* not for client use */
+
+    const UInt32 CREATED = 0x12181964;
+
+    /*!
+     *  ======== Elem ========
+     *  Opaque ListMP element
+     *
+     *  A field of this type must be placed at the head of client structs.
+     */
+    @Opaque struct Elem {
+        volatile SharedRegion.SRPtr next;       /* volatile for whole_program */
+        volatile SharedRegion.SRPtr prev;       /* volatile for whole_program */
+    };
+
+
+    /*!
+     *  ======== nameSrvPrms ========
+     *  This Params object is used for temporary storage of the
+     *  module wide parameters that are for setting the NameServer instance.
+     */
+    metaonly config NameServer.Params nameSrvPrms;
+
+    /*!
+     *  ======== elemClear ========
+     *  Clears a ListMP element's pointers
+     *
+     *  This API is not for removing elements from a ListMP, and
+     *  should never be called on an element in a ListMP--only on deListed
+     *  elements.
+     *
+     *  @param(elem)    element to be cleared
+     */
+    Void elemClear(Elem *elem);
+
+    /* Initialize shared memory */
+    Void postInit(Object *obj, Error.Block *eb);
+
+    /*! Structure of attributes in shared memory */
+    struct Attrs {
+        Bits32              status;     /* Created stamp                 */
+        SharedRegion.SRPtr  gateMPAddr; /* GateMP SRPtr (shm safe)       */
+        Elem                head;       /* head of list                  */
+    };
+
+    /* instance object */
+    struct Instance_State {
+        Attrs           *attrs;         /* local pointer to attrs        */
+        Ptr             nsKey;          /* for removing NS entry         */
+        Ipc.ObjType     objType;        /* Static/Dynamic? open/creator? */
+        GateMP.Handle   gate;           /* Gate for critical regions     */
+        SizeT           allocSize;      /* Shared memory allocated       */
+        UInt16          regionId;       /* SharedRegion ID               */
+        Bool            cacheEnabled;   /* Whether to do cache calls     */
+        SizeT           cacheLineSize;  /* The region cache line size    */
+    };
+
+    /* module object */
+    struct Module_State {
+        NameServer.Handle nameServer;
+    };
+}
diff --git a/packages/ti/sdo/ipc/ListMP.xs b/packages/ti/sdo/ipc/ListMP.xs
new file mode 100644 (file)
index 0000000..0e230f7
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== ListMP.xs ========
+ *
+ */
+
+var Cache        = null;
+var Ipc          = null;
+var GateMP       = null;
+var ListMP       = null;
+var SharedRegion = null;
+var MultiProc    = null;
+var NameServer   = null;
+var instCount = 0;      /* use to determine if processing last instance */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    ListMP = this;
+    Ipc          = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP       = xdc.useModule('ti.sdo.ipc.GateMP');
+    SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    MultiProc    = xdc.useModule("ti.sdo.utils.MultiProc");
+    NameServer   = xdc.useModule("ti.sdo.utils.NameServer");
+    Cache        = xdc.useModule("ti.sysbios.hal.Cache");
+
+    ListMP.common$.fxntab = false;
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    mod.nameServer = null;
+    ListMP.nameSrvPrms.maxRuntimeEntries = params.maxRuntimeEntries;
+    ListMP.nameSrvPrms.maxNameLen        = params.maxNameLen;
+    ListMP.nameSrvPrms.tableSection      = params.tableSection;
+
+    /*
+     *  Get the current number of created static instances of this module.
+     *  Note: if user creates a static instance after this point and
+     *        expects to use NameServer, this is a problem.
+     */
+    var instCount = this.$instances.length;
+
+    /* create NameServer here only if no static instances are created */
+    if (instCount == 0) {
+        mod.nameServer = NameServer.create("ListMP", ListMP.nameSrvPrms);
+    }
+}
+
+/*
+ *  ======== viewInitBasic ========
+ *  Processes the 'Basic' view for a ListMP instance.
+ */
+function viewInitBasic(view, obj)
+{
+    var NameServer = xdc.useModule('ti.sdo.utils.NameServer');
+    var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+    var GateMP = xdc.useModule('ti.sdo.ipc.GateMP');
+
+    /* Determine if the instance was given a name in the nameserver. */
+    if (obj.nsKey != 0x0) {
+        view.label = NameServer.getNameByKey$view(obj.nsKey);
+    }
+    /* Otherwise, leave the label empty. */
+    else {
+        view.label = "";
+    }
+
+    /* Get the instance's type (created, opened, etc.) */
+    view.type = Ipc.getObjTypeStr$view(obj.objType);
+
+    /* Display the handle to the instance's gate. */
+    view.gate = String(obj.gate);
+}
+
+/*
+ *  ======== viewInitLists ========
+ *  Processes the 'Lists' view for a ListMP instance.
+ *
+ *  The 'Lists' view is a tree-type view (Instance Data) which displays the
+ *  elements on the list. For each element, it displays an index and both the
+ *  local and shared region address of the element.
+ */
+function viewInitLists(view, obj)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    var ListMP = xdc.useModule('ti.sdo.ipc.ListMP');
+
+    /* Label the list by its address. */
+    view.label = String(obj.$addr);
+
+    /* Retrieve the ListMP's Attrs struct. */
+    var attrs;
+    try {
+        attrs = Program.fetchStruct(obj.attrs$fetchDesc, obj.attrs);
+    }
+    /* If there was a problem fetching the attrs struct, report it. */
+    catch (e) {
+        /* Create an element view to display the problem. */
+        var elemView = Program.newViewStruct('ti.sdo.ipc.ListMP', 'Lists');
+        Program.displayError(elemView, 'index',
+                             "Problem retrieving the instance's Attrs " +
+                             "struct: " + e);
+        view.elements.$add(elemView);
+        return;
+    }
+
+    /* Compute the address of the 'head' element within the attrs struct. */
+    var hdrOffset = $om['ti.sdo.ipc.ListMP.Attrs'].$offsetof('head');
+    var hdrAddr = Number(obj.attrs) + hdrOffset;
+
+    /* Get the shared region address of the header. */
+    try {
+        var srHdrAddr = SharedRegion.getSRPtrMeta$view(hdrAddr);
+    }
+    /* If there was a problem, report it. */
+    catch (e) {
+        /* Create an element view to display the problem. */
+        var elemView = Program.newViewStruct('ti.sdo.ipc.ListMP', 'Lists');
+        Program.displayError(elemView, 'index',
+                             "Problem retrieving SharedRegion address for " +
+                             "the list's head: " + e);
+        view.elements.$add(elemView);
+        return;
+    }
+
+    /*
+     * To check for loops, store each address as a key in a map,
+     * then with each new address check first if it is already in
+     * the map.
+     */
+    var srAddrs = {};
+
+    /* Start at the head element. */
+    var e = attrs.head;
+
+    /* Loop through all of the elements until we're back at the head. */
+    while (e.next != srHdrAddr) {
+
+        /* Before fetching the next element, verify we're not in a loop. */
+        if (e.next in srAddrs) {
+            var lastElem = view.elements[view.elements.length - 1];
+            Program.displayError(lastElem, 'addr', "List contains loop. " +
+                                 "This element points to SharedRegion " +
+                                 "address 0x" + Number(e.next).toString(16));
+            break;
+        }
+
+        /* Create a view structure to represent the next element. */
+        var elemView = Program.newViewStruct('ti.sdo.ipc.ListMP', 'Lists');
+
+        /* Display the shared region address of the next element. */
+        elemView.srPtr = "0x" + Number(e.next).toString(16);
+
+        /*
+         * Get the local address of the next element using the SharedRegion
+         * module.
+         */
+        try {
+            var nextAddr = SharedRegion.getPtrMeta$view(Number(e.next));
+        }
+        catch (e) {
+            Program.displayError(elemView, 'addr', "Problem calculating " +
+                                 "local address: " + addressString(e));
+        }
+
+        /* Display the local address of the next element. */
+        elemView.addr = "0x" + Number(nextAddr).toString(16);
+
+        /* Add the element to the view. */
+        view.elements.$add(elemView);
+
+        /*
+         * Add the address to a map so we can check for loops.
+         * The value 'true' is just a placeholder to make sure the address
+         * is in the map.
+         */
+        srAddrs[e.next] = true;
+
+        /* Fetch the next element (using its local address) */
+        e = Program.fetchStruct(ListMP.Elem$fetchDesc, nextAddr);
+    }
+}
diff --git a/packages/ti/sdo/ipc/MessageQ.c b/packages/ti/sdo/ipc/MessageQ.c
new file mode 100644 (file)
index 0000000..cbc1a60
--- /dev/null
@@ -0,0 +1,879 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MessageQ.c ========
+ *  Implementation of functions specified in MessageQ.xdc.
+ */
+
+#include <xdc/std.h>
+
+#include <string.h>
+
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/Startup.h>
+
+#include <xdc/runtime/knl/ISync.h>
+#include <xdc/runtime/knl/GateThread.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/syncs/SyncSem.h>
+
+#include <ti/sdo/ipc/interfaces/IMessageQTransport.h>
+#include <ti/sdo/utils/List.h>
+
+/* must be included after the internal header file for now */
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+
+#include "package/internal/MessageQ.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(MessageQ_Params_init);
+    #pragma FUNC_EXT_CALLED(MessageQ_alloc);
+    #pragma FUNC_EXT_CALLED(MessageQ_close);
+    #pragma FUNC_EXT_CALLED(MessageQ_count);
+    #pragma FUNC_EXT_CALLED(MessageQ_create);
+    #pragma FUNC_EXT_CALLED(MessageQ_delete);
+    #pragma FUNC_EXT_CALLED(MessageQ_open);
+    #pragma FUNC_EXT_CALLED(MessageQ_free);
+    #pragma FUNC_EXT_CALLED(MessageQ_get);
+    #pragma FUNC_EXT_CALLED(MessageQ_getQueueId);
+    #pragma FUNC_EXT_CALLED(MessageQ_put);
+    #pragma FUNC_EXT_CALLED(MessageQ_registerHeap);
+    #pragma FUNC_EXT_CALLED(MessageQ_setReplyQueue);
+    #pragma FUNC_EXT_CALLED(MessageQ_setMsgTrace);
+    #pragma FUNC_EXT_CALLED(MessageQ_staticMsgInit);
+    #pragma FUNC_EXT_CALLED(MessageQ_unblock);
+    #pragma FUNC_EXT_CALLED(MessageQ_unregisterHeap);
+#endif
+
+/*
+ *  ======== MessageQ_msgInit ========
+ *  This is a helper function to initialize a message.
+ */
+static Void MessageQ_msgInit(MessageQ_Msg msg)
+{
+    UInt key;
+
+    msg->replyId = (UInt16)MessageQ_INVALIDMESSAGEQ;
+    msg->msgId   = MessageQ_INVALIDMSGID;
+    msg->dstId   = (UInt16)MessageQ_INVALIDMESSAGEQ;
+    msg->flags   = ti_sdo_ipc_MessageQ_HEADERVERSION |
+                   MessageQ_NORMALPRI |
+                   (ti_sdo_ipc_MessageQ_TRACEMASK &
+                   (ti_sdo_ipc_MessageQ_traceFlag << ti_sdo_ipc_MessageQ_TRACESHIFT));
+    msg->srcProc = MultiProc_self();
+
+    key = Hwi_disable();
+    msg->seqNum  = MessageQ_module->seqNum++;
+    Hwi_restore(key);
+}
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== MessageQ_Params_init ========
+ */
+Void MessageQ_Params_init(MessageQ_Params *params)
+{
+    params->synchronizer = NULL;
+}
+
+/*
+ *  ======== MessageQ_alloc ========
+ *  Allocate a message and initial the needed fields (note some
+ *  of the fields in the header at set via other APIs or in the
+ *  MessageQ_put function.
+ */
+MessageQ_Msg MessageQ_alloc(UInt16 heapId, Uint32 size)
+{
+    MessageQ_Msg msg;
+    Error_Block eb;
+
+    Assert_isTrue((heapId < MessageQ_module->numHeaps),
+                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);
+
+    Assert_isTrue((MessageQ_module->heaps[heapId] != NULL),
+                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);
+
+    /* Allocate the message. No alignment requested */
+    Error_init(&eb);
+    msg = Memory_alloc(MessageQ_module->heaps[heapId], size, 0, &eb);
+
+    if (msg == NULL) {
+        return (NULL);
+    }
+
+    /* Fill in the fields of the message */
+    MessageQ_msgInit(msg);
+    msg->msgSize = size;
+    msg->heapId  = heapId;
+
+    if (ti_sdo_ipc_MessageQ_traceFlag == TRUE) {
+        Log_write3(ti_sdo_ipc_MessageQ_LM_alloc, (UArg)(msg),
+            (UArg)(msg->seqNum), (UArg)(msg->srcProc));
+    }
+
+    return (msg);
+}
+
+/*
+ *  ======== MessageQ_count ========
+ */
+Int MessageQ_count(MessageQ_Handle handle)
+{
+    Int              count = 0;
+    UInt             key;
+    List_Elem       *tempMsg = NULL;
+    List_Handle      listHandle;
+    ti_sdo_ipc_MessageQ_Object *obj = (ti_sdo_ipc_MessageQ_Object *)handle;
+
+    /* lock */
+    key = Hwi_disable();
+
+    /* Get the list */
+    listHandle = ti_sdo_ipc_MessageQ_Instance_State_highList(obj);
+
+    /* Loop through and count the messages */
+    while ((tempMsg = List_next(listHandle, tempMsg)) != NULL) {
+        count++;
+    }
+
+    listHandle = ti_sdo_ipc_MessageQ_Instance_State_normalList(obj);
+
+    /* Loop through and count the messages */
+    while ((tempMsg = List_next(listHandle, tempMsg)) != NULL) {
+        count++;
+    }
+
+    /* unlock scheduler */
+    Hwi_restore(key);
+
+    return (count);
+}
+
+/*
+ *  ======== MessageQ_close ========
+ */
+Int MessageQ_close(MessageQ_QueueId *queueId)
+{
+    *queueId = MessageQ_INVALIDMESSAGEQ;
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== MessageQ_create ========
+ */
+MessageQ_Handle MessageQ_create(String name, const MessageQ_Params *params)
+{
+    ti_sdo_ipc_MessageQ_Handle handle;
+    ti_sdo_ipc_MessageQ_Params prms;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    if (params != NULL) {
+        ti_sdo_ipc_MessageQ_Params_init(&prms);
+
+        prms.synchronizer = params->synchronizer;
+
+        handle = ti_sdo_ipc_MessageQ_create(name, &prms, &eb);
+    }
+    else {
+        handle = ti_sdo_ipc_MessageQ_create(name, NULL, &eb);
+    }
+
+    return ((MessageQ_Handle)handle);
+}
+
+/*
+ *  ======== MessageQ_delete ========
+ */
+Int MessageQ_delete(MessageQ_Handle *handlePtr)
+{
+    ti_sdo_ipc_MessageQ_Handle *instp;
+
+    instp = (ti_sdo_ipc_MessageQ_Handle *)handlePtr;
+
+    ti_sdo_ipc_MessageQ_delete(instp);
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== MessageQ_free ========
+ */
+Int MessageQ_free(MessageQ_Msg msg)
+{
+    IHeap_Handle heap;
+
+    /* make sure msg is not NULL */
+    Assert_isTrue((msg != NULL), ti_sdo_ipc_MessageQ_A_invalidMsg);
+
+    /* Cannot free a message that was initialized via MessageQ_staticMsgInit */
+    Assert_isTrue((msg->heapId != ti_sdo_ipc_MessageQ_STATICMSG),
+                  ti_sdo_ipc_MessageQ_A_cannotFreeStaticMsg);
+
+    Assert_isTrue((msg->heapId < MessageQ_module->numHeaps),
+                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);
+
+    Assert_isTrue((MessageQ_module->heaps[msg->heapId] != NULL),
+                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);
+
+    if ((ti_sdo_ipc_MessageQ_traceFlag == TRUE) ||
+        (msg->flags & ti_sdo_ipc_MessageQ_TRACEMASK) != 0) {
+        Log_write3(ti_sdo_ipc_MessageQ_LM_free, (UArg)(msg),
+            (UArg)(msg->seqNum), (UArg)(msg->srcProc));
+    }
+
+    heap = MessageQ_module->heaps[msg->heapId];
+
+    if (heap != NULL) {
+        Memory_free(heap, msg, msg->msgSize);
+    }
+    else {
+        return (MessageQ_E_FAIL);
+    }
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== MessageQ_get ========
+ */
+Int MessageQ_get(MessageQ_Handle handle, MessageQ_Msg *msg, UInt timeout)
+{
+    Int status;
+    List_Handle highList;
+    List_Handle normalList;
+    ti_sdo_ipc_MessageQ_Object *obj = (ti_sdo_ipc_MessageQ_Object *)handle;
+
+    /* Get the list */
+    normalList = ti_sdo_ipc_MessageQ_Instance_State_normalList(obj);
+    highList   = ti_sdo_ipc_MessageQ_Instance_State_highList(obj);
+
+    /* Keep looping while there are no elements on either list */
+    *msg = (MessageQ_Msg)List_get(highList);
+    while (*msg == NULL) {
+        *msg = (MessageQ_Msg)List_get(normalList);
+        if (*msg == NULL) {
+            /*  Block until notified. */
+            status = ISync_wait(obj->synchronizer, timeout, NULL);
+            if (status == ISync_WaitStatus_TIMEOUT) {
+                return (MessageQ_E_TIMEOUT);
+            }
+            else if (status < 0) {
+                return (MessageQ_E_FAIL);
+            }
+
+            if (obj->unblocked) {
+                /* *(msg) may be NULL */
+                return (MessageQ_E_UNBLOCKED);
+            }
+
+            *msg = (MessageQ_Msg)List_get(highList);
+        }
+    }
+
+    if ((ti_sdo_ipc_MessageQ_traceFlag == TRUE) ||
+        (((*msg)->flags & ti_sdo_ipc_MessageQ_TRACEMASK) != 0)) {
+        Log_write4(ti_sdo_ipc_MessageQ_LM_get, (UArg)(*msg),
+            (UArg)((*msg)->seqNum), (UArg)((*msg)->srcProc), (UArg)(obj));
+    }
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== MessageQ_getQueueId ========
+ */
+MessageQ_QueueId MessageQ_getQueueId(MessageQ_Handle handle)
+{
+    MessageQ_QueueId queueId;
+    ti_sdo_ipc_MessageQ_Object *obj = (ti_sdo_ipc_MessageQ_Object *)handle;
+
+    queueId = (obj->queue);
+
+    return (queueId);
+}
+
+/*
+ *  ======== MessageQ_open ========
+ */
+Int MessageQ_open(String name, MessageQ_QueueId *queueId)
+{
+    Int         status;
+    Error_Block eb;
+
+    Assert_isTrue(name != NULL, ti_sdo_ipc_MessageQ_A_invalidParam);
+    Assert_isTrue(queueId != NULL, ti_sdo_ipc_MessageQ_A_invalidParam);
+
+    Error_init(&eb);
+
+    /* Search NameServer */
+    status = NameServer_getUInt32(
+            (NameServer_Handle)MessageQ_module->nameServer, name, queueId,
+            NULL);
+
+    if (status >= 0) {
+        return (MessageQ_S_SUCCESS);    /* name found */
+    }
+    else {
+        return (MessageQ_E_NOTFOUND);   /* name not found */
+    }
+}
+
+/*
+ *  ======== MessageQ_put ========
+ */
+Int MessageQ_put(MessageQ_QueueId queueId, MessageQ_Msg msg)
+{
+    IMessageQTransport_Handle transport;
+    MessageQ_QueueIndex dstProcId = (MessageQ_QueueIndex)(queueId >> 16);
+    List_Handle       listHandle;
+    Int               status;
+    UInt              priority;
+#ifndef xdc_runtime_Log_DISABLE_ALL
+    UInt16            flags;
+    UInt16            seqNum;
+    UInt16            srcProc;
+#endif
+    ti_sdo_ipc_MessageQ_Object   *obj;
+
+    Assert_isTrue((msg != NULL), ti_sdo_ipc_MessageQ_A_invalidMsg);
+
+    msg->dstId   = (UInt16)(queueId);
+    msg->dstProc = (UInt16)(queueId >> 16);
+
+    if (dstProcId != MultiProc_self()) {
+        /* assert that dstProcId is valid */
+        Assert_isTrue(dstProcId < ti_sdo_utils_MultiProc_numProcessors,
+                      ti_sdo_ipc_MessageQ_A_procIdInvalid);
+
+        /* Put the high and urgent messages to the high priority transport */
+        priority = (UInt)((msg->flags) &
+            ti_sdo_ipc_MessageQ_TRANSPORTPRIORITYMASK);
+
+        /* Call the transport associated with this message queue */
+        transport = MessageQ_module->transports[dstProcId][priority];
+        if (transport == NULL) {
+            /* Try the other transport */
+            priority = !priority;
+            transport = MessageQ_module->transports[dstProcId][priority];
+        }
+
+        /* assert transport is not null */
+        Assert_isTrue(transport != NULL,
+            ti_sdo_ipc_MessageQ_A_unregisteredTransport);
+
+#ifndef xdc_runtime_Log_DISABLE_ALL
+        /* use local vars so msg does not get cached after put */
+        flags = msg->flags;
+
+        if ((ti_sdo_ipc_MessageQ_traceFlag) ||
+            (flags & ti_sdo_ipc_MessageQ_TRACEMASK) != 0) {
+            /* use local vars so msg does not get cached after put */
+            seqNum  = msg->seqNum;
+            srcProc = msg->srcProc;
+        }
+#endif
+
+        /* put msg to remote processor using transport */
+        if (IMessageQTransport_put(transport, msg)) {
+            status = MessageQ_S_SUCCESS;
+
+#ifndef xdc_runtime_Log_DISABLE_ALL
+            /* if trace enabled */
+            if ((ti_sdo_ipc_MessageQ_traceFlag) ||
+                (flags & ti_sdo_ipc_MessageQ_TRACEMASK) != 0) {
+                Log_write4(ti_sdo_ipc_MessageQ_LM_putRemote, (UArg)(msg),
+                          (UArg)(seqNum), (UArg)(srcProc),
+                          (UArg)(dstProcId));
+            }
+#endif
+        }
+        else {
+            status = MessageQ_E_FAIL;
+        }
+    }
+    else {
+        /* Assert queueId is valid */
+        Assert_isTrue((UInt16)queueId < MessageQ_module->numQueues,
+                      ti_sdo_ipc_MessageQ_A_invalidQueueId);
+
+        /* It is a local MessageQ */
+        obj = MessageQ_module->queues[(UInt16)(queueId)];
+
+        /* Assert object is not NULL */
+        Assert_isTrue(obj != NULL, ti_sdo_ipc_MessageQ_A_invalidObj);
+
+        if ((msg->flags & MessageQ_PRIORITYMASK) == MessageQ_URGENTPRI) {
+            listHandle = ti_sdo_ipc_MessageQ_Instance_State_highList(obj);
+            List_putHead(listHandle, (List_Elem *)msg);
+        }
+        else {
+            if ((msg->flags & MessageQ_PRIORITYMASK) == MessageQ_NORMALPRI) {
+                listHandle = ti_sdo_ipc_MessageQ_Instance_State_normalList(obj);
+            }
+            else {
+                listHandle = ti_sdo_ipc_MessageQ_Instance_State_highList(obj);
+            }
+            /* put on the queue */
+            List_put(listHandle, (List_Elem *)msg);
+        }
+
+        ISync_signal(obj->synchronizer);
+
+        status = MessageQ_S_SUCCESS;
+
+        if ((ti_sdo_ipc_MessageQ_traceFlag) ||
+            (msg->flags & ti_sdo_ipc_MessageQ_TRACEMASK) != 0) {
+            Log_write4(ti_sdo_ipc_MessageQ_LM_putLocal, (UArg)(msg),
+                       (UArg)(msg->seqNum), (UArg)(msg->srcProc), (UArg)(obj));
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== MessageQ_registerHeap ========
+ *  Register a heap
+ */
+Int MessageQ_registerHeap(Ptr heap, UInt16 heapId)
+{
+    Int status;
+    UInt key;
+    IHeap_Handle iheap = (IHeap_Handle)heap;
+
+    /* Make sure the heapId is valid */
+    Assert_isTrue((heapId < MessageQ_module->numHeaps),
+                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);
+
+    /* lock scheduler */
+    key = Hwi_disable();
+
+    /* Make sure the id is not already in use */
+    if (MessageQ_module->heaps[heapId] == NULL) {
+        MessageQ_module->heaps[heapId] = iheap;
+        status = MessageQ_S_SUCCESS;
+    }
+    else {
+        status = MessageQ_E_ALREADYEXISTS;
+    }
+
+    /* unlock scheduler */
+    Hwi_restore(key);
+
+    return (status);
+}
+
+/*
+ *  ======== MessageQ_setMsgTrace ========
+ */
+Void MessageQ_setMsgTrace(MessageQ_Msg msg, Bool traceFlag)
+{
+    msg->flags = (msg->flags & ~ti_sdo_ipc_MessageQ_TRACEMASK) |
+                 (traceFlag << ti_sdo_ipc_MessageQ_TRACESHIFT);
+    Log_write4(ti_sdo_ipc_MessageQ_LM_setTrace, (UArg)(msg), (UArg)(msg->seqNum),
+               (UArg)(msg->srcProc), (UArg)(traceFlag));
+}
+
+/*
+ *  ======== MessageQ_setReplyQueue ========
+ *  Embed the source message queue into a message.
+ */
+Void MessageQ_setReplyQueue(MessageQ_Handle handle, MessageQ_Msg msg)
+{
+    ti_sdo_ipc_MessageQ_Object *obj = (ti_sdo_ipc_MessageQ_Object *)handle;
+
+    msg->replyId   = (UInt16)(obj->queue);
+    msg->replyProc = (UInt16)(obj->queue >> 16);
+}
+
+/*
+ *  ======== MessageQ_staticMsgInit ========
+ */
+Void MessageQ_staticMsgInit(MessageQ_Msg msg, Uint32 size)
+{
+    Assert_isTrue((msg != NULL), ti_sdo_ipc_MessageQ_A_invalidMsg);
+
+    MessageQ_msgInit(msg);
+
+    msg->heapId  = ti_sdo_ipc_MessageQ_STATICMSG;
+    msg->msgSize = size;
+
+    if (ti_sdo_ipc_MessageQ_traceFlag == TRUE) {
+        Log_write3(ti_sdo_ipc_MessageQ_LM_staticMsgInit, (UArg)(msg),
+                (UArg)(msg->seqNum), (UArg)(msg->srcProc));
+    }
+}
+
+/*
+ *  ======== MessageQ_unblock ========
+ */
+Void MessageQ_unblock(MessageQ_Handle handle)
+{
+    ti_sdo_ipc_MessageQ_Object *obj = (ti_sdo_ipc_MessageQ_Object *)handle;
+
+    /* Assert that the queue is using a blocking synchronizer */
+    Assert_isTrue(ISync_query((obj->synchronizer), ISync_Q_BLOCKING) == TRUE,
+        ti_sdo_ipc_MessageQ_A_invalidUnblock);
+
+    /* Set instance to 'unblocked' state */
+    obj->unblocked = TRUE;
+
+    /* Signal the synchronizer */
+    ISync_signal(obj->synchronizer);
+}
+
+/*
+ *  ======== MessageQ_unregisterHeap ========
+ *  Unregister a heap
+ */
+Int MessageQ_unregisterHeap(UInt16 heapId)
+{
+    UInt key;
+
+    Assert_isTrue((heapId < MessageQ_module->numHeaps),
+                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);
+
+    /* lock scheduler */
+    key = Hwi_disable();
+
+    MessageQ_module->heaps[heapId] = NULL;
+
+    /* unlock scheduler */
+    Hwi_restore(key);
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_MessageQ_Module_startup ========
+ */
+Int ti_sdo_ipc_MessageQ_Module_startup(Int phase)
+{
+    Int i;
+
+    /* Ensure NameServer Module_startup() has completed */
+    if (ti_sdo_utils_NameServer_Module_startupDone() == FALSE) {
+        return (Startup_NOTDONE);
+    }
+
+    if (GateThread_Module_startupDone() == FALSE) {
+        return (Startup_NOTDONE);
+    }
+
+    if (MessageQ_module->gate == NULL) {
+        MessageQ_module->gate =
+            GateThread_Handle_upCast(GateThread_create(NULL, NULL));
+    }
+
+    /* Loop through all the static objects and set the id */
+    for (i = 0; i < ti_sdo_ipc_MessageQ_Object_count(); i++) {
+        MessageQ_module->queues[i] = (ti_sdo_ipc_MessageQ_Object *)
+                ti_sdo_ipc_MessageQ_Object_get(NULL, i);
+    }
+
+    /* Null out the dynamic ones */
+    for (i = ti_sdo_ipc_MessageQ_Object_count(); i < MessageQ_module->numQueues;
+            i++) {
+        MessageQ_module->queues[i] = NULL;
+    }
+
+    return (Startup_DONE);
+}
+
+/*
+ *  ======== ti_sdo_ipc_MessageQ_registerTransport ========
+ *  Register a transport
+ */
+Bool ti_sdo_ipc_MessageQ_registerTransport(IMessageQTransport_Handle handle,
+    UInt16 procId, UInt priority)
+{
+    Bool flag = FALSE;
+    UInt key;
+
+    /* Make sure the procId is valid */
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors, ti_sdo_ipc_MessageQ_A_procIdInvalid);
+
+    /* lock scheduler */
+    key = Hwi_disable();
+
+    /* Make sure the id is not already in use */
+    if (MessageQ_module->transports[procId][priority] == NULL) {
+        MessageQ_module->transports[procId][priority] = handle;
+        flag = TRUE;
+    }
+
+    /* unlock scheduler */
+    Hwi_restore(key);
+
+    return (flag);
+}
+
+/*
+ *  ======== ti_sdo_ipc_MessageQ_unregisterTransport ========
+ *  Unregister a heap
+ */
+Void ti_sdo_ipc_MessageQ_unregisterTransport(UInt16 procId, UInt priority)
+{
+    UInt key;
+
+    /* Make sure the procId is valid */
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors, ti_sdo_ipc_MessageQ_A_procIdInvalid);
+
+    /* lock scheduler */
+    key = Hwi_disable();
+
+    MessageQ_module->transports[procId][priority] = NULL;
+
+    /* unlock scheduler */
+    Hwi_restore(key);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== MessageQ_Instance_init ========
+ */
+Int ti_sdo_ipc_MessageQ_Instance_init(ti_sdo_ipc_MessageQ_Object *obj, String name,
+        const ti_sdo_ipc_MessageQ_Params *params, Error_Block *eb)
+{
+    Int              i;
+    UInt16           start;
+    UInt16           count;
+    UInt             key;
+    Bool             found = FALSE;
+    List_Handle      listHandle;
+    SyncSem_Handle   syncSemHandle;
+    MessageQ_QueueIndex queueIndex;
+
+    /* lock */
+    key = IGateProvider_enter(MessageQ_module->gate);
+
+    start = ti_sdo_ipc_MessageQ_Object_count();
+    count = MessageQ_module->numQueues;
+
+    /* Search the dynamic array for any holes */
+    for (i = start; (i < count) && (found == FALSE); i++) {
+        if (MessageQ_module->queues[i] == NULL) {
+            MessageQ_module->queues[i] = obj;
+            queueIndex = i;
+            found = TRUE;
+        }
+    }
+
+    /*
+     *  If no free slot was found:
+     *     - if no growth allowed, raise and error
+     *     - if growth is allowed, grow the array
+     */
+    if (found == FALSE) {
+        if (ti_sdo_ipc_MessageQ_maxRuntimeEntries != NameServer_ALLOWGROWTH) {
+            /* unlock scheduler */
+            IGateProvider_leave(MessageQ_module->gate, key);
+
+            Error_raise(eb, ti_sdo_ipc_MessageQ_E_maxReached,
+                ti_sdo_ipc_MessageQ_maxRuntimeEntries, 0);
+            return (1);
+        }
+        else {
+            queueIndex = MessageQ_grow(obj, eb);
+            if (queueIndex == MessageQ_INVALIDMESSAGEQ) {
+                /* unlock scheduler */
+                IGateProvider_leave(MessageQ_module->gate, key);
+                return (2);
+            }
+        }
+    }
+
+    /* create default sync if not specified */
+    if (params->synchronizer == NULL) {
+        /* Create a SyncSem as the synchronizer */
+        syncSemHandle = SyncSem_create(NULL, eb);
+
+        if (syncSemHandle == NULL) {
+            /* unlock scheduler */
+            IGateProvider_leave(MessageQ_module->gate, key);
+            return (3);
+        }
+
+        /* store handle for use in finalize ...  */
+        obj->syncSemHandle = syncSemHandle;
+
+        obj->synchronizer = SyncSem_Handle_upCast(syncSemHandle);
+    }
+    else {
+        obj->syncSemHandle = NULL;
+
+        obj->synchronizer = params->synchronizer;
+    }
+
+    /* unlock scheduler */
+    IGateProvider_leave(MessageQ_module->gate, key);
+
+    /* Fill in the message queue object */
+    listHandle = ti_sdo_ipc_MessageQ_Instance_State_normalList(obj);
+    List_construct(List_struct(listHandle), NULL);
+
+    listHandle = ti_sdo_ipc_MessageQ_Instance_State_highList(obj);
+    List_construct(List_struct(listHandle), NULL);
+
+    obj->queue = ((MessageQ_QueueId)(MultiProc_self()) << 16) | queueIndex;
+
+    obj->unblocked = FALSE;
+
+    /* Add into NameServer */
+    if (name != NULL) {
+        obj->nsKey = NameServer_addUInt32(
+                (NameServer_Handle)MessageQ_module->nameServer, name,
+                obj->queue);
+
+        if (obj->nsKey == NULL) {
+            Error_raise(eb, ti_sdo_ipc_MessageQ_E_nameFailed, name, 0);
+            return (4);
+        }
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== MessageQ_Instance_finalize ========
+ */
+Void ti_sdo_ipc_MessageQ_Instance_finalize(
+        ti_sdo_ipc_MessageQ_Object* obj, Int status)
+{
+    UInt key;
+    MessageQ_QueueIndex index = (MessageQ_QueueIndex)(obj->queue);
+    List_Handle listHandle;
+
+    if (obj->syncSemHandle != NULL) {
+        SyncSem_delete(&obj->syncSemHandle);
+    }
+
+    listHandle = ti_sdo_ipc_MessageQ_Instance_State_normalList(obj);
+
+    /* Destruct the list */
+    List_destruct(List_struct(listHandle));
+
+    listHandle = ti_sdo_ipc_MessageQ_Instance_State_highList(obj);
+
+    /* Destruct the list */
+    List_destruct(List_struct(listHandle));
+
+    /* lock */
+    key = IGateProvider_enter(MessageQ_module->gate);
+
+    /* Null out entry in the array. */
+    MessageQ_module->queues[index] = NULL;
+
+    /* unlock scheduler */
+    IGateProvider_leave(MessageQ_module->gate, key);
+
+    if (obj->nsKey != NULL) {
+        NameServer_removeEntry((NameServer_Handle)MessageQ_module->nameServer,
+            obj->nsKey);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_MessageQ_grow ========
+ */
+UInt16 ti_sdo_ipc_MessageQ_grow(ti_sdo_ipc_MessageQ_Object *obj,
+        Error_Block *eb)
+{
+    UInt16 oldSize;
+    UInt16 queueIndex = MessageQ_module->numQueues;
+    ti_sdo_ipc_MessageQ_Handle *queues;
+    ti_sdo_ipc_MessageQ_Handle *oldQueues;
+    oldSize = (MessageQ_module->numQueues) * sizeof(MessageQ_Handle);
+
+
+    /* Allocate larger table */
+    queues = Memory_alloc(ti_sdo_ipc_MessageQ_Object_heap(),
+                          oldSize + sizeof(MessageQ_Handle), 0, eb);
+
+    if (queues == NULL) {
+        return (MessageQ_INVALIDMESSAGEQ);
+    }
+
+    /* Copy contents into new table */
+    memcpy(queues, MessageQ_module->queues, oldSize);
+
+    /* Fill in the new entry */
+    queues[queueIndex] = obj;
+
+    /* Hook-up new table */
+    oldQueues = MessageQ_module->queues;
+    MessageQ_module->queues = queues;
+    MessageQ_module->numQueues++;
+
+    /* Delete old table if not statically defined */
+    if (MessageQ_module->canFreeQueues == TRUE) {
+        Memory_free(ti_sdo_ipc_MessageQ_Object_heap(), oldQueues, oldSize);
+    }
+    else {
+        MessageQ_module->canFreeQueues = TRUE;
+    }
+
+    return (queueIndex);
+}
diff --git a/packages/ti/sdo/ipc/MessageQ.xdc b/packages/ti/sdo/ipc/MessageQ.xdc
new file mode 100644 (file)
index 0000000..0b8e105
--- /dev/null
@@ -0,0 +1,694 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MessageQ.xdc ========
+ *
+ */
+
+package ti.sdo.ipc;
+
+import xdc.runtime.IHeap;
+import xdc.runtime.Assert;
+import xdc.runtime.Error;
+import xdc.runtime.Diags;
+import xdc.runtime.Log;
+import xdc.runtime.IGateProvider;
+import xdc.runtime.knl.ISync;
+
+import ti.sysbios.syncs.SyncSem;
+
+import ti.sdo.ipc.interfaces.IMessageQTransport;
+import ti.sdo.utils.NameServer;
+import ti.sdo.utils.List;
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== MessageQ ========
+ *  Message-passing with queuing
+ *
+ *  The MessageQ module supports the structured sending and receiving of
+ *  variable length messages. This module can be used for homogeneous
+ *  (DSP to DSP)  or heterogeneous (Arm to DSP) multi-processor messaging.
+ *
+ *  MessageQ provides more sophisticated messaging than other modules. It is
+ *  typically used for complex situations such as multi-processor messaging.
+ *
+ *  The following are key features of the MessageQ module:
+ *  @p(blist)
+ *  -Writers and readers can be relocated to another processor with no
+ *   runtime code changes.
+ *  -Timeouts are allowed when receiving messages.
+ *  -Readers can determine the writer and reply back.
+ *  -Receiving a message is deterministic when the timeout is zero.
+ *  -Messages can reside on any message queue.
+ *  -Supports zero-copy transfers.
+ *  -Can send and receive from any type of thread.
+ *  -Notification mechanism is specified by application.
+ *  -Allows QoS (quality of service) on message buffer pools. For example,
+ *   using specific buffer pools for specific message queues.
+ *  @p
+ *
+ *  Messages are sent and received by being placed on and removed from a
+ *  message queue. A reader is a thread that gets (reads) messages from a
+ *  message queue. A writer is a thread that puts (writes) a message to a
+ *  message queue. Each message queue has one reader and can have many writers.
+ *  A thread may read from or write to multiple message queues.
+ *
+ *  Conceptually, the reader thread owns a message queue. The reader thread
+ *  creates a message queue. The writer threads open a created message queue
+ *  to get access to them.
+ *
+ *  Message queues are identified by a system-wide unique name. Internally,
+ *  MessageQ uses the {@link ti.sdo.utils.NameServer} module for managing
+ *  these names. The names are used for opening a message queue.
+ *
+ *  Messages must be allocated from the MessageQ module. Once a message is
+ *  allocated, it can be sent to any message queue. Once a message is sent, the
+ *  writer loses ownership of the message and should not attempt to modify the
+ *  message. Once the reader receives the message, it owns the message. It
+ *  may either free the message or re-use the message.
+ *
+ *  Messages in a message queue can be of variable length. The only
+ *  requirement is that the first field in the definition of a message must be a
+ *  {@link #MsgHeader} structure. For example:
+ *  @p(code)
+ *  typedef struct MyMsg {
+ *      MessageQ_MsgHeader header;
+ *      ...
+ *  } MyMsg;
+ *  @p
+ *
+ *  The MessageQ API uses the MessageQ_MsgHeader internally. Your application
+ *  should not modify or directly access the fields in the MessageQ_MsgHeader.
+ *
+ *  All messages sent via the MessageQ module must be allocated from a
+ *  {@link xdc.runtime.IHeap} implementation. The heap can also be used for
+ *  other memory allocation not related to MessageQ.
+ *
+ *  An application can use multiple heaps. The purpose of having multiple
+ *  heaps is to allow an application to regulate its message usage. For
+ *  example, an application can allocate critical messages from one heap of fast
+ *  on-chip memory and non-critical messages from another heap of slower
+ *  external memory.
+ *
+ *  The {@link #registerHeap} and {@link #registerHeapMeta} are APIs used to
+ *  assign a MessageQ heapId to a heap. When allocating a message, the heapId
+ *  is used, not the heap handle. This heapId is actually placed into the
+ *  message (part of the {@link #MsgHeader}). Care must be taken when assigning
+ *  heapIds. Refer to the {@link #registerHeap} and {@link #registerHeapMeta}
+ *  descriptions for more details.
+ *
+ *  MessageQ also supports the usage of messages that are not allocated via the
+ *  {@link #alloc} function. Please refer to the {@link #staticMsgInit}
+ *  function description for more details.
+ *
+ *  MessageQ supports reads/writes of different thread models. This is
+ *  accomplished by having the creator of the message queue specify a
+ *  {@link xdc.runtime.knl.ISync#Object} via the {@link #synchronizer}
+ *  configuration parameter. The {@link xdc.runtime.knl.ISync#signal}
+ *  portion of the ISync instance is called whenever the {@link #put}
+ *  is called. The {@link xdc.runtime.knl.ISync#wait} portion is
+ *  called in the {@link #get} if and only if there are no messages.
+ *
+ *  Since ISyncs are binary, the reader must drain the message queue of all
+ *  messages before waiting for another signal. For example, if the reader
+ *  was a SYSBIOS Swi, the {@link xdc.runtime.knl.ISync} instance
+ *  could be a SyncSwi. If a {@link #put} was called, the Swi_post() would
+ *  be called. The Swi would run and it must call {@link #get} until no
+ *  messages are returned.
+ *
+ *  In a multiple processor system, MessageQ communicates to other
+ *  processors via {@link ti.sdo.ipc.interfaces.IMessageQTransport} instances.
+ *  MessageQ supports a high priority and a normal priority transport between
+ *  any two processors. The IMessageQTransport instances are created via the
+ *  {@link #SetupTransportProxy}. The instances are responsible for
+ *  registering themselves with MessageQ. This is accomplished via the
+ * {@link #registerTransport} function.
+ */
+
+@ModuleStartup
+@InstanceInitError
+@InstanceFinalize
+
+module MessageQ
+{
+    /*!
+     *  ======== QueuesView ========
+     *  @_nodoc
+     */
+    metaonly struct QueuesView {
+        String  name;
+        UInt    queueId;
+    }
+
+    /*!
+     *  ======== MessagesView ========
+     *  @_nodoc
+     */
+    metaonly struct MessagesView {
+        Int          seqNum;
+        Int          msgSize;
+        String       priority;
+        String       srcProc;
+        String       replyProc;
+        String       replyId;
+        Int          msgId;
+        String       heap;
+        Bool         traceEnabled;
+        Int          version;
+    }
+
+    /*!
+     *  ======== ModuleView ========
+     *  @_nodoc
+     */
+    metaonly struct ModuleView {
+        String               heaps[];
+        String               gate;
+        UInt16               nextSeqNum;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Queues',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitQueues',
+                        structName: 'QueuesView'
+                    }
+                ],
+                ['Messages',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitMessages',
+                        structName: 'MessagesView'
+                    }
+                ],
+                ['Module',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE,
+                        viewInitFxn: 'viewInitModule',
+                        structName: 'ModuleView'
+                    }
+                ]
+            ]
+        });
+
+    /*!
+     *  ======== LM_setTrace ========
+     *  Logged when setting the trace flag on a message
+     *
+     *  This is logged when tracing on a message is set via
+     *  {@link #setMsgTrace}.
+     */
+    config Log.Event LM_setTrace = {
+        mask: Diags.USER1,
+        msg: "LM_setTrace: Message 0x%x (seqNum = %d, srcProc = %d) traceFlag = %d"
+    };
+
+    /*!
+     *  ======== LM_alloc ========
+     *  Logged when allocating a message
+     *
+     *  When the {@link #traceFlag} is true, all message allocations
+     *  are logged.
+     */
+    config Log.Event LM_alloc = {
+        mask: Diags.USER1,
+        msg: "LM_alloc: Message 0x%x (seqNum = %d, srcProc = %d) was allocated"
+    };
+
+    /*!
+     *  ======== LM_staticMsgInit ========
+     *  Logged when statically initializing a message
+     *
+     *  When the {@link #traceFlag} is true, all messages that
+     *  are statically initialized via {@link #staticMsgInit} are logged.
+     */
+    config Log.Event LM_staticMsgInit = {
+        mask: Diags.USER1,
+        msg: "LM_staticMsgInit: Message 0x%x (seqNum = %d, srcProc = %d) was set in MessageQ_staticMsgInit"
+    };
+
+    /*!
+     *  ======== LM_free ========
+     *  Logged when freeing a message
+     *
+     *  When the {@link #traceFlag} is true, all freeing of messages
+     *  are logged. If an individual message's tracing was enabled
+     *  via {@link #setMsgTrace}, the MessageQ_free is also logged.
+     */
+    config Log.Event LM_free = {
+        mask: Diags.USER1,
+        msg: "LM_free: Message 0x%x (seqNum = %d, srcProc = %d) was freed"
+    };
+
+    /*!
+     *  ======== LM_putLocal ========
+     *  Logged when a message is placed onto a local queue
+     *
+     *  When the {@link #traceFlag} is true, all putting of messages
+     *  are logged. If an individual message's tracing was enabled
+     *  via {@link #setMsgTrace}, the MessageQ_put is also logged.
+     */
+    config Log.Event LM_putLocal = {
+        mask: Diags.USER1,
+        msg: "LM_putLocal: Message 0x%x (seqNum = %d, srcProc = %d) was placed onto queue 0x%x"
+    };
+
+    /*!
+     *  ======== LM_putRemote ========
+     *  Logged when a message is given to a transport
+     *
+     *  When the {@link #traceFlag} is true, all putting of messages
+     *  to a transport are logged. If an individual message's tracing
+     *  was enabled  via {@link #setMsgTrace}, the MessageQ_put is
+     *  also logged.
+     */
+    config Log.Event LM_putRemote = {
+        mask: Diags.USER1,
+        msg: "LM_putRemote: Message 0x%x (seqNum = %d, srcProc = %d) was given to processor %d transport"
+    };
+
+    /*!
+     *  ======== LM_rcvByTransport ========
+     *  Logged when a transport receives an incoming message
+     *
+     *  When the {@link #traceFlag} is true, all incoming messages
+     *  are logged. If an individual message's tracing
+     *  was enabled  via {@link #setMsgTrace}, the receiving of a message is
+     *  also logged.
+     */
+    config Log.Event LM_rcvByTransport = {
+        mask: Diags.USER1,
+        msg: "LM_rcvByTransport: Message 0x%x (seqNum = %d, srcProc = %d) was received"
+    };
+
+    /*!
+     *  ======== LM_get ========
+     *  Logged when a message is received off the queue
+     *
+     *  When the {@link #traceFlag} is true, all getting of messages
+     *  are logged. If an individual message's tracing
+     *  was enabled  via {@link #setMsgTrace}, the MessageQ_get is
+     *  also logged.
+     */
+    config Log.Event LM_get = {
+        mask: Diags.USER1,
+        msg: "LM_get: Message 0x%x (seqNum = %d, srcProc = %d) was received by queue 0x%x"
+    };
+
+    /*! MessageQ ID */
+    typedef UInt32 QueueId;
+
+    /*!
+     *  ======== SetupTransportProxy ========
+     *  MessageQ transport setup proxy
+     */
+    proxy SetupTransportProxy inherits ti.sdo.ipc.interfaces.ITransportSetup;
+
+    /*!
+     *  Message priority values. These must match the values defined in
+     *  ti/ipc/MessageQ.h but are needed here for ROV.
+     */
+    const UInt NORMALPRI   = 0;
+    const UInt HIGHPRI     = 1;
+    const UInt RESERVEDPRI = 2;
+    const UInt URGENTPRI   = 3;
+
+    /*!
+     *  Assert raised when calling API with wrong handle
+     *
+     *  Some APIs can only be called with an opened handle (e.g.
+     *  {@link #close}. Some can only be called with a created handle
+     *  (e.g. {@link #get}).
+     */
+    config Assert.Id A_invalidContext  = {
+        msg: "A_invalidContext: Cannot call with an open/create handle"
+    };
+
+    /*!
+     *  Assert raised when attempting to free a static message
+     */
+    config Assert.Id A_cannotFreeStaticMsg  = {
+        msg: "A_cannotFreeStaticMsg: Cannot call MessageQ_free with static msg"
+    };
+
+    /*!
+     *  Assert raised when an invalid message is supplied
+     */
+    config Assert.Id A_invalidMsg  = {
+        msg: "A_invalidMsg: Invalid message"
+    };
+
+    /*!
+     *  Assert raised when an invalid queueId is supplied
+     */
+    config Assert.Id A_invalidQueueId  = {
+        msg: "A_invalidQueueId: Invalid queueId is used"
+    };
+
+    /*!
+     *  Assert raised when using an invalid heapId
+     */
+    config Assert.Id A_heapIdInvalid  = {
+        msg: "A_heapIdInvalid: heapId is invalid"
+    };
+
+    /*!
+     *  Assert raised when using an invalid procId
+     */
+    config Assert.Id A_procIdInvalid  = {
+        msg: "A_procIdInvalid: procId is invalid"
+    };
+
+    /*!
+     *  Assert raised for an invalid MessageQ object
+     */
+    config Assert.Id A_invalidObj  = {
+        msg: "A_invalidObj: an invalid obj is used"
+    };
+
+    /*!
+     *  Assert raised for an invalid parameter
+     */
+    config Assert.Id A_invalidParam  = {
+        msg: "A_invalidParam: an invalid parameter was passed in"
+    };
+
+    /*!
+     *  Assert raised when attempting to send a message to a core
+     *  where a transport has not been registered.
+     */
+    config Assert.Id A_unregisteredTransport  = {
+        msg: "A_unregisteredTransport: transport is not registered"
+    };
+
+    /*!
+     *  Assert raised when attempting to unblock a remote MessageQ or one that
+     *  has been configured with a non-blocking synchronizer
+     */
+    config Assert.Id A_invalidUnblock  = {
+        msg: "A_invalidUnblock: Trying to unblock a remote MessageQ or a queue with non-blocking synchronizer"
+    };
+
+    /*!
+     *  Error raised if all the message queue objects are taken
+     */
+    config Error.Id E_maxReached  = {
+        msg: "E_maxReached: All objects in use. MessageQ.maxRuntimeEntries is %d"
+    };
+
+    /*!
+     *  Error raised when heapId has not been registered
+     */
+    config Error.Id E_unregisterHeapId  = {
+        msg: "E_unregisterHeapId: Heap id %d not registered"
+    };
+
+    /*!
+     *  Error raised in a create call when a name fails to be added
+     *  to the NameServer table.  This can be because the name already
+     *  exists, the table has reached its max length, or out of memory.
+     */
+    config Error.Id E_nameFailed  = {
+        msg: "E_nameFailed: '%s' name failed to be added to NameServer"
+    };
+
+    /*!
+     *  Trace setting
+     *
+     *  This flag allows the configuration of the default module trace
+     *  settings.
+     */
+    config Bool traceFlag = false;
+
+    /*!
+     *  Number of heapIds in the system
+     *
+     *  This allows MessageQ to pre-allocate the heaps table.
+     *  The heaps table is used when registering heaps.
+     *
+     *  There is no default heap, so unless the system is only using
+     *  {@link #staticMsgInit}, the application must register a heap.
+     */
+    config UInt16 numHeaps = 8;
+
+    /*!
+     *  Maximum number of MessageQs that can be dynamically created
+     */
+    config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+
+    /*!
+     *  Gate used to make the name table thread safe
+     *
+     *  This gate is used when accessing the name table during
+     *  a {@link #create}, {@link #delete}, and {@link #open}.
+     *
+     *  This gate is also used to protect MessageQ when growing
+     *  internal tables in the {@link #create}.
+     *
+     *  The table is in local memory, not shared memory. So a
+     *  single processor gate will work.
+     *
+     *  The default will be {@link xdc.runtime.knl.GateThread}
+     *  instance.
+     */
+    config IGateProvider.Handle nameTableGate = null;
+
+    /*!
+     *  Maximum length for Message queue names
+     */
+    config UInt maxNameLen = 32;
+
+    /*!
+     *  Section name is used to place the names table
+     */
+    metaonly config String tableSection = null;
+
+    /*!
+     *  ======== registerHeapMeta ========
+     *  Statically register a heap with MessageQ
+     *
+     *  Build error if heapId is in use.
+     *
+     *  @param(heap)        Heap to register
+     *  @param(heapId)      heapId associated with the heap
+     */
+    metaonly Void registerHeapMeta(IHeap.Handle heap, UInt16 heapId);
+
+     /*!
+     *  ======== registerTransportMeta ========
+     *  Statically register a transport with MessageQ
+     *
+     *  Build error if remote processor already has a transport
+     *  registered.
+     *
+     *  @param(transport)   transport to register
+     *  @param(procId)      procId that transport communicaties with
+     *  @param(priority)    priority of transport
+     */
+     metaonly Void registerTransportMeta(IMessageQTransport.Handle transport, UInt16 procId, UInt priority);
+
+    /*!
+     *  ======== registerTransport ========
+     *  Register a transport with MessageQ
+     *
+     *  This API is called by the transport when it is created.
+     *
+     *  @param(transport)   transport to register
+     *  @param(procId)      MultiProc id that transport communicates with
+     *  @param(priority)    priority of transport
+     *
+     *  @b(returns)         Whether the register was successful.
+     */
+    Bool registerTransport(IMessageQTransport.Handle transport, UInt16 procId,
+        UInt priority);
+
+    /*!
+     *  ======== unregisterTransport ========
+     *  Unregister a transport with MessageQ
+     *
+     *  @param(procId)      unregister transport that communicates with
+     *                      this remote processor
+     *  @param(priority)    priority of transport
+     */
+    Void unregisterTransport(UInt16 procId, UInt priority);
+
+instance:
+
+    /*!
+     *  ISync handle used to signal IO completion
+     *
+     *  The ISync instance is used in the {@link #get} and {@link #put}.
+     *  The {@link xdc.runtime.knl.ISync#signal} is called as part
+     *  of the {@link #put} call.  The {@link xdc.runtime.knl.ISync#wait} is
+     *  called in the {@link #get} if there are no messages present.
+     */
+    config ISync.Handle synchronizer = null;
+
+    /*! @_nodoc
+     *  ======== create ========
+     *  Create a message queue
+     *
+     *  @param(name)         Name of the message queue.
+     */
+    create(String name);
+
+internal:
+    /*
+     *  The following describes the usage of the flag field
+     *  ---------------------------------
+     *  |V V V|T|     reserved      |P P|
+     *  ---------------------------------
+     *   E D C B A 0 9 8 7 6 5 4 3 2 1 0
+     *
+     *  V = version
+     *  P = priority
+     *  T = trace flag
+     */
+
+    /*! Mask to extract version setting */
+    const UInt VERSIONMASK = 0xE000;
+
+    /*! Version setting */
+    const UInt HEADERVERSION = 0x2000;
+
+    /*! Mask to extract Trace setting */
+    const UInt TRACEMASK = 0x1000;
+
+    /*! Shift for Trace setting */
+    const UInt TRACESHIFT = 12;
+
+    /*!
+     *  Mask to extract priority setting.
+     *  This is needed here for ROV but must match
+     *  the value defined in ti/ipc/MessageQ.h
+     */
+    const UInt PRIORITYMASK = 0x3;
+
+    /*! Mask to extract priority setting */
+    const UInt TRANSPORTPRIORITYMASK = 0x1;
+
+     /*! return code for Instance_init */
+    const Int PROXY_FAILURE = 1;
+
+    /*
+     *  Used to denote a message that was initialized
+     *  with the MessageQ_staticMsgInit function.
+     */
+    const UInt16 STATICMSG = 0xFFFF;
+
+    /*! Required first field in every message */
+    @Opaque struct MsgHeader {
+        Bits32       reserved0;         /* reserved for List.elem->next */
+        Bits32       reserved1;         /* reserved for List.elem->prev */
+        Bits32       msgSize;           /* message size                 */
+        Bits16       flags;             /* bitmask of different flags   */
+        Bits16       msgId;             /* message id                   */
+        Bits16       dstId;             /* destination processor id     */
+        Bits16       dstProc;           /* destination processor        */
+        Bits16       replyId;           /* reply id                     */
+        Bits16       replyProc;         /* reply processor              */
+        Bits16       srcProc;           /* source processor             */
+        Bits16       heapId;            /* heap id                      */
+        Bits16       seqNum;            /* sequence number              */
+        Bits16       reserved;          /* reserved                     */
+    };
+
+    struct HeapEntry {
+        IHeap.Handle  heap;
+        UInt16        heapId;
+    };
+
+    struct TransportEntry {
+        IMessageQTransport.Handle  transport;
+        UInt16             procId;
+    };
+
+    /*!
+     *  ======== nameSrvPrms ========
+     *  This Params object is used for temporary storage of the
+     *  module wide parameters that are for setting the NameServer instance.
+     */
+    metaonly config NameServer.Params nameSrvPrms;
+
+    /*!
+     *  Statically registered heaps
+     *
+     *  This configuration parameter allows the static registeration
+     *  of heaps. The index of the array corresponds to the heapId.
+     */
+    metaonly config HeapEntry staticHeaps[];
+
+    /*!
+     *  Statically registered transports
+     *
+     *  This configuration parameter allows the static registeration
+     *  of transports. The index of the array corresponds to the procId.
+     */
+    metaonly config TransportEntry staticTransports[];
+
+    /*!
+     *  Allows for the number of dynamically created message queues to grow.
+     */
+    UInt16 grow(Object *obj, Error.Block *eb);
+
+    struct Instance_State {
+        QueueId         queue;        /* Unique id                     */
+        ISync.Handle    synchronizer; /* completion synchronizer       */
+        List.Object     normalList;   /* Embedded List objects         */
+        List.Object     highList;     /* Embedded List objects         */
+        Ptr             nsKey;        /* unique NameServer key         */
+        SyncSem.Handle  syncSemHandle;/* for use in finalize           */
+        Bool            unblocked;    /* Whether MessageQ is unblocked */
+    };
+
+    struct Module_State {
+        IMessageQTransport.Handle transports[][2];
+        Handle               queues[];
+        IHeap.Handle         heaps[];
+        IGateProvider.Handle gate;
+        UInt16               numQueues;
+        UInt16               numHeaps;
+        NameServer.Handle    nameServer;
+        Bool                 canFreeQueues;
+        UInt16               seqNum;
+    };
+}
diff --git a/packages/ti/sdo/ipc/MessageQ.xs b/packages/ti/sdo/ipc/MessageQ.xs
new file mode 100644 (file)
index 0000000..2f1854a
--- /dev/null
@@ -0,0 +1,487 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MessageQ.xs ========
+ *
+ */
+
+var MultiProc  = null;
+var NameServer = null;
+var MessageQ   = null;
+var GateThread = null;
+var Settings   = null;
+var SyncSem    = null;
+
+var instCount = 0;  /* use to determine if processing last instance */
+var sharedCreateId = new Array();
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init(name)
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    /* Initialize the shared CreateId array */
+    var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
+    sharedCreateId.length != MultiProc.numProcessors;
+
+    for (var i = 0; i < sharedCreateId.length; i++) {
+        sharedCreateId[i] = 1;
+    }
+}
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    MessageQ   = this;
+    Settings   = xdc.useModule('ti.sdo.ipc.family.Settings');
+    List       = xdc.useModule("ti.sdo.utils.List");
+    MultiProc  = xdc.useModule("ti.sdo.utils.MultiProc");
+    NameServer = xdc.useModule('ti.sdo.utils.NameServer');
+    GateThread = xdc.useModule("xdc.runtime.knl.GateThread");
+    SyncSem    = xdc.useModule("ti.sysbios.syncs.SyncSem");
+
+    /* Plug the SetupTransportProxy for the MessageQ transport */
+    if (MessageQ.SetupTransportProxy == null) {
+        try {
+            MessageQ.SetupTransportProxy =
+                xdc.useModule(Settings.getMessageQSetupDelegate());
+        }
+        catch (e) {
+            /* Plug in the generic shared memory transport */
+            MessageQ.SetupTransportProxy =
+                xdc.useModule('ti.sdo.ipc.transports.TransportShmSetup');
+        }
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    /* initialize the NameServer param to be used now or later */
+    MessageQ.nameSrvPrms.maxRuntimeEntries = params.maxRuntimeEntries;
+    MessageQ.nameSrvPrms.tableSection      = params.tableSection;
+    MessageQ.nameSrvPrms.maxNameLen        = params.maxNameLen;
+
+    /*
+     *  Get the current number of created static instances of this module.
+     *  Note: if user creates a static instance after this point and
+     *        expects to use NameServer, this is a problem.
+     */
+     var instCount = this.$instances.length;
+
+    /* create NameServer here only if no static instances are created */
+    if (instCount == 0) {
+        mod.nameServer = NameServer.create("MessageQ",
+                                           MessageQ.nameSrvPrms);
+    }
+    else {
+        mod.nameServer = null;
+    }
+
+    /*
+     *  If no growth allowed, pre-allocate the max length
+     */
+    mod.numQueues = this.$instances.length;
+    if (params.maxRuntimeEntries != NameServer.ALLOWGROWTH) {
+        mod.numQueues += params.maxRuntimeEntries;
+    }
+    mod.queues.length = mod.numQueues;
+    mod.canFreeQueues = false;
+
+    if (params.nameTableGate == null) {
+         mod.gate = null;
+    }
+    else {
+        mod.gate = params.nameTableGate;
+    }
+
+    var messsageQParams = new this.Params;
+
+    /* Initial the seqNum used for tracing */
+    mod.seqNum     = 0;
+
+    /* Set the length of the heaps array */
+    mod.numHeaps     = params.numHeaps;
+    mod.heaps.length = mod.numHeaps;
+
+    /* Initialize the heaps array to null */
+    for (var i = 0; i < mod.heaps.length; i++) {
+            mod.heaps[i] = null;
+    }
+
+    /*
+     *  Sort the static heaps by heap id into the heaps array
+     */
+    for (var i = 0; i < params.staticHeaps.length; i++) {
+
+        /* Make sure the id is not too big */
+        if (params.staticHeaps[i].heapId >= mod.numHeaps) {
+            MessageQ.$logError("Out of range heapId (" +
+                                params.staticHeaps[i].heapId +
+                                "). Max heapId is " + (params.numHeaps - 1) +
+                                " (MessageQ.numHeaps - 1).", this);
+        }
+
+        /* Make sure the same id is not used twice */
+        if (mod.heaps[params.staticHeaps[i].heapId] != null) {
+            MessageQ.$logError("Cannot register multiple heaps to heapId " +
+                                params.staticHeaps[i].heapId + ".", this);
+        }
+
+        mod.heaps[params.staticHeaps[i].heapId] = params.staticHeaps[i].heap;
+    }
+
+    /* Set the length of the transport array */
+    mod.transports.length = MultiProc.numProcessors;
+
+    /* Initialize all the transports to null */
+    for (var i = 0; i < mod.transports.length; i++) {
+        mod.transports[i][0] = null;
+        mod.transports[i][1] = null;
+    }
+
+    /*
+     *  Sort the static Transports by processor id into the
+     *  transport array
+     */
+    for (var i = 0; i < params.staticTransports.length; i++) {
+
+        /* Make sure the procId is not too big */
+        if (params.staticTransports[i].procId >= MultiProc.numProcessors) {
+            MessageQ.$logError("MessageQ Out of range procId (" +
+                                params.staticTransports[i].procId +
+                                "). Max procId is " +
+                                (MultiProc.numProcessors) +
+                                " (MultiProc.numProcessors).", this);
+        }
+
+        /* Make sure the same id is not used twice */
+        if (mod.transports[params.staticTransports[i].procId] != null) {
+            MessageQ.$logError("Cannot register multiple transports to one" +
+                               " remote processor " +
+                               params.staticTransports[i].procId + ".", this);
+        }
+
+        mod.transports[params.staticTransports[i].procId] =
+            params.staticTransports[i].transport;
+    }
+}
+
+/*
+ *  ======== registerHeapMeta ========
+ */
+function registerHeapMeta(heap, heapId)
+{
+    var entry = new this.HeapEntry();
+    entry.heap = heap;
+    entry.heapId = heapId;
+    this.staticHeaps.$add(entry);
+}
+
+/*
+ *  ======== registerTransportMeta ========
+ */
+function registerTransportMeta(transport, procId, priority)
+{
+    var entry = new this.transportEntry();
+    entry.transport = transport;
+    entry.procId    = procId;
+    this.staticTransports.$add(entry);
+}
+
+/*
+ *  ======== viewInitQueues ========
+ */
+function viewInitQueues(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+    /* view.name */
+    try {
+        view.name = NameServer.getName$view("MessageQ", obj.queue);
+    }
+    catch(e) {
+        Program.displayError(view, "name",
+            "Error retrieving name from NameServer: " + e);
+    }
+
+    /* view.queueId */
+    view.queueId = obj.queue & 0xffff;
+
+}
+
+/*
+ *  ======== viewInitMessages ========
+ */
+function viewInitMessages(view, obj)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+    var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+    var NameServer = xdc.useModule('ti.sdo.utils.NameServer');
+
+    print("viewInitMessages called");
+
+    /* view.label */
+    try {
+        view.label = NameServer.getName$view("MessageQ", obj.queue);
+    }
+    catch(e) {
+        Program.displayError(view, "label",
+            "Error retrieving name from NameServer: " + e);
+        return;
+    }
+
+    /* Retrieve the ROV view for the embedded high priority message list. */
+    addMsgsFromList(view, obj.highList);
+
+    /* Retrieve the ROV view for the embedded normal priority message list. */
+    addMsgsFromList(view, obj.normalList);
+}
+
+/*
+ *  ======== addMsgsFromList ========
+ *  Scans the provided list object and adds the messages on it to the view.
+ */
+function addMsgsFromList(view, list)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    print("Calling addMsgsFromList");
+
+    /* Scan the list to retrieve the addresses of the messages. */
+    try {
+        var listView = Program.scanObjectView("ti.sdo.utils.List", list,
+            "Basic");
+    }
+    /* If there was a problem scanning the list, report it. */
+    catch (e) {
+        var msgView = Program.newViewStruct('ti.sdo.ipc.MessageQ', 'Messages');
+        /*
+         * If there was a problem, report it using the first field, and
+         * return.
+         */
+        Program.displayError(msgView, 'seqNum', String(e));
+        view.elements.$add(msgView);
+        return;
+    }
+
+    try {
+        /* Fetch each of the message headers on the list. */
+        for each (var addr in listView.elems) {
+            print("Trying to call getMsgView for 0x" + Number(addr).toString(16));
+            var msgView = getMsgView(Number(addr));
+
+            view.elements.$add(msgView);
+        }
+    }
+    catch (e) {
+        /*
+         * If there were any problems retrieving the view, add an element
+         * to report the error.
+         */
+        var msgView = Program.newViewStruct('ti.sdo.ipc.MessageQ', 'Messages');
+        Program.displayError(msgView, 'seqNum', String(e));
+        view.elements.$add(msgView);
+    }
+}
+
+/*
+ *  ======== getMsgView ========
+ *  Returns a view structure representing the message at the given address.
+ */
+function getMsgView(addr)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+    var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+
+    print("getting message view: 0x" + Number(addr).toString(16));
+
+    /* Create a new message view to populate. */
+    var msgView = Program.newViewStruct('ti.sdo.ipc.MessageQ', 'Messages');
+
+    /* Fetch the message header from the given address. */
+    try {
+        var msgHeader = Program.fetchStruct(MessageQ.MsgHeader$fetchDesc,
+                                            Number(addr));
+    }
+    catch (e) {
+        /*
+         * If there was a problem, report it using the first field, and
+         * return the view.
+         */
+        Program.displayError(msgView, 'seqNum', String(e));
+        return (msgView);
+    }
+
+    /* Display the messages sequence number and size. */
+    msgView.seqNum = msgHeader.seqNum;
+    msgView.msgSize = msgHeader.msgSize;
+
+    /* The flags field contains the message priority. */
+    var priority = msgHeader.flags & MessageQ.PRIORITYMASK;
+    getPriority(msgView, priority);
+
+    /* The flags field also contains the trace enabled bit. */
+    msgView.traceEnabled = msgHeader.flags & MessageQ.TRACEMASK;
+
+    /* The flags field also contains the version bits. */
+    msgView.version = (msgHeader.flags & MessageQ.VERSIONMASK) >> 13;
+
+    /* Display the message ID set by the user. */
+    msgView.msgId = msgHeader.msgId;
+
+    /*
+     * Scan in the MultiProc view so we have the mapping from processor id
+     * to processor name.
+     */
+    try {
+        var multiProcView = Program.scanModuleView('ti.sdo.utils.MultiProc',
+                                                   'Module');
+    }
+    catch (e) {
+        /*
+         * If there was a problem scanning the MultiProc view, display the
+         * error, but keep processing anyway.
+         */
+        Program.displayError(msgView, 'srcProc', String(e));
+    }
+
+    /* Lookup the names of the destination, reply, and source processors. */
+    msgView.srcProc = multiProcView.nameList[msgHeader.srcProc];
+
+    /* If a reply queue hasn't been specified, display "N/A" */
+    if (msgHeader.replyId == 0xFFFF) {
+        msgView.replyProc = "N/A";
+        msgView.replyId = "N/A";
+    }
+    /* Otherwise display the reply queue. */
+    else {
+        msgView.replyProc = multiProcView.nameList[msgHeader.replyProc];
+        // TODO - Should this display the name of the MessageQ?
+        msgView.replyId = String(msgHeader.replyId);
+    }
+
+    /* Display the heap that the message was allocated from. */
+    msgView.heap = getHeapNameFromId(msgHeader.heapId);
+
+    return (msgView);
+}
+
+/*
+ *  ======== getPriority ========
+ *  Fills in the message views 'priority' field given the priority value.
+ */
+function getPriority(msgView, priority)
+{
+    var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    switch (priority) {
+        case MessageQ.NORMALPRI:
+            msgView.priority = "(" + MessageQ.NORMALPRI + ") Normal";
+            break;
+        case MessageQ.HIGHPRI:
+            msgView.priority = "(" + MessageQ.HIGHPRI + ") High";
+            break;
+        case MessageQ.RESERVEDPRI:
+            msgView.priority = "(" + MessageQ.RESERVEDPRI + ") Reserved";
+            break;
+        case MessageQ.URGENTPRI:
+            msgView.priority = "(" + MessageQ.URGENTPRI + ") Urgent";
+            break;
+        default:
+            Program.displayError(msgView, 'priority',
+                                 'Message has invalid priority: ' + priority);
+    }
+}
+
+/*
+ *  ======== getHeapNameFromId ========
+ *  This function takes the heap Id from a message (the heap ids are assigned
+ *  by MessageQ) and retrieves a name for the heap.
+ */
+function getHeapNameFromId(heapId)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    /* The module state contains the list of heaps. */
+    var modView = Program.scanModuleView('ti.sdo.ipc.MessageQ', 'Module');
+
+    /* Get the string representation of the address. */
+    if ((heapId == -1) || (heapId == 65535)) {
+        var heapAddr = "[static]";
+    }
+    else {
+        var heapAddr = String(modView.heaps[heapId]);
+    }
+
+    return (heapId + " (" + heapAddr + ")");
+}
+
+/*
+ *  ======== viewInitModule ========
+ */
+function viewInitModule(view, mod)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    /* Scan in the array of heaps. */
+    try {
+        view.heaps = Program.fetchArray(mod.heaps$fetchDesc, mod.heaps,
+                                          mod.numHeaps);
+    }
+    catch (e) {
+        Program.displayError(view, 'heaps', "Problem retrieving array of " +
+                             "heaps: " + e);
+    }
+
+    /* Display the handle to the module's gate. */
+    view.gate = mod.gate;
+
+    /*
+     * Display the module's sequence number, which is the next value
+     * that will be used.
+     */
+    view.nextSeqNum = mod.seqNum;
+}
diff --git a/packages/ti/sdo/ipc/Notify.c b/packages/ti/sdo/ipc/Notify.c
new file mode 100644 (file)
index 0000000..5971798
--- /dev/null
@@ -0,0 +1,922 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Notify.c ========
+ */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Gate.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/List.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+
+#include "package/internal/Notify.xdc.h"
+
+#define ISRESERVED(eventId) (((eventId) & 0xFFFF) >= ti_sdo_ipc_Notify_reservedEvents || \
+                                (((eventId) >> 16) == Notify_SYSTEMKEY))
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(Notify_attach);
+    #pragma FUNC_EXT_CALLED(Notify_disable);
+    #pragma FUNC_EXT_CALLED(Notify_disableEvent);
+    #pragma FUNC_EXT_CALLED(Notify_enableEvent);
+    #pragma FUNC_EXT_CALLED(Notify_eventAvailable);
+    #pragma FUNC_EXT_CALLED(Notify_intLineRegistered);
+    #pragma FUNC_EXT_CALLED(Notify_numIntLines);
+    #pragma FUNC_EXT_CALLED(Notify_registerEvent);
+    #pragma FUNC_EXT_CALLED(Notify_registerEventSingle);
+    #pragma FUNC_EXT_CALLED(Notify_restore);
+    #pragma FUNC_EXT_CALLED(Notify_sendEvent);
+    #pragma FUNC_EXT_CALLED(Notify_sharedMemReq);
+    #pragma FUNC_EXT_CALLED(Notify_unregisterEvent);
+    #pragma FUNC_EXT_CALLED(Notify_unregisterEventSingle);
+#endif
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  A Note about interrupt latency:
+ *
+ *  Some of the functions below modify the registration of callback functions
+ *  (registerEventSingle, unregisterEventSingle, registerEvent, unregisterEvent)
+ *  Because the state of event registration is modified in these functions and
+ *  the Notify_exec function (run within an ISR context) reads this state, we
+ *  have to consider the possibility and outcome of these functions being
+ *  interrupted by the Notify_exec function.  In order to ensure the integrity
+ *  of the callback registration state during any call to Notify_exec, we
+ *  eliminate the possiblity of preemption altogether by adhering to the
+ *  following rules:
+ *
+ *  - If registering a single (or many) callback functions, modify state in the
+ *    following order:
+ *
+ *    1.  Add to the event list (if registerEvent)
+ *    2.  Add the callback function (if registerEventSingle for the first time
+ *        or if doing a single register)
+ *    3.  Finally enable the event in the notify driver, thus opening the gate
+ *        for incoming interrupts.
+ *
+ *    Performing step 3) last during a register is crucial as it ensures that
+ *    the remote processor never sends an interrupt that disrupts the operations
+ *    performed in/between 1) and 2).
+ *
+ *  - If unregistering a single (or many) callback functions, perform the
+ *    above steps in reverse order.  Doing so ensures that possibility of
+ *    getting incoming interrupts is eliminated before local callback
+ *    registration state is modified.
+ *
+ */
+
+/*
+ *  ======== Notify_attach ========
+ *  Called within Ipc module or directly by the user
+ */
+Int Notify_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    Int status;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+        ti_sdo_ipc_Notify_A_invArgument);
+
+    /* Use the NotifySetup proxy to setup drivers */
+    status = ti_sdo_ipc_Notify_SetupProxy_attach(remoteProcId, sharedAddr);
+
+    return (status);
+}
+
+
+/*
+ *  ======== Notify_disable ========
+ */
+UInt Notify_disable(UInt16 procId, UInt16 lineId)
+{
+    UInt key;
+    UInt modKey;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    ti_sdo_ipc_Notify_Object *obj;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors &&
+            lineId < ti_sdo_ipc_Notify_numLines,
+            ti_sdo_ipc_Notify_A_invArgument);
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+        Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    /* Nesting value and enable state have to be in sync */
+    modKey = Gate_enterModule();
+
+    obj->nesting++;
+    if (obj->nesting == 1) {
+        /* Disable receiving all events */
+        if (procId != MultiProc_self()) {
+            INotifyDriver_disable(obj->driverHandle);
+        }
+    }
+
+    key = obj->nesting;
+
+    Gate_leaveModule(modKey);
+
+    return (key);
+}
+
+/*
+ *  ======== Notify_disableEvent ========
+ */
+Void Notify_disableEvent(UInt16 procId, UInt16 lineId, UInt32 eventId)
+{
+    UInt32 strippedEventId = (eventId & 0xFFFF);
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    ti_sdo_ipc_Notify_Object *obj;
+    UInt sysKey;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors && lineId <
+            ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    if (procId != MultiProc_self()) {
+        /* disable the remote event */
+        INotifyDriver_disableEvent(obj->driverHandle, strippedEventId);
+    }
+    else {
+        /* disable the local event */
+        sysKey = Hwi_disable();
+        CLEAR_BIT(Notify_module->localEnableMask, strippedEventId);
+        Hwi_restore(sysKey);
+    }
+}
+
+/*
+ *  ======== Notify_enableEvent ========
+ */
+Void Notify_enableEvent(UInt16 procId, UInt16 lineId, UInt32 eventId)
+{
+    UInt32 strippedEventId = (eventId & 0xFFFF);
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    ti_sdo_ipc_Notify_Object *obj;
+    UInt sysKey;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors && lineId <
+            ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    if (procId != MultiProc_self()) {
+        /* enable the remote event */
+        INotifyDriver_enableEvent(obj->driverHandle, strippedEventId);
+    }
+    else {
+        /* enable the local event */
+        sysKey = Hwi_disable();
+        SET_BIT(Notify_module->localEnableMask, strippedEventId);
+        Hwi_restore(sysKey);
+    }
+}
+
+/*
+ *  ======== Notify_eventAvailable ========
+ */
+Bool Notify_eventAvailable(UInt16 procId, UInt16 lineId, UInt32 eventId)
+{
+    UInt32 strippedEventId = (eventId & 0xFFFF);
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    Bool available;
+    ti_sdo_ipc_Notify_Object *obj;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors && lineId <
+            ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+    if (obj == NULL) {
+        /* Driver not registered */
+        return (FALSE);
+    }
+
+    if (!ISRESERVED(eventId)) {
+        /* Event is reserved and the caller isn't using Notify_SYSTEMKEY */
+        return (FALSE);
+    }
+
+    available = (obj->callbacks[strippedEventId].fnNotifyCbck == NULL);
+
+    return (available);
+}
+
+/*
+ *  ======== Notify_intLineRegistered ========
+ */
+Bool Notify_intLineRegistered(UInt16 procId, UInt16 lineId)
+{
+    Bool registered;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors && lineId <
+            ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+
+    registered = (Notify_module->notifyHandles[clusterId][lineId] != NULL);
+
+    return (registered);
+}
+
+/*
+ *  ======== Notify_numIntLines ========
+ */
+UInt16 Notify_numIntLines(UInt16 procId)
+{
+    UInt16 numIntLines;
+
+    if (MultiProc_self() == procId) {
+        /* There is always a single interrupt line to the loopback instance */
+        numIntLines = 1;
+    }
+    else {
+        /* Query the NotifySetup module for the device */
+        numIntLines = ti_sdo_ipc_Notify_SetupProxy_numIntLines(procId);
+    }
+
+    return (numIntLines);
+}
+
+/*
+ *  ======== Notify_registerEvent ========
+ */
+Int Notify_registerEvent(UInt16                 procId,
+                         UInt16                 lineId,
+                         UInt32                 eventId,
+                         Notify_FnNotifyCbck    fnNotifyCbck,
+                         UArg                   cbckArg)
+{
+    UInt32               strippedEventId = (eventId & 0xFFFF);
+    UInt16 clusterId =   ti_sdo_utils_MultiProc_getClusterId(procId);
+    Int                  status;
+    ti_sdo_ipc_Notify_Object        *obj;
+    UInt                 modKey;
+    List_Handle          eventList;
+    ti_sdo_ipc_Notify_EventListener *listener;
+    Bool                 listWasEmpty;
+    Error_Block          eb;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors &&
+            lineId < ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    Error_init(&eb);
+
+    modKey = Gate_enterModule();
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    /* Allocate a new EventListener */
+    listener = Memory_alloc(ti_sdo_ipc_Notify_Object_heap(),
+            sizeof(ti_sdo_ipc_Notify_EventListener), 0, &eb);
+    if (listener == NULL) {
+        /* Listener memory allocation failed.  Leave module gate & return */
+        Gate_leaveModule(modKey);
+
+        return (Notify_E_MEMORY);
+    }
+
+    listener->callback.fnNotifyCbck = (Fxn)fnNotifyCbck;
+    listener->callback.cbckArg = cbckArg;
+
+    eventList = List_Object_get(obj->eventList, strippedEventId);
+
+    /*
+     *  Store whether the list was empty so we know whether to register the
+     *  callback
+     */
+    listWasEmpty = List_empty(eventList);
+
+    /*
+     *  Need to atomically add to the list using the system gate because
+     *  Notify_exec might preempt List_remove.  List_put is atomic.
+     */
+    List_put(eventList, (List_Elem *)listener);
+
+    if (listWasEmpty) {
+        /*
+         *  Registering this event for the first time.  Need to register the
+         *  callback function.
+         */
+        status = Notify_registerEventSingle(procId, lineId, eventId,
+            Notify_execMany, (UArg)obj);
+
+        /* Notify_registerEventSingle should always succeed */
+        Assert_isTrue(status == Notify_S_SUCCESS,
+                ti_sdo_ipc_Notify_A_internal);
+    }
+
+    status = Notify_S_SUCCESS;
+
+    Gate_leaveModule(modKey);
+
+    return (status);
+}
+
+/*
+ *  ======== Notify_registerEventSingle ========
+ */
+Int Notify_registerEventSingle(UInt16                 procId,
+                               UInt16                 lineId,
+                               UInt32                 eventId,
+                               Notify_FnNotifyCbck    fnNotifyCbck,
+                               UArg                   cbckArg)
+{
+    UInt32        strippedEventId = (eventId & 0xFFFF);
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    UInt          modKey;
+    Int           status;
+    ti_sdo_ipc_Notify_Object *obj;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors &&
+            lineId < ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    modKey = Gate_enterModule();
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    if (obj->callbacks[strippedEventId].fnNotifyCbck) {
+        /* A callback is already registered. Fail. */
+        status = Notify_E_ALREADYEXISTS;
+    }
+    else {
+        /*
+         *  No callback is registered. Register it. There is no need to protect
+         *  these modifications because the event isn't registered yet.
+         */
+        obj->callbacks[strippedEventId].fnNotifyCbck = (Fxn)fnNotifyCbck;
+        obj->callbacks[strippedEventId].cbckArg = cbckArg;
+
+        if (procId != MultiProc_self()) {
+            /* Tell the remote notify driver that the event is now registered */
+            INotifyDriver_registerEvent(obj->driverHandle, strippedEventId);
+        }
+
+        status = Notify_S_SUCCESS;
+    }
+
+    Gate_leaveModule(modKey);
+
+    return (status);
+}
+
+/*
+ *  ======== Notify_restore ========
+ */
+Void Notify_restore(UInt16 procId, UInt16 lineId, UInt key)
+{
+    UInt modKey;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    ti_sdo_ipc_Notify_Object *obj;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors &&
+            lineId < ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+    Assert_isTrue(key == obj->nesting, ti_sdo_ipc_Notify_A_outOfOrderNesting);
+
+    /* Nesting value and enable state have to be in sync */
+    modKey = Gate_enterModule();
+
+    obj->nesting--;
+    if (obj->nesting == 0) {
+        /* Enable receiving events */
+        if (procId != MultiProc_self()) {
+            INotifyDriver_enable(obj->driverHandle);
+        }
+    }
+
+    Gate_leaveModule(modKey);
+}
+
+/*
+ *  ======== Notify_sendEvent ========
+ */
+Int Notify_sendEvent(UInt16   procId,
+                     UInt16   lineId,
+                     UInt32   eventId,
+                     UInt32   payload,
+                     Bool     waitClear)
+{
+    UInt32        strippedEventId = (eventId & 0xFFFF);
+    UInt16        clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    Int           status;
+    ti_sdo_ipc_Notify_Object *obj;
+    UInt          sysKey;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors &&
+            lineId < ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    if (procId != MultiProc_self()) {
+        /* Send a remote event */
+        status = INotifyDriver_sendEvent(obj->driverHandle,
+                                         strippedEventId,
+                                         payload, waitClear);
+    }
+    else {
+        /*
+         *  The check agaist non-NULL fnNotifyCbCk must be atomic with
+         *  Notify_exec so Notify_exec doesn't encounter a null callback.
+         */
+        sysKey = Hwi_disable();
+
+        /*
+         *  If nesting == 0 (the driver is enabled) and the event is enabled,
+         *  send the event
+         */
+        if (obj->callbacks[strippedEventId].fnNotifyCbck == NULL) {
+            /* No callbacks are registered locally for the event. */
+            status = Notify_E_EVTNOTREGISTERED;
+        }
+        else if (obj->nesting != 0) {
+            /* Driver is disabled */
+            status = Notify_E_FAIL;
+        }
+        else if (!TEST_BIT (Notify_module->localEnableMask, strippedEventId)){
+            /* Event is disabled */
+            status = Notify_E_EVTDISABLED;
+        }
+        else {
+            /* Execute the callback function registered to the event */
+            ti_sdo_ipc_Notify_exec(obj, strippedEventId, payload);
+
+            status = Notify_S_SUCCESS;
+        }
+
+        Hwi_restore(sysKey);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== Notify_sharedMemReq ========
+ */
+SizeT Notify_sharedMemReq(UInt16 procId, Ptr sharedAddr)
+{
+    SizeT memReq;
+
+    if (procId == MultiProc_self()) {
+        return (0);
+    }
+
+    /* Determine device-specific shared memory requirements */
+    memReq = ti_sdo_ipc_Notify_SetupProxy_sharedMemReq(procId, sharedAddr);
+
+    return (memReq);
+}
+
+/*
+ *  ======== Notify_unregisterEventSingle ========
+ */
+Int Notify_unregisterEventSingle(UInt16 procId, UInt16 lineId, UInt32 eventId)
+{
+    UInt32  strippedEventId = (eventId & 0xFFFF);
+    UInt16  clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    Int     status;
+    ti_sdo_ipc_Notify_Object *obj;
+    UInt    modKey;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors &&
+            lineId < ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    modKey = Gate_enterModule();
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    if (obj->callbacks[strippedEventId].fnNotifyCbck) {
+        if (procId != MultiProc_self()) {
+            /*
+             *  First, Tell the remote notify driver that the event is now
+             *  unregistered
+             */
+            INotifyDriver_unregisterEvent(obj->driverHandle,
+                                          strippedEventId);
+        }
+
+        /*
+         *  No need to protect these modifications with the system gate because
+         *  we shouldn't get preempted by Notify_exec after INotifyDriver_
+         *  unregisterEvent.
+         */
+        obj->callbacks[strippedEventId].fnNotifyCbck = NULL;
+        obj->callbacks[strippedEventId].cbckArg = NULL;
+
+        status = Notify_S_SUCCESS;
+    }
+    else {
+        /* No callback is registered. Fail. */
+        status = Notify_E_FAIL;
+    }
+
+    Gate_leaveModule(modKey);
+
+    return (status);
+}
+
+/*
+ *  ======== Notify_unregisterEvent ========
+ */
+Int Notify_unregisterEvent(UInt16                 procId,
+                           UInt16                 lineId,
+                           UInt32                 eventId,
+                           Notify_FnNotifyCbck    fnNotifyCbck,
+                           UArg                   cbckArg)
+{
+    UInt32  strippedEventId = (eventId & 0xFFFF);
+    UInt16  clusterId = ti_sdo_utils_MultiProc_getClusterId(procId);
+    Int     status;
+    UInt    sysKey, modKey;
+    ti_sdo_ipc_Notify_Object *obj;
+    List_Handle eventList;
+    ti_sdo_ipc_Notify_EventListener *listener;
+    UInt    count = 0;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors && lineId <
+            ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(strippedEventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(ISRESERVED(eventId), ti_sdo_ipc_Notify_A_reservedEvent);
+
+    modKey = Gate_enterModule();
+
+    obj = (ti_sdo_ipc_Notify_Object *)
+            Notify_module->notifyHandles[clusterId][lineId];
+
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_notRegistered);
+
+    eventList = List_Object_get(obj->eventList, strippedEventId);
+
+    if (List_empty(eventList)) {
+        return (Notify_E_NOTFOUND);
+    }
+
+    /* Get the first listener on the list */
+    listener = (ti_sdo_ipc_Notify_EventListener *)List_next(eventList, NULL);
+
+    while (listener != NULL) {
+        count++;
+        if (listener->callback.fnNotifyCbck == (Fxn)fnNotifyCbck &&
+                listener->callback.cbckArg == cbckArg ) {
+            break;      /* found a match! */
+        }
+        listener = (ti_sdo_ipc_Notify_EventListener *)
+            List_next(eventList, (List_Elem *)listener);
+    }
+
+    if (listener == NULL) {
+        /* Event listener not found */
+        status = Notify_E_NOTFOUND;
+    }
+    else {
+        if (count == 1 && List_next(eventList, (List_Elem *)listener) == NULL) {
+            /*
+             *  If only one element counted so far and the List_next returns
+             *  NULL, the list will be empty after unregistering.  Therefore,
+             *  unregister the callback function.
+             */
+            status = Notify_unregisterEventSingle(procId, lineId, eventId);
+            /* unregisterEvent should always suceed */
+            Assert_isTrue(status == Notify_S_SUCCESS,
+                    ti_sdo_ipc_Notify_A_internal);
+
+            /*  No need to protect the list removal: the event's unregistered */
+            List_remove(eventList, (List_Elem *)listener);
+        }
+        else {
+            /*
+             *  Need to atomically remove from the list using the system gate
+             *  because Notify_exec might preempt List_remove (the event is
+             *  still registered)
+             */
+            sysKey = Hwi_disable();
+            List_remove(eventList, (List_Elem *)listener);
+            Hwi_restore(sysKey);
+        }
+
+        /* Free the memory alloc'ed for the event listener */
+        Memory_free(ti_sdo_ipc_Notify_Object_heap(), listener,
+            sizeof(ti_sdo_ipc_Notify_EventListener));
+
+        status = Notify_S_SUCCESS;
+    }
+
+    Gate_leaveModule(modKey);
+
+    return (status);
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_Notify_Module_startup ========
+ */
+Int ti_sdo_ipc_Notify_Module_startup(Int phase)
+{
+    UInt16 procId = MultiProc_self();
+
+    /*
+     *  Wait for Startup to be done (if MultiProc id not yet set) because a
+     *  user fxn may set it
+     */
+    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
+        return (Startup_NOTDONE);
+    }
+
+    /* Ensure that the MultiProc ID has been configured */
+    Assert_isTrue(procId != MultiProc_INVALIDID,
+            ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    /* Create a local instance */
+    ti_sdo_ipc_Notify_create(NULL, procId, 0, NULL, NULL);
+
+    return (Startup_DONE);
+}
+
+/*
+ *************************************************************************
+ *                      Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_Notify_Instance_init ========
+ */
+Int ti_sdo_ipc_Notify_Instance_init(
+        ti_sdo_ipc_Notify_Object *obj,
+        INotifyDriver_Handle driverHandle,
+        UInt16 remoteProcId, UInt16 lineId,
+        const ti_sdo_ipc_Notify_Params *params,
+        Error_Block *eb)
+{
+    UInt        i;
+    UInt16      clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    List_Handle eventList;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors &&
+                  lineId < ti_sdo_ipc_Notify_numLines, ti_sdo_ipc_Notify_A_invArgument);
+    Assert_isTrue(Notify_module->notifyHandles[clusterId][lineId] == NULL,
+                  ti_sdo_ipc_Notify_A_alreadyRegistered);
+
+    obj->remoteProcId = remoteProcId;
+    obj->lineId = lineId;
+    obj->nesting = 0;
+
+    /* Allocate and initialize (to 0 with calloc()) the callbacks array. */
+    obj->callbacks = Memory_calloc(ti_sdo_ipc_Notify_Object_heap(),
+            (sizeof(ti_sdo_ipc_Notify_EventCallback) *
+            ti_sdo_ipc_Notify_numEvents), 0, eb);
+    if (obj->callbacks == NULL) {
+        return (2);
+    }
+
+    obj->eventList = Memory_alloc(ti_sdo_ipc_Notify_Object_heap(),
+        sizeof(List_Struct) * ti_sdo_ipc_Notify_numEvents, 0, eb);
+    if (obj->eventList == NULL) {
+        return (1);
+    }
+
+    for (i = 0; i < ti_sdo_ipc_Notify_numEvents; i++) {
+        eventList = List_Object_get(obj->eventList, i);
+
+        /* Pass in NULL for eb since construct should never fail */
+        List_construct(List_struct(eventList), NULL);
+    }
+
+    /* Used solely for remote driver (NULL if remoteProcId == self) */
+    obj->driverHandle = driverHandle;
+
+    if (driverHandle != NULL) {
+        /* Send this handle to the INotifyDriver */
+        INotifyDriver_setNotifyHandle(driverHandle, obj);
+    }
+
+    Notify_module->notifyHandles[clusterId][lineId] = obj;
+
+    return (0);
+}
+
+/*
+ *  ======== ti_sdo_ipc_Notify_Instance_finalize ========
+ */
+Void ti_sdo_ipc_Notify_Instance_finalize(ti_sdo_ipc_Notify_Object *obj,
+        Int status)
+{
+    UInt    i;
+    UInt16  clusterId = ti_sdo_utils_MultiProc_getClusterId(obj->remoteProcId);
+
+    switch (status) {
+        case 0:
+            /* Unregister the notify instance from the Notify module */
+            Notify_module->notifyHandles[clusterId][obj->lineId] = NULL;
+
+            /* Destruct the event lists */
+            for (i = 0; i < ti_sdo_ipc_Notify_numEvents; i++) {
+                List_destruct(List_struct(List_Object_get(obj->eventList, i)));
+            }
+
+            /* Free memory used for the List.Objects */
+            Memory_free(ti_sdo_ipc_Notify_Object_heap(), obj->eventList,
+                    sizeof(List_Struct) * ti_sdo_ipc_Notify_numEvents);
+
+            /* OK to fall through */
+
+        case 1:
+            /* Free memory used for callbacks array */
+            Memory_free(ti_sdo_ipc_Notify_Object_heap(), obj->callbacks,
+                    sizeof(ti_sdo_ipc_Notify_EventCallback) *
+                    ti_sdo_ipc_Notify_numEvents);
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_Notify_detach ========
+ *  Called within Ipc module
+ */
+Int ti_sdo_ipc_Notify_detach(UInt16 remoteProcId)
+{
+    ti_sdo_ipc_Notify_Object *obj;
+    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
+    INotifyDriver_Handle driverHandle;
+    UInt i;
+
+    for (i = 0; i < ti_sdo_ipc_Notify_numLines; i++) {
+        obj = (ti_sdo_ipc_Notify_Object *)
+                Notify_module->notifyHandles[clusterId][i];
+
+        /* Ensure that notify is actually registered for the procId + lineId */
+        if (obj != NULL) {
+            driverHandle = obj->driverHandle;
+
+            /* First, unregister the driver since it was registered last */
+            ti_sdo_ipc_Notify_delete(&obj);
+
+            /* Second, delete the driver itself */
+            INotifyDriver_delete(&driverHandle);
+        }
+
+    }
+
+    /* Notify_detech never fails on RTOS */
+    return (Notify_S_SUCCESS);
+}
+
+
+/*
+ *  ======== ti_sdo_ipc_Notify_exec ========
+ */
+Void ti_sdo_ipc_Notify_exec(ti_sdo_ipc_Notify_Object *obj, UInt32 eventId,
+        UInt32 payload)
+{
+    ti_sdo_ipc_Notify_EventCallback *callback;
+
+    callback = &(obj->callbacks[eventId]);
+
+    /* Make sure the callback function is not null */
+    Assert_isTrue(callback->fnNotifyCbck != NULL,
+            ti_sdo_ipc_Notify_A_internal);
+
+    /* Execute the callback function with its argument and the payload */
+    callback->fnNotifyCbck(obj->remoteProcId, obj->lineId, eventId,
+        callback->cbckArg, payload);
+}
+
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_Notify_execMany ========
+ */
+Void ti_sdo_ipc_Notify_execMany(UInt16 procId, UInt16 lineId, UInt32 eventId,
+        UArg arg, UInt32 payload)
+{
+    ti_sdo_ipc_Notify_Object *obj = (ti_sdo_ipc_Notify_Object *)arg;
+    List_Handle eventList;
+    ti_sdo_ipc_Notify_EventListener *listener;
+
+    /* Both loopback and the the event itself are enabled */
+    eventList = List_Object_get(obj->eventList, eventId);
+
+    /* Use "NULL" to get the first EventListener on the list */
+    listener = (ti_sdo_ipc_Notify_EventListener *)List_next(eventList, NULL);
+    while (listener != NULL) {
+        /* Execute the callback function */
+        listener->callback.fnNotifyCbck(procId, lineId,
+            eventId, listener->callback.cbckArg, payload);
+
+        listener = (ti_sdo_ipc_Notify_EventListener *)List_next(eventList,
+             (List_Elem *)listener);
+    }
+}
+
+/*
+ *                      Added procId/lineId Asserts to [un]registerEvent[Single]
+ *! 24-Mar-2010 skp     Fix SDOCM00068331 (sendEvent shouldn't enter mod gate)
+ *! 04-Mar-2010 skp     Fix SDOCM00067532 (added Notify_eventAvailable)
+ *! 19-Feb-2010 skp     Added FUNC_EXT_CALLED #pragma's
+ *! 21-Jan-2010 skp     Fix SDOCM00066064 (misc notify bugs)
+ *! 01-Dec-2009 skp     Loopback instance created in Module_startup
+ *! 19-Nov-2009 skp     fixed high interrupt latency issues
+ */
diff --git a/packages/ti/sdo/ipc/Notify.xdc b/packages/ti/sdo/ipc/Notify.xdc
new file mode 100644 (file)
index 0000000..8bb7456
--- /dev/null
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Notify.xdc ========
+ *
+ */
+
+package ti.sdo.ipc;
+
+import xdc.runtime.Assert;
+import xdc.runtime.Diags;
+
+import xdc.rov.ViewInfo;
+
+import ti.sdo.utils.List;
+
+import ti.sdo.ipc.interfaces.INotifyDriver;
+
+/*!
+ *  ======== Notify ========
+ *  Notification manager
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/Notify.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>Notify = xdc.useModule('ti.sdo.ipc.Notify');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ *  The Notify module typically doesn't require much (if any) configuration at
+ *  static time. However, it is possible to reduce the amount of shared memory
+ *  used by the Notify subsystem by reducing the value of {@link #numEvents}.
+ */
+
+@Gated
+@ModuleStartup
+@InstanceInitError
+@InstanceFinalize
+
+module Notify
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        UInt        remoteProcId;
+        String      remoteProcName;
+        UInt        lineId;
+        UInt        disabled;
+    }
+
+    /*! @_nodoc */
+    metaonly struct EventDataView {
+        UInt        eventId;
+        String      fnNotifyCbck;
+        String      cbckArg;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['EventListeners',
+                    {
+                        type: ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'EventDataView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  Assert raised when trying to re-register for given line and processor
+     */
+    config Assert.Id A_alreadyRegistered =
+        {msg: "A_alreadyRegistered: Notify instance for the processor/line already registered"};
+
+    /*!
+     *  Assert raised when trying to use an unregistered Notify instance
+     */
+    config Assert.Id A_notRegistered =
+        {msg: "A_notRegistered: Notify instance not yet registered for the processor/line"};
+
+    /*!
+     *  Assert raised when trying to improperly use a reserved event
+     */
+    config Assert.Id A_reservedEvent =
+        {msg: "A_reservedEvent: Improper use of a reserved event"};
+
+    /*!
+     *  Assert raised when {@link #restore} called with improper key
+     */
+    config Assert.Id A_outOfOrderNesting =
+        {msg: "A_outOfOrderNesting: Out of order nesting"};
+
+    /*!
+     *  ======== A_invArgument ========
+     *  Assert raised when an argument is invalid
+     */
+    config Assert.Id A_invArgument  = {
+        msg: "A_invArgument: Invalid argument supplied"
+    };
+
+    /*!
+     *  ======== A_internal ========
+     *  Assert raised when an internal error is encountered
+     */
+    config Assert.Id A_internal = {
+        msg: "A_internal: An internal error has occurred"
+    };
+
+    /*!
+     *  ======== SetupProxy ========
+     *  Device-specific Notify setup proxy
+     */
+    proxy SetupProxy inherits ti.sdo.ipc.interfaces.INotifySetup;
+
+    /*! Maximum number of events supported by the Notify module */
+    const UInt MAXEVENTS = 32;
+
+    /*!
+     *  Number of events supported by Notify
+     *
+     *  Lowering this value offers the benefit of lower footprint especially in
+     *  shared memory.
+     */
+    config UInt numEvents = 32;
+
+    /*!
+     *  ======== sendEventPollCount ========
+     *  Poll for specified amount before sendEvent times out
+     *
+     *  Setting a finite value for sendEventPollCount will cause
+     *  Notify_sendEvent to poll for an amount of time
+     *  proportional to this value when the 'waitClear' flag is TRUE.
+     */
+    config UInt32 sendEventPollCount = -1;
+
+    /*! @_nodoc
+     *  Maximum number of interrupt lines between a single pair of processors
+     *
+     *  This config is usually set internally by the NotfiySetup proxy when the
+     *  proxy is set up to use more than one line.
+     */
+    config UInt16 numLines = 1;
+
+    /*!
+     *  Number of reserved event numbers
+     *
+     *  The first reservedEvents event numbers are reserved for
+     *  middleware modules. Attempts to use these reserved events
+     *  will result in a {@link #A_reservedEvent} assert.
+     *
+     *  To use the reserved events, the top 16-bits of the eventId must equal
+     *  Notify_SYSTEMKEY.
+     */
+    config UInt16 reservedEvents = 5;
+
+    /*!
+     *  @_nodoc
+     *  Detach Notify from a remote processor. Should only be called by the Ipc
+     *  module during its detach operation.
+     */
+    Int detach(UInt16 remoteProcId);
+
+instance:
+
+    /*! @_nodoc
+     *  Register a created Notify driver with the Notify module
+     *
+     *  The Notify module stores a copy of the driverHandle in an array
+     *  indexed by procId and lineId.  Furture references to the procId
+     *  and lineId in Notify APIs will utilize the driver registered using
+     *  {@link #create}.
+     *
+     *  @param(driverHandle)    Notify driver handle
+     *  @param(procId)          Remote processor id
+     *  @param(lineId)          Line id
+     */
+    create(INotifyDriver.Handle driverHandle, UInt16 remoteProcId,
+           UInt16 lineId);
+
+    /*! @_nodoc
+     *  Called internally by the Notify module or notify driver module
+     *  to execute the callback registered to a specific event.
+     */
+    Void exec(UInt32 eventId, UInt32 payload);
+
+internal:
+
+    /*!
+     *  Used to execute a list of callback functions when the callbacks are
+     *  registered using registerMany.
+     */
+    Void execMany(UInt16 remoteProcId, UInt16 lineId, UInt32 eventId, UArg arg,
+                  UInt32 payload);
+
+    struct EventCallback {
+        Fxn             fnNotifyCbck;
+        UArg            cbckArg;
+    }
+
+    struct EventListener {
+        List.Elem       element;          /* List elem         */
+        EventCallback   callback;
+    }
+
+    struct Instance_State {
+        UInt                    nesting;        /* Disable/restore nesting    */
+        INotifyDriver.Handle    driverHandle;   /* Driver handle              */
+        UInt16                  remoteProcId;   /* Remote MultiProc id        */
+        UInt16                  lineId;         /* Interrupt line id          */
+        EventCallback           callbacks[];    /* indexed by eventId         */
+        List.Object             eventList[];    /* indexed by eventId         */
+    };
+
+    struct Module_State {
+        Handle        notifyHandles[][]; /* indexed by procId then lineId */
+
+        /*
+         * these fields are used for local/loopback events
+         */
+        Bits32        localEnableMask;  /* default to enabled (-1) */
+    }
+
+}
diff --git a/packages/ti/sdo/ipc/Notify.xs b/packages/ti/sdo/ipc/Notify.xs
new file mode 100644 (file)
index 0000000..6cebb4c
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Notify.xs ========
+ */
+
+var Notify      = null;
+var MultiProc   = null;
+var Memory      = null;
+var Ipc         = null;
+var List        = null;
+var Settings    = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Notify      = this;
+    Memory      = xdc.useModule('xdc.runtime.Memory');
+    MultiProc   = xdc.useModule('ti.sdo.utils.MultiProc');
+    List        = xdc.useModule('ti.sdo.utils.List');
+    Settings    = xdc.useModule('ti.sdo.ipc.family.Settings');
+
+    /* Check for valid numEvents */
+    if (Notify.numEvents > Notify.MAXEVENTS) {
+        Notify.$logFatal("Notify.numEvents may not be set to a value greater" +
+                          " than " + Notify.MAXEVENTS, Notify);
+    }
+
+    /*
+     *  Plug the module gate which will be used for protecting Notify APIs from
+     *  each other. Use GateSwi
+     */
+    if (Notify.common$.gate === undefined) {
+        var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
+        Notify.common$.gate = GateSwi.create();
+    }
+
+    /* Plug the NotifySetup proxy */
+    if (Notify.SetupProxy == null) {
+        if (MultiProc.numProcessors == 1) {
+            /*
+             *  On a uniprocessor system (or Notify is disabled). We will never
+             *  need to setup remote notify driver instances, so plug in
+             *  NotifySetupNull.
+             */
+            Notify.SetupProxy
+                = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifySetupNull');
+        }
+        else {
+            /*
+             *  On a multiprocessor system.  Query the Settings module for the
+             *  device-specific NotifySetup delegate.
+             */
+            try {
+                delegateName = Settings.getNotifySetupDelegate();
+                Notify.SetupProxy = xdc.useModule(delegateName);
+            }
+            catch (e) {
+                Notify.$logFatal(String(e), Notify);
+            }
+        }
+    }
+
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    var handles = Notify.$object.notifyHandles;
+
+    handles.length = MultiProc.numProcsInCluster;
+
+    /* Initialize every handle to null */
+    for (var i = 0; i < handles.length; i++) {
+        handles[i].length = params.numLines;
+
+        for (var j = 0; j < handles[i].length; j++) {
+            handles[i][j] = null;
+        }
+    }
+
+    mod.localEnableMask = ~0;   /* all enabled by default */
+}
+
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* view.remoteProcId */
+    view.remoteProcId = obj.remoteProcId;
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    /* view.lineId */
+    view.lineId = obj.lineId;
+
+    /* view.disabled */
+    view.disabled = obj.nesting;
+}
+
+/*
+ *  ======== viewInitData ========
+ *  Instance data view.
+ */
+function viewInitData(view, obj)
+{
+    var Notify  = xdc.useModule('ti.sdo.ipc.Notify');
+    var List    = xdc.useModule('ti.sdo.utils.List');
+    var modCfg = Program.getModuleConfig('ti.sdo.ipc.Notify');
+
+    /* Display the instance label in the tree */
+    view.label = "procId = " + obj.remoteProcId + " lineId = " + obj.lineId;
+
+    /* Fetch the callback array */
+    try {
+        var callbacks = Program.fetchArray(obj.callbacks$fetchDesc,
+                                           obj.callbacks,
+                                           modCfg.numEvents);
+    }
+    catch(e) {
+        Program.displayError(view, "eventId", "Problem retrieving callback " +
+                             " array from instance state.");
+        return;
+    }
+
+    /* Fetch the eventList */
+    try {
+        var eventList = Program.fetchArray(obj.eventList$fetchDesc,
+                                           obj.eventList,
+                                           modCfg.numEvents);
+    }
+    catch(e) {
+        Program.displayError(view, "eventId", "Problem retrieving eventList " +
+                             " from instance state.");
+        return;
+    }
+
+    /* For each element of the buffer... */
+    for (var eventId = 0; eventId < modCfg.numEvents; eventId++) {
+        var fnNotifyCbck = callbacks[eventId].fnNotifyCbck;
+        if (Number(fnNotifyCbck) == 0) {
+            /* Event is unplugged */
+            continue;
+        }
+
+        var fxnName = Program.lookupFuncName(Number(fnNotifyCbck))[0];
+        if (fxnName == "ti_sdo_ipc_Notify_execMany__I") {
+            /* Multiple callbacks registered.  View all of them */
+            try {
+                listView = Program.scanObjectView('ti.sdo.utils.List',
+                                                   eventList[eventId],
+                                                  'Basic');
+                }
+            catch (e) {
+                Program.displayError(view, "eventId", "Problem scanning ROV " +
+                    " for embedded event list object");
+                return;
+            }
+            for each (var listElemPtr in listView.elems) {
+                try {
+                    var eventListener = Program.fetchStruct(
+                            Notify.EventListener$fetchDesc,
+                            $addr(listElemPtr));
+                }
+                catch(e) {
+                    Program.displayError(view, "eventId", "Problem " +
+                        "retrieving event listener ");
+                    return;
+                }
+
+                var elem = Program.newViewStruct('ti.sdo.ipc.Notify',
+                                                 'EventListeners');
+                elem.eventId = eventId;
+                elem.fnNotifyCbck = Program.lookupFuncName(
+                    Number(eventListener.callback.fnNotifyCbck))[0];
+                elem.cbckArg = "0x" +
+                    Number(eventListener.callback.cbckArg).toString(16);
+
+                /* Create a new row in the instance data view */
+                view.elements.$add(elem);
+            }
+        }
+        else {
+            /* Single callback function registered. Just view one. */
+            var elem = Program.newViewStruct('ti.sdo.ipc.Notify',
+                                             'EventListeners');
+            elem.fnNotifyCbck = fxnName;
+            elem.eventId = eventId;
+            elem.cbckArg = "0x" +
+                Number(callbacks[eventId].cbckArg).toString(16);
+
+            /* Create a new row in the instance data view */
+            view.elements.$add(elem);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/SharedRegion.c b/packages/ti/sdo/ipc/SharedRegion.c
new file mode 100644 (file)
index 0000000..60d02f6
--- /dev/null
@@ -0,0 +1,852 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== SharedRegion.c ========
+ *  Implementation of functions specified in SharedRegion.xdc.
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Memory.h>
+
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/hal/Hwi.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/heaps/_HeapMemMP.h>
+
+#include "package/internal/SharedRegion.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(SharedRegion_clearEntry);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getCacheLineSize);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getEntry);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getHeap);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getId);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getIdByName);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getNumRegions);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getPtr);
+    #pragma FUNC_EXT_CALLED(SharedRegion_getSRPtr);
+    #pragma FUNC_EXT_CALLED(SharedRegion_isCacheEnabled);
+    #pragma FUNC_EXT_CALLED(SharedRegion_setEntry);
+    #pragma FUNC_EXT_CALLED(SharedRegion_translateEnabled);
+    #pragma FUNC_EXT_CALLED(SharedRegion_invalidSRPtr);
+#endif
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== SharedRegion_clearEntry ========
+ *  Clears the region in the table.
+ */
+Int SharedRegion_clearEntry(UInt16 id)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    HeapMemMP_Handle    heapMemHandle;
+    UInt16 myId, ownerProcId;
+    Int status = HeapMemMP_S_SUCCESS;
+    UInt key;
+
+    /* Need to make sure id is smaller than numEntries */
+    Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries), ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+    /* Need to make sure not trying to clear Region 0 */
+    Assert_isTrue(id != 0, ti_sdo_ipc_SharedRegion_A_region0Clear);
+
+    myId = MultiProc_self();
+
+    /* get the region */
+    region = &(SharedRegion_module->regions[id]);
+
+    /* store these fields to local variables */
+    ownerProcId = region->entry.ownerProcId;
+    heapMemHandle  = (HeapMemMP_Handle)region->heap;
+
+    /* needs to be thread safe */
+    key = Hwi_disable();
+
+    /* clear region to their defaults */
+    region->entry.isValid       = FALSE;
+    region->entry.base          = NULL;
+    region->entry.len           = 0;
+    region->entry.ownerProcId   = 0;
+    region->entry.cacheEnable   = TRUE;
+    region->entry.cacheLineSize = ti_sdo_ipc_SharedRegion_cacheLineSize;
+    region->entry.createHeap    = TRUE;
+    region->entry.name          = NULL;
+    region->reservedSize        = 0;
+    region->heap                = NULL;
+
+    /* leave the gate */
+    Hwi_restore(key);
+
+    /* delete or close previous created heap outside the gate */
+    if (heapMemHandle != NULL) {
+        if (ownerProcId == myId) {
+            status = HeapMemMP_delete(&heapMemHandle);
+        }
+        else if (ownerProcId != MultiProc_INVALIDID) {
+            status = HeapMemMP_close(&heapMemHandle);
+        }
+    }
+
+    if (status == HeapMemMP_S_SUCCESS) {
+        status = SharedRegion_S_SUCCESS;
+    }
+    else {
+        status = SharedRegion_E_FAIL;
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== SharedRegion_getCacheLineSize ========
+ */
+SizeT SharedRegion_getCacheLineSize(UInt16 id)
+{
+    SizeT cacheLineSize = 0;
+
+    /*
+     *  if translate == TRUE or translate == FALSE
+     *  and 'id' is not INVALIDREGIONID, then Assert id is valid.
+     *  Return the heap associated with the region id.
+     *
+     *  If those conditions are not met, the id is from
+     *  an addres in local memory so return NULL.
+     */
+    if ((ti_sdo_ipc_SharedRegion_translate) ||
+        ((ti_sdo_ipc_SharedRegion_translate == FALSE) &&
+        (id != SharedRegion_INVALIDREGIONID))) {
+        /* Need to make sure id is smaller than numEntries */
+        Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries),
+            ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+        cacheLineSize = SharedRegion_module->regions[id].entry.cacheLineSize;
+    }
+
+    return (cacheLineSize);
+}
+
+/*
+ *  ======== SharedRegion_getEntry ========
+ */
+Int SharedRegion_getEntry(UInt16 id, SharedRegion_Entry *entry)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+
+    /* Make sure entry is not NULL */
+    Assert_isTrue((entry != NULL), ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /* Need to make sure id is smaller than numEntries */
+    Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries), ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+    region = &(SharedRegion_module->regions[id]);
+
+    entry->base          = region->entry.base;
+    entry->len           = region->entry.len;
+    entry->ownerProcId   = region->entry.ownerProcId;
+    entry->isValid       = region->entry.isValid;
+    entry->cacheEnable   = region->entry.cacheEnable;
+    entry->cacheLineSize = region->entry.cacheLineSize;
+    entry->createHeap    = region->entry.createHeap;
+    entry->name          = region->entry.name;
+
+    return (SharedRegion_S_SUCCESS);
+}
+
+/*
+ *  ======== SharedRegion_getId ========
+ *  Returns the id of shared region that the pointer resides in.
+ *  Returns SharedRegion_INVALIDREGIONID if no region is found.
+ */
+UInt16 SharedRegion_getId(Ptr addr)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    UInt i;
+    UInt key;
+    UInt16 regionId = SharedRegion_INVALIDREGIONID;
+
+    /* Try to find the entry that contains the address */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+
+        /* needs to be thread safe */
+        key = Hwi_disable();
+
+        if ((region->entry.isValid) && (addr >= region->entry.base) &&
+            (addr < (Ptr)((UInt32)region->entry.base + region->entry.len))) {
+            regionId = i;
+
+            /* leave the gate */
+            Hwi_restore(key);
+            break;
+        }
+
+        /* leave the gate */
+        Hwi_restore(key);
+    }
+
+    return (regionId);
+}
+
+/*
+ *  ======== SharedRegion_getIdByName ========
+ *  Returns the id of shared region that matches name.
+ *  Returns SharedRegion_INVALIDREGIONID if no region is found.
+ */
+UInt16 SharedRegion_getIdByName(String name)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    UInt16 i;
+    UInt key;
+    UInt16 regionId = SharedRegion_INVALIDREGIONID;
+
+    /* loop through entries to find matching name */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+
+        /* needs to be thread safe */
+        key = Hwi_disable();
+
+        if (region->entry.isValid) {
+            if (strcmp(region->entry.name, name) == 0) {
+                regionId = i;
+
+                /* leave the gate */
+                Hwi_restore(key);
+                break;
+            }
+        }
+
+        /* leave the gate */
+            Hwi_restore(key);
+    }
+
+    return (regionId);
+}
+
+/*
+ *  ======== SharedRegion_getNumRegions ========
+ */
+UInt16 SharedRegion_getNumRegions(Void)
+{
+    return (ti_sdo_ipc_SharedRegion_numEntries);
+}
+
+/*
+ *  ======== SharedRegion_getPtr ========
+ *  This function takes a shared region pointer and returns a pointer.
+ */
+Ptr SharedRegion_getPtr(SharedRegion_SRPtr srPtr)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    Ptr returnPtr;
+    UInt16 regionId;
+
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        returnPtr = (Ptr)srPtr;
+    }
+    else if (srPtr == ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
+        returnPtr = NULL;
+    }
+    else {
+        /* find regionId from srPtr */
+        regionId = (UInt32)srPtr >> ti_sdo_ipc_SharedRegion_numOffsetBits;
+
+        /* make sure regionId of SRPtr less than numEntries */
+        Assert_isTrue(regionId < ti_sdo_ipc_SharedRegion_numEntries,
+            ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+        region = &(SharedRegion_module->regions[regionId]);
+
+        /* Make sure the region is valid */
+        Assert_isTrue(region->entry.isValid == TRUE,
+                ti_sdo_ipc_SharedRegion_A_regionInvalid);
+
+        returnPtr = (Ptr)((srPtr & ti_sdo_ipc_SharedRegion_offsetMask) +
+                          (UInt32)region->entry.base);
+    }
+
+    return (returnPtr);
+}
+
+/*
+ *  ======== SharedRegion_getSRPtr ========
+ *  This function takes a pointer and an id and returns a shared region
+ *  pointer.
+ */
+SharedRegion_SRPtr SharedRegion_getSRPtr(Ptr addr, UInt16 id)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    SharedRegion_SRPtr retPtr;
+
+    /* if translate == false, set SRPtr to addr */
+    if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
+        retPtr = (SharedRegion_SRPtr)addr;
+    }
+    else if (addr == NULL) {
+        retPtr = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+    }
+    else {
+        /* Need to make sure id is smaller than numEntries */
+        Assert_isTrue(id < ti_sdo_ipc_SharedRegion_numEntries,
+            ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+        region = &(SharedRegion_module->regions[id]);
+
+        /*
+         *  Note: The very last byte on the very last id cannot be mapped
+         *        because ti_sdo_ipc_SharedRegion_INVALIDSRPTR which is ~0 denotes an
+         *        error. Since pointers should be word aligned, we don't
+         *        expect this to be a problem.
+         *
+         *        ie: numEntries = 4,
+         *            id = 3, base = 0x00000000, len = 0x40000000
+         *            ==> address 0x3fffffff would be invalid because the
+         *                SRPtr for this address is 0xffffffff
+         */
+        if (((UInt32)addr >= (UInt32)region->entry.base) &&
+            ((UInt32)addr < ((UInt32)region->entry.base + region->entry.len))) {
+            retPtr = (SharedRegion_SRPtr)((id << ti_sdo_ipc_SharedRegion_numOffsetBits)
+                     | ((UInt32)addr - (UInt32)region->entry.base));
+        }
+        else {
+            Assert_isTrue(FALSE, ti_sdo_ipc_SharedRegion_A_addrOutOfRange);
+            retPtr = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+        }
+    }
+
+    return (retPtr);
+}
+
+/*
+ *  ======== SharedRegion_isCacheEnabled ========
+ */
+Bool SharedRegion_isCacheEnabled(UInt16 id)
+{
+    Bool cacheEnable = FALSE;
+
+    /*
+     *  if translate == TRUE or translate == FALSE
+     *  and 'id' is not INVALIDREGIONID, then Assert id is valid.
+     *  Return the heap associated with the region id.
+     *
+     *  If those conditions are not met, the id is from
+     *  an address in local memory so return NULL.
+     */
+    if ((ti_sdo_ipc_SharedRegion_translate) ||
+        ((ti_sdo_ipc_SharedRegion_translate == FALSE) &&
+        (id != SharedRegion_INVALIDREGIONID))) {
+        /* Need to make sure id is smaller than numEntries */
+        Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries),
+            ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+        cacheEnable = SharedRegion_module->regions[id].entry.cacheEnable;
+    }
+
+    return (cacheEnable);
+}
+
+/*
+ *  ======== SharedRegion_setEntry ========
+ *  Sets the region specified in the table.
+ */
+Int SharedRegion_setEntry(UInt16 id, SharedRegion_Entry *entry)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    HeapMemMP_Params    params;
+    HeapMemMP_Handle    heapHandle;
+    HeapMemMP_Handle    *heapHandlePtr;
+    UInt                key;
+    Ptr                 sharedAddr;
+    Int status = SharedRegion_S_SUCCESS;
+    Error_Block eb;
+
+    /* Need to make sure id is smaller than numEntries */
+    Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries),
+        ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+    /* Make sure entry is not NULL */
+    Assert_isTrue((entry != NULL), ti_sdo_ipc_Ipc_A_nullArgument);
+
+    Error_init(&eb);
+
+    region = &(SharedRegion_module->regions[id]);
+
+    /* make sure region does not overlap existing ones */
+    status = SharedRegion_checkOverlap(entry->base, entry->len);
+
+    if (status == SharedRegion_S_SUCCESS) {
+        /* region entry should be invalid at this point */
+        if (region->entry.isValid) {
+            /* Assert that a region already exists */
+            Assert_isTrue(FALSE, ti_sdo_ipc_SharedRegion_A_alreadyExists);
+            status = SharedRegion_E_ALREADYEXISTS;
+            return (status);
+        }
+
+        /* Assert if cacheEnabled and cacheLineSize equal 0 */
+        if ((entry->cacheEnable) && (entry->cacheLineSize == 0)) {
+            /* if cache enabled, cache line size must != 0 */
+            Assert_isTrue(FALSE, ti_sdo_ipc_SharedRegion_A_cacheLineSizeIsZero);
+        }
+
+        /* needs to be thread safe */
+        key = Hwi_disable();
+
+        /* set specified region id to entry values */
+        region->entry.base          = entry->base;
+        region->entry.len           = entry->len;
+        region->entry.ownerProcId   = entry->ownerProcId;
+        region->entry.cacheEnable   = entry->cacheEnable;
+        region->entry.cacheLineSize = entry->cacheLineSize;
+        region->entry.createHeap    = entry->createHeap;
+        region->entry.name          = entry->name;
+        region->entry.isValid       = entry->isValid;
+
+        /* leave gate */
+        Hwi_restore(key);
+
+        if (!region->entry.isValid) {
+            /* Region isn't valid yet */
+            return (status);
+        }
+
+        if (entry->ownerProcId == MultiProc_self()) {
+            if ((entry->createHeap) && (region->heap == NULL)) {
+                /* get current Ptr (reserve memory with size of 0) */
+                sharedAddr = ti_sdo_ipc_SharedRegion_reserveMemory(id, 0);
+
+                HeapMemMP_Params_init(&params);
+                params.sharedAddr = sharedAddr;
+                params.sharedBufSize = region->entry.len -
+                                       region->reservedSize;
+
+                /*
+                 *  Calculate size of HeapMemMP_Attrs and adjust sharedBufSize
+                 *  Size of HeapMemMP_Attrs = HeapMemMP_sharedMemReq(&params) -
+                 *                            params.sharedBufSize
+                 */
+                params.sharedBufSize -= (HeapMemMP_sharedMemReq(&params)
+                                         - params.sharedBufSize);
+
+                heapHandle = HeapMemMP_create(&params);
+                if (heapHandle == NULL) {
+                    region->entry.isValid = FALSE;
+                    return (SharedRegion_E_MEMORY);
+                }
+
+                region->heap = (IHeap_Handle)heapHandle;
+            }
+        }
+        else {
+            if ((entry->createHeap) && (region->heap == NULL)) {
+                /* sharedAddr should match creator's for each region */
+                sharedAddr = (Ptr)((UInt32)entry->base +
+                    region->reservedSize);
+
+                /* set the pointer to a heap handle */
+                heapHandlePtr = (HeapMemMP_Handle *)&(region->heap);
+
+                /* open the heap by address */
+                if (HeapMemMP_openByAddr(sharedAddr, heapHandlePtr) !=
+                    HeapMemMP_S_SUCCESS) {
+                    status = SharedRegion_E_FAIL;
+                    region->entry.isValid = FALSE;
+                }
+            }
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== SharedRegion_checkOverlap ========
+ *  Checks to make sure overlap does not exists.
+ */
+Int SharedRegion_checkOverlap(Ptr base, SizeT len)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    UInt i;
+    UInt key;
+
+    /* needs to be thread safe */
+    key = Hwi_disable();
+
+    /* check to make sure new region does not overlap existing ones */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+        if (region->entry.isValid) {
+            if (base >= region->entry.base) {
+                if (base < (Ptr)((UInt32)region->entry.base +
+                    region->entry.len)) {
+                    Hwi_restore(key);
+                    Assert_isTrue(FALSE, ti_sdo_ipc_SharedRegion_A_overlap);
+                    return (SharedRegion_E_FAIL);
+                }
+            }
+            else {
+                if ((Ptr)((UInt32)base + len) > region->entry.base) {
+                    Hwi_restore(key);
+                    Assert_isTrue(FALSE, ti_sdo_ipc_SharedRegion_A_overlap);
+                    return (SharedRegion_E_FAIL);
+                }
+            }
+        }
+    }
+
+    Hwi_restore(key);
+
+    return (SharedRegion_S_SUCCESS);
+}
+
+
+/*
+ *  ======== SharedRegion_entryInit ========
+ */
+Void SharedRegion_entryInit(SharedRegion_Entry *entry)
+{
+    /* Make sure entry is not NULL */
+    Assert_isTrue((entry != NULL), ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /* init the entry to default values */
+    entry->base          = NULL;
+    entry->len           = 0;
+    entry->ownerProcId   = 0;
+    entry->cacheEnable   = TRUE;
+    entry->cacheLineSize = ti_sdo_ipc_SharedRegion_cacheLineSize;
+    entry->createHeap    = TRUE;
+    entry->name          = NULL;
+    entry->isValid       = FALSE;
+}
+
+/*
+ *  ======== SharedRegion_getHeap ========
+ */
+Ptr SharedRegion_getHeap(UInt16 id)
+{
+    IHeap_Handle heap = NULL;
+
+    /*
+     *  if translate == TRUE or translate == FALSE
+     *  and 'id' is not INVALIDREGIONID, then Assert id is valid.
+     *  Return the heap associated with the region id.
+     *
+     *  If those conditions are not met, the id is from
+     *  an addres in local memory so return NULL.
+     */
+    if ((ti_sdo_ipc_SharedRegion_translate) ||
+        ((ti_sdo_ipc_SharedRegion_translate == FALSE) &&
+        (id != SharedRegion_INVALIDREGIONID))) {
+
+        /* assert id is valid */
+        Assert_isTrue(id < ti_sdo_ipc_SharedRegion_numEntries,
+            ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+        heap = SharedRegion_module->regions[id].heap;
+    }
+
+    return (heap);
+}
+
+/*
+ *  ======== SharedRegion_translateEnabled ========
+ */
+Bool SharedRegion_translateEnabled(Void)
+{
+    return (ti_sdo_ipc_SharedRegion_translate);
+}
+
+/*
+ *  ======== SharedRegion_invalidSRPtr ========
+ */
+SharedRegion_SRPtr SharedRegion_invalidSRPtr(Void)
+{
+    return (ti_sdo_ipc_SharedRegion_INVALIDSRPTR);
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_attach ========
+ */
+Int ti_sdo_ipc_SharedRegion_attach(UInt16 remoteProcId)
+{
+    Int i;
+    Ptr sharedAddr;
+    ti_sdo_ipc_SharedRegion_Region *region;
+    HeapMemMP_Handle    *heapHandlePtr;
+    Int status = SharedRegion_S_SUCCESS;
+
+    /*
+     *  Loop through the regions and open the heap if not owner
+     */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+        if ((region->entry.isValid) &&
+            (region->entry.ownerProcId != MultiProc_self()) &&
+            (region->entry.ownerProcId != MultiProc_INVALIDID) &&
+            (region->entry.createHeap) &&
+            (region->heap == NULL)) {
+            /* sharedAddr should match creator's for each region */
+            sharedAddr = (Ptr)((UInt32)region->entry.base +
+                region->reservedSize);
+
+            /* get the heap handle from SharedRegion Module state */
+            heapHandlePtr = (HeapMemMP_Handle *)&(region->heap);
+
+            /* heap should already be created so open by address */
+            status = HeapMemMP_openByAddr(sharedAddr, heapHandlePtr);
+        }
+    }
+
+    return(status);
+}
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_detach ========
+ */
+Int ti_sdo_ipc_SharedRegion_detach(UInt16 remoteProcId)
+{
+    Int i;
+    ti_sdo_ipc_SharedRegion_Region *region;
+    HeapMemMP_Handle    *heapHandlePtr;
+    Int status = SharedRegion_S_SUCCESS;
+
+    /*
+     *  Loop through the regions and close the heap only when
+     *  detaching from owner of heap.
+     */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+        if ((region->entry.isValid) &&
+            (region->entry.ownerProcId == remoteProcId) &&
+            (region->heap != NULL)) {
+            /* get the heap handle from SharedRegion Module state */
+            heapHandlePtr = (HeapMemMP_Handle *)&(region->heap);
+
+            /* heap should already be created so open by address */
+            status = HeapMemMP_close(heapHandlePtr);
+        }
+    }
+
+    return(status);
+}
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_clearReservedMemory ========
+ *  Clears the reserve memory for each region in the table.
+ */
+Void ti_sdo_ipc_SharedRegion_clearReservedMemory()
+{
+    Int i;
+    ti_sdo_ipc_SharedRegion_Region *region;
+
+    /*
+     *  Loop through shared regions. If an owner of a region is specified,
+     *  the owner zeros out the reserved memory in each region.
+     */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+        if ((region->entry.isValid) &&
+            (region->entry.ownerProcId == MultiProc_self())) {
+            /* clear reserved memory */
+            memset(region->entry.base, 0, region->reservedSize);
+
+            /* writeback invalidate the cache if enabled in region */
+            if (region->entry.cacheEnable) {
+                Cache_wbInv(region->entry.base, region->reservedSize,
+                         Cache_Type_ALL, TRUE);
+            }
+        }
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_reserveMemory ========
+ */
+Ptr ti_sdo_ipc_SharedRegion_reserveMemory(UInt16 id, SizeT size)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+    UInt32 minAlign;
+    SizeT curSize, newSize;
+    Ptr   retPtr;
+
+    /* Need to make sure id is smaller than numEntries */
+    Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries),
+        ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+    /* assert that region at specified id is valid */
+    Assert_isTrue(SharedRegion_module->regions[id].entry.isValid == TRUE,
+                  ti_sdo_ipc_SharedRegion_A_regionInvalid);
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(id) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(id);
+    }
+
+    region = &(SharedRegion_module->regions[id]);
+
+    /* Set the current size to the reservedSize */
+    curSize = region->reservedSize;
+
+    /* No need to round here since curSize is already aligned */
+    retPtr = (Ptr)((UInt32)region->entry.base + curSize);
+
+    /*  Round the new size to the min alignment since */
+    newSize = _Ipc_roundup(size, minAlign);
+
+    /* Need to make sure (curSize + newSize) is smaller than region len */
+    Assert_isTrue((region->entry.len >= (curSize + newSize)),
+                   ti_sdo_ipc_SharedRegion_A_reserveTooMuch);
+
+    /* Add the new size to current size */
+    region->reservedSize = curSize + newSize;
+
+    return (retPtr);
+}
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_resetInternalFields ========
+ */
+Void ti_sdo_ipc_SharedRegion_resetInternalFields(UInt16 id)
+{
+    ti_sdo_ipc_SharedRegion_Region *region;
+
+    /* Need to make sure id is smaller than numEntries */
+    Assert_isTrue((id < ti_sdo_ipc_SharedRegion_numEntries),
+        ti_sdo_ipc_SharedRegion_A_idTooLarge);
+
+    region = &(SharedRegion_module->regions[id]);
+
+    region->reservedSize = 0;
+}
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_start ========
+ */
+Int ti_sdo_ipc_SharedRegion_start(Void)
+{
+    Int i;
+    ti_sdo_ipc_SharedRegion_Region *region;
+    HeapMemMP_Params    params;
+    HeapMemMP_Handle    heapHandle;
+    Ptr                 sharedAddr;
+    Int status = SharedRegion_S_SUCCESS;
+
+    /* assert that region 0 is valid */
+    Assert_isTrue((ti_sdo_ipc_SharedRegion_numEntries > 0) &&
+        (SharedRegion_module->regions[0].entry.isValid),
+        ti_sdo_ipc_SharedRegion_A_region0Invalid);
+
+    /*
+     *  Loop through shared regions. If an owner of a region is specified
+     *  and createHeap has been specified for the SharedRegion, then
+     *  the owner creates a HeapMemMP and the other processors open it.
+     */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+        if ((region->entry.isValid) &&
+            (region->entry.ownerProcId == MultiProc_self()) &&
+            (region->entry.createHeap) &&
+            (region->heap == NULL)) {
+            /* get the next free address in each region */
+            sharedAddr = (Ptr)((UInt32)region->entry.base +
+                region->reservedSize);
+
+            /*  Create the HeapMemMP in the region. */
+            HeapMemMP_Params_init(&params);
+            params.sharedAddr = sharedAddr;
+            params.sharedBufSize = region->entry.len - region->reservedSize;
+
+            /* Adjust to account for the size of HeapMemMP_Attrs */
+            params.sharedBufSize -= (HeapMemMP_sharedMemReq(&params)
+                                    - params.sharedBufSize);
+            heapHandle = HeapMemMP_create(&params);
+
+            if (heapHandle == NULL) {
+                status = SharedRegion_E_FAIL;
+            }
+            else {
+                /* put heap handle into SharedRegion Module state */
+                region->heap = (IHeap_Handle)heapHandle;
+            }
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== ti_sdo_ipc_SharedRegion_stop ========
+ */
+Int ti_sdo_ipc_SharedRegion_stop(Void)
+{
+    Int i;
+    ti_sdo_ipc_SharedRegion_Region *region;
+    HeapMemMP_Handle    *heapHandlePtr;
+    Int status = SharedRegion_S_SUCCESS;
+
+    /*
+     *  Loop through shared regions. If owner then delete the heap,
+     *  otherwise the heap should have been closed in detach().
+     */
+    for (i = 0; i < ti_sdo_ipc_SharedRegion_numEntries; i++) {
+        region = &(SharedRegion_module->regions[i]);
+        if ((region->entry.isValid) &&
+            (region->entry.ownerProcId == MultiProc_self()) &&
+            (region->heap != NULL)) {
+            /* get the heap handle from SharedRegion Module state */
+            heapHandlePtr = (HeapMemMP_Handle *)&(region->heap);
+
+            /* delete the HeapMemMP */
+            status = HeapMemMP_delete(heapHandlePtr);
+        }
+    }
+
+    return (status);
+}
diff --git a/packages/ti/sdo/ipc/SharedRegion.xdc b/packages/ti/sdo/ipc/SharedRegion.xdc
new file mode 100644 (file)
index 0000000..be0c674
--- /dev/null
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== SharedRegion.xdc ========
+ *
+ */
+
+package ti.sdo.ipc;
+
+import xdc.runtime.Error;
+import xdc.runtime.IHeap;
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== SharedRegion ========
+ *  Shared memory manager and address translator.
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/SharedRegion.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ *  The SharedRegion module is designed to be used in a multi-processor
+ *  environment in which memory regions are shared and accessed
+ *  across different processors. The module itself does not use any shared
+ *  memory, because all module state is stored locally.  SharedRegion
+ *  APIs use the system gate for thread protection.
+ *
+ *  This module creates and stores a local shared memory region table.  The
+ *  table contains the processor's view for every shared region in the system.
+ *  The table must not contain any overlapping regions.  Each processor's
+ *  view of a particular shared memory region is determined by the region id.
+ *  In cases where a processor cannot access a certain shared memory region,
+ *  that shared memory region should be left invalid for that processor.
+ *  Note:  The {@link #numEntries} must be the same on all processors.
+ *
+ *  Each shared region contains the following:
+ *  @p(blist)
+ *  -base:          The base address
+ *  -len:           The length
+ *  -name:          The name of the region
+ *  -isValid:       Whether the region is valid
+ *  -ownerProcId:   The id of the processor which owns the region
+ *  -cacheEnable:   Whether the region is cacheable
+ *  -cacheLineSize: The cache line size
+ *  -createHeap:    Whether a heap is created for the region.
+ *  @p
+ *
+ *  A region is added statically using the {@link #setEntryMeta} API.
+ *  The length of a region must be the same across all processors.
+ *  The owner of the region can be specified.  If specified, the owner
+ *  manages the shared region.  It creates a HeapMemMP instance which spans
+ *  the full size of the region.  The other processors open the same HeapMemMP
+ *  instance.
+ *
+ *  Note: Prior to calling Ipc_start(), If a SharedRegion's 'isValid'
+ *  is true and 'createHeap' is true then the owner of the SharedRegion
+ *  must be the same as the owner of SharedRegion 0.
+ *
+ *  An example of a SharedRegion configuration is as follows:
+ *
+ *  @p(code)
+ *
+ * var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+ * SharedRegion.setEntryMeta(0,
+ *     { base: 0x80000000,
+ *       len: 0x20000,
+ *       ownerProcId: 0,
+ *       isValid: true,
+ *       cacheLineSize: 64,
+ *       name: "DDR2",
+ *     });
+ *
+ *  @p
+ *
+ *  The shared region table along with a shared region pointer (SRPtr)
+ *  is used to do address translation at runtime. The shared region
+ *  pointer is a 32-bit portable pointer composed of an id and offset.
+ *  The most significant bits of a SRPtr are used for the id.
+ *  The id corresponds to the index of the entry in the table.
+ *  The offset is the offset from the base of the shared memory region.
+ *  The number of entries in the table determines the number of bits to
+ *  use for the id.  Increasing the number of entries increases the
+ *  range of ids but decreases the range of the offset.
+ *
+ *  Note:  Region 0 must be visible by all processors.  Region 0 is used for
+ *         synchonizing the processors, creating the default GateMP, and
+ *         creating Notify and MessageQ transport instances.  The HeapMemMP
+ *         created in Region 0 is the length of the region minus memory
+ *         reserved for creating these internal instances.
+ *
+ *  Refer to the doxygen documentation for run-time API documenation.
+ *
+ */
+
+module SharedRegion
+{
+    /*!
+     *  ======== RegionView ========
+     *  @_nodoc
+     */
+    metaonly struct RegionView {
+        UInt16       id;
+        String       base;
+        String       end;
+        String       len;
+        UInt16       ownerProcId;
+        Bool         cacheEnable;
+        Bool         isValid;
+        UInt16       cacheLineSize;
+        SizeT        reservedSize;
+        Ptr          heap;
+        String       name;
+    };
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Regions',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitRegions',
+                        structName: 'RegionView'
+                    }
+                ]
+            ]
+        });
+
+    /*!
+     *  Definition of shared region pointer type
+     */
+    typedef Bits32 SRPtr;
+
+    /*!
+     *  Assert raised when the id is larger than numEntries.
+     */
+    config xdc.runtime.Assert.Id A_idTooLarge =
+        {msg: "A_idTooLarge: id cannot be larger than numEntries"};
+
+    /*!
+     *  Assert raised when an address is out of the range of the region id.
+     */
+    config xdc.runtime.Assert.Id A_addrOutOfRange =
+        {msg: "A_addrOutOfRange: Address is out of region id's range"};
+
+    /*!
+     *  Assert raised when attempting to clear region 0
+     */
+    config xdc.runtime.Assert.Id A_region0Clear =
+        {msg: "A_region0Clear: Region 0 cannot be cleared"};
+
+    /*!
+     *  Assert raised when region zero is invalid
+     */
+    config xdc.runtime.Assert.Id A_region0Invalid =
+        {msg: "A_region0Invalid: Region zero is invalid"};
+
+    /*!
+     *  Assert raised when region is invalid
+     */
+    config xdc.runtime.Assert.Id A_regionInvalid =
+        {msg: "A_regionInvalid: Region is invalid"};
+
+    /*!
+     *  Assert raised when the trying to reserve too much memory.
+     */
+    config xdc.runtime.Assert.Id A_reserveTooMuch =
+        {msg: "A_reserveTooMuch: Trying to reserve too much memory"};
+
+    /*!
+     *  Assert raised when cache enabled but cache line size = 0.
+     */
+    config xdc.runtime.Assert.Id A_cacheLineSizeIsZero =
+        {msg: "A_cacheLineSizeIsZero: cache line size cannot be zero"};
+
+    /*!
+     *  Assert raised when a new entry overlaps an existing one.
+     */
+    config xdc.runtime.Assert.Id A_overlap  =
+        {msg: "A_overlap: Shared region overlaps"};
+
+    /*!
+     *  Assert raised when a valid table entry already exists.
+     */
+    config xdc.runtime.Assert.Id A_alreadyExists =
+        {msg: "A_alreadyExists: Trying to overwrite an existing valid entry"};
+
+    /*!
+     *  Assert raised when trying to use a heap for a region that has no heap
+     */
+    config xdc.runtime.Assert.Id A_noHeap =
+        {msg: "A_noHeap: Region has no heap"};
+
+    /*!
+     *  ======== Entry ========
+     *  Structure for specifying a region.
+     *
+     *  Each region entry should not overlap with any other entry.  The
+     *  length of a region should be the same across all processors.
+     *
+     *  During static configuration, the 'isValid' field can be set to 'false'
+     *  to signify a partially completed entry.  This should only be done
+     *  if the base address of the entry is not known during static
+     *  configuration.  The entry can be completed and the
+     *  'isValid' field can be set to true at runtime.
+     *
+     *  @field(base)          The base address.
+     *  @field(len)           The length.
+     *  @field(ownerProcId)   MultiProc id of processor that manages region.
+     *  @field(isValid)       Whether the region is valid or not.
+     *  @field(cacheEnable)   Whether the region is cacheable.
+     *  @field(cacheLineSize) The cache line size for the region.
+     *  @field(createHeap)    Whether a heap is created for the region.
+     *  @field(name)          The name associated with the region.
+     */
+    struct Entry {
+        Ptr    base;
+        SizeT  len;
+        UInt16 ownerProcId;
+        Bool   isValid;
+        Bool   cacheEnable;
+        SizeT  cacheLineSize;
+        Bool   createHeap;
+        String name;
+    };
+
+    /*! Specifies the invalid id */
+    const UInt16 INVALIDREGIONID = 0xFFFF;
+
+    /*! Specifies the default owner proc id */
+    const UInt16 DEFAULTOWNERID = ~0;
+
+    /*!
+     *  Worst-case cache line size
+     *
+     *  This is the default system cache line size for all modules.
+     *  When a module puts structures in shared memory, this value is
+     *  used to make sure items are aligned on a cache line boundary.
+     *  If no cacheLineSize is specified for a region, it will use this
+     *  value.
+     */
+    config SizeT cacheLineSize = 128;
+
+    /*!
+     *  The number of shared region table entries.
+     *
+     *  This value is used for calculating the number of bits for the offset.
+     *  Note: This value must be the same across all processors in the system.
+     *        Increasing this parameter will increase the footprint and
+     *        the time for translating a pointer to a SRPtr.
+     */
+    config UInt16 numEntries = 4;
+
+    /*!
+     *  Determines whether address translation is required.
+     *
+     *  This configuration parameter should be set to 'false' if and only if all
+     *  shared memory regions have the same base address for all processors.
+     *  If 'false', it results in a fast {@link #getPtr} and {@link #getSRPtr},
+     *  because a SRPtr is equivalent to a Ptr and no translation is done.
+     */
+    config Bool translate = true;
+
+    /*! @_nodoc
+     *  Value that corresponds to NULL in SRPtr address space.
+     */
+    config SRPtr INVALIDSRPTR = 0xFFFFFFFF;
+
+    /*! @_nodoc
+     *  ======== attach ========
+     *  Opens a heap, for non-owner processors, for each SharedRegion.
+     *
+     *  Function is called in Ipc_attach().
+     */
+    Int attach(UInt16 remoteProcId);
+
+    /*! @_nodoc
+     *  ======== clearReservedMemory ========
+     *  Clears the reserve memory for each region in the table.
+     */
+    Void clearReservedMemory();
+
+    /*! @_nodoc
+     *  ======== detach ========
+     *  Close the heap, for non-owner processors when detaching from the owner.
+     *
+     *  Function is called in Ipc_detach().
+     */
+    Int detach(UInt16 remoteProcId);
+
+    /*!
+     *  ======== genSectionInCmd ========
+     *  Enable/Disable generation of output section in linker cmd file
+     *
+     *  This function can be called for each shared region to not generate
+     *  an output section in the linker command file.  By default all shared
+     *  region entries generate an output section in the linker command file.
+     *
+     *  @param(id)          Region id.
+     *  @param(gen)         TRUE - generate, FALSE - don't generate
+     */
+    metaonly Void genSectionInCmd(UInt16 id, Bool gen);
+
+    /*!
+     *  ======== getCacheLineSizeMeta ========
+     *  Meta version of Ipc_getCacheLineSize
+     */
+    metaonly SizeT getCacheLineSizeMeta(UInt16 id);
+
+    /*! @_nodoc
+     *  ======== getIdMeta ========
+     *  Returns the region id for a given local address
+     *
+     *  @param(addr)    Address to retrieve the shared region pointer.
+     *
+     *  @b(returns)     region id
+     */
+    metaonly UInt16 getIdMeta(Ptr addr);
+
+    /*! @_nodoc
+     *  ======== getPtrMeta ========
+     *  Meta version of {@link #getPtr}
+     */
+    metaonly Ptr getPtrMeta(SRPtr srptr);
+
+    /*! @_nodoc
+     *  ======== getPtrMeta$view ========
+     *  ROV-time version of getPtrMeta
+     *
+     *  @param(srptr)   Shared region pointer.
+     *
+     *  @b(returns)     Pointer associated with shared region pointer.
+     */
+    metaonly Ptr getPtrMeta$view(SRPtr srptr);
+
+    /*! @_nodoc
+     *  ======== getSRPtrMeta ========
+     *  Meta version of {@link #getSRPtr}
+     */
+    metaonly SRPtr getSRPtrMeta(Ptr addr);
+
+    /*! @_nodoc
+     *  ======== getSRPtrMeta$view ========
+     *  ROV-time version of getSRPtrMeta
+     *
+     *  @param(addr)    Address to retrieve the shared region pointer.
+     *
+     *  @b(returns)     Shared region pointer.
+     */
+    metaonly SRPtr getSRPtrMeta$view(Ptr addr);
+
+    /*! @_nodoc
+     *  ======== isCacheEnabledMeta ========
+     *  Meta version of {@link #isCacheEnabled}
+     */
+    metaonly Bool isCacheEnabledMeta(UInt16 id);
+
+    /*! @_nodoc
+     *  ======== reserveMemory ========
+     *  Reserves the specified amount of memory from the specified region id.
+     *
+     *  Must be called before Ipc_start().  The amount of memory reserved
+     *  must be the same on all cores.
+     *  The return pointer is the starting address that was reserved.
+     *
+     *  @param(id)      Region id.
+     *  @param(size)    Amount of memory to reserve.
+     *
+     *  @b(returns)     Starting address of memory reserved.
+     */
+    Ptr reserveMemory(UInt16 id, SizeT size);
+
+    /*! @_nodoc
+     *  ======== resetInternalFields ========
+     *  Reset the internal fields of a region.
+     *
+     *  This function is called in Ipc_stop() to reset the reservedSize
+     *  and heap handle.  It should not be called by the user.
+     *
+     *  @param(id)      Region id.
+     */
+    Void resetInternalFields(UInt16 id);
+
+    /*!
+     *  ======== setEntryMeta ========
+     *  Sets the entry at the specified region id in the shared region table.
+     *
+     *  The required parameters are base and len. All the other fields will
+     *  get their default if not specified.
+     *
+     *  @param(id)          Region id.
+     *  @param(entry)       Entry fields about the region.
+     */
+    metaonly Void setEntryMeta(UInt16 id, Entry entry);
+
+    /*! @_nodoc
+     *  ======== start ========
+     *  Creates a heap by owner of region for each SharedRegion.
+     *
+     *  Function is called by Ipc_start().  Requires that SharedRegion 0
+     *  be valid before calling start().
+     */
+    Int start();
+
+    /*! @_nodoc
+     *  ======== stop ========
+     *  Undo what was done by start.
+     *
+     *  This function is called by Ipc_stop().  It deletes any heap that
+     *  was created in start for the owner of any SharedRegion.  For
+     *  non-owners, it doesn't do anything.
+     */
+    Int stop();
+
+
+internal:
+
+    const UInt32 CREATED = 0x08111963;
+
+    /* Information stored on a per region basis */
+    struct Region {
+        Entry        entry;
+        SizeT        reservedSize;
+        IHeap.Handle heap;
+    };
+
+    /* temporary storage of shared regions */
+    metaonly config Entry entry[];
+
+    /* generate linker section for shared regions */
+    metaonly config Bool genSectionInLinkCmd[];
+
+    /* internal to keep track of the number of entries added */
+    metaonly config UInt entryCount;
+
+    /* number of bits for the offset for a SRPtr. This value is calculated */
+    config UInt32 numOffsetBits;
+
+    /* offset bitmask using for generating a SRPtr */
+    config UInt32 offsetMask;
+
+    /*
+     *  ======== checkOverlap ========
+     *  Determines if there is an overlap with an existing entry
+     *
+     *  @param(base)    Base address of the region
+     *  @param(len)     Size of the region
+     *
+     *  @b(returns)     Status if successful or not.
+     */
+    Int checkOverlap(Ptr base, SizeT len);
+
+    /*
+     *  ======== Module State structure ========
+     *  The regions array contains information for each shared region entry.
+     *  The size of the table will be determined by the number of entries.
+     */
+    struct Module_State {
+        Region      regions[];
+    };
+}
diff --git a/packages/ti/sdo/ipc/SharedRegion.xs b/packages/ti/sdo/ipc/SharedRegion.xs
new file mode 100644 (file)
index 0000000..d05a1ff
--- /dev/null
@@ -0,0 +1,622 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== SharedRegion.xs ========
+ *
+ */
+
+var GateMP       = null;
+var HeapMemMP    = null;
+var Ipc          = null;
+var MultiProc    = null;
+var SharedRegion = null;
+var Cache        = null;
+
+var staticInited = false;   /* set to true in  module$static$init */
+var idArray = [];           /* for storing the id of an entry     */
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    SharedRegion = this;
+
+    SharedRegion.entry.length = 0;
+    SharedRegion.entryCount = 0;
+    SharedRegion.numOffsetBits = 0;
+    SharedRegion.$object.regions.length = 0;
+}
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    GateMP    = xdc.useModule("ti.sdo.ipc.GateMP");
+    Ipc       = xdc.useModule("ti.sdo.ipc.Ipc");
+    HeapMemMP = xdc.useModule("ti.sdo.ipc.heaps.HeapMemMP");
+    MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
+    Cache     = xdc.useModule("ti.sysbios.hal.Cache");
+
+    /* in a single processor system, we should never translate */
+    if (MultiProc.numProcessors == 1) {
+        SharedRegion.translate = false;
+    }
+
+    if (SharedRegion.translate == false) {
+        SharedRegion.INVALIDSRPTR = 0x0;
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    var Memory    = xdc.module('xdc.runtime.Memory');
+    var regions   = SharedRegion.$object.regions;
+
+    staticInited = true;
+
+    /* allocate the number of entries in the table and intialize it */
+    regions.length   = params.numEntries;
+
+    for (var i = 0; i < params.numEntries; i++) {
+        regions[i].entry.base          = $addr(0);
+        regions[i].entry.len           = 0;
+        regions[i].entry.ownerProcId   = 0;
+        regions[i].entry.isValid       = false;
+        regions[i].entry.cacheEnable   = true;
+        regions[i].entry.cacheLineSize = params.cacheLineSize;
+        regions[i].entry.createHeap    = true;
+        regions[i].reservedSize        = 0;
+        regions[i].heap                = null;
+        regions[i].entry.name          = String(null);
+    }
+
+    /* set the length of the genSectionInLinkCmd[] */
+    SharedRegion.genSectionInLinkCmd.length   = params.numEntries;
+
+    /* default the generate output section to be true for all shared regions */
+    for (var i = 0; i < SharedRegion.genSectionInLinkCmd.length; i++) {
+        SharedRegion.genSectionInLinkCmd[i] = true;
+    }
+
+    SharedRegion.numOffsetBits = getNumOffsetBits();
+    SharedRegion.offsetMask = (1 << SharedRegion.numOffsetBits) - 1;
+
+    /*
+     *  Add entry to lookup table for all segments added by 'addEntry'. Each
+     *  entry's info was temporarily stored into SharedRegion.entry[].
+     *  where 'i' is equivalent to the number of entries.
+     */
+    for (var i = 0; i < SharedRegion.entry.length; i++) {
+        var entry = SharedRegion.entry[i];
+
+        /* make sure id is smaller than numEntries */
+        if (idArray[i] >= params.numEntries) {
+            SharedRegion.$logError("Id: " + idArray[i] + " " +
+                "is greater than or equal to numEntries.", SharedRegion);
+        }
+
+        if (idArray[i] != SharedRegion.INVALIDREGIONID) {
+            regions[idArray[i]].entry.base          = entry.base;
+            regions[idArray[i]].entry.len           = entry.len;
+            regions[idArray[i]].entry.ownerProcId   = entry.ownerProcId;
+            regions[idArray[i]].entry.isValid       = entry.isValid;
+            regions[idArray[i]].entry.cacheEnable   = entry.cacheEnable;
+            regions[idArray[i]].entry.cacheLineSize = entry.cacheLineSize;
+            regions[idArray[i]].entry.createHeap    = entry.createHeap;
+            regions[idArray[i]].entry.name          = entry.name;
+        }
+    }
+}
+
+/*
+ *  ======== setEntryMeta ========
+ *  Adds a memory region to the lookup table.
+ *  Function places entries in temporary storage and process this structure
+ *  at the end of module$static$init() because the number of entries
+ *  cannot be initialize until after user's configuration is executed.
+ */
+function setEntryMeta(id, entry)
+{
+    var num = SharedRegion.entryCount;
+
+    SharedRegion.entryCount++;
+    idArray.length++;
+    SharedRegion.entry.length = SharedRegion.entryCount;
+
+    /* Initialize new table entry for all processors. */
+    SharedRegion.entry[num].base          = $addr(0);
+    SharedRegion.entry[num].len           = 0;
+    SharedRegion.entry[num].ownerProcId   = 0;
+    SharedRegion.entry[num].isValid       = false;
+    SharedRegion.entry[num].cacheEnable   = true;
+    SharedRegion.entry[num].cacheLineSize = SharedRegion.cacheLineSize;
+    SharedRegion.entry[num].createHeap    = true;
+    SharedRegion.entry[num].name          = String(null);
+
+    /* check to see region does not overlap */
+    checkOverlap(entry);
+
+    /* squirrel away entry information to be processed in module$static$init */
+    idArray[num]                          = id;
+    SharedRegion.entry[num].base          = $addr(entry.base);
+    SharedRegion.entry[num].len           = entry.len;
+
+    /* set 'ownerProcId' if defined otherwise no default owner */
+    if (entry.ownerProcId != undefined) {
+        SharedRegion.entry[num].ownerProcId   = entry.ownerProcId;
+    }
+
+    /* set 'name' field if defined otherwise name is null */
+    if (entry.name != undefined) {
+        SharedRegion.entry[num].name = entry.name;
+    }
+
+    /* set 'isValid' field if defined otherwise its false */
+    if (entry.isValid != undefined) {
+        SharedRegion.entry[num].isValid = entry.isValid;
+    }
+
+    /* set the 'cacheEnable' field if defined otherwise is true */
+    if (entry.cacheEnable != undefined) {
+        SharedRegion.entry[num].cacheEnable = entry.cacheEnable;
+    }
+
+    /* set the 'createHeap' field if defined otherwise use default */
+    if (entry.createHeap != undefined) {
+        SharedRegion.entry[num].createHeap = entry.createHeap;
+    }
+
+    /* set the 'cacheLineSize' field if defined otherwise its the default */
+    if (entry.cacheLineSize != undefined) {
+        /* Error if cacheEnable but cacheLineSize set to 0 */
+        if (SharedRegion.entry[num].cacheEnable && (entry.cacheLineSize == 0)) {
+            SharedRegion.$logError("cacheEnable is set to true for " +
+                "region: " + id + " cacheLineSize it set to 0.", SharedRegion);
+        }
+        else {
+            SharedRegion.entry[num].cacheLineSize = entry.cacheLineSize;
+        }
+    }
+
+    /*
+     *  The cacheLineSize is used for alignment of an address as well as
+     *  padding of shared structures therefore it cannot be 0.
+     *  This value must be the same across different processors in the system.
+     *  Initially it was thought this would be the size of a Ptr (4), but the
+     *  max default alignment is the size of a Long or Double (8) on C64P
+     *  target therefore the minimum cacheLineSize must be 8.
+     */
+    if (SharedRegion.entry[num].cacheLineSize == 0) {
+        var target  = Program.build.target;
+        SharedRegion.entry[num].cacheLineSize = 8;
+    }
+
+    if (entry.base % SharedRegion.entry[num].cacheLineSize != 0) {
+        /* Error if base address not aligned to cache boundary */
+        SharedRegion.$logError("Base Address of 0x" +
+            Number(entry.base).toString(16) +
+            " is not aligned to cache boundary (" +
+            SharedRegion.entry[num].cacheLineSize + ")", SharedRegion);
+    }
+}
+
+/*
+ *  ======== genSectionInCmd ========
+ *  Depending on what 'gen' is, it will either generate or not
+ *  generate an output section for the given shared region with 'id'.
+ */
+function genSectionInCmd(id, gen)
+{
+    /* make sure id is smaller than numEntries */
+    if (id >= SharedRegion.numEntries) {
+        SharedRegion.$logError("Id: " + id + " " +
+            "is greater than or equal to numEntries.", SharedRegion);
+    }
+
+    SharedRegion.genSectionInLinkCmd[id] = gen;
+}
+
+/*
+ *  ======== getPtrMeta ========
+ *  Get the pointer given the SRPtr.
+ */
+function getPtrMeta(srptr)
+{
+    var returnPtr = 0;
+    var offsetBits = getNumOffsetBits();
+    var base;
+    var entry;
+    var foundBase = false;
+
+    if (staticInited && (SharedRegion.translate == false)) {
+        returnPtr = srptr;
+    }
+    else {
+        entry = SharedRegion.entry;
+
+        /* unsigned right shift by offsetBits to get id */
+        var id = srptr >>> offsetBits;
+
+        /* loop through entry table */
+        for (var i = 0; i < entry.length; i++) {
+            if ((entry[i].isValid == true) && (idArray[i] == id)) {
+                base = entry[i].base;
+                foundBase = true;
+                break;
+            }
+        }
+
+        /* a valid entry was found so get the ptr from srptr */
+        if (foundBase) {
+            returnPtr = (srptr & ((1 << offsetBits) - 1)) + base;
+        }
+    }
+
+    return (returnPtr);
+}
+
+/*
+ *  ======== getIdMeta ========
+ *  Get the id given the addr
+ */
+function getIdMeta(addr)
+{
+    var entry;
+    var id = SharedRegion.INVALIDREGIONID;
+
+    if (staticInited && (SharedRegion.translate == false)) {
+        id = 0;
+    }
+    else {
+        entry = SharedRegion.entry;
+        for (var i = 0; i < entry.length; i++) {
+            if ((addr >= entry[i].base) &&
+                (addr < (entry[i].base + entry[i].len))) {
+                id = idArray[i];
+                break;
+            }
+        }
+    }
+
+    return (id);
+}
+
+/*
+ *  ======== getCacheLineSizeMeta ========
+ */
+function getCacheLineSizeMeta(id)
+{
+    /* make sure id is smaller than numEntries */
+    if (id >= SharedRegion.numEntries) {
+        SharedRegion.$logError("Id: " + id + " " +
+            "is greater than or equal to numEntries.", SharedRegion);
+    }
+
+    return (cacheLineSize[id]);
+}
+
+/*
+ *  ======== isCacheEnabledMeta ========
+ *  Given the id return the 'cacheEnable' flag.
+ *  function cannot be called from user's *.cfg file.
+ */
+function isCacheEnabledMeta(id)
+{
+    /* make sure id is smaller than numEntries */
+    if (id >= SharedRegion.numEntries) {
+        SharedRegion.$logError("Id: " + id + " " +
+            "is greater than or equal to numEntries.", SharedRegion);
+    }
+
+    return (SharedRegion.entry[id].cacheEnable);
+}
+
+/*
+ *  ======== checkOverlap ========
+ *  Checks to make sure the memory region does not overlap with another region.
+ *  This function is only called if MultiProc.id has been set to a valid id.
+ */
+function checkOverlap(memseg)
+{
+    var map  = SharedRegion.entry;
+
+    for (var i = 0; i < map.length; i++) {
+        if (memseg.base >= map[i].base) {
+            if (memseg.base < (map[i].base + map[i].len)) {
+                /* base of new region is within another region */
+                SharedRegion.$logError("Segment: " + utils.toHex(memseg.base) +
+                    " overlaps with: " + map[i].name, SharedRegion);
+            }
+        }
+        else {
+            if ((memseg.base + memseg.len) > map[i].base) {
+                    /* part of region is within another region */
+                SharedRegion.$logError("Segment: " + utils.toHex(memseg.base) +
+                    " overlaps with: " + map[i].name, SharedRegion);
+            }
+        }
+    }
+}
+
+/*
+ *  ======== getNumOffsetBits ========
+ *  Return the number of offsetBits bits
+ */
+function getNumOffsetBits()
+{
+    var numEntries = SharedRegion.numEntries;
+    var indexBits = 0;
+    var numOffsetBits;
+
+    if (numEntries == 0) {
+        indexBits = 0;
+    }
+    else if (numEntries == 1) {
+        indexBits = 1;
+    }
+    else {
+        numEntries = numEntries - 1;
+
+        /* determine the number of bits for the index */
+        while (numEntries) {
+            indexBits++;
+            numEntries = numEntries >> 1;
+        }
+    }
+
+    numOffsetBits = 32 - indexBits;
+
+    return (numOffsetBits);
+}
+
+/*
+ *  ======== reserveNumBytes ========
+ */
+function reserveNumBytes(numBytes)
+{
+    SharedRegion.numBytesReserved = numBytes;
+}
+
+/*
+ *  ======== viewInitRegions ========
+ */
+function viewInitRegions(view)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+    /* Scan the raw view in order to obtain the module state. */
+    var rawView;
+    try {
+        rawView = Program.scanRawView('ti.sdo.ipc.SharedRegion');
+    }
+    catch (e) {
+        var entryView = Program.newViewStruct('ti.sdo.ipc.SharedRegion',
+                'Regions');
+        Program.displayError(entryView, 'base',
+            "Problem retrieving raw view: " + e);
+        view.elements.$add(entryView);
+        return;
+    }
+
+    var mod = rawView.modState;
+
+    /* Retrieve the module configuration. */
+    var modCfg = Program.getModuleConfig('ti.sdo.ipc.SharedRegion');
+
+    /* Retrieve the table of entries. */
+    try {
+        var regions = Program.fetchArray(SharedRegion.Region$fetchDesc,
+                                         mod.regions,
+                                         modCfg.numEntries);
+    }
+    catch (e) {
+        var entryView = Program.newViewStruct('ti.sdo.ipc.SharedRegion',
+                'Regions');
+        Program.displayError(entryView, 'base',
+            "Caught exception while trying to retrieve regions table: " + e);
+        view.elements.$add(entryView);
+        return;
+    }
+
+    /* Display each of the regions. */
+    for (var i = 0; i < regions.length; i++) {
+        var entry = regions[i].entry;
+
+        var entryView = Program.newViewStruct('ti.sdo.ipc.SharedRegion',
+                                              'Regions');
+
+        var base =  Number(entry.base);
+        var len =  Number(entry.len);
+
+        entryView.id = i;
+        entryView.base = "0x" + Number(base).toString(16);
+        entryView.len = "0x" + Number(len).toString(16);
+        if (len == 0) {
+            entryView.end = "0x" + Number(base + len).toString(16);
+        }
+        else {
+            entryView.end = "0x" + Number(base + len - 1).toString(16);
+        }
+        entryView.ownerProcId = entry.ownerProcId;
+        entryView.isValid = entry.isValid;
+        entryView.cacheEnable = entry.cacheEnable;
+        entryView.cacheLineSize = entry.cacheLineSize;
+        entryView.reservedSize = regions[i].reservedSize;
+        entryView.heap = regions[i].heap;
+        try {
+            entryView.name = Program.fetchString(Number(entry.name));
+        }
+        catch (e) {
+            Program.displayError(entryView, 'name', "Problem retrieving name: " + e);
+        }
+
+        view.elements.$add(entryView);
+    }
+}
+
+/*
+ *  ======== getPtrMeta$view ========
+ */
+function getPtrMeta$view(srptr)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    /*
+     * Retrieve the SharedRegion module configuration.
+     * Store the configuration to the 'SharedRegion' global variable in this
+     * file so that we can call the config-time API 'getNumOffsetBits'.
+     */
+    SharedRegion = Program.getModuleConfig('ti.sdo.ipc.SharedRegion');
+
+    /* Ensure that srptr is a number */
+    srptr = Number(srptr);
+
+    /* If there's no translation to be done, just return the pointer. */
+    if (SharedRegion.translate == false) {
+        return (srptr);
+    }
+
+    /* If srptr is SharedRegion.INVALIDSRPTR then return NULL*/
+    if (srptr == SharedRegion.INVALIDSRPTR) {
+        return (0);
+    }
+
+    /*
+     * Retrieve the 'Regions' view.
+     * This view may throw an exception; let this exception propogate up and
+     * be caught by the view calling this API.
+     */
+    var regionsView = Program.scanModuleDataView('ti.sdo.ipc.SharedRegion',
+        'Regions');
+
+    /* Get the regions from the view. */
+    var regions = regionsView.elements;
+
+
+    /* Retrieve the number of offset bits. */
+    var numOffsetBits = getNumOffsetBits();
+
+    /* unsigned right shift by offset to get id */
+    var id = srptr >>> numOffsetBits;
+
+    /* Verify the computed id is within range. */
+    if (id > regions.length) {
+        throw (new Error("The region id " + id + " of the SharedRegion " +
+                         "pointer 0x" + Number(srptr).toString(16) + " is " +
+                         "not a valid id."));
+    }
+
+    /* Retrieve the region. */
+    var region = regions[id];
+
+    /* Verify the region is valid. */
+    if (!region.isValid) {
+        throw (new Error("The SharedRegion " + id + " of the SharedRegion " +
+                         "pointer 0x" + Number(srptr).toString(16) + " is " +
+                         "currently invalid."));
+    }
+
+    /* Compute the local address. */
+    var ptr = (srptr & ((1 << numOffsetBits) - 1)) + parseInt(region.base);
+
+    return (ptr);
+}
+
+/*
+ *  ======== getSRPtrMeta$view ========
+ */
+function getSRPtrMeta$view(addr)
+{
+    /*
+     * Retrieve the SharedRegion module configuration.
+     * Store the configuration to the 'SharedRegion' global variable in this
+     * file so that we can call the config-time API 'getNumOffsetBits'.
+     */
+    SharedRegion = Program.getModuleConfig('ti.sdo.ipc.SharedRegion');
+
+    /* Ensure the address is a number */
+    addr = Number(addr);
+
+    /* If there's no translation to be done, just return the pointer. */
+    if (SharedRegion.translate == false) {
+        return (addr);
+    }
+
+    /* If addr is NULL, return SharedRegion.INVALIDSRPTR */
+    if (addr == 0) {
+        return (SharedRegion.INVALIDSRPTR);
+    }
+
+    /*
+     * Retrieve the 'Regions' view.
+     * This view may throw an exception; let this exception propogate up and
+     * be caught by the view calling this API.
+     */
+    var regionsView = Program.scanModuleDataView('ti.sdo.ipc.SharedRegion',
+        'Regions');
+
+    /* Get the regions from the view. */
+    var regions = regionsView.elements;
+
+
+    /* Retrieve the number of offset bits. */
+    var numOffsetBits = getNumOffsetBits();
+
+    /* Look through each of the regions for this address. */
+    for (var i = 0; i < regions.length; i++) {
+
+        /* Compute the beginning and end address of this region. */
+        var begin = parseInt(regions[i].base);
+        var end = parseInt(regions[i].end);
+
+        /* If the address falls within this region... */
+        if ((addr >= begin) && (addr < end)) {
+            /* Compute the shared region address and return. */
+            return ((i << numOffsetBits) + (addr - begin));
+        }
+    }
+
+    /* If we didn't find a region containing the address, throw an error. */
+    throw("No address range found for: " + Number(addr).toString(16));
+}
diff --git a/packages/ti/sdo/ipc/_GateMP.h b/packages/ti/sdo/ipc/_GateMP.h
new file mode 100644 (file)
index 0000000..195f9ae
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _GateMP.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_GateMP__nolocalnames
+
+#include <ti/sdo/ipc/GateMP.h>
+
+#include <ti/ipc/GateMP.h>
diff --git a/packages/ti/sdo/ipc/_Ipc.h b/packages/ti/sdo/ipc/_Ipc.h
new file mode 100644 (file)
index 0000000..ba6138f
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _Ipc.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_Ipc__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/ipc/Ipc.h>
+
+/* the common .h file */
+#include <ti/ipc/Ipc.h>
+
+/* Round the value 'a' up by 'b', a power of two */
+#define _Ipc_roundup(a, b) \
+    (UInt32)((((UInt32)(a)) + (((UInt32)(b)) - 1)) & ~((UInt32)(b) - 1))
diff --git a/packages/ti/sdo/ipc/_ListMP.h b/packages/ti/sdo/ipc/_ListMP.h
new file mode 100644 (file)
index 0000000..51d894e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _ListMP.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_ListMP__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/ipc/ListMP.h>
+
+/* the common .h file */
+#include <ti/ipc/ListMP.h>
diff --git a/packages/ti/sdo/ipc/_MessageQ.h b/packages/ti/sdo/ipc/_MessageQ.h
new file mode 100644 (file)
index 0000000..2f93f59
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _MessageQ.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_MessageQ__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/ipc/MessageQ.h>
+
+/* the common .h file */
+#include <ti/ipc/MessageQ.h>
diff --git a/packages/ti/sdo/ipc/_Notify.h b/packages/ti/sdo/ipc/_Notify.h
new file mode 100644 (file)
index 0000000..45a009c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _Notify.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_Notify__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/ipc/Notify.h>
+
+/* the common .h file */
+#include <ti/ipc/Notify.h>
diff --git a/packages/ti/sdo/ipc/_SharedRegion.h b/packages/ti/sdo/ipc/_SharedRegion.h
new file mode 100644 (file)
index 0000000..32a42e2
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _SharedRegion.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_SharedRegion__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/ipc/SharedRegion.h>
+
+/* the common .h file */
+#include <ti/ipc/SharedRegion.h>
diff --git a/packages/ti/sdo/ipc/build/common.bld b/packages/ti/sdo/ipc/build/common.bld
new file mode 100644 (file)
index 0000000..c19e570
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== common.bld ========
+ *
+ */
+
+
+/*
+ *  ======== getProfiles ========
+ *  Determines which profiles to build for.
+ *
+ *  Any argument in XDCARGS which does not contain platform= is treated
+ *  as a profile. This way multiple build profiles can be specified by
+ *  separating them with a space.
+ */
+function getProfiles(xdcArgs)
+{
+    /*
+     * cmdlProf[1] gets matched to "whole_program,debug" if
+     * ["abc", "profile=whole_program,debug"] is passed in as xdcArgs
+     */
+    var cmdlProf = (" " + xdcArgs.join(" ") + " ").match(/ profile=([^ ]+) /);
+
+
+    if (cmdlProf == null) {
+        /* No profile=XYZ found */
+        return [];
+    }
+
+    /* Split "whole_program,debug" into ["whole_program", "debug"] */
+    var profiles = cmdlProf[1].split(',');
+
+    return profiles;
+}
+
+/*
+ *  ======== buildLibs ========
+ *  This function generates the makefile goals for the libraries
+ *  produced by a ti.sysbios package.
+ */
+function buildLibs(objList, relList, filter, xdcArgs)
+{
+    var ccopts = "";
+    var asmopts = "";
+
+    for (var i = 0; i < Build.targets.length; i++) {
+        var targ = Build.targets[i];
+
+        /* skip target if not supported */
+        if (!supportsTarget(targ, filter)) {
+            continue;
+        }
+
+        var profiles = getProfiles(xdcArgs);
+
+        /* If no profiles were assigned, use only the default one. */
+        if (profiles.length == 0) {
+            profiles[0] = "debug";
+        }
+
+        for (var j = 0; j < profiles.length; j++) {
+
+            if (profiles[j] == "smp") {
+                var libPath = "lib/smpipc/debug/";
+                ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
+                asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
+            }
+            else {
+                var libPath = "lib/ipc/debug/";
+                /* build all package libs using Hwi macros */
+                ccopts += " -Dti_sysbios_Build_useHwiMacros";
+                ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
+                asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
+            }
+
+            /* confirm that this target supports this profile */
+            if (targ.profiles[profiles[j]] !== undefined) {
+                var profile = profiles[j];
+                var lib = Pkg.addLibrary(libPath + Pkg.name,
+                                targ, {
+                                profile: profile,
+                                copts: ccopts,
+                                aopts: asmopts,
+                                releases: relList
+                                });
+                lib.addObjects(objList);
+            }
+        }
+    }
+}
+
+
+/*
+ *  ======== supportsTarget ========
+ *  Returns true if target is in the filter object. If filter
+ *  is null or empty, that's taken to mean all targets are supported.
+ */
+function supportsTarget(target, filter)
+{
+    var list, field;
+
+    if (filter == null) {
+        return true;
+    }
+
+    /*
+     * For backwards compatibility, we support filter as an array of
+     * target names.  The preferred approach is to specify filter as
+     * an object with 'field' and 'list' elements.
+     *
+     * Old form:
+     *     var trgFilter = [ "Arm9", "Arm9t", "Arm9t_big_endian" ]
+     *
+     * New (preferred) form:
+     *
+     *     var trgFilter = {
+     *         field: "isa",
+     *         list: [ "v5T", "v7R" ]
+     *     };
+     *
+     */
+    if (filter instanceof Array) {
+        list = filter;
+        field = "name";
+    }
+    else {
+        list = filter.list;
+        field = filter.field;
+    }
+
+    if (list == null || field == null) {
+        throw("invalid filter parameter, must specify list and field!");
+    }
+
+    if (field == "noIsa") {
+        if (String(','+list.toString()+',').match(','+target["isa"]+',')) {
+            return (false);
+        }
+        return (true);
+    }
+
+    /*
+     * add ',' at front and and tail of list and field strings to allow
+     * use of simple match API.  For example, the string is updated to:
+     * ',v5T,v7R,' to allow match of ',v5t,'.
+     */
+    if (String(','+list.toString()+',').match(','+target[field]+',')) {
+        return (true);
+    }
+
+    return (false);
+}
diff --git a/packages/ti/sdo/ipc/build/package.bld b/packages/ti/sdo/ipc/build/package.bld
new file mode 100644 (file)
index 0000000..690f548
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+Pkg.otherFiles = [
+    "test.bld", "common.bld", "package.bld"
+];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
diff --git a/packages/ti/sdo/ipc/build/package.xdc b/packages/ti/sdo/ipc/build/package.xdc
new file mode 100644 (file)
index 0000000..2a8005b
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.sdo.ipc.build ========
+ *  @_nodoc
+ */
+package ti.sdo.ipc.build {
+}
diff --git a/packages/ti/sdo/ipc/build/test.bld b/packages/ti/sdo/ipc/build/test.bld
new file mode 100644 (file)
index 0000000..f5b8508
--- /dev/null
@@ -0,0 +1,552 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== test.bld ========
+ */
+
+/*
+ *  "testing.doc" in ti.sysbios.build.doc details specifying, building, and
+ *  running tests. Below are details on the properties supported by tests
+ *  in a package's testArray.
+ *
+ *  ======== testArray ========
+ *  The testArray is used by buildTests in test.bld to generate the makefile
+ *  goals for the tests in this package. The test objects in this array can
+ *  have the following properties:
+ *    name: The name of the test.
+ *    sources: An array of the names of the source files, without the '.c's
+ *    config: The name of the config file, without the '.cfg'
+ *    buildTargets: The names of the targets supported by the test. If this
+ *             property is undefined, the test will be built for all targets,
+ *             so this array is really intended for restricting the test to
+ *             the specified targets.
+ *    noBuildTargets: The names of targets *not* supported by the test.
+ *              The test will be built for all other targets listed in
+ *              Build.targets array. Cannot use buildTargets and noBuildTargets
+ *              for the same test.
+ *    buildPlatforms: The names of the platforms supported by the test. If this
+ *             property is undefined, the test will support all of the
+ *             platforms in the target.platforms[] array in config.bld, so this
+ *             array is really intended for restricting the test to specific
+ *             platforms. When actually building the tests with sm-make, the
+ *             platform to build for is specified using XDCARGS. Only specify
+ *             the platform suffix, not the entire name.
+ *
+ *  Only the test name is required. If none of the other properties are
+ *  specified, they will be inferred from the test name by adding the
+ *  appropriate file extension.
+ *
+ *  The buildTargets and buildPlatforms are really there so that tests whose
+ *  output changes depending on the target or platform can be separated.
+ *
+ */
+
+/*
+ *  ======== buildTests ========
+ *  This function generates the makefile goals for all of the
+ *  tests in the testArray parameter. Each test package, in its
+ *  package.bld, should define a testArray, import this file, and
+ *  call buildTests. The second argument is the XDCARGS environment
+ *  variable. In package.bld, just pass 'arguments' as the second
+ *  parameter.
+ */
+function buildTests(testArray, xdcArgs)
+{
+    /* The XDCARGS specify which profiles and platforms to build for. */
+    var profiles = getProfiles(xdcArgs);
+    if (profiles.length == 0) {
+        if (Pkg.attrs.profile != null && Pkg.attrs.profile !== undefined) {
+            profiles[0] = Pkg.attrs.profile;
+        }
+        else {
+            profiles[0] = "release";
+        }
+    }
+    var platform = getPlatform(xdcArgs);
+
+    /*
+     *  'PackageContents.uses' allows us to provide legacy include path
+     *  for the compiler.  This adds '-I<elem>/ti/bios/include' for
+     *  each <elem> in XDCPATH.  This is more portable than using
+     *  copts and $(PKGROOT) which only works if test cases are in same
+     *  repository as BIOS itself (as is the case for avala tree, but not
+     *  for TII/Wipro testing and also for ndk and cudatest trees).
+     */
+    var PackageContents = xdc.useModule('xdc.bld.PackageContents');
+    PackageContents.uses = ["ti/bios/include"];
+
+    /*  ==== LOOP OVER TESTS ==== */
+    for (var i = 0; i < testArray.length; i++) {
+        var test = testArray[i];
+
+        /* Infer any missing properties from the name */
+        fillIn(test);
+
+        /* ==== LOOP OVER TARGETS ==== */
+        for (var j = 0; j < Build.targets.length; j++) {
+            var targ = Build.targets[j];
+
+            /* If the test doesn't support this target, skip this target. */
+            if (!testSupportsTarget(test, targ)) {
+                continue;
+            }
+
+            /*
+             *  ==== platform=default ====
+             *  If we're using the default platform, don't create a platform
+             *  subdirectory for the test.
+             */
+            if (platform.useDefaultPlatform) {
+                platform.name = targ.platform;
+                if (!testSupportsPlatform(test, platform.name)) {
+                    platform.name = platformSuffix(targ.platform);
+                    if (!testSupportsPlatform(test, platform.name)) {
+                        continue;
+                    }
+                }
+
+                /* For each profile... */
+                for (var m = 0; m < profiles.length; m++) {
+                    var profile = profiles[m];
+
+                    var testName = profile + '/' + test.name;
+
+                    addTestGoals(test, profile, targ, targ.platform, testName);
+                }
+            }
+            /*
+             *  ==== platform=<platform> =====
+             *  If a platform was specified explicitly, place it in a platform
+             *  subdirectory, regardless of whether or not it's the default.
+             */
+            else if (platform.useThisPlatform) {
+                if (!testSupportsPlatform(test, platform.name)) {
+                    continue;
+                }
+
+                /*
+                 * We have the platform suffix but need the full platform. Look
+                 * through the targ.platforms array to see find the full
+                 * platform name. It's possible that this target doesn't support
+                 * this platform, in which case, continue.
+                 */
+                var fullPlatformName = "";
+
+                for (var m = 0; m < targ.platforms.length; m++) {
+                    if (targ.platforms[m].indexOf(platform.name) != -1) {
+                        fullPlatformName = targ.platforms[m];
+                        break;
+                    }
+                }
+                /*
+                 * If the platform wasn't found then it's not supported
+                 * by this target.
+                 */
+                if (fullPlatformName == "") {
+                    continue;
+                }
+
+                /* For each profile... */
+                for (var m = 0; m < profiles.length; m++) {
+                    var profile = profiles[m];
+
+                    /* Replace any ':' in platform name with '_' */
+                    platform.name = platform.name.replace(/\:/g, '_');
+
+                    var testName = platform.name + '/' + profile + '/' +
+                                   test.name;
+
+                    addTestGoals(test, profile, targ, fullPlatformName,
+                                 testName);
+                }
+            }
+            /*
+             *  ==== platform=all =====
+             *  If we are building for all platforms, place them ALL in
+             *  platform subdirectories, even the default platform.
+             */
+            else if (platform.useAllPlatforms) {
+                /* For all of this target's platforms.. */
+                for (var k = 0; k < targ.platforms.length; k++) {
+                    platform.name = targ.platforms[k];
+                    if (!testSupportsPlatform(test, platform.name)) {
+                        platform.name = platformSuffix(targ.platforms[k]);
+                        if (!testSupportsPlatform(test, platform.name)) {
+                            continue;
+                        }
+                    }
+
+                    /* For each profile... */
+                    for (var m = 0; m < profiles.length; m++) {
+                        var profile = profiles[m];
+
+                        /* Replace any '.' in platform name with '_' */
+                        platform.name = platform.name.replace(/\./g, '_');
+                        /* Replace any ':' in platform name with '_' */
+                        platform.name = platform.name.replace(/\:/g, '_');
+
+                        var testName = platform.name + '/' + profile + '/' +
+                                       test.name;
+
+                        addTestGoals(test, profile, targ, targ.platforms[k],
+                                     testName);
+                    }
+                }
+            }
+            else {
+                print("\nERROR: Test.bld has incorrectly read in the " +
+                      "platform from XDCARGS.\n");
+                return(-1);
+            }
+        }
+    }
+}
+
+
+/*
+ *  ======== getProfiles ========
+ *  Determines which profiles to build for.
+ *
+ *  Any argument in XDCARGS which does not contain platform= is treated
+ *  as a profile here. This way multiple build profiles can be specified
+ *  just by separating them with a space.
+ */
+function getProfiles(xdcArgs)
+{
+    /*
+     * cmdlProf[1] gets matched to "whole_program,debug" if
+     * ["abc", "profile=whole_program,debug"] is passed in as xdcArgs
+     */
+    var cmdlProf = (" " + xdcArgs.join(" ") + " ").match(/ profile=([^ ]+) /);
+
+
+    if (cmdlProf == null) {
+        /* No profile=XYZ found */
+        return [];
+    }
+
+    /* Split "whole_program,debug" into ["whole_program", "debug"] */
+    var profiles = cmdlProf[1].split(',');
+
+    return profiles;
+}
+
+/*
+ *  ======== getPlatform ========
+ *  Reads the XDCARGS to determine what platforms to build for. This function
+ *  returns an object containing all of the info about what platforms to build
+ *  for.
+ */
+function getPlatform(xdcArgs)
+{
+    var platform = new Object();
+    platform.name = "";
+    platform.useDefaultPlatform = true;
+    platform.useAllPlatforms = false;
+    platform.useThisPlatform = false;
+
+    /*
+     * Look through all of the XDCARGS to see if a platform has been
+     * specified.
+     */
+    for (var i = 0; i < xdcArgs.length; i++) {
+        var index = xdcArgs[i].indexOf("platform=");
+        if (index != -1) {
+            platform.name = xdcArgs[i].substring(index + 9, xdcArgs[i].length);
+            if (platform.name == "default") {
+                return (platform)
+            }
+            else if (platform.name == "all") {
+                platform.useDefaultPlatform = false;
+                platform.useAllPlatforms = true;
+                return (platform);
+            }
+            else {
+                platform.useDefaultPlatform = false;
+                platform.useThisPlatform = true;
+                return (platform);
+            }
+        }
+    }
+
+    /* If nothing was specified in XDCARGS, use the default platform. */
+    return (platform);
+}
+
+/*
+ *  ======== testSupportsTarget ========
+ *  Returns true if the given test supports the given target.
+ *  If there are no filter arrays, that's taken to mean that
+ *  the test should be built for all targets.
+ *  Only one filter array is allowed.
+ */
+function testSupportsTarget(test, target)
+{
+    var count = 0;
+    var noFlag = false;
+    var fieldName;
+    var list;
+
+    for (var f in test) {
+        switch (f) {
+            case 'noBuildTargets':
+            case 'noNameList': {
+                noFlag = true;
+            }
+            case 'buildTargets':
+            case 'nameList': {
+                fieldName = 'name';
+                list = test[f];
+                count++;
+                break;
+            }
+
+            case 'noIsaList': {
+                noFlag = true;
+            }
+            case 'isaList': {
+                fieldName = 'isa';
+                list = test[f];
+                count++;
+                break;
+            }
+
+            case 'noSuffixList': {
+                noFlag = true;
+            }
+            case 'suffixList': {
+                fieldName = 'suffix';
+                list = test[f];
+                count++;
+                break;
+            }
+        }
+    }
+
+    /* if no filters specified, then test supports all targets */
+    if (count == 0) {
+        return (true);
+    }
+
+    /* make sure only one filter list was specified */
+    if (count != 1) {
+        throw Error("cannot specify more than one filter list, "
+            + "test.name = " + test.name);
+    }
+
+    /*
+     * add ',' at front and and tail of list and field strings to allow
+     * use of simple match API.  For example, the string is updated to:
+     * ',v5T,v7R,' to allow match of ',v5t,'.
+     */
+    if (String(','+list.toString()+',').match(','+target[fieldName]+',')) {
+        return (!noFlag);
+    }
+    else {
+        return (noFlag);
+    }
+
+    /* should not get here */
+    throw Error("internal error in testSupportsTarget()");
+}
+
+/*
+ *  ======== testSupportsPlatform ========
+ *  This function is to support the buildPlatforms array.
+ */
+function testSupportsPlatform(test, platform)
+{
+    if ((test.buildPlatforms == null) || (test.buildPlatforms.length == 0)) {
+        return (true);
+    }
+
+    for (var i = 0; i < test.buildPlatforms.length; i++) {
+        if (test.buildPlatforms[i] == platform) {
+            return(true);
+        }
+    }
+
+    return (false);
+}
+
+/*
+ *  ======== platformSuffix ========
+ *  Parses a full platform name ("ti.platforms.ezdsp2812") to return only the
+ *  the platform suffix ("ezdsp2812"). It does this by returning everything
+ *  after the last period '.' in the platform name.
+ */
+function platformSuffix(platform)
+{
+    var begin = platform.lastIndexOf('.') + 1;
+
+    return (platform.substring(begin, platform.length));
+}
+
+
+/*
+ *  ======== addTestGoal ========
+ *  This function calls pkg.addExecutable to create the .test and
+ *  .regress.test goals for the given test, profile, and target.
+ */
+function addTestGoals(test, profile, target, platform, testName)
+{
+    /* FIRST, specify the basic executable without reference output. */
+
+    /* Specify the .test goal */
+    var testAttrs = {
+                        execArgs: test.timeout,
+                        args: ""
+                    };
+    /* get the options defined in the test argument */
+    var defs = (test.defs == undefined) ? "" : test.defs;
+    var copts = (test.copts == undefined) ? "" : test.copts;
+    var aopts = (test.aopts == undefined) ? "" : test.aopts;
+    var lopts = (test.lopts == undefined) ? "" : test.lopts;
+
+    /*
+     *  profileCopts are needed for cudatest.  Since avala builds non tiTargets,
+     *  comment this out for now, and resolve later.
+     */
+    var profileCopts = undefined;
+            //tiTargets[target.name].profiles[profile].compileOpts.copts;
+    var profileAopts = undefined;
+            //tiTargets[target.name].profiles[profile].compileOpts.aopts;
+    var profileLopts = undefined;
+            //tiTargets[target.name].profiles[profile].linkOpts;
+    var profileDefs = undefined;
+            //tiTargets[target.name].profiles[profile].compileOpts.defs;
+
+    /* verify they are defined */
+    profileCopts = (profileCopts == undefined) ? "" : profileCopts;
+    profileAopts = (profileAopts == undefined) ? "" : profileAopts;
+    profileLopts = (profileLopts == undefined) ? "" : profileLopts;
+    profileDefs = (profileDefs == undefined) ? "" : profileDefs;
+
+    /* get config arguments, if any */
+    var cfgArgs = (test.cfgArgs == undefined || test.cfgArgs == "") ?
+            "" : test.cfgArgs;
+
+    /* Specify the executable's properties */
+    var execAttrs = {
+                        defs:  defs + profileDefs,
+                        copts: copts + profileCopts,
+                        aopts: aopts + profileAopts,
+                        lopts: lopts + profileLopts,
+                        cfgScript: test.config + ".cfg",
+                        cfgArgs: test.cfgArgs,
+                        profile: profile,
+                        test: testAttrs,
+                    };
+
+    var prog = Pkg.addExecutable(testName, target, platform, execAttrs);
+
+    /* Add the source files */
+    prog.addObjects(test.sources);
+
+    /*
+     * SECOND, add additional test goals as necessary for regression and for
+     * different sets of arguments.
+     */
+
+    /* Specify the .regress.test goal */
+    var rTestAttrs = {
+                         groupName: "regress",
+                         refOutput: "golden/" + test.refOutput + ".k",
+                         execArgs: test.timeout,
+                         args: ""
+                     };
+
+    /* If there are no arguments, then just add the regression goal. */
+    if (test.argsToMain.length == 0) {
+        prog.addTest(rTestAttrs);
+    }
+    /*
+     * If there are arguments, then for each set of arguments, add one test
+     * goal with reference output (the regression test) and one without.
+     */
+    else {
+        for (var i = 0; i < test.argsToMain.length; i++) {
+            testAttrs.args = test.argsToMain[i].args;
+            prog.addTest(testAttrs);
+
+            rTestAttrs.refOutput = "golden/" + test.argsToMain[i].refOutput + ".k";
+            rTestAttrs.args = test.argsToMain[i].args;
+            prog.addTest(rTestAttrs);
+        }
+    }
+}
+
+
+/*
+ *  ======== fillIn ========
+ *  Fills in any missing test properties (except for targets array)
+ *  using the test name.
+ */
+function fillIn(test)
+{
+    if ((test.name == undefined) || (test.name == "")) {
+        throw "Each test must have a test.name";
+    }
+    if ((test.sources == undefined) || (test.sources == null)) {
+        test.sources = [test.name];
+    }
+    if ((test.config == undefined) || (test.config == "")) {
+        test.config = test.name;
+    }
+    if ((test.refOutput == undefined) || (test.refOutput == "")) {
+        test.refOutput = test.name;
+    }
+
+    /*
+     * Test timeout needs to be converted from int to String.
+     * Default is 60 seconds.
+     */
+    if ((test.timeout == undefined)) {
+        test.timeout = "-t 60";
+    }
+    else {
+        test.timeout = "-t " + test.timeout;
+    }
+
+    /* argsToMain is an array. */
+    if ((test.argsToMain == undefined) || (test.argsToMain == null)) {
+        test.argsToMain = new Array();
+    }
+
+    /* Fill in any missing reference outputs for the different arguments. */
+    for (var i = 0; i < test.argsToMain.length; i++) {
+        if ((test.argsToMain[i].refOutput == undefined) ||
+            (test.argsToMain[i].refOutput == null)) {
+            test.argsToMain[i].refOutput = test.refOutput;
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/Settings.xdc b/packages/ti/sdo/ipc/family/Settings.xdc
new file mode 100644 (file)
index 0000000..eee7d7a
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Settings.xdc ========
+ *
+ */
+
+/*!
+ *  @_nodoc
+ *  Family setting module
+ */
+metaonly module Settings
+{
+    /*! returns the family specific Interrupt module delegate */
+    String getDefaultInterruptDelegate();
+
+    /*! returns the device specific GateSpinLock settings */
+    Any getGateHWSpinlockSettings();
+
+    /*! returns the device specific GateHWSem settings */
+    Any getGateHWSemSettings();
+
+    /*! returns the module name of the HW Gate that the device supports */
+    String getHWGate();
+
+    /*! returns true when the host needs to program the mmu for the slave */
+    Bool getIpcSR0Setup();
+
+    /*! returns the MultiProc.id of the HOST if configured in MultiProc */
+    UInt16 getHostProcId();
+
+    /*! returns whether the processor is in the build device */
+    Bool procInDevice(String procName);
+
+    /*! returns array of names of processors on the build device */
+    Any getDeviceProcNames();
+
+    /*! returns the device specific NameServer Remote delegate */
+    String getNameServerRemoteDelegate();
+
+    /*! returns the device specific NotifySetup delegate */
+    String getNotifySetupDelegate();
+
+    /*! returns the MessageQ transport setup delegate */
+    String getMessageQSetupDelegate();
+
+    /*! returns whether to generate slave data for the host */
+    Bool generateSlaveDataForHost();
+}
diff --git a/packages/ti/sdo/ipc/family/Settings.xs b/packages/ti/sdo/ipc/family/Settings.xs
new file mode 100644 (file)
index 0000000..76d1821
--- /dev/null
@@ -0,0 +1,711 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== Settings.xs ========
+ */
+
+/*
+ *  ======== setDeviceAliases ========
+ */
+function setDeviceAliases(settingsTable, aliasTable)
+{
+    /* Number of times to call the outer loop */
+    var numLoops = 6;
+
+    /*
+     *  Execute the 2nd loop 'numLoops' times to allow aliases of aliases
+     *  to be applied to the table
+     */
+    for (var i = 0; i < numLoops; i++) {
+        for (var device in aliasTable) {
+            for each (var alias in aliasTable[device]) {
+                /*
+                 *  Define the alias only if the alias doesn't already exist
+                 *  in the table and if the device does exist in the table.
+                 */
+                if (settingsTable[alias] == null &&
+                    settingsTable[device] != null) {
+                    settingsTable[alias] = settingsTable[device];
+                }
+            }
+        }
+    }
+}
+
+/*
+ *  ======== setCatalogAliases ========
+ */
+function setCatalogAliases(settingsTable, aliasTable)
+{
+    for (var catalogName in settingsTable) {
+        if (aliasTable[catalogName] != null) {
+            var catalogAlias = aliasTable[catalogName];
+            if (settingsTable[catalogAlias] == null) {
+                settingsTable[catalogAlias] = settingsTable[catalogName];
+                continue;
+            }
+            for (var deviceName in settingsTable[catalogName]) {
+                settingsTable[catalogAlias][deviceName] =
+                    settingsTable[catalogName][deviceName];
+            }
+        }
+    }
+}
+
+/*
+ *  ======== deviceSupportCheck ========
+ *  Check validity of device
+ */
+function deviceSupportCheck()
+{
+    var deviceName;
+
+    /* look for exact match */
+    for (deviceName in procNames) {
+        if (deviceName == Program.cpu.deviceName) {
+            return deviceName;
+        }
+    }
+
+    /* now look for wild card match */
+    for (deviceName in procNames) {
+        if (Program.cpu.deviceName.match(deviceName)) {
+            return deviceName;
+        }
+    }
+}
+
+/*
+ *  ======== catalogAliases ========
+ *  Aliases for catalog
+ */
+var catalogAliases = {
+    'ti.catalog.arm.cortexm3' : ['ti.catalog.arm'],
+}
+
+/*
+ *  ======== deviceAliases ========
+ *  Aliases for devices used in IPC
+ */
+var deviceAliases = {
+    'TMS320C6472'       : ['TMS320CTCI6486'],
+    'TMS320C6474'       : ['TMS320CTCI6488'],
+    'TMS320DA830'       : ['OMAPL138',
+                           'OMAPL137'],
+    'OMAP3530'          : ['TMS320C3430'],
+    'TMS320TI816X'      : ['TMS320CDM740',
+                           'TMS320DM8148',
+                           'TMS320DM8168',
+                           'TMS320C6A8168',
+                           'TMS320C6A8149',
+                           'TMS320TI811X',
+                           'TMS320TI813X',
+                           'TMS320TI814X'],
+    'TMS320C6678'       : ['TMS320TCI6608',
+                           'TMS320C6674',
+                           'TMS320C6672'],
+    'TMS320C6670'       : ['TMS320TCI6616',
+                           'TMS320CTCI6497',
+                           'TMS320CTCI6498',
+                           'TMS320TCI6618',
+                           'TMS320TCI6614',
+                           'TMS320C6657'],
+    'TMS320TCI6634'     : ['TMS320TCI6636',
+                           'TMS320TCI6638',
+                           'Kepler'],
+    'LM3.*'             : ['LM4.*'],
+}
+
+/*
+ *  ======== procNames ========
+ */
+var procNames = {
+    'TMS320CDM6446'     : ["DSP", "HOST"],
+    'TMS320DA830'       : ["DSP", "HOST"],
+    'OMAPL138'          : ["DSP", "HOST"],
+    'TMS320TI816X'      : ["DSP", "VIDEO-M3", "VPSS-M3", "HOST"],
+    'TMS320TI813X'      : ["VIDEO-M3", "VPSS-M3", "HOST"],
+    'TMS320C6A8168'     : ["DSP", "VPSS-M3", "HOST"],
+    'TMS320C6A8149'     : ["DSP", "EVE", "VIDEO-M3", "VPSS-M3", "HOST"],
+    'TMS320C6670'       : ["CORE0", "CORE1", "CORE2", "CORE3"],
+    'TMS320C6657'       : ["CORE0", "CORE1"],
+    'TMS320C6672'       : ["CORE0", "CORE1"],
+    'TMS320TCI6614'     : ["CORE0", "CORE1", "CORE2", "CORE3", "HOST"],
+    'TMS320TCI6634'     : ["CORE0", "CORE1", "CORE2", "CORE3",
+                           "CORE4", "CORE5", "CORE6", "CORE7"],
+    'TMS320TCI6636'     : ["CORE0", "CORE1", "CORE2", "CORE3",
+                           "CORE4", "CORE5", "CORE6", "CORE7",
+                            "HOST0", "HOST1", "HOST2", "HOST3"],
+    'TMS320TCI6638'     : ["CORE0", "CORE1", "CORE2", "CORE3",
+                           "CORE4", "CORE5", "CORE6", "CORE7",
+                           "HOST0", "HOST1", "HOST2", "HOST3"],
+    'Kepler'            : ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
+                           "CORE4", "CORE5", "CORE6", "CORE7"],
+    'TMS320C6674'       : ["CORE0", "CORE1", "CORE2", "CORE3"],
+    'TMS320C6678'       : ["CORE0", "CORE1", "CORE2", "CORE3",
+                           "CORE4", "CORE5", "CORE6", "CORE7"],
+    'TMS320C6472'       : ["CORE0", "CORE1", "CORE2",
+                           "CORE3", "CORE4", "CORE5"],
+    'TMS320C6474'       : ["CORE0", "CORE1", "CORE2"],
+    'OMAP3530'          : ["DSP", "HOST"],
+    'OMAP4430'          : ["DSP", "CORE0", "CORE1", "HOST"],
+    'Arctic'            : ["DSP", "ARP32"],
+    'F28M3.*'           : ["M3", "C28"],
+    'LM3.*'             : [ "" ],  /* single core, any name can be used */
+    'Vayu'              : ["DSP1", "DSP2", "EVE1", "EVE2", "EVE3", "EVE4",
+                           "IPU1", "IPU2", "HOST"],
+};
+setDeviceAliases(procNames, deviceAliases);
+
+/*
+ *  ======== hostNeedsSlaveData =======
+ */
+var hostNeedsSlaveData = {
+    'TMS320TI816X'      : 1,
+    'OMAP3530'          : 1,
+    'OMAP4430'          : 1,
+    'TMS320CDM6446'     : 1,
+    'TMS320DA830'       : 1,
+    'OMAPL138'          : 1,
+    'Vayu'              : 1,
+};
+setDeviceAliases(hostNeedsSlaveData, deviceAliases);
+
+/*
+ *  ======== sr0MemorySetup =======
+ *  The devices in this list means these devices have a slave mmu
+ *  that needs to be configured by the host before the slave can proceed.
+ */
+var sr0MemorySetup = {
+    'TMS320TI816X'      : 1,
+    'OMAP3530'          : 1,
+    'OMAP4430'          : 1,
+};
+setDeviceAliases(sr0MemorySetup, deviceAliases);
+
+/*
+ *  ======== hostProcNames =======
+ *  The name of the host or master processor.
+ */
+var hostProcNames = {
+    'TMS320CDM6446'     : ["HOST"],
+    'TMS320DA830'       : ["HOST"],
+    'OMAPL138'          : ["HOST"],
+    'TMS320TI816X'      : ["HOST"],
+    'OMAP3530'          : ["HOST"],
+    'OMAP4430'          : ["HOST"],
+    'TMS320C6678'       : ["CORE0"],
+    'TMS320C6670'       : ["CORE0"],
+    'TMS320C6472'       : ["CORE0"],
+    'TMS320C6474'       : ["CORE0"],
+    'F28M3.*'           : ["M3"],
+    'TMS320TCI6634'     : ["CORE0"],
+    'TMS320TCI6636'     : ["HOST0"],
+    'TMS320TCI6638'     : ["HOST0"],
+    'Kepler'            : ["HOST"],
+};
+setDeviceAliases(hostProcNames, deviceAliases);
+
+/*
+ *  ======== nameServerRemoteDelegates ========
+ */
+var nameServerRemoteDelegates = {
+    'OMAP3530'          : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320CDM6446'     : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320DA830'       : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320TI816X'      : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320C6678'       : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320C6670'       : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320C6472'       : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320C6474'       : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'OMAP4430'          : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'Arctic'            : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'F28M3.*'           : { del: 'ti.sdo.ipc.family.f28m35x.NameServerBlock', },
+    'Vayu'              : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+    'TMS320TCI6634'     : { del: 'ti.sdo.ipc.nsremote.NameServerRemoteNotify',},
+};
+setDeviceAliases(nameServerRemoteDelegates, deviceAliases);
+
+/*
+ *  ======== notifySetupDelegates ========
+ */
+var notifySetupDelegates = {
+    'OMAP3530'          : { del: 'ti.sdo.ipc.family.omap3530.NotifySetup', },
+    'TMS320CDM6446'     : { del: 'ti.sdo.ipc.family.dm6446.NotifySetup', },
+    'TMS320DA830'       : { del: 'ti.sdo.ipc.family.da830.NotifySetup', },
+    'TMS320TI816X'      : { del: 'ti.sdo.ipc.family.ti81xx.NotifySetup', },
+    'TMS320C6A8149'     : { del: 'ti.sdo.ipc.family.c6a8149.NotifySetup', },
+    'TMS320C6678'       : { del: 'ti.sdo.ipc.family.c647x.NotifySetup', },
+    'TMS320C6670'       : { del: 'ti.sdo.ipc.family.c647x.NotifySetup', },
+    'TMS320C6472'       : { del: 'ti.sdo.ipc.family.c647x.NotifySetup', },
+    'TMS320C6474'       : { del: 'ti.sdo.ipc.family.c647x.NotifySetup', },
+    'TMS320TCI6634'     : { del: 'ti.sdo.ipc.family.tci663x.NotifyCircSetup', },
+    'OMAP4430'          : { del: 'ti.sdo.ipc.family.omap4430.NotifySetup', },
+    'Arctic'            : { del: 'ti.sdo.ipc.family.arctic.NotifyCircSetup', },
+    'F28M3.*'           : { del: 'ti.sdo.ipc.notifyDrivers.NotifySetupNull', },
+    'LM3.*'             : { del: 'ti.sdo.ipc.notifyDrivers.NotifySetupNull', },
+    'Vayu'              : { del: 'ti.sdo.ipc.family.vayu.NotifySetup', },
+
+};
+setDeviceAliases(notifySetupDelegates, deviceAliases);
+
+/*
+ *  ======== messageQSetupDelegates ========
+ */
+var messageQSetupDelegates = {
+    'OMAP3530'          : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320CDM6446'     : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320DA830'       : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320TI816X'      : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320C6A8149'     : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320C6678'       : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320C6670'       : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320C6472'       : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320C6474'       : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'TMS320TCI6634'     : { del: 'ti.sdo.ipc.transports.TransportShmNotifySetup', },
+    'OMAP4430'          : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+    'Arctic'            : { del: 'ti.sdo.ipc.transports.TransportShmNotifySetup', },
+    'F28M3.*'           : { del: 'ti.sdo.ipc.transports.TransportNullSetup', },
+    'LM3.*'             : { del: 'ti.sdo.ipc.transports.TransportNullSetup', },
+    'Vayu'              : { del: 'ti.sdo.ipc.transports.TransportShmSetup', },
+};
+setDeviceAliases(messageQSetupDelegates, deviceAliases);
+
+/*
+ *  ======== interruptDelegates ========
+ */
+var interruptDelegates = {
+    'ti.catalog.arm' : {
+        'TMS320CDM6446' : { del: 'ti.sdo.ipc.family.dm6446.InterruptArm', },
+        'TMS320DA830'   : { del: 'ti.sdo.ipc.family.da830.InterruptArm', },
+        'OMAPL138'      : { del: 'ti.sdo.ipc.family.da830.InterruptArm', },
+    },
+    'ti.catalog.arm.cortexm3' : {
+        'TMS320TI816X'  : { del: 'ti.sdo.ipc.family.ti81xx.InterruptDucati', },
+        'TMS320C6A8149' : { del: 'ti.sdo.ipc.family.c6a8149.InterruptDucati', },
+        'OMAP4430'      : { del: 'ti.sdo.ipc.family.omap4430.InterruptDucati', },
+        'F28M3.*'       : { del: 'ti.sdo.ipc.family.f28m35x.InterruptM3', },
+    },
+    'ti.catalog.arm.cortexm4' : {
+        'Vayu'          : { del: 'ti.sdo.ipc.family.vayu.InterruptIpu', },
+    },
+    'ti.catalog.arm.cortexa8' : {
+        'TMS320TI816X'  : { del: 'ti.sdo.ipc.family.ti81xx.InterruptHost', },
+        'TMS320C6A8149' : { del: 'ti.sdo.ipc.family.c6a8149.InterruptHost', },
+        'OMAP3530'      : { del: 'ti.sdo.ipc.family.omap3530.InterruptHost', },
+    },
+    'ti.catalog.arm.cortexa15' : {
+        'Vayu'          : { del: 'ti.sdo.ipc.family.vayu.InterruptHost', },
+    },
+    'ti.catalog.c6000' : {
+        'OMAP3530'      : { del: 'ti.sdo.ipc.family.omap3530.InterruptDsp', },
+        'TMS320CDM6446' : { del: 'ti.sdo.ipc.family.dm6446.InterruptDsp', },
+        'TMS320DA830'   : { del: 'ti.sdo.ipc.family.da830.InterruptDsp', },
+        'OMAPL138'      : { del: 'ti.sdo.ipc.family.da830.InterruptDsp', },
+        'TMS320TI816X'  : { del: 'ti.sdo.ipc.family.ti81xx.InterruptDsp', },
+        'TMS320C6A8149' : { del: 'ti.sdo.ipc.family.c6a8149.InterruptDsp', },
+        'TMS320C6472'   : { del: 'ti.sdo.ipc.family.c647x.Interrupt', },
+        'TMS320C6474'   : { del: 'ti.sdo.ipc.family.c647x.Interrupt', },
+        'TMS320C6678'   : { del: 'ti.sdo.ipc.family.c647x.Interrupt', },
+        'TMS320C6670'   : { del: 'ti.sdo.ipc.family.c647x.Interrupt', },
+        'TMS320TCI6634' : { del: 'ti.sdo.ipc.family.tci663x.Interrupt', },
+
+        'OMAP4430'      : { del: 'ti.sdo.ipc.family.omap4430.InterruptDsp', },
+        'Arctic'        : { del: 'ti.sdo.ipc.family.arctic.InterruptDsp', },
+        'Vayu'          : { del: 'ti.sdo.ipc.family.vayu.InterruptDsp', },
+    },
+    'ti.catalog.arp32' : {
+        'TMS320C6A8149' : { del: 'ti.sdo.ipc.family.c6a8149.InterruptEve', },
+        'Arctic'        : { del: 'ti.sdo.ipc.family.arctic.InterruptArp32', },
+        'Vayu'          : { del: 'ti.sdo.ipc.family.vayu.InterruptArp32', },
+    },
+    'ti.catalog.c2800' : {
+        'F28M3.*'       : { del: 'ti.sdo.ipc.family.f28m35x.InterruptC28', },
+    },
+};
+for (var family in interruptDelegates) {
+    setDeviceAliases(interruptDelegates[family], deviceAliases);
+}
+setCatalogAliases(interruptDelegates, catalogAliases);
+
+/*
+ *  ======== spinlockDelegates ========
+ */
+var spinlockDelegates = {
+    'ti.catalog.arm.cortexm3' : {
+        'OMAP4430' : {
+            baseAddr:   0x4A0F6800,
+            numLocks:   32,
+        },
+        'TMS320TI816X' : {
+            baseAddr:   0x480CA800,
+            numLocks:   64,
+        },
+    },
+    'ti.catalog.arm.cortexm4' : {
+        'Vayu' : {
+            baseAddr:   0x4A0F6800,
+            numLocks:   32
+        },
+    },
+    'ti.catalog.arm.cortexa8' : {
+        'TMS320TI816X' : {
+            baseAddr:   0x480CA800,
+            numLocks:   64,
+        },
+    },
+    'ti.catalog.arm.cortexa15' : {
+        'Vayu' : {
+            baseAddr:   0x4A0F6800,
+            numLocks:   32
+        },
+    },
+    'ti.catalog.c6000' : {
+        'TMS320TI816X' : {
+            baseAddr:   0x080CA800,
+            numLocks:   64,
+        },
+        'OMAP4430' : {
+            baseAddr:   0x4A0F6800,
+            numLocks:   32,
+        },
+        'Arctic' : {
+            baseAddr:   0x480CA800,
+            numLocks:   64,
+        },
+        'Vayu' : {
+            baseAddr:   0x4A0F6800,
+            numLocks:   32
+        },
+    },
+    'ti.catalog.arp32' : {
+        /*     'TMS320C6A8149' : {
+                   baseAddr:   0x480CA800,
+                   numLocks:   64,
+               },
+       */
+        'Arctic' : {
+            baseAddr:   0x480CA800,
+            numLocks:   64,
+        },
+        'Vayu' : {
+            baseAddr:   0x4A0F6800,
+            numLocks:   32
+        },
+    }
+}
+for (var family in spinlockDelegates) {
+    setDeviceAliases(spinlockDelegates[family], deviceAliases);
+}
+setCatalogAliases(spinlockDelegates, catalogAliases);
+
+/*
+ *  ======== hwSemDelegates ========
+ */
+var hwSemDelegates = {
+    'ti.catalog.c6000' : {
+        'TMS320C6474' : {
+            baseAddr:   0x02B40100,
+            queryAddr:  0x02B40300,
+            numSems:    32,
+        },
+        'TMS320C6678' : {
+            baseAddr:   0x02640100,
+            queryAddr:  0x02640200,
+            numSems:    32,
+        },
+        'TMS320C6670' : {
+            baseAddr:   0x02640100,
+            queryAddr:  0x02640200,
+            numSems:    32,
+        },
+        'TMS320TCI6634' : {
+            baseAddr:   0x02640100,
+            queryAddr:  0x02640200,
+            numSems:    32,
+        },
+    },
+}
+for (var family in hwSemDelegates) {
+    setDeviceAliases(hwSemDelegates[family], deviceAliases);
+}
+setCatalogAliases(hwSemDelegates, catalogAliases);
+
+/*
+ *  ======== getGateHWSemSettings ========
+ */
+function getGateHWSemSettings()
+{
+    var errorString = "IPC does not have a default GateHWSem" +
+                      " delegate for the " + deviceName + " device!";
+    var catalogName = Program.cpu.catalogName;
+    var deviceName = deviceSupportCheck();
+
+    var errStr = "The device " + deviceName +
+        " does not support hardware semaphores!";
+
+    try {
+        var hwSemSettings = hwSemDelegates[catalogName][deviceName];
+    }
+    catch(e) {
+        throw new Error(errStr);
+    }
+
+    if (hwSemSettings == null) {
+        throw new Error(errStr);
+    }
+
+    return (hwSemSettings);
+}
+
+/*
+ *  ======== getGateHWSpinlockSettings ========
+ */
+function getGateHWSpinlockSettings()
+{
+    var errorString = "IPC does not have a default GateHWSpinlock" +
+                      " delegate for the " + deviceName + " device!";
+    var catalogName = Program.cpu.catalogName;
+    var deviceName = deviceSupportCheck();
+
+    var errStr = "The device " + deviceName +
+        " does not support hardware spinlocks!";
+
+    try {
+        var spinLockSettings = spinlockDelegates[catalogName][deviceName];
+    }
+    catch(e) {
+        throw new Error(errStr);
+    }
+
+    if (spinLockSettings == null) {
+        throw new Error(errStr);
+    }
+
+    return (spinLockSettings);
+}
+
+/*
+ *  ======== generateSlaveDataForHost ========
+ */
+function generateSlaveDataForHost()
+{
+    var deviceName = deviceSupportCheck();
+    var retval = hostNeedsSlaveData[deviceName];
+
+    /* A15 is the already the host no need to generate data */
+    if ((Program.cpu.catalogName == 'ti.catalog.arm.cortexa8') ||
+        (Program.cpu.catalogName == 'ti.catalog.arm.cortexa9') ||
+        (Program.cpu.catalogName == 'ti.catalog.arm.cortexa15')) {
+        return (false);
+    }
+
+    if (retval != null) {
+        return (true);
+    }
+
+    return (false);
+}
+
+/*
+ *  ======== getHostProcId ========
+ */
+function getHostProcId()
+{
+    var MultiProc = xdc.module("ti.sdo.utils.MultiProc");
+    var deviceName = deviceSupportCheck();
+    var hostProcName = hostProcNames[deviceName];
+
+    if (hostProcName == null) {
+        /* The device doesn't have a core that runs a hlos */
+        return (MultiProc.INVALIDID);
+    }
+
+    /*
+     *  If the device may run a hlos, return the corresponding core's MultiProc
+     *  id. MultiProc.INVALIDID will be returned if the core exists but isn't
+     *  being used in the application
+     */
+    return(MultiProc.getIdMeta(String(hostProcName)));
+}
+
+/*
+ *  ======== getIpcSR0Setup ========
+ */
+function getIpcSR0Setup()
+{
+    var deviceName = deviceSupportCheck();
+    var memorySetup = sr0MemorySetup[deviceName];
+
+    if (memorySetup == null) {
+        /* The device has memory available to it */
+        return (true);
+    }
+    else {
+        /* The device needs host to enable memory through mmu */
+        return (false);
+    }
+}
+
+/*
+ *  ======== getHWGate ========
+ */
+function getHWGate()
+{
+    var deviceName = deviceSupportCheck();
+    if (deviceName == "TMS320C6472" ||
+        deviceName == "TMS320CTCI6486") {
+        return ('ti.sdo.ipc.gates.GateAAMonitor');
+    }  
+    else if (deviceName == "TMS320C6A8149") { 
+        return ('ti.sdo.ipc.gates.GatePetersonN');
+    }
+    try {
+        this.getGateHWSpinlockSettings();
+        return ('ti.sdo.ipc.gates.GateHWSpinlock');
+    }
+    catch(e) {
+    }
+
+    try {
+        this.getGateHWSemSettings();
+        return ('ti.sdo.ipc.gates.GateHWSem');
+    }
+    catch(e) {
+    }
+
+    return('ti.sdo.ipc.gates.GatePeterson');
+}
+
+/*
+ *  ======== getDefaultInterruptDelegate ========
+ */
+function getDefaultInterruptDelegate()
+{
+    var catalogName = Program.cpu.catalogName;
+    var deviceName = deviceSupportCheck();
+
+    var delegate = interruptDelegates[catalogName][deviceName];
+
+    if (delegate == null) {
+        throw new Error ("IPC does not have a default Interrupt"
+            + " delegate for the " + deviceName + " device!");
+    }
+
+    return (delegate.del);
+}
+
+/*
+ *  ======== getNameServerRemoteDelegate ========
+ */
+function getNameServerRemoteDelegate()
+{
+    var deviceName = deviceSupportCheck();
+
+    var delegate = nameServerRemoteDelegates[deviceName];
+
+    if (delegate == null) {
+        delegate = { del: 'ti.sdo.utils.NameServerRemoteNull', };
+    }
+
+    return (delegate.del);
+}
+
+/*
+ *  ======== getNotifySetupDelegate ========
+ */
+function getNotifySetupDelegate()
+{
+    var deviceName = deviceSupportCheck();
+
+    var delegate = notifySetupDelegates[deviceName];
+
+    if (delegate == null) {
+        throw new Error ("IPC does not have a default NotifySetup"
+            + " delegate for the " + deviceName + " device!");
+    }
+
+    return (delegate.del);
+}
+
+/*
+ *  ======== getMessageQSetupDelegate ========
+ */
+function getMessageQSetupDelegate()
+{
+    var deviceName = deviceSupportCheck();
+
+    var delegate = messageQSetupDelegates[deviceName];
+
+    if (delegate == null) {
+        throw new Error ("IPC does not have a default MessageQ setup"
+            + " delegate for the " + deviceName + " device!");
+    }
+
+    return (delegate.del);
+}
+
+/*
+ *  ======== procInDevice ========
+ */
+function procInDevice(procName)
+{
+    var deviceName = deviceSupportCheck();
+    if (procNames[deviceName] == null) {
+        throw("The device (" + Program.cpu.deviceName +
+                       ") isn't supported by IPC");
+    }
+
+    /* Search through the procNames table */
+    for each (name in procNames[deviceName]) {
+        if (name == procName) {
+            return (true);
+        }
+    }
+
+    return (false);
+}
+
+/*
+ *  ======== getDeviceProcNames ========
+ */
+function getDeviceProcNames()
+{
+    var deviceName = deviceSupportCheck();
+    if (procNames[deviceName] == null) {
+        throw("The device (" + Program.cpu.deviceName +
+                       ") isn't supported by IPC");
+    }
+
+    return (procNames[deviceName]);
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/InterruptArp32.c b/packages/ti/sdo/ipc/family/arctic/InterruptArp32.c
new file mode 100644 (file)
index 0000000..1fa3cd6
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArp32.c ========
+ *  ARP32 mailbox based interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/family/arp32/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptArp32.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned mailboxes */
+#define DSP_TO_ARP32      0
+#define ARP32_TO_DSP      1
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M) (InterruptArp32_mailboxBaseAddr + 0x040 + (0x4 * M))
+#define MAILBOX_STATUS(M)  (InterruptArp32_mailboxBaseAddr + 0x0C0 + (0x4 * M))
+
+/* ARP32 registers */
+#define MBX_INTR_TO_ARP32 0
+#define MBX_INTR_TO_DSP 1
+
+#define MAILBOX_IRQSTATUS_CLR(INTR_NUM)  (InterruptArp32_mailboxBaseAddr + 0x104 + (INTR_NUM * 0x10))
+
+#define MAILBOX_IRQENABLE_SET(INTR_NUM)  (InterruptArp32_mailboxBaseAddr + 0x108 + (INTR_NUM * 0x10))
+
+#define MAILBOX_IRQENABLE_CLR(INTR_NUM)  (InterruptArp32_mailboxBaseAddr + 0x10C + (INTR_NUM * 0x10))
+
+#define ARP32INT           29
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptArp32_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptArp32_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    REG32(MAILBOX_IRQENABLE_SET(MBX_INTR_TO_ARP32)) = MAILBOX_REG_VAL(DSP_TO_ARP32);
+    Hwi_enableInterrupt(ARP32INT);
+}
+
+/*!
+ *  ======== InterruptArp32_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptArp32_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    REG32(MAILBOX_IRQENABLE_CLR(MBX_INTR_TO_ARP32)) = MAILBOX_REG_VAL(DSP_TO_ARP32);
+    Hwi_disableInterrupt(ARP32INT);
+}
+
+/*!
+ *  ======== InterruptArp32_intRegister ========
+ */
+Void InterruptArp32_intRegister(UInt16 remoteProcId,
+                                 IInterrupt_IntInfo *intInfo,
+                                 Fxn func, UArg arg)
+{
+    UInt        key;
+    Hwi_Params  hwiAttrs;
+    Error_Block eb;
+    InterruptArp32_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptArp32_arp32ProcId == MultiProc_self()),
+                   ti_sdo_ipc_Ipc_A_internal);
+
+    /* init error block */
+    Error_init(&eb);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptArp32_module->fxnTable);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptArp32_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptArp32_module->numPlugged++;
+    if (InterruptArp32_module->numPlugged == 1) {
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.arg = arg;
+        hwiAttrs.vectorNum = intInfo->intVectorId;
+
+        Hwi_create(ARP32INT,
+                  (Hwi_FuncPtr)InterruptArp32_intShmStub,
+                   &hwiAttrs,
+                   &eb);
+    }
+
+    /* enable the mailbox and Hwi */
+    InterruptArp32_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptArp32_intUnregister ========
+ */
+Void InterruptArp32_intUnregister(UInt16 remoteProcId,
+                                   IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    InterruptArp32_FxnTable *table;
+
+    /* Disable the mailbox interrupt source */
+    InterruptArp32_intDisable(remoteProcId, intInfo);
+
+    InterruptArp32_module->numPlugged--;
+    if (InterruptArp32_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptArp32_module->fxnTable);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*!
+ *  ======== InterruptArp32_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptArp32_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    /* disable interrupts */
+    key = Hwi_disable();
+
+    if (REG32(MAILBOX_STATUS(ARP32_TO_DSP)) == 0) {
+        /* write the mailbox message to dsp */
+        REG32(MAILBOX_MESSAGE(ARP32_TO_DSP)) = arg;
+    }
+
+    /* restore interrupts */
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptArp32_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptArp32_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    /* disable interrupts */
+    key = Hwi_disable();
+
+    if (REG32(MAILBOX_STATUS(DSP_TO_ARP32)) == 0) {
+        /* write the mailbox message to arp32 */
+        REG32(MAILBOX_MESSAGE(DSP_TO_ARP32)) = arg;
+    }
+
+    /* restore interrupts */
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptArp32_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptArp32_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    /* DSP to ARP32 */
+    arg = REG32(MAILBOX_MESSAGE(DSP_TO_ARP32));
+
+    /* clear the dsp mailbox */
+    REG32(MAILBOX_IRQSTATUS_CLR(MBX_INTR_TO_ARP32)) = MAILBOX_REG_VAL(DSP_TO_ARP32);
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptArp32_intShmStub ========
+ */
+Void InterruptArp32_intShmStub(UArg arg)
+{
+    InterruptArp32_FxnTable *table;
+
+    if ((REG32(MAILBOX_IRQENABLE_SET(MBX_INTR_TO_ARP32)) &
+        MAILBOX_REG_VAL(DSP_TO_ARP32)) &&
+        REG32(MAILBOX_STATUS(DSP_TO_ARP32)) != 0) { /* DSP to ARP32 */
+        /* call function with arg */
+        table = &(InterruptArp32_module->fxnTable);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/InterruptArp32.xdc b/packages/ti/sdo/ipc/family/arctic/InterruptArp32.xdc
new file mode 100644 (file)
index 0000000..a75bdbb
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArp32.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptArp32 ========
+ *  ARP32 based interrupt manager
+ */
+
+module InterruptArp32 inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x4008B000;
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt arp32ProcId = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to be plugged for dsp-arp32 interrupts */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable;
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/InterruptArp32.xs b/packages/ti/sdo/ipc/family/arctic/InterruptArp32.xs
new file mode 100644 (file)
index 0000000..94602fb
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArp32.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Core        = null;
+var MultiProc   = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arp32.Hwi");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.arp32ProcId  = MultiProc.getIdMeta("ARP32");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    mod.fxnTable.func  = null;
+    mod.fxnTable.arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/InterruptDsp.c b/packages/ti/sdo/ipc/family/arctic/InterruptDsp.c
new file mode 100644 (file)
index 0000000..9debf4d
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Mailbox based interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned mailboxes */
+#define DSP_TO_ARP32      0
+#define ARP32_TO_DSP      1
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M)   (InterruptDsp_mailboxBaseAddr + 0x40 + (0x4 * M))
+#define MAILBOX_STATUS(M)    (InterruptDsp_mailboxBaseAddr + 0xC0 + (0x4 * M))
+
+#define MBX_INTR_TO_ARP32 0
+#define MBX_INTR_TO_DSP 1
+
+#define MAILBOX_IRQSTATUS_CLR(INTR_NUM)  (InterruptDsp_mailboxBaseAddr + 0x104 + ((INTR_NUM) * 0x10))
+
+#define MAILBOX_IRQENABLE_SET(INTR_NUM)  (InterruptDsp_mailboxBaseAddr + 0x108 + ((INTR_NUM) * 0x10))
+
+#define MAILBOX_IRQENABLE_CLR(INTR_NUM)  (InterruptDsp_mailboxBaseAddr + 0x10C + ((INTR_NUM) * 0x10))
+
+#define MAILBOX_EOI_REG             (InterruptDsp_mailboxBaseAddr + 0x140)
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    REG32(MAILBOX_IRQENABLE_SET(MBX_INTR_TO_DSP)) = MAILBOX_REG_VAL(ARP32_TO_DSP);
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    REG32(MAILBOX_IRQENABLE_CLR(MBX_INTR_TO_DSP)) = MAILBOX_REG_VAL(ARP32_TO_DSP);
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Hwi_Params  hwiAttrs;
+    Error_Block eb;
+    InterruptDsp_FxnTable *table;
+
+    Assert_isTrue(intInfo->intVectorId <= 15, ti_sdo_ipc_Ipc_A_internal);
+
+    /* init error block */
+    Error_init(&eb);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDsp_module->fxnTable);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptDsp_module->numPlugged++;
+    if (InterruptDsp_module->numPlugged == 1) {
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.arg = arg;
+        hwiAttrs.eventId = 90;
+
+        Hwi_create(intInfo->intVectorId,
+                   (Hwi_FuncPtr)InterruptDsp_intShmStub,
+                   &hwiAttrs,
+                   &eb);
+
+        /* enable the interrupt vector */
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+
+    /* Enable the mailbox interrupt to the DSP */
+    InterruptDsp_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    InterruptDsp_FxnTable *table;
+
+    /* Disable the mailbox interrupt source */
+    InterruptDsp_intDisable(remoteProcId, intInfo);
+
+    InterruptDsp_module->numPlugged--;
+    if (InterruptDsp_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptDsp_module->fxnTable);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     *
+     *  Note regarding possible race condition between local 'intSend' and
+     *  remote 'intClear':
+     *  It is possible that we we read the MAILBOX_MSGSTATUS_X register during
+     *  the remote side's intClear.  Therefore, we might choose _not_ to send
+     *  write to the mailbox even though the mailbox is about to be cleared a
+     *  few cycles later. In this case, the interrupt will be lost.
+     *  This is OK, however. intClear should always be called by the Notify
+     *  driver _before_ shared memory is read, so the event will be picked up
+     *  anyway by the previous interrupt that caused intClear to be called.
+     */
+    key = Hwi_disable();
+
+    if (REG32(MAILBOX_STATUS(DSP_TO_ARP32)) == 0) {
+        /* write the mailbox message to arp32 */
+        REG32(MAILBOX_MESSAGE(DSP_TO_ARP32)) = arg;
+    }
+
+    /* restore interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /* disable interrupts */
+    key = Hwi_disable();
+
+    if (REG32(MAILBOX_STATUS(ARP32_TO_DSP)) == 0) {
+        /* write the mailbox message to dsp */
+        REG32(MAILBOX_MESSAGE(ARP32_TO_DSP)) = arg;
+    }
+
+    /* restore interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    arg = REG32(MAILBOX_MESSAGE(ARP32_TO_DSP));
+
+    /* clear the dsp mailbox */
+    REG32(MAILBOX_IRQSTATUS_CLR(MBX_INTR_TO_DSP)) = MAILBOX_REG_VAL(ARP32_TO_DSP);
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intShmStub ========
+ */
+Void InterruptDsp_intShmStub(UArg arg)
+{
+    InterruptDsp_FxnTable *table;
+
+    if (((REG32(MAILBOX_IRQENABLE_SET(MBX_INTR_TO_DSP)) &
+        MAILBOX_REG_VAL(ARP32_TO_DSP)) &&
+        REG32(MAILBOX_STATUS(ARP32_TO_DSP))) != 0) {
+        /* call function with arg */
+        table = &(InterruptDsp_module->fxnTable);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/arctic/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..1136c72
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDsp ========
+ *  TI81xx/DSP interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x5908B000;
+
+internal:
+
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt arp32ProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable;
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/InterruptDsp.xs b/packages/ti/sdo/ipc/family/arctic/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..fbd3cb6
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xs ========
+ *
+ */
+
+var Hwi             = null;
+var Cache           = null;
+var MultiProc       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Cache       = xdc.useModule("ti.sysbios.family.c64p.Cache");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.arp32ProcId     = MultiProc.getIdMeta("ARP32");
+
+    /* must disable MAR89 which contains the mailbox registers */
+    if (Cache.MAR64_95 === undefined) {
+        Cache.MAR64_95 = 0;
+    }
+    else {
+        /* MAR89 is bit 25, must zero this bit */
+        Cache.MAR64_95 &= 0xFDFFFFFF;
+    }
+}
+
+function module$static$init(mod, params)
+{
+    mod.fxnTable.func  = null;
+    mod.fxnTable.arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..74fa880
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyCircParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverCirc_Params_init(&notifyCircParams);
+    notifyCircParams.sharedAddr = sharedAddr;
+    notifyCircParams.remoteProcId  = remoteProcId;
+
+    /* Set the intVectorId */
+    if (MultiProc_self() == NotifyCircSetup_dspProcId) {
+        notifyCircParams.intVectorId = NotifyCircSetup_dspIntVectId;
+    }
+    else {
+        notifyCircParams.intVectorId = NotifyCircSetup_arp32IntVectId;
+    }
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyCircParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverCirc_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params notifyCircParams;
+
+    NotifyDriverCirc_Params_init(&notifyCircParams);
+    notifyCircParams.sharedAddr = sharedAddr;
+
+    memReq = NotifyDriverCirc_sharedMemReq(&notifyCircParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..72ea5ad
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Notify setup proxy for ARP32
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on ARP32.
+ */
+
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+    /*!
+     *  Interrupt vector id for ARP32.
+     */
+    config UInt arp32IntVectId = 4;
+
+internal:
+
+    config UInt arp32ProcId     = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/arctic/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..ed0e4c2
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ *
+ */
+
+var NotifyDriverCirc = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifyCircSetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify           = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc        = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifyCircSetup  = this;
+
+    this.arp32ProcId   = MultiProc.getIdMeta("ARP32");
+    this.dspProcId   = MultiProc.getIdMeta("DSP");
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/NotifySetup.c b/packages/ti/sdo/ipc/family/arctic/NotifySetup.c
new file mode 100644 (file)
index 0000000..3cef06e
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    /* Set the intVectorId */
+    if (MultiProc_self() == NotifySetup_dspProcId) {
+        notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
+    }
+    else {
+        notifyShmParams.intVectorId = NotifySetup_arp32IntVectId;
+    }
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params notifyShmParams;
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+
+    memReq = NotifyDriverShm_sharedMemReq(&notifyShmParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/NotifySetup.xdc b/packages/ti/sdo/ipc/family/arctic/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..23dd319
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetup ========
+ *  Notify setup proxy for ARP32
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on ARP32.
+ */
+
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+    /*!
+     *  Interrupt vector id for ARP32.
+     */
+    config UInt arp32IntVectId = 4;
+
+internal:
+
+    config UInt arp32ProcId     = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/NotifySetup.xs b/packages/ti/sdo/ipc/family/arctic/NotifySetup.xs
new file mode 100644 (file)
index 0000000..5944d20
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifySetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifySetup     = this;
+
+    this.arp32ProcId  = MultiProc.getIdMeta("ARP32");
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/package.bld b/packages/ti/sdo/ipc/family/arctic/package.bld
new file mode 100644 (file)
index 0000000..02485de
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_674 = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptDsp",
+];
+
+var trgFilter_674 = {
+        field: "isa",
+        list: [ "674" ]
+};
+
+var objList_arp32 = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptArp32",
+];
+
+var trgFilter_arp32 = {
+        field: "isa",
+        list: [ "arp32" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, arguments);
+IpcBuild.buildLibs(objList_arp32, undefined, trgFilter_arp32, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, ["profile=smp"]);
+IpcBuild.buildLibs(objList_arp32, undefined, trgFilter_arp32, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/arctic/package.xdc b/packages/ti/sdo/ipc/family/arctic/package.xdc
new file mode 100644 (file)
index 0000000..eb56c6a
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.arctic ========
+ */
+package ti.sdo.ipc.family.arctic [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptArp32;
+}
diff --git a/packages/ti/sdo/ipc/family/arctic/package.xs b/packages/ti/sdo/ipc/family/arctic/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/Interrupt.c b/packages/ti/sdo/ipc/family/c647x/Interrupt.c
new file mode 100644 (file)
index 0000000..a72939b
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.c ========
+ *  C647x based interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+#include <ti/sdo/ipc/family/c647x/MultiProcSetup.h>
+
+#include "package/internal/Interrupt.xdc.h"
+
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Interrupt_Module_startup ========
+ */
+Int Interrupt_Module_startup(Int phase)
+{
+    volatile UInt32 *kick0 = (volatile UInt32 *)Interrupt_KICK0;
+    volatile UInt32 *kick1 = (volatile UInt32 *)Interrupt_KICK1;
+    SharedRegion_Entry entry;
+    UInt16 procId = MultiProc_self();
+
+    /*
+     *  Wait for Startup to be done (if MultiProc id not yet set) because a
+     *  user fxn should set it
+     */
+    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
+        return (Startup_NOTDONE);
+    }
+
+    if (!Interrupt_enableKick) {
+        /* Do not unlock the kick registers */
+        return (Startup_DONE);
+    }
+
+    SharedRegion_getEntry(0, &entry);
+
+    /*
+     * Only write to the KICK registers if:
+     * - This core is the SR0 owner
+     * - There is no SR0 and this core has procId '0'
+     */
+    if ((entry.isValid && procId == entry.ownerProcId) ||
+        (!entry.isValid && procId == 0)) {
+        if (Interrupt_KICK0 && Interrupt_KICK1){
+            /* unlock the KICK mechanism in the Bootcfg MMRs if defined */
+            kick0[0] = 0x83e70b13;      /* must be written with this value */
+            kick1[0] = 0x95a4f1e0;      /* must be written with this value */
+        }
+    }
+
+    return (Startup_DONE);
+}
+
+/*
+ *  ======== Interrupt_intEnable ========
+ *  Enable interrupt
+ */
+Void Interrupt_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*
+ *  ======== Interrupt_intDisable ========
+ *  Disables interrupts
+ */
+Void Interrupt_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+/*
+ *  ======== Interrupt_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void Interrupt_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                           Fxn func, UArg arg)
+{
+    UInt key, i;
+    Hwi_Params hwiAttrs;
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    /* setup the function table using the same Hwi int */
+    Interrupt_module->args[remoteProcId] = arg;
+
+    /* Make sure the interrupt only gets plugged once */
+    Interrupt_module->numPlugged++;
+    if (Interrupt_module->numPlugged == 1) {
+        Interrupt_module->func = func;
+
+        /* Clear any pending interrupt */
+        for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+            Interrupt_intClear(i, NULL);
+        }
+
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+        hwiAttrs.arg         = arg;
+        hwiAttrs.eventId     = Interrupt_INTERDSPINT;
+
+        Hwi_create(intInfo->intVectorId,
+            (Hwi_FuncPtr)Interrupt_intShmStub, &hwiAttrs, NULL);
+
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== Interrupt_intUnregister ========
+ */
+Void Interrupt_intUnregister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+
+    Interrupt_module->numPlugged--;
+    if (Interrupt_module->numPlugged == 0) {
+        /* No need to disable interrupt: Hwi_delete takes care of this */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+
+        /* unset the function */
+        Interrupt_module->func = NULL;
+    }
+
+    /* Unset the function table */
+    Interrupt_module->args[remoteProcId] = 0;
+}
+
+/*
+ *  ======== Interrupt_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                       UArg arg)
+{
+    UInt32 val;
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+
+    /*
+     *  bit 0 is set to generate interrupt.
+     *  bits 4-7 is set to specify the interrupt generation source.
+     *  The convention is that bit 4 (SRCS0) is used for core 0,
+     *  bit 5 (SRCS1) for core 1, etc... .
+     */
+    val = (1 << (DNUM + Interrupt_SRCSx_SHIFT)) | 1;
+
+    ipcgr[MultiProcSetup_procMap[remoteProcId]] =  val;
+}
+
+/*
+ *  ======== Interrupt_intPost ========
+ *  Send interrupt to the remote processor
+ */
+Void Interrupt_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                       UArg arg)
+{
+    UInt32 val;
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+
+    /*
+     *  bit 0 is set to generate interrupt.
+     *  bits 4-7 is set to specify the interrupt generation source.
+     *  The convention is that bit 4 (SRCS0) is used for core 0,
+     *  bit 5 (SRCS1) for core 1, etc... .
+     */
+    val = (1 << (MultiProcSetup_procMap[srcProcId] + Interrupt_SRCSx_SHIFT)) | 1;
+
+    ipcgr[DNUM] =  val;
+}
+
+/*
+ *  ======== Interrupt_intClear ========
+ *  Acknowledge interrupt by clearing the corresponding source bit.
+ *  Does not clear the IFR bit by way of ICR write because that should
+ *  only be done during init time.
+ */
+UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+
+    ipcar[DNUM] =  (1 << (MultiProcSetup_procMap[remoteProcId] +
+            Interrupt_SRCSx_SHIFT));
+
+    return (0);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Interrupt_intShmStub ========
+ */
+Void Interrupt_intShmStub(UArg arg)
+{
+    Int i;
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt32 ipcarVal = ipcar[DNUM];
+
+    for (i = 0; i < ti_sdo_utils_MultiProc_numProcsInCluster; i++) {
+        if ((ipcarVal) & (1 << (MultiProcSetup_procMap[i +
+            MultiProc_getBaseIdOfCluster()]
+            + Interrupt_SRCSx_SHIFT))) {
+            Interrupt_module->func(Interrupt_module->args[i +
+                MultiProc_getBaseIdOfCluster()]);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/Interrupt.xdc b/packages/ti/sdo/ipc/family/c647x/Interrupt.xdc
new file mode 100644 (file)
index 0000000..684f806
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xdc ========
+ */
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== Interrupt ========
+ *  C647x/C667x based interrupt manager
+ */
+@ModuleStartup
+
+module Interrupt inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* @_nodoc */
+    metaonly struct InterruptDataStruct {
+        UInt    remoteCoreId;
+        String  isrFxn;
+        String  isrArg;
+        Bool    isFlagged;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Registered Interrupts',
+                    {
+                        type: ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInterruptsData',
+                        structName: 'InterruptDataStruct'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== enableKick ========
+     *  If set to 'true' IPC will unlock the KICK registers on C66x devices
+     *
+     *  IPC unlocks the KICK registers on the local core if (and only if) all
+     *  the following conditions are met:
+     *  - This configuration is set to 'true'
+     *  - SharedRegion #0 is valid and the local core is its owner
+     *  - SharedRegion #0 is not valid and the local core is CORE0
+     */
+    config Bool enableKick = true;
+
+internal:
+
+    /*! Shift value used for setting/identifying interrupt source */
+    const UInt SRCSx_SHIFT = 4;
+
+    /*! Ptr to the IPC Generation Registers */
+    config Ptr IPCGR0;
+
+    /*! Ptr to the IPC Acknowledgment Registers */
+    config Ptr IPCAR0;
+
+    /*! Ptr to the KICK0 Bootcfg Registers */
+    config Ptr KICK0;
+
+    /*! Ptr to the KICK1 Bootcfg Registers */
+    config Ptr KICK1;
+
+    /*! Inter-processor interrupt id (varies per device) */
+    config UInt INTERDSPINT;
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub function plugged as interrupt handler
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        Fxn    func;
+        UArg   args[];  /* One entry for each core */
+        UInt   numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/Interrupt.xs b/packages/ti/sdo/ipc/family/c647x/Interrupt.xs
new file mode 100644 (file)
index 0000000..e28954c
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ */
+
+var deviceSettings = {
+    'TMS320C6472' : {
+        IPCGR0:         0x02A80540,
+        IPCAR0:         0x02A80580,
+        KICK0:          0,
+        KICK1:          0,
+        INTERDSPINT:    84,
+    },
+    'TMS320C6474' : {
+        IPCGR0:         0x02880900,
+        IPCAR0:         0x02880940,
+        KICK0:          0,
+        KICK1:          0,
+        INTERDSPINT:    76,
+    },
+    'TMS320C6670' : {
+        IPCGR0:         0x02620240,
+        IPCAR0:         0x02620280,
+        KICK0:          0x02620038,
+        KICK1:          0x0262003C,
+        INTERDSPINT:    90,
+    },
+    'TMS320C6678' : {
+        IPCGR0:         0x02620240,
+        IPCAR0:         0x02620280,
+        KICK0:          0x02620038,
+        KICK1:          0x0262003C,
+        INTERDSPINT:    91,
+    },
+    'Kepler' : {
+        IPCGR0:         0x02620240,
+        IPCAR0:         0x02620280,
+        KICK0:          0x02620038,
+        KICK1:          0x0262003C,
+        INTERDSPINT:    90,
+    },
+}
+var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
+Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
+
+var Hwi;
+var Interrupt;
+var Ipc;
+var MultiProc;
+var SharedRegion;
+var MultiProcSetup;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    var settings = deviceSettings[Program.cpu.deviceName];
+
+    this.IPCGR0         = settings.IPCGR0;
+    this.IPCAR0         = settings.IPCAR0;
+    this.KICK0          = settings.KICK0;
+    this.KICK1          = settings.KICK1;
+    this.INTERDSPINT    = settings.INTERDSPINT;
+}
+
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Interrupt       = this;
+    Hwi             = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    MultiProcSetup  = xdc.useModule("ti.sdo.ipc.family.c647x.MultiProcSetup");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    var args = Interrupt.$object.args;
+    var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
+
+    /* The function table length should be the number of processors */
+    args.length = MultiProc.numProcessors;
+    for (var i = 0; i < args.length; i++) {
+        args[i] = 0;
+    }
+
+    mod.func = null;
+    mod.numPlugged = 0;
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInterruptsData ========
+ *  Module data view
+ */
+function viewInterruptsData(view)
+{
+    var Interrupt       = xdc.useModule('ti.sdo.ipc.family.c647x.Interrupt');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* Retrieve the module state. */
+    var rawView = Program.scanRawView('ti.sdo.ipc.family.c647x.Interrupt');
+    var mod = rawView.modState;
+    /* Retrieve the module configuration. */
+    var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.c647x.Interrupt');
+    var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+
+    var args = Program.fetchArray(Interrupt.args$fetchDesc,
+                                  mod.args,
+                                  MultiProcCfg.numProcessors);
+
+    var localId = MultiProc.self$view();
+
+    if (localId != MultiProc.INVALIDID) {
+        var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
+            $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
+    }
+
+    for (var i = 0; i < MultiProcCfg.numProcessors; i++) {
+        var entryView =
+                Program.newViewStruct('ti.sdo.ipc.family.c647x.Interrupt',
+                'Registered Interrupts');
+        entryView.remoteCoreId = i;
+        if (Number(mod.func) != 0) {
+            entryView.isrFxn =
+                    Program.lookupFuncName(Number(mod.func))[0];
+            entryView.isrArg = "0x" + Number(args[i]).toString(16);
+        }
+        else {
+            entryView.isrFxn = "(unplugged)";
+            entryView.isrArg = "";
+        }
+
+        if (localId != MultiProc.INVALIDID) {
+            var enableFlag = ipcar0[localId].elem;
+
+            if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
+                entryView.isFlagged = true;
+            }
+            else {
+                entryView.isFlagged = false;
+            }
+        }
+
+
+        view.elements.$add(entryView);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/MultiProcSetup.c b/packages/ti/sdo/ipc/family/c647x/MultiProcSetup.c
new file mode 100644 (file)
index 0000000..db4f15d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProcSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/family/c647x/Interrupt.h>
+#include <xdc/runtime/Assert.h>
+
+#include "package/internal/MultiProcSetup.xdc.h"
+
+/*!
+ *  ======== MultiProcSetup_init ========
+ */
+Void MultiProcSetup_init()
+{
+    extern cregister volatile UInt DNUM;
+    UInt16 procId;
+
+    /* Skip if the procId has already been set */
+    if (MultiProc_self() != MultiProc_INVALIDID) {
+        return;
+    }
+
+    procId = MultiProcSetup_getProcId(DNUM);
+
+    /*
+     *  Assert that image is being loaded onto a core that was included in the
+     *  MultiProc name list (via setConfig)
+     */
+    Assert_isTrue(procId != MultiProc_INVALIDID,
+            MultiProcSetup_A_invalidProcessor);
+
+    /* Set the local ID */
+    MultiProc_setLocalId(procId);
+}
+
+
+/*
+ *  ======== MultiProcSetup_getProcId ========
+ */
+UInt16 MultiProcSetup_getProcId(UInt coreId)
+{
+    UInt i;
+    for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+        if (MultiProcSetup_procMap[i] == coreId) {
+            return (i);
+        }
+    }
+
+    return (MultiProc_INVALIDID);
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/MultiProcSetup.xdc b/packages/ti/sdo/ipc/family/c647x/MultiProcSetup.xdc
new file mode 100644 (file)
index 0000000..ff76df5
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProcSetup.xdc ========
+ */
+
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== MultiProcSetup ========
+ */
+
+module MultiProcSetup
+{
+    /*!
+     * By default the MultiProcSetup module will set the ID at startup.
+     *
+     * By setting this flag to false, the initialization step is suppressed.
+     */
+    config Bool configureProcId = true;
+
+    /*!
+     *  Assert raised when the target core is not in the MultiProc name list
+     */
+    config Assert.Id A_invalidProcessor  = {
+        msg: "A_invalidProcessor: This core is not present in the MultiProc name list"
+    };
+
+    /*! ProcId -> CoreId mapping (indexed by procId) */
+    config UInt16 procMap[];
+
+internal:
+
+    /*!
+     *  ======== getProcId ========
+     *  Returns the MultiProc ID corresponding to a specific core
+     */
+    UInt16 getProcId(UInt coreId);
+
+    Void init();
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/MultiProcSetup.xs b/packages/ti/sdo/ipc/family/c647x/MultiProcSetup.xs
new file mode 100644 (file)
index 0000000..51e122f
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProcSetup.xs ========
+ */
+
+var MultiProcSetup  = null;
+var MultiProc       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    MultiProcSetup = this;
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /*
+     *  Only configure the local procId if the user hasn't disabled the config
+     *  and if the procId hasn't been statically set
+     */
+    if (MultiProcSetup.configureProcId == true &&
+            MultiProc.id == MultiProc.INVALIDID) {
+        var Startup = xdc.useModule('xdc.runtime.Startup');
+        Startup.firstFxns.$add(MultiProcSetup.init);
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+
+    /* The procMap is based upon the MuliProc id, init it here */
+    this.procMap.length = MultiProc.numProcessors;
+    for (var i = 0; i < this.procMap.length; i++) {
+        this.procMap[i] = -1;
+    }
+
+    /* Set the procMap based on the configured names in MultiProc.setConfig */
+    for (var i = MultiProc.baseIdOfCluster; i < MultiProc.baseIdOfCluster +
+        MultiProc.numProcsInCluster; i++) {
+
+        /* The nameList is based on an index */
+        if (MultiProc.nameList[i - MultiProc.baseIdOfCluster] == null) {
+            /* nameList is NULL, don't need to set the procMap */
+            break;
+        }
+
+        this.procMap[i] = Number(MultiProc.nameList[i -
+            MultiProc.baseIdOfCluster].substring("CORE".length));
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..f13509d
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include <xdc/runtime/Error.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* init params and set default values */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.intVectorId     = NotifyCircSetup_dspIntVectId;
+    notifyShmParams.sharedAddr      = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverCirc_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
+            &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+
+        return (Notify_E_FAIL);
+    }
+
+    return (Notify_S_SUCCESS);
+}
+
+/*!
+ * ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params params;
+
+    NotifyDriverCirc_Params_init(&params);
+    params.sharedAddr      = sharedAddr;
+    params.intVectorId     = NotifyCircSetup_dspIntVectId;
+    params.remoteProcId    = remoteProcId;
+
+    memReq = NotifyDriverCirc_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..a68a718
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/c647x/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..6a95ce1
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ *
+ */
+
+var NotifyCircSetup  = null;
+var MultiProc    = null;
+var MultiProcSetup = null;
+var Notify       = null;
+var NotifyDriverShm = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyCircSetup = this;
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.c647x.MultiProcSetup');
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/NotifySetup.c b/packages/ti/sdo/ipc/family/c647x/NotifySetup.c
new file mode 100644 (file)
index 0000000..e1cb1ec
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include <xdc/runtime/Error.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*!
+ *  ======== NotifySetup_attach ========
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* init params and set default values */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.intVectorId     = NotifySetup_dspIntVectId;
+    notifyShmParams.sharedAddr      = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
+            &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+
+        return (Notify_E_FAIL);
+    }
+
+    return (Notify_S_SUCCESS);
+}
+
+/*!
+ * ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params params;
+
+    NotifyDriverShm_Params_init(&params);
+    params.sharedAddr      = sharedAddr;
+    params.intVectorId     = NotifySetup_dspIntVectId;
+    params.remoteProcId    = remoteProcId;
+
+    memReq = NotifyDriverShm_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/NotifySetup.xdc b/packages/ti/sdo/ipc/family/c647x/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..a88552b
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== NotifySetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/NotifySetup.xs b/packages/ti/sdo/ipc/family/c647x/NotifySetup.xs
new file mode 100644 (file)
index 0000000..3c1e106
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifySetup  = null;
+var MultiProc    = null;
+var MultiProcSetup = null;
+var Notify       = null;
+var NotifyDriverShm = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifySetup = this;
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.c647x.MultiProcSetup');
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/package.bld b/packages/ti/sdo/ipc/family/c647x/package.bld
new file mode 100644 (file)
index 0000000..205e530
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_64P = [
+      "Interrupt",
+      "MultiProcSetup",
+      "NotifySetup",
+      "NotifyCircSetup",
+];
+
+var trgFilter_64P = {
+        field: "isa",
+        list: [ "64P", "64P_big_endian", "66" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_64P, undefined, trgFilter_64P, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_64P, undefined, trgFilter_64P, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/c647x/package.xdc b/packages/ti/sdo/ipc/family/c647x/package.xdc
new file mode 100644 (file)
index 0000000..0a01c6f
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.c647x ========
+ */
+package ti.sdo.ipc.family.c647x [1,0,0,0] {
+    module    Interrupt;
+    module    MultiProcSetup;
+    module    NotifySetup;
+    module    NotifyCircSetup;
+}
diff --git a/packages/ti/sdo/ipc/family/c647x/package.xs b/packages/ti/sdo/ipc/family/c647x/package.xs
new file mode 100644 (file)
index 0000000..ae45afa
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.c b/packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.c
new file mode 100644 (file)
index 0000000..5df7815
--- /dev/null
@@ -0,0 +1,463 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Mailbox based interrupt manager
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned mailbox users */
+#define DSP_TO_HOST      0
+#define DSP_TO_VIDEO     1
+#define DSP_TO_VPSS      2
+#define HOST_TO_DSP      3
+#define HOST_TO_VIDEO    4
+#define HOST_TO_VPSS     5
+#define VIDEO_TO_HOST    6
+#define VIDEO_TO_DSP     7
+#define VPSS_TO_HOST     8
+#define VPSS_TO_DSP      9
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M)   (InterruptDsp_mailboxBaseAddr + 0x40 + (0x4 * M))
+#define MAILBOX_STATUS(M)    (InterruptDsp_mailboxBaseAddr + 0xC0 + (0x4 * M))
+
+#define MAILBOX_IRQSTATUS_CLR_DSP   (InterruptDsp_mailboxBaseAddr + 0x114)
+#define MAILBOX_IRQENABLE_SET_DSP   (InterruptDsp_mailboxBaseAddr + 0x118)
+#define MAILBOX_IRQENABLE_CLR_DSP   (InterruptDsp_mailboxBaseAddr + 0x11C)
+#define MAILBOX_EOI_REG             (InterruptDsp_mailboxBaseAddr + 0x140)
+
+#define MAILBOX_DSPINT         56
+
+/* Assigned eve mailbox users */
+#define EVE_TO_HOST     0
+#define EVE_TO_DSP      1
+#define EVE_TO_VIDEO    2
+#define HOST_TO_EVE     3
+#define DSP_TO_EVE      4
+#define VIDEO_TO_EVE    5
+
+#define EVE_MAILBOX_MESSAGE(M)      (InterruptDsp_mailboxEveBaseAddr + 0x40 + (0x4 * M))
+#define EVE_MAILBOX_STATUS(M)       (InterruptDsp_mailboxEveBaseAddr + 0xC0 + (0x4 * M))
+
+#define EVE_MAILBOX_IRQSTATUS_CLR_DSP   (InterruptDsp_mailboxEveBaseAddr + 0x124)
+#define EVE_MAILBOX_IRQENABLE_SET_DSP   (InterruptDsp_mailboxEveBaseAddr + 0x128)
+#define EVE_MAILBOX_IRQENABLE_CLR_DSP   (InterruptDsp_mailboxEveBaseAddr + 0x12C)
+#define EVE_MAILBOX_EOI_REG             (InterruptDsp_mailboxEveBaseAddr + 0x140)
+
+#define EVE_MAILBOX_DSPINT      94
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_eveProcId) {
+        REG32(EVE_MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(EVE_TO_DSP);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_eveProcId) {
+        REG32(EVE_MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(EVE_TO_DSP);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*
+ *  ======== InterruptDsp_intRegister ========
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Int         index;
+    Hwi_Params  hwiAttrs;
+    Error_Block eb;
+    InterruptDsp_FxnTable *table;
+
+    Assert_isTrue(intInfo->intVectorId <= 15, ti_sdo_ipc_Ipc_A_internal);
+
+    /* init error block */
+    Error_init(&eb);
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        index = 2;
+    }
+    else if (remoteProcId == InterruptDsp_eveProcId) {
+        index = 3;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;     /* keep Coverity happy */
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    if (remoteProcId == InterruptDsp_eveProcId) {
+        /* This should be called only once */
+        /* Register interrupt for eve internal mailbox */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.arg     = arg;
+        hwiAttrs.eventId = EVE_MAILBOX_DSPINT;
+
+        Hwi_create(intInfo->intVectorId,
+                   (Hwi_FuncPtr)InterruptDsp_intEveShmStub,
+                   &hwiAttrs,
+                   &eb);
+
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+    else {
+        /* Make sure the interrupt only gets plugged once */
+        InterruptDsp_module->numPlugged++;
+
+        if (InterruptDsp_module->numPlugged == 1) {
+            /* Register interrupt for system mailbox */
+            Hwi_Params_init(&hwiAttrs);
+            hwiAttrs.arg     = arg;
+            hwiAttrs.eventId = MAILBOX_DSPINT;
+
+            Hwi_create(intInfo->intVectorId,
+                       (Hwi_FuncPtr)InterruptDsp_intShmStub,
+                       &hwiAttrs,
+                       &eb);
+
+            Hwi_enableInterrupt(intInfo->intVectorId);
+        }
+    }
+
+    /* Enable the mailbox interrupt to the DSP */
+    InterruptDsp_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    InterruptDsp_FxnTable *table;
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        index = 2;
+    }
+    else if (remoteProcId == InterruptDsp_eveProcId) {
+        index = 3;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;   /* keep Coverity happy */
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptDsp_intDisable(remoteProcId, intInfo);
+
+    if (remoteProcId == InterruptDsp_eveProcId) {
+        /* Delete the Hwi for eve internal mailbox */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+    else {
+        /* decrement numPlugged */
+        InterruptDsp_module->numPlugged--;
+
+        if (InterruptDsp_module->numPlugged == 0) {
+            /* Delete the Hwi for system mailbox */
+            hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+            Hwi_delete(&hwiHandle);
+        }
+    }
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = NULL;
+}
+
+/*
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     *
+     *  Note regarding possible race condition between local 'intSend' and
+     *  remote 'intClear':
+     *  It is possible that we we read the MAILBOX_MSGSTATUS_X register during
+     *  the remote side's intClear.  Therefore, we might choose _not_ to send
+     *  write to the mailbox even though the mailbox is about to be cleared a
+     *  few cycles later. In this case, the interrupt will be lost.
+     *  This is OK, however. intClear should always be called by the Notify
+     *  driver _before_ shared memory is read, so the event will be picked up
+     *  anyway by the previous interrupt that caused intClear to be called.
+     */
+    if (remoteProcId == InterruptDsp_hostProcId) { /* HOST */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) { /* VIDEO-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_VIDEO)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_VIDEO)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) { /* VPSS-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_VPSS)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_VPSS)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* EVE */
+        key = Hwi_disable();
+        if (REG32(EVE_MAILBOX_STATUS(DSP_TO_EVE)) == 0) {
+            REG32(EVE_MAILBOX_MESSAGE(DSP_TO_EVE)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptDsp_vpssProcId) { /* VPSS-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VPSS_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(VPSS_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptDsp_videoProcId) { /* VIDEO-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VIDEO_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(VIDEO_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptDsp_hostProcId) {  /* HOST */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* EVE */
+        key = Hwi_disable();
+        if (REG32(EVE_MAILBOX_STATUS(EVE_TO_DSP)) == 0) {
+            REG32(EVE_MAILBOX_MESSAGE(EVE_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptDsp_hostProcId) { /* HOST */
+        arg = REG32(MAILBOX_MESSAGE(HOST_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+
+        /* Write to EOI (End Of Interrupt) register */
+        REG32(MAILBOX_EOI_REG) = 0x1;
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) { /* VIDEO-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VIDEO_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+
+        /* Write to EOI (End Of Interrupt) register */
+        REG32(MAILBOX_EOI_REG) = 0x1;
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) { /* VPSS-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VPSS_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+
+        /* Write to EOI (End Of Interrupt) register */
+        REG32(MAILBOX_EOI_REG) = 0x1;
+    }
+    else { /* EVE */
+        arg = REG32(EVE_MAILBOX_MESSAGE(EVE_TO_DSP));
+        REG32(EVE_MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(EVE_TO_DSP);
+
+        /* Write to EOI (End Of Interrupt) register */
+        REG32(EVE_MAILBOX_EOI_REG) = 0x1;
+    }
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptDsp_intShmStub ========
+ */
+Void InterruptDsp_intShmStub(UArg arg)
+{
+    InterruptDsp_FxnTable *table;
+
+    /* Process messages from the HOST */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(HOST_TO_DSP))
+        && REG32(MAILBOX_STATUS(HOST_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VIDEO  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(VIDEO_TO_DSP))
+        && REG32(MAILBOX_STATUS(VIDEO_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VPSS  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(VPSS_TO_DSP))
+        && REG32(MAILBOX_STATUS(VPSS_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[2]);
+        (table->func)(table->arg);
+    }
+}
+
+/*
+ *  ======== InterruptDsp_intEveShmStub ========
+ */
+Void InterruptDsp_intEveShmStub(UArg arg)
+{
+    InterruptDsp_FxnTable *table;
+
+    /* Process messages from the EVE */
+    if ((REG32(EVE_MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(EVE_TO_DSP))
+        && REG32(EVE_MAILBOX_STATUS(EVE_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[3]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..03d9d8c
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDsp ========
+ *  TI81xx/DSP interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /*! @_nodoc */
+    metaonly struct InterruptDataView {
+        String      remoteProcName;
+        Bool        registered;
+        Bool        enabled;
+        Bool        intPending;
+        Ptr         payload;
+    };
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['IncomingInterrupts',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitInterrupt',
+                        structName: 'InterruptDataView'
+                    }
+                ],
+            ]
+        });
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x080C8000;
+
+    /* Base address for the EVE Mailbox */
+    config UInt32 mailboxEveBaseAddr = 0x5908B000;
+
+internal:
+
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId  = MultiProc.INVALIDID;
+    config UInt eveProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged for system mailbox
+     */
+    Void intShmStub(UArg arg);
+
+    /*!
+     *  ======== intEveShmStub ========
+     *  Stub to be plugged for EVE mailbox
+     */
+    Void intEveShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[4];
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.xs b/packages/ti/sdo/ipc/family/c6a8149/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..d08f092
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xs ========
+ */
+
+var Hwi             = null;
+var MultiProc       = null;
+var Cache           = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Cache       = xdc.useModule("ti.sysbios.family.c64p.Cache");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+    this.eveProcId      = MultiProc.getIdMeta("EVE");
+
+    /*
+     *  Disable MAR89 which contains the internal eve mailbox registers
+     *  This MAR bit is enabled by default because the eve internal DMEM
+     *  needs to be added to the platform memory map and any address space
+     *  in the memory map gets enabled in the cache.
+     */
+    if (Cache.MAR64_95 === undefined) {
+        Cache.MAR64_95 = 0;
+    }
+    else {
+        /* MAR89 is bit 25, must zero this bit */
+        Cache.MAR64_95 &= 0xFDFFFFFF;
+    }
+}
+
+function module$static$init(mod, params)
+{
+    /* HOST to DSP */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* VIDEO-M3 to DSP */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* VPSS-M3 to DSP */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    /* EVE to DSP */
+    mod.fxnTable[3].func  = null;
+    mod.fxnTable[3].arg   = 0;
+
+    mod.numPlugged = 0;
+}
+
+/*
+ *  ======== viewInitInterrupt ========
+ */
+function viewInitInterrupt(view)
+{
+    var InterruptDspModStr = "ti.sdo.ipc.family.ti81xx.InterruptDsp";
+    var Program             = xdc.useModule('xdc.rov.Program');
+    var InterruptDsp       = xdc.useModule(InterruptDspModStr);
+    var MultiProc           = xdc.useModule('ti.sdo.utils.MultiProc');
+    var MultiProcCfg        = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+    var InterruptDspCfg    = Program.getModuleConfig(InterruptDspModStr);
+    var ScalarStructs       = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var mod                 = Program.scanRawView(InterruptDspModStr).modState;
+
+    var remoteProcIds = [
+        /*
+         * [remoteProcId,
+         *  fxnTable index,
+         *  MBX# (from remote),
+         *  MBX# (to remote)]
+         */
+        [InterruptDspCfg.hostProcId, 0, 3, 0],
+        [InterruptDspCfg.videoProcId, 1, 7, 1],
+        [InterruptDspCfg.vpssProcId, 2, 9, 2]
+    ];
+
+    var MAILBOX_IRQSTATUS_CLR_DSP = (InterruptDspCfg.mailboxBaseAddr + 0x114);
+    var MAILBOX_IRQENABLE_SET_DSP = (InterruptDspCfg.mailboxBaseAddr + 0x118);
+    var MAILBOX_IRQENABLE_CLR_DSP = (InterruptDspCfg.mailboxBaseAddr + 0x11C);
+
+    function MAILBOX_MESSAGE(M) {
+        return (InterruptDspCfg.mailboxBaseAddr + 0x040 + (0x4 * M));
+    }
+
+    function MAILBOX_STATUS(M) {
+        return (InterruptDspCfg.mailboxBaseAddr + 0x0C0 + (0x4 * M));
+    }
+
+    function MAILBOX_REG_VAL(M) {
+        return (0x1 << (2 * M));
+    }
+
+    for each (procId in remoteProcIds) {
+        if (procId[0] != MultiProc.INVALIDID) {
+            var entryView = Program.newViewStruct(InterruptDspModStr,
+                    'IncomingInterrupts');
+            entryView.remoteProcName = MultiProc.getName$view(procId[0]) + " ("
+                    + procId[0] + ")";
+            entryView.registered = (Number(mod.fxnTable[procId[1]].func) != 0);
+            print(entryView.remoteProcName + ": " + mod.fxnTable[procId[1]].func);
+
+            var enabled = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_IRQENABLE_SET_DSP), false).elem;
+            entryView.enabled = ((enabled & MAILBOX_REG_VAL(procId[2])) != 0);
+
+            var intPending = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_STATUS(procId[2])), false).elem;
+            entryView.intPending = (intPending != 0);
+
+            entryView.payload = $addr(Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_MESSAGE(procId[2])), false).elem);
+
+            view.elements.$add(entryView);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.c b/packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.c
new file mode 100644 (file)
index 0000000..8ba3cd3
--- /dev/null
@@ -0,0 +1,644 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.c ========
+ *  Ducati/TI81xx based interupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/family/arm/m3/Hwi.h>
+#include <ti/sysbios/family/arm/ducati/Core.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptDucati.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/*
+ *  Ducati control register that maintains inter-core interrupt bits.
+ *
+ *  Using separate VIDEO and VPSS values to do 16-bit reads/writes
+ *  because we do not want to overwrite the other cores value.
+ */
+#define INTERRUPT_VIDEO           (InterruptDucati_ducatiCtrlBaseAddr)
+#define INTERRUPT_VPSS            (InterruptDucati_ducatiCtrlBaseAddr + 2)
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST      0
+#define DSP_TO_VIDEO     1
+#define DSP_TO_VPSS      2
+#define HOST_TO_DSP      3
+#define HOST_TO_VIDEO    4
+#define HOST_TO_VPSS     5
+#define VIDEO_TO_HOST    6
+#define VIDEO_TO_DSP     7
+#define VPSS_TO_HOST     8
+#define VPSS_TO_DSP      9
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M) (InterruptDucati_mailboxBaseAddr + 0x040 + (0x4 * M))
+#define MAILBOX_STATUS(M)  (InterruptDucati_mailboxBaseAddr + 0x0C0 + (0x4 * M))
+
+/* VIDEO registers */
+#define MAILBOX_IRQSTATUS_CLR_VIDEO    (InterruptDucati_mailboxBaseAddr + 0x124)
+#define MAILBOX_IRQENABLE_SET_VIDEO    (InterruptDucati_mailboxBaseAddr + 0x128)
+#define MAILBOX_IRQENABLE_CLR_VIDEO    (InterruptDucati_mailboxBaseAddr + 0x12C)
+
+/* VPSS registers */
+#define MAILBOX_IRQSTATUS_CLR_VPSS     (InterruptDucati_mailboxBaseAddr + 0x134)
+#define MAILBOX_IRQENABLE_SET_VPSS     (InterruptDucati_mailboxBaseAddr + 0x138)
+#define MAILBOX_IRQENABLE_CLR_VPSS     (InterruptDucati_mailboxBaseAddr + 0x13C)
+
+#define MAILBOX_M3VIDEOINT     53
+#define MAILBOX_M3DSSINT       54
+
+/* Assigned eve mailbox users */
+#define EVE_TO_HOST     0
+#define EVE_TO_DSP      1
+#define EVE_TO_VIDEO    2
+#define HOST_TO_EVE     3
+#define DSP_TO_EVE      4
+#define VIDEO_TO_EVE    5
+
+#define EVE_MAILBOX_MESSAGE(M)      (InterruptDucati_mailboxEveBaseAddr + 0x40 + (0x4 * M))
+#define EVE_MAILBOX_STATUS(M)       (InterruptDucati_mailboxEveBaseAddr + 0xC0 + (0x4 * M))
+
+#define EVE_MAILBOX_IRQSTATUS_CLR_VIDEO   (InterruptDucati_mailboxEveBaseAddr + 0x134)
+#define EVE_MAILBOX_IRQENABLE_SET_VIDEO   (InterruptDucati_mailboxEveBaseAddr + 0x138)
+#define EVE_MAILBOX_IRQENABLE_CLR_VIDEO   (InterruptDucati_mailboxEveBaseAddr + 0x13C)
+#define EVE_MAILBOX_EOI_REG               (InterruptDucati_mailboxEveBaseAddr + 0x140)
+
+#define EVE_MAILBOX_M3VIDEOINT  38
+
+#define M3INTERCOREINT          19
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptDucati_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDucati_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    /*
+     *  If the remote processor communicates via mailboxes, we should enable
+     *  the Mailbox IRQ instead of enabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_eveProcId) {
+            REG32(EVE_MAILBOX_IRQENABLE_SET_VIDEO) =
+                MAILBOX_REG_VAL(EVE_TO_VIDEO);
+        }
+        else {
+            Hwi_enableInterrupt(M3INTERCOREINT);
+        }
+    }
+    else {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            Hwi_enableInterrupt(M3INTERCOREINT);
+        }
+    }
+}
+
+/*
+ *  ======== InterruptDucati_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDucati_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    /*
+     *  If the remote processor communicates via mailboxes, we should disable
+     *  the Mailbox IRQ instead of disabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_eveProcId) {
+            REG32(EVE_MAILBOX_IRQENABLE_CLR_VIDEO) =
+                MAILBOX_REG_VAL(EVE_TO_VIDEO);
+        }
+        else {
+            Hwi_disableInterrupt(M3INTERCOREINT);
+        }
+    }
+    else {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            Hwi_disableInterrupt(M3INTERCOREINT);
+        }
+    }
+}
+
+/*
+ *  ======== InterruptDucati_intRegister ========
+ */
+Void InterruptDucati_intRegister(UInt16 remoteProcId,
+                                 IInterrupt_IntInfo *intInfo,
+                                 Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+    Int         index;
+    Error_Block eb;
+    InterruptDucati_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptDucati_videoProcId == MultiProc_self()) ||
+                  (InterruptDucati_vpssProcId == MultiProc_self()),
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /* init error block */
+    Error_init(&eb);
+
+    /*
+     *  VPSS-M3 & VIDEO-M3 each have a unique interrupt ID for receiving
+     *  interrupts external to the Ducati subsystem.
+     *  (M3DSSINT & MAILBOX_M3VIDEOINT).
+     *  However, they have a separate interrupt ID for receving interrupt from
+     *  each other(M3INTERCOREINT).
+     *
+     *  Store the interrupt id in the intInfo so it can be used during
+     *  intUnregiseter.
+     */
+    if (remoteProcId == InterruptDucati_dspProcId) {
+        index = 0;
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            intInfo->localIntId = MAILBOX_M3VIDEOINT;
+        }
+        else {
+            intInfo->localIntId = MAILBOX_M3DSSINT ;
+        }
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        index = 1;
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            intInfo->localIntId = MAILBOX_M3VIDEOINT;
+        }
+        else {
+            intInfo->localIntId = MAILBOX_M3DSSINT ;
+        }
+    }
+    else if (remoteProcId == InterruptDucati_eveProcId) {
+        index = 3;
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            intInfo->localIntId = EVE_MAILBOX_M3VIDEOINT;
+        }
+        else {
+            /* Core1 communication to EVE is not supported */
+            Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        }
+    }
+    else {
+        /* Going to the other M3 */
+        index = 2;
+        intInfo->localIntId = M3INTERCOREINT;
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDucati_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDucati_intClear(remoteProcId, intInfo);
+
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;
+
+    /* Make sure the interrupt only gets plugged once */
+    if (index == 0 || index == 1) {
+        InterruptDucati_module->numPlugged++;
+        if (InterruptDucati_module->numPlugged == 1) {
+            Hwi_create(intInfo->localIntId,
+                      (Hwi_FuncPtr)InterruptDucati_intShmMbxStub,
+                      &hwiAttrs,
+                      &eb);
+
+            /* Interrupt_intEnable won't enable the Hwi */
+            Hwi_enableInterrupt(intInfo->localIntId);
+        }
+    }
+    else if (index == 2) {
+        Hwi_create(intInfo->localIntId,
+                  (Hwi_FuncPtr)InterruptDucati_intShmDucatiStub,
+                  &hwiAttrs,
+                  &eb);
+    }
+    else {
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            Hwi_create(intInfo->localIntId,
+                      (Hwi_FuncPtr)InterruptDucati_intShmEveMbxStub,
+                      &hwiAttrs,
+                      &eb);
+
+            /* Interrupt_intEnable won't enable the Hwi */
+            Hwi_enableInterrupt(intInfo->localIntId);
+        }
+    }
+
+    InterruptDucati_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== InterruptDucati_intUnregister ========
+ */
+Void InterruptDucati_intUnregister(UInt16 remoteProcId,
+                                   IInterrupt_IntInfo *intInfo)
+{
+    Int         index;
+    InterruptDucati_FxnTable *table;
+    Hwi_Handle  hwiHandle;
+
+    if (remoteProcId == InterruptDucati_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptDucati_eveProcId) {
+        index = 3;
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* Core1 communication to EVE is not supported */
+            return;
+        }
+    }
+    else {
+        /* Going to the other M3 */
+        index = 2;
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptDucati_intDisable(remoteProcId, intInfo);
+
+    /* Disable the interrupt itself */
+    if (index == 0 || index == 1) {
+        /* case for DSP or HOST */
+        InterruptDucati_module->numPlugged--;
+        if (InterruptDucati_module->numPlugged == 0) {
+            hwiHandle = Hwi_getHandle(intInfo->localIntId);
+            Hwi_delete(&hwiHandle);
+        }
+    }
+    else if (index == 2) {
+        /* case for other M3 */
+        hwiHandle = Hwi_getHandle(M3INTERCOREINT);
+        Hwi_delete(&hwiHandle);
+    }
+    else {
+        /* case for EVE */
+        hwiHandle = Hwi_getHandle(intInfo->localIntId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptDucati_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*
+ *  ======== InterruptDucati_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDucati_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    if (remoteProcId == InterruptDucati_videoProcId ||
+        remoteProcId == InterruptDucati_vpssProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VPSS-M3 to VIDEO-M3 */
+            REG16(INTERRUPT_VIDEO) |= 0x1;
+        }
+        else {
+            /* VIDEO-M3 to VPSS-M3 */
+            REG16(INTERRUPT_VPSS) |= 0x1;
+        }
+    }
+    else if (remoteProcId == InterruptDucati_dspProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VPSS-M3 to DSP */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VPSS_TO_DSP)) == 0) {
+                REG32(MAILBOX_MESSAGE(VPSS_TO_DSP)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* VIDEO-M3 to DSP */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VIDEO_TO_DSP)) == 0) {
+                REG32(MAILBOX_MESSAGE(VIDEO_TO_DSP)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VPSS-M3 to HOST */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VPSS_TO_HOST)) == 0) {
+                REG32(MAILBOX_MESSAGE(VPSS_TO_HOST)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* VIDEO-M3 to HOST */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VIDEO_TO_HOST)) == 0) {
+                REG32(MAILBOX_MESSAGE(VIDEO_TO_HOST)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+    else {
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            /* VIDEO-M3 to EVE */
+            key = Hwi_disable();
+            if (REG32(EVE_MAILBOX_STATUS(VIDEO_TO_EVE)) == 0) {
+                REG32(EVE_MAILBOX_MESSAGE(VIDEO_TO_EVE)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+}
+
+
+/*
+ *  ======== InterruptDucati_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptDucati_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptDucati_videoProcId ||
+        srcProcId == InterruptDucati_vpssProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VIDEO-M3 to VPSS-M3 */
+            REG16(INTERRUPT_VPSS) |= 0x1;
+        }
+        else {
+            /* VPSS-M3 to VIDEO-M3 */
+            REG16(INTERRUPT_VIDEO) |= 0x1;
+        }
+    }
+    else if (srcProcId == InterruptDucati_dspProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* DSP to VPSS-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(DSP_TO_VPSS)) == 0) {
+                REG32(MAILBOX_MESSAGE(DSP_TO_VPSS)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* DSP to VIDEO-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(DSP_TO_VIDEO)) == 0) {
+                REG32(MAILBOX_MESSAGE(DSP_TO_VIDEO)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+    else if (srcProcId == InterruptDucati_hostProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* HOST to VPSS-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(HOST_TO_VPSS)) == 0) {
+                REG32(MAILBOX_MESSAGE(HOST_TO_VPSS)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* HOST to VIDEO-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(HOST_TO_VIDEO)) == 0) {
+                REG32(MAILBOX_MESSAGE(HOST_TO_VIDEO)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+    else {
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            /* EVE to VIDEO-M3 */
+            key = Hwi_disable();
+            if (REG32(EVE_MAILBOX_STATUS(EVE_TO_VIDEO)) == 0) {
+                REG32(EVE_MAILBOX_MESSAGE(EVE_TO_VIDEO)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+}
+
+
+/*
+ *  ======== InterruptDucati_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDucati_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptDucati_videoProcId ||
+        remoteProcId == InterruptDucati_vpssProcId) {
+        arg = REG32(InterruptDucati_ducatiCtrlBaseAddr);
+
+        /* Look at BIOS's ducati Core id */
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            if ((REG16(INTERRUPT_VIDEO) & 0x1) == 0x1) {
+                /* VPSS-M3 to VIDEO-M3 */
+                REG16(INTERRUPT_VIDEO) &= ~(0x1);
+            }
+        }
+        else {
+            if ((REG16(INTERRUPT_VPSS) & 0x1) == 0x1) {
+                /* VIDEO-M3 to VPSS-M3 */
+                REG16(INTERRUPT_VPSS) &= ~(0x1);
+            }
+        }
+    }
+    else if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            /* HOST to VIDEO-M3 */
+            arg = REG32(MAILBOX_MESSAGE(HOST_TO_VIDEO));
+            REG32(MAILBOX_IRQSTATUS_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            /* DSP to VIDEO-M3 */
+            arg = REG32(MAILBOX_MESSAGE(DSP_TO_VIDEO));
+            REG32(MAILBOX_IRQSTATUS_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            /* EVE to VIDEO-M3 */
+            arg = REG32(EVE_MAILBOX_MESSAGE(EVE_TO_VIDEO));
+            REG32(EVE_MAILBOX_IRQSTATUS_CLR_VIDEO) = MAILBOX_REG_VAL(EVE_TO_VIDEO);
+        }
+    }
+    else { /* M3DSSINT */
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            /* HOST to VPSS-M3 */
+            arg = REG32(MAILBOX_MESSAGE(HOST_TO_VPSS));
+            REG32(MAILBOX_IRQSTATUS_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            /* DSP to VPSS-M3 */
+            arg = REG32(MAILBOX_MESSAGE(DSP_TO_VPSS));
+            REG32(MAILBOX_IRQSTATUS_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            /* EVE cannot send an interrupt to VPSS-M3! */
+            Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+            arg = 0;    /* keep Coverity happy */
+        }
+    }
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptDucati_intShmDucatiStub ========
+ */
+Void InterruptDucati_intShmDucatiStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    table = &(InterruptDucati_module->fxnTable[2]);
+    (table->func)(table->arg);
+}
+
+/*
+ *  ======== InterruptDucati_intShmMbxStub ========
+ */
+Void InterruptDucati_intShmMbxStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if ((REG32(MAILBOX_IRQENABLE_SET_VIDEO) &
+                MAILBOX_REG_VAL(DSP_TO_VIDEO)) &&
+            REG32(MAILBOX_STATUS(DSP_TO_VIDEO)) != 0) { /* DSP to VIDEO-M3 */
+            table = &(InterruptDucati_module->fxnTable[0]);
+            (table->func)(table->arg);
+        }
+        if ((REG32(MAILBOX_IRQENABLE_SET_VIDEO) &
+                MAILBOX_REG_VAL(HOST_TO_VIDEO)) &&
+            REG32(MAILBOX_STATUS(HOST_TO_VIDEO)) != 0) { /* HOST to VIDEO-M3 */
+            table = &(InterruptDucati_module->fxnTable[1]);
+            (table->func)(table->arg);
+        }
+    }
+    else {
+        if ((REG32(MAILBOX_IRQENABLE_SET_VPSS) &
+                MAILBOX_REG_VAL(DSP_TO_VPSS)) &&
+             REG32(MAILBOX_STATUS(DSP_TO_VPSS)) != 0) { /* DSP to VPSS-M3 */
+            table = &(InterruptDucati_module->fxnTable[0]);
+            (table->func)(table->arg);
+        }
+        if ((REG32(MAILBOX_IRQENABLE_SET_VPSS) &
+                MAILBOX_REG_VAL(HOST_TO_VPSS)) &&
+            REG32(MAILBOX_STATUS(HOST_TO_VPSS)) != 0) { /* HOST to VPSS-M3 */
+            table = &(InterruptDucati_module->fxnTable[1]);
+            (table->func)(table->arg);
+        }
+    }
+}
+
+/*
+ *  ======== InterruptDucati_intShmEveMbxStub ========
+ */
+Void InterruptDucati_intShmEveMbxStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if ((REG32(EVE_MAILBOX_IRQENABLE_SET_VIDEO) &
+            MAILBOX_REG_VAL(EVE_TO_VIDEO)) &&
+            REG32(EVE_MAILBOX_STATUS(EVE_TO_VIDEO)) != 0) { /* EVE to VIDEO-M3 */
+            table = &(InterruptDucati_module->fxnTable[3]);
+            (table->func)(table->arg);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.xdc b/packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.xdc
new file mode 100644 (file)
index 0000000..d7deabd
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDucati ========
+ *  TI81xx/Ducati based interrupt manager
+ */
+
+module InterruptDucati inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x480C8000;
+
+    /* Base address for the Ducati CTRL register */
+    config UInt32 ducatiCtrlBaseAddr = 0x40001000;
+
+    /* Base address for the EVE Mailbox */
+    config UInt32 mailboxEveBaseAddr = 0x5908B000;
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId  = MultiProc.INVALIDID;
+    config UInt eveProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to be plugged for inter-ducati interrupts */
+    Void intShmDucatiStub(UArg arg);
+
+    /*! Stub to be plugged for system mailbox interrupts */
+    Void intShmMbxStub(UArg arg);
+
+    /*! Stub to be plugged for EVE mailbox interrupts */
+    Void intShmEveMbxStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[4];
+        UInt       numPlugged;
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.xs b/packages/ti/sdo/ipc/family/c6a8149/InterruptDucati.xs
new file mode 100644 (file)
index 0000000..417dd04
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Core        = null;
+var MultiProc   = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arm.m3.Hwi");
+    Core        = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.videoProcId  = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId   = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+    this.eveProcId    = MultiProc.getIdMeta("EVE");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    /* M3 to C674 */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* M3 to HOST */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* Inter-M3 interrupt */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    /* EVE to HOST */
+    mod.fxnTable[3].func  = null;
+    mod.fxnTable[3].arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptEve.c b/packages/ti/sdo/ipc/family/c6a8149/InterruptEve.c
new file mode 100644 (file)
index 0000000..1d08b21
--- /dev/null
@@ -0,0 +1,383 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptEve.c ========
+ *  EVE mailbox based interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/family/arp32/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptEve.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned eve mailbox users */
+#define EVE_TO_HOST     0
+#define EVE_TO_DSP      1
+#define EVE_TO_VIDEO    2
+#define HOST_TO_EVE     3
+#define DSP_TO_EVE      4
+#define VIDEO_TO_EVE    5
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M) (InterruptEve_mailboxEveBaseAddr + 0x040 + (0x4 * M))
+#define MAILBOX_STATUS(M)  (InterruptEve_mailboxEveBaseAddr + 0x0C0 + (0x4 * M))
+
+#define MAILBOX_IRQSTATUS_CLR_EVE  (InterruptEve_mailboxEveBaseAddr + 0x104)
+#define MAILBOX_IRQENABLE_SET_EVE  (InterruptEve_mailboxEveBaseAddr + 0x108)
+#define MAILBOX_IRQENABLE_CLR_EVE  (InterruptEve_mailboxEveBaseAddr + 0x10C)
+#define MAILBOX_EOI_REG            (InterruptEve_mailboxEveBaseAddr + 0x140)
+
+#define MAILBOX_EVEINT      29
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptEve_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptEve_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptEve_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_EVE) = MAILBOX_REG_VAL(HOST_TO_EVE);
+    }
+    else if (remoteProcId == InterruptEve_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_EVE) = MAILBOX_REG_VAL(VIDEO_TO_EVE);
+    }
+    else if (remoteProcId == InterruptEve_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_EVE) = MAILBOX_REG_VAL(DSP_TO_EVE);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*
+ *  ======== InterruptEve_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptEve_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptEve_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_EVE) = MAILBOX_REG_VAL(HOST_TO_EVE);
+    }
+    else if (remoteProcId == InterruptEve_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_EVE) = MAILBOX_REG_VAL(VIDEO_TO_EVE);
+    }
+    else if (remoteProcId == InterruptEve_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_EVE) = MAILBOX_REG_VAL(DSP_TO_EVE);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*
+ *  ======== InterruptEve_intRegister ========
+ */
+Void InterruptEve_intRegister(UInt16 remoteProcId,
+                              IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Int         index;
+    Hwi_Params  hwiAttrs;
+    Error_Block eb;
+    InterruptEve_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptEve_eveProcId == MultiProc_self()),
+                   ti_sdo_ipc_Ipc_A_internal);
+
+    /* init error block */
+    Error_init(&eb);
+
+    if (remoteProcId == InterruptEve_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptEve_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptEve_dspProcId) {
+        index = 2;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptEve_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptEve_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptEve_module->numPlugged++;
+    if (InterruptEve_module->numPlugged == 1) {
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.arg = arg;
+        hwiAttrs.vectorNum = intInfo->intVectorId;
+
+        Hwi_create(MAILBOX_EVEINT,
+                  (Hwi_FuncPtr)InterruptEve_intShmStub,
+                   &hwiAttrs,
+                   &eb);
+
+        Hwi_enableInterrupt(MAILBOX_EVEINT);
+    }
+
+    /* enable the mailbox and Hwi */
+    InterruptEve_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== InterruptEve_intUnregister ========
+ */
+Void InterruptEve_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    InterruptEve_FxnTable *table;
+
+    if (remoteProcId == InterruptEve_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptEve_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptEve_dspProcId) {
+        index = 2;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptEve_intDisable(remoteProcId, intInfo);
+
+    InterruptEve_module->numPlugged--;
+    if (InterruptEve_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptEve_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*
+ *  ======== InterruptEve_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptEve_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    if (remoteProcId == InterruptEve_hostProcId) {
+        /* disable interrupts */
+        key = Hwi_disable();
+
+        if (REG32(MAILBOX_STATUS(EVE_TO_HOST)) == 0) {
+            /* write the mailbox message to host */
+            REG32(MAILBOX_MESSAGE(EVE_TO_HOST)) = arg;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptEve_videoProcId) {
+        /* disable interrupts */
+        key = Hwi_disable();
+
+        if (REG32(MAILBOX_STATUS(EVE_TO_VIDEO)) == 0) {
+            /* write the mailbox message to video-m3 */
+            REG32(MAILBOX_MESSAGE(EVE_TO_VIDEO)) = arg;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(key);
+    }
+    else {
+        /* disable interrupts */
+        key = Hwi_disable();
+
+        if (REG32(MAILBOX_STATUS(EVE_TO_DSP)) == 0) {
+            /* write the mailbox message to dsp */
+            REG32(MAILBOX_MESSAGE(EVE_TO_DSP)) = arg;
+        }
+
+        /* restore interrupts */
+        key = Hwi_disable();
+    }
+}
+
+/*
+ *  ======== InterruptEve_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptEve_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                            UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptEve_hostProcId) {
+        /* disable interrupts */
+        key = Hwi_disable();
+
+        if (REG32(MAILBOX_STATUS(HOST_TO_EVE)) == 0) {
+            /* write the mailbox message to arp32 */
+            REG32(MAILBOX_MESSAGE(HOST_TO_EVE)) = arg;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptEve_videoProcId) {
+        /* disable interrupts */
+        key = Hwi_disable();
+
+        if (REG32(MAILBOX_STATUS(VIDEO_TO_EVE)) == 0) {
+            /* write the mailbox message to arp32 */
+            REG32(MAILBOX_MESSAGE(VIDEO_TO_EVE)) = arg;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(key);
+    }
+    else {
+        /* disable interrupts */
+        key = Hwi_disable();
+
+        if (REG32(MAILBOX_STATUS(DSP_TO_EVE)) == 0) {
+            /* write the mailbox message to arp32 */
+            REG32(MAILBOX_MESSAGE(DSP_TO_EVE)) = arg;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(key);
+    }
+}
+
+
+/*
+ *  ======== InterruptEve_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptEve_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptEve_hostProcId) { /* HOST */
+        arg = REG32(MAILBOX_MESSAGE(HOST_TO_EVE));
+        REG32(MAILBOX_IRQSTATUS_CLR_EVE) = MAILBOX_REG_VAL(HOST_TO_EVE);
+    }
+    else if (remoteProcId == InterruptEve_videoProcId) { /* VIDEO-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VIDEO_TO_EVE));
+        REG32(MAILBOX_IRQSTATUS_CLR_EVE) = MAILBOX_REG_VAL(VIDEO_TO_EVE);
+    }
+    else { /* DSP */
+        arg = REG32(MAILBOX_MESSAGE(DSP_TO_EVE));
+        REG32(MAILBOX_IRQSTATUS_CLR_EVE) = MAILBOX_REG_VAL(DSP_TO_EVE);
+    }
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptEve_intShmStub ========
+ */
+Void InterruptEve_intShmStub(UArg arg)
+{
+    InterruptEve_FxnTable *table;
+
+    /* Process messages from the HOST */
+    if ((REG32(MAILBOX_IRQENABLE_SET_EVE) & MAILBOX_REG_VAL(HOST_TO_EVE))
+        && REG32(MAILBOX_STATUS(HOST_TO_EVE)) != 0) {
+        table = &(InterruptEve_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VIDEO  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_EVE) & MAILBOX_REG_VAL(VIDEO_TO_EVE))
+        && REG32(MAILBOX_STATUS(VIDEO_TO_EVE)) != 0) {
+        table = &(InterruptEve_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from DSP  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_EVE) & MAILBOX_REG_VAL(DSP_TO_EVE))
+        && REG32(MAILBOX_STATUS(DSP_TO_EVE)) != 0) {
+        table = &(InterruptEve_module->fxnTable[2]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptEve.xdc b/packages/ti/sdo/ipc/family/c6a8149/InterruptEve.xdc
new file mode 100644 (file)
index 0000000..32d4cdd
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptEve.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptEve ========
+ *  ARP32 based interrupt manager
+ */
+
+module InterruptEve inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxEveBaseAddr = 0x4008B000;
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId  = MultiProc.INVALIDID;
+    config UInt eveProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to be plugged for interrupts */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[3]; /* HOST, VIDEO, DSP can communicate with EVE */
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptEve.xs b/packages/ti/sdo/ipc/family/c6a8149/InterruptEve.xs
new file mode 100644 (file)
index 0000000..0c0af7d
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptEve.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Core        = null;
+var MultiProc   = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arp32.Hwi");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+    this.eveProcId      = MultiProc.getIdMeta("EVE");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    /* HOST to EVE */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* VIDEO-M3 to EVE */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* DSP to EVE */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptHost.c b/packages/ti/sdo/ipc/family/c6a8149/InterruptHost.c
new file mode 100644 (file)
index 0000000..b27afaf
--- /dev/null
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.c ========
+ *  Mailbox based interrupt manager
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/family/arm/a8/intcps/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptHost.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST      0
+#define DSP_TO_VIDEO     1
+#define DSP_TO_VPSS      2
+#define HOST_TO_DSP      3
+#define HOST_TO_VIDEO    4
+#define HOST_TO_VPSS     5
+#define VIDEO_TO_HOST    6
+#define VIDEO_TO_DSP     7
+#define VPSS_TO_HOST     8
+#define VPSS_TO_DSP      9
+
+#define MAILBOX_MESSAGE(M)   (InterruptHost_mailboxBaseAddr + 0x040 + (0x4 * M))
+#define MAILBOX_STATUS(M)    (InterruptHost_mailboxBaseAddr + 0x0C0 + (0x4 * M))
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_IRQSTATUS_CLR_HOST  (InterruptHost_mailboxBaseAddr + 0x104)
+#define MAILBOX_IRQENABLE_SET_HOST  (InterruptHost_mailboxBaseAddr + 0x108)
+#define MAILBOX_IRQENABLE_CLR_HOST  (InterruptHost_mailboxBaseAddr + 0x10C)
+
+#define MAILBOX_HOSTINT        77
+
+/* Assigned eve mailbox users */
+#define EVE_TO_HOST     0
+#define EVE_TO_DSP      1
+#define EVE_TO_VIDEO    2
+#define HOST_TO_EVE     3
+#define DSP_TO_EVE      4
+#define VIDEO_TO_EVE    5
+
+#define EVE_MAILBOX_MESSAGE(M)      (InterruptHost_mailboxEveBaseAddr + 0x40 + (0x4 * M))
+#define EVE_MAILBOX_STATUS(M)       (InterruptHost_mailboxEveBaseAddr + 0xC0 + (0x4 * M))
+
+#define EVE_MAILBOX_IRQSTATUS_CLR_HOST   (InterruptHost_mailboxEveBaseAddr + 0x114)
+#define EVE_MAILBOX_IRQENABLE_SET_HOST   (InterruptHost_mailboxEveBaseAddr + 0x118)
+#define EVE_MAILBOX_IRQENABLE_CLR_HOST   (InterruptHost_mailboxEveBaseAddr + 0x11C)
+#define EVE_MAILBOX_EOI_REG              (InterruptHost_mailboxEveBaseAddr + 0x140)
+
+#define EVE_MAILBOX_HOSTINT     107
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptHost_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptHost_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptHost_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_eveProcId) {
+        REG32(EVE_MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(EVE_TO_HOST);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*
+ *  ======== InterruptHost_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptHost_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptHost_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_eveProcId) {
+        REG32(EVE_MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(EVE_TO_HOST);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*
+ *  ======== InterruptHost_intRegister ========
+ */
+Void InterruptHost_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Int         index;
+    Error_Block eb;
+    InterruptHost_FxnTable *table;
+
+    /* init error block */
+    Error_init(&eb);
+
+    if (remoteProcId == InterruptHost_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        index = 2;
+    }
+    else if (remoteProcId == InterruptHost_eveProcId) {
+        index = 3;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;   /* should never get here, but keep Coverity happy */
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptHost_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptHost_intClear(remoteProcId, intInfo);
+
+    if (remoteProcId == InterruptHost_eveProcId) {
+        /* Register interrupt for eve mailbox */
+        Hwi_create(EVE_MAILBOX_HOSTINT,
+                   (Hwi_FuncPtr)InterruptHost_intEveShmStub,
+                   NULL,
+                   &eb);
+
+        Hwi_enableInterrupt(EVE_MAILBOX_HOSTINT);
+    }
+    else {
+        /* Make sure the interrupt only gets plugged once */
+        InterruptHost_module->numPlugged++;
+
+        if (InterruptHost_module->numPlugged == 1) {
+            /* Register interrupt for system mailbox */
+            Hwi_create(MAILBOX_HOSTINT,
+                      (Hwi_FuncPtr)InterruptHost_intShmStub,
+                      NULL,
+                      &eb);
+
+            Hwi_enableInterrupt(MAILBOX_HOSTINT);
+        }
+    }
+
+    /* Enable the mailbox interrupt to the HOST core */
+    InterruptHost_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== InterruptHost_intUnregister ========
+ */
+Void InterruptHost_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    InterruptHost_FxnTable *table;
+
+    if (remoteProcId == InterruptHost_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        index = 2;
+    }
+    else if (remoteProcId == InterruptHost_eveProcId) {
+        index = 3;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;   /* should never get here, but keep Coverity happy */
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptHost_intDisable(remoteProcId, intInfo);
+
+    if (remoteProcId == InterruptHost_eveProcId) {
+        /* Delete the Hwi for eve internal mailbox */
+        hwiHandle = Hwi_getHandle(EVE_MAILBOX_HOSTINT);
+        Hwi_delete(&hwiHandle);
+    }
+    else {
+        /* decrement numPlugged */
+        InterruptHost_module->numPlugged--;
+
+        if (InterruptHost_module->numPlugged == 0) {
+            /* Delete the Hwi */
+            hwiHandle = Hwi_getHandle(MAILBOX_HOSTINT);
+            Hwi_delete(&hwiHandle);
+        }
+    }
+
+    table = &(InterruptHost_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = NULL;
+}
+
+/*
+ *  ======== InterruptHost_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptHost_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     *
+     *  Note regarding possible race condition between local 'intSend' and
+     *  remote 'intClear':
+     *  It is possible that we we read the MAILBOX_MSGSTATUS_X register during
+     *  the remote side's intClear.  Therefore, we might choose _not_ to send
+     *  write to the mailbox even though the mailbox is about to be cleared a
+     *  few cycles later. In this case, the interrupt will be lost.
+     *  This is OK, however. intClear should always be called by the Notify
+     *  driver _before_ shared memory is read, so the event will be picked up
+     *  anyway by the previous interrupt that caused intClear to be called.
+     */
+    if (remoteProcId == InterruptHost_dspProcId) { /* DSP */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) { /* VIDEO-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_VIDEO)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_VIDEO)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) { /* VPSS-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_VPSS)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_VPSS)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* EVE */
+        key = Hwi_disable();
+        if (REG32(EVE_MAILBOX_STATUS(HOST_TO_EVE)) == 0) {
+            REG32(EVE_MAILBOX_MESSAGE(HOST_TO_EVE)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*
+ *  ======== InterruptHost_intPost ========
+ */
+Void InterruptHost_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptHost_vpssProcId) { /* VPSS-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VPSS_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(VPSS_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptHost_videoProcId) { /* VIDEO-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VIDEO_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(VIDEO_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptHost_dspProcId) {  /* DSP */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* EVE */
+        key = Hwi_disable();
+        if (REG32(EVE_MAILBOX_STATUS(EVE_TO_HOST)) == 0) {
+            REG32(EVE_MAILBOX_MESSAGE(EVE_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*
+ *  ======== InterruptHost_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptHost_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptHost_dspProcId) { /* DSP */
+        arg = REG32(MAILBOX_MESSAGE(DSP_TO_HOST));
+        REG32(MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) { /* VIDEO-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VIDEO_TO_HOST));
+        REG32(MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) { /* VPSS-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VPSS_TO_HOST));
+        REG32(MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+    else { /* EVE */
+        arg = REG32(EVE_MAILBOX_MESSAGE(EVE_TO_HOST));
+        REG32(EVE_MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(EVE_TO_HOST);
+
+        /* Write to EOI (End Of Interrupt) register */
+        REG32(EVE_MAILBOX_EOI_REG) = 0x1;
+    }
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== InterruptHost_intShmStub ========
+ */
+Void InterruptHost_intShmStub(UArg arg)
+{
+    InterruptHost_FxnTable *table;
+
+    /* Process messages from the DSP */
+    if ((REG32(MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(DSP_TO_HOST))
+        && REG32(MAILBOX_STATUS(DSP_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VIDEO  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(VIDEO_TO_HOST))
+        && REG32(MAILBOX_STATUS(VIDEO_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VPSS  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(VPSS_TO_HOST))
+        && REG32(MAILBOX_STATUS(VPSS_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[2]);
+        (table->func)(table->arg);
+    }
+}
+
+/*
+ *  ======== InterruptHost_intEveShmStub ========
+ */
+Void InterruptHost_intEveShmStub(UArg arg)
+{
+    InterruptHost_FxnTable *table;
+
+    /* Process messages from the EVE */
+    if ((REG32(EVE_MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(EVE_TO_HOST))
+        && REG32(EVE_MAILBOX_STATUS(EVE_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[3]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptHost.xdc b/packages/ti/sdo/ipc/family/c6a8149/InterruptHost.xdc
new file mode 100644 (file)
index 0000000..a11e8dc
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptHost ========
+ *  TI81xx/A8 interrupt manager
+ */
+
+module InterruptHost inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /*! @_nodoc */
+    metaonly struct InterruptDataView {
+        String      remoteProcName;
+        Bool        registered;
+        Bool        enabled;
+        Bool        intPending;
+        Ptr         payload;
+    };
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['IncomingInterrupts',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitInterrupt',
+                        structName: 'InterruptDataView'
+                    }
+                ],
+            ]
+        });
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x480C8000;
+
+    /* Base address for the EVE Mailbox */
+    config UInt32 mailboxEveBaseAddr = 0x5908B000;
+
+internal:
+
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId   = MultiProc.INVALIDID;
+    config UInt eveProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged
+     */
+    Void intShmStub(UArg arg);
+
+    /*!
+     *  ======== intEveShmStub ========
+     *  Stub to be plugged for EVE mailbox
+     */
+    Void intEveShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[4];
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/InterruptHost.xs b/packages/ti/sdo/ipc/family/c6a8149/InterruptHost.xs
new file mode 100644 (file)
index 0000000..c1374bf
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xs ========
+ *
+ */
+
+var Hwi             = null;
+var Mmu             = null;
+var MultiProc       = null;
+var Ipc             = null;
+var SECTION_DESC_SHIFT = 20;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arm.a8.intcps.Hwi");
+    Mmu         = xdc.useModule("ti.sysbios.family.arm.a8.Mmu");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+    this.eveProcId      = MultiProc.getIdMeta("EVE");
+
+}
+
+function module$static$init(mod, params)
+{
+    /*
+     *  By default the internal eve mailbox registers are in a cacheable
+     *  region because the eve internal DMEM is part of the platform memory
+     *  map.  Add this code here to make the memory region non-cacheable.
+     */
+    var addr = this.mailboxEveBaseAddr
+    var attrs = {
+        type      : Mmu.FirstLevelDesc_SECTION,
+        bufferable: false,
+        cacheable:  false,
+        shareable:  false,
+        noexecute:  true,
+    };
+
+    Mmu.setFirstLevelDescMeta(addr, addr, attrs);
+
+    /* DSP to HOST */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* VIDEO-M3 to HOST */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* VPSS-M3 to HOST */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    /* EVE to HOST */
+    mod.fxnTable[3].func  = null;
+    mod.fxnTable[3].arg   = 0;
+
+    mod.numPlugged = 0;
+}
+
+/*
+ *  ======== viewInitInterrupt ========
+ */
+function viewInitInterrupt(view)
+{
+    var InterruptHostModStr = "ti.sdo.ipc.family.ti81xx.InterruptHost";
+    var Program             = xdc.useModule('xdc.rov.Program');
+    var InterruptHost       = xdc.useModule(InterruptHostModStr);
+    var MultiProc           = xdc.useModule('ti.sdo.utils.MultiProc');
+    var MultiProcCfg        = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+    var InterruptHostCfg    = Program.getModuleConfig(InterruptHostModStr);
+    var ScalarStructs       = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var mod                 = Program.scanRawView(InterruptHostModStr).modState;
+
+    var remoteProcIds = [
+        /*
+         * [remoteProcId,
+         *  fxnTable index,
+         *  MBX# (from remote),
+         *  MBX# (to remote)]
+         */
+        [InterruptHostCfg.dspProcId, 0, 0, 3],
+        [InterruptHostCfg.videoProcId, 1, 6, 4],
+        [InterruptHostCfg.vpssProcId, 2, 8, 5]
+    ];
+
+    var MAILBOX_IRQSTATUS_CLR_HOST = (InterruptHostCfg.mailboxBaseAddr + 0x104);
+    var MAILBOX_IRQENABLE_SET_HOST = (InterruptHostCfg.mailboxBaseAddr + 0x108);
+    var MAILBOX_IRQENABLE_CLR_HOST = (InterruptHostCfg.mailboxBaseAddr + 0x10C);
+
+    function MAILBOX_MESSAGE(M) {
+        return (InterruptHostCfg.mailboxBaseAddr + 0x040 + (0x4 * M));
+    }
+
+    function MAILBOX_STATUS(M) {
+        return (InterruptHostCfg.mailboxBaseAddr + 0x0C0 + (0x4 * M));
+    }
+
+    function MAILBOX_REG_VAL(M) {
+        return (0x1 << (2 * M));
+    }
+
+    for each (procId in remoteProcIds) {
+        if (procId[0] != MultiProc.INVALIDID) {
+            var entryView = Program.newViewStruct(InterruptHostModStr,
+                    'IncomingInterrupts');
+            entryView.remoteProcName = MultiProc.getName$view(procId[0]) + " ("
+                    + procId[0] + ")";
+            entryView.registered = (Number(mod.fxnTable[procId[1]].func) != 0);
+            print(entryView.remoteProcName + ": " + mod.fxnTable[procId[1]].func);
+
+            var enabled = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_IRQENABLE_SET_HOST), false).elem;
+            entryView.enabled = ((enabled & MAILBOX_REG_VAL(procId[2])) != 0);
+
+            var intPending = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_STATUS(procId[2])), false).elem;
+            entryView.intPending = (intPending != 0);
+
+            entryView.payload = $addr(Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_MESSAGE(procId[2])), false).elem);
+
+            view.elements.$add(entryView);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..46d4f1b
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyCircParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverCirc_Params_init(&notifyCircParams);
+    notifyCircParams.sharedAddr = sharedAddr;
+    notifyCircParams.remoteProcId  = remoteProcId;
+
+    /* Disable cache for inter-ducati NotifyDriverCirc instances */
+    if ((MultiProc_self() == NotifyCircSetup_vpssProcId &&
+         remoteProcId == NotifyCircSetup_videoProcId) ||
+        (MultiProc_self() == NotifyCircSetup_videoProcId &&
+         remoteProcId == NotifyCircSetup_vpssProcId)) {
+         notifyCircParams.cacheLineSize = 0;
+         notifyCircParams.cacheEnabled = FALSE;
+    }
+
+    /* Set the intVectorId if on the DSP */
+    if (MultiProc_self() == NotifyCircSetup_dspProcId) {
+        if (remoteProcId == NotifyCircSetup_eveProcId) {
+            notifyCircParams.intVectorId = NotifyCircSetup_dspIntVectIdForEve;
+        }
+        else {
+            notifyCircParams.intVectorId = NotifyCircSetup_dspIntVectId;
+        }
+    }
+
+    /* Set the intVectorId if on the EVE */
+    if (MultiProc_self() == NotifyCircSetup_eveProcId) {
+        notifyCircParams.intVectorId = NotifyCircSetup_eveIntVectId;
+    }
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyCircParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverCirc_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params notifyCircParams;
+
+    NotifyDriverCirc_Params_init(&notifyCircParams);
+    notifyCircParams.sharedAddr = sharedAddr;
+    /* Disable cache for inter-ducati NotifyDriverCirc instances */
+    if ((MultiProc_self() == NotifyCircSetup_vpssProcId &&
+         remoteProcId == NotifyCircSetup_videoProcId) ||
+        (MultiProc_self() == NotifyCircSetup_videoProcId &&
+        remoteProcId == NotifyCircSetup_vpssProcId)) {
+        notifyCircParams.cacheEnabled = FALSE;
+        notifyCircParams.cacheLineSize = 0;
+    }
+
+    memReq = NotifyDriverCirc_sharedMemReq(&notifyCircParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 myId = MultiProc_self();
+
+    if (((myId == NotifyCircSetup_eveProcId) &&
+        (remoteProcId == NotifyCircSetup_vpssProcId)) ||
+        ((myId == NotifyCircSetup_vpssProcId) &&
+        (remoteProcId == NotifyCircSetup_eveProcId))) {
+        return (0);
+    }
+
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..abe0193
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Notify setup proxy for TI81xx
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on TI81xx.
+ */
+
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for C6A8149/DSP system mailbox.
+     */
+    config UInt dspIntVectId = 5;
+
+    /*!
+     *  Interrupt vector id for C6A8149/DSP eve mailbox.
+     */
+    config UInt dspIntVectIdForEve = 6;
+
+    /*!
+     *  Interrupt vector id for C6A8149/EVE.
+     */
+    config UInt eveIntVectId = 4;
+
+internal:
+
+    config UInt videoProcId     = MultiProc.INVALIDID;
+    config UInt vpssProcId      = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+    config UInt eveProcId       = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/c6a8149/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..f8b53d0
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ *
+ */
+
+var NotifyDriverCirc = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifyCircSetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifyCircSetup     = this;
+
+    this.videoProcId  = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId   = MultiProc.getIdMeta("VPSS-M3");
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+    this.eveProcId    = MultiProc.getIdMeta("EVE");
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c b/packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c
new file mode 100644 (file)
index 0000000..36d8c8f
--- /dev/null
@@ -0,0 +1,587 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== NotifyDriverMbx.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Hwi.h>
+#ifdef xdc_target__isaCompatible_v7M
+#include <ti/sysbios/family/arm/ducati/Core.h>
+#endif
+
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyDriverMbx.xdc.h"
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST         0
+#define DSP_TO_VIDEO        1
+#define DSP_TO_VPSS         2
+#define HOST_TO_DSP         3
+#define HOST_TO_VIDEO       4
+#define HOST_TO_VPSS        5
+#define VIDEO_TO_HOST       6
+#define VIDEO_TO_DSP        7
+#define VPSS_TO_HOST        8
+#define VPSS_TO_DSP         9
+#define VIDEO_TO_VPSS       10
+#define VPSS_TO_VIDEO       11
+
+#define MAILBOX_REG_VAL(M)            (0x1 << (2 * M))
+
+/* Register access method. */
+#define REG16(A)                      (*(volatile UInt16 *) (A))
+#define REG32(A)                      (*(volatile UInt32 *) (A))
+
+#define MAILBOX_FIFOLENGTH      4
+
+#define MAILBOX_MESSAGE(M) \
+        (NotifyDriverMbx_mailboxBaseAddr + 0x40 + (0x4 * M))
+#define MAILBOX_FIFOSTATUS(M) \
+        (NotifyDriverMbx_mailboxBaseAddr + 0x80 + (0x4 * M))
+#define MAILBOX_STATUS(M) \
+        (NotifyDriverMbx_mailboxBaseAddr + 0xC0 + (0x4 * M))
+
+/* HOST registers */
+#define MAILBOX_IRQSTATUS_CLR_HOST    (NotifyDriverMbx_mailboxBaseAddr + 0x104)
+#define MAILBOX_IRQENABLE_SET_HOST    (NotifyDriverMbx_mailboxBaseAddr + 0x108)
+#define MAILBOX_IRQENABLE_CLR_HOST    (NotifyDriverMbx_mailboxBaseAddr + 0x10C)
+
+/* DSP registers */
+#define MAILBOX_IRQSTATUS_CLR_DSP     (NotifyDriverMbx_mailboxBaseAddr + 0x114)
+#define MAILBOX_IRQENABLE_SET_DSP     (NotifyDriverMbx_mailboxBaseAddr + 0x118)
+#define MAILBOX_IRQENABLE_CLR_DSP     (NotifyDriverMbx_mailboxBaseAddr + 0x11C)
+
+/* VIDEO registers */
+#define MAILBOX_IRQSTATUS_CLR_VIDEO   (NotifyDriverMbx_mailboxBaseAddr + 0x124)
+#define MAILBOX_IRQENABLE_SET_VIDEO   (NotifyDriverMbx_mailboxBaseAddr + 0x128)
+#define MAILBOX_IRQENABLE_CLR_VIDEO   (NotifyDriverMbx_mailboxBaseAddr + 0x12C)
+
+/* VPSS registers */
+#define MAILBOX_IRQSTATUS_CLR_VPSS    (NotifyDriverMbx_mailboxBaseAddr + 0x134)
+#define MAILBOX_IRQENABLE_SET_VPSS    (NotifyDriverMbx_mailboxBaseAddr + 0x138)
+#define MAILBOX_IRQENABLE_CLR_VPSS    (NotifyDriverMbx_mailboxBaseAddr + 0x13C)
+
+#define MAILBOX_EOI_REG               (NotifyDriverMbx_mailboxBaseAddr + 0x140)
+
+#define MBX(src, dst)                 (src##_TO_##dst)
+
+#define PROCID_HOST                   NotifyDriverMbx_hostProcId
+#define PROCID_VPSS                   NotifyDriverMbx_vpssProcId
+#define PROCID_VIDEO                  NotifyDriverMbx_videoProcId
+#define PROCID_DSP                    NotifyDriverMbx_dspProcId
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverMbx_Module_startup ========
+ */
+
+/* The INIT macro empties the mailbox that corresponds to 'src'-to-'dst' */
+#define INIT(src, dst)                                                  \
+    while (REG32(MAILBOX_STATUS(MBX(src, dst)))) {                      \
+        REG32(MAILBOX_MESSAGE(MBX(src, dst)));                          \
+    }                                                                   \
+    REG32(MAILBOX_IRQSTATUS_CLR_##dst)                                  \
+            = MAILBOX_REG_VAL(MBX(src, dst));
+
+Int NotifyDriverMbx_Module_startup(Int phase)
+{
+#if defined(xdc_target__isaCompatible_64)
+
+    INIT(HOST, DSP)
+    INIT(VIDEO, DSP)
+    INIT(VPSS, DSP)
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        INIT(DSP, VPSS)
+        INIT(HOST, VPSS)
+        INIT(VIDEO, VPSS)
+    }
+    else {
+        INIT(DSP, VIDEO)
+        INIT(HOST, VIDEO)
+        INIT(VPSS, VIDEO)
+    }
+
+#else
+    INIT(DSP, HOST)
+    INIT(VIDEO, HOST)
+    INIT(VPSS, HOST)
+
+#endif
+
+    return (Startup_DONE);
+}
+
+
+/*
+ **************************************************************
+ *                       Instance functions
+ **************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverMbx_Instance_init ========
+ */
+Void NotifyDriverMbx_Instance_init(NotifyDriverMbx_Object *obj,
+        const NotifyDriverMbx_Params *params)
+{
+    UInt        key;
+
+
+    /*
+     * Check whether remote proc ID has been set and isn't the same as the
+     * local proc ID
+     */
+    Assert_isTrue ((params->remoteProcId < MultiProc_getNumProcessors()) &&
+                   (params->remoteProcId != MultiProc_INVALIDID) &&
+                   (params->remoteProcId != MultiProc_self()),
+                   ti_sdo_ipc_Notify_A_internal);
+
+    if (params->remoteProcId >= MultiProc_getNumProcessors() ||
+        params->remoteProcId == MultiProc_INVALIDID) {
+        return;    /* keep Coverity happy */
+    }
+
+    obj->remoteProcId = params->remoteProcId;
+    obj->evtRegMask = 0;
+    obj->notifyHandle = NULL;
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    /* Store the driver handle so it can be retreived in the isr */
+    NotifyDriverMbx_module->drvHandles[obj->remoteProcId] = obj;
+
+    /* Enable the mailbox interrupt from the remote core */
+    NotifyDriverMbx_enable(obj);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== NotifyDriverMbx_Instance_finalize ========
+ */
+Void NotifyDriverMbx_Instance_finalize(NotifyDriverMbx_Object *obj)
+{
+    /* Disable the mailbox interrupt source */
+    NotifyDriverMbx_disable(obj);
+
+    NotifyDriverMbx_module->drvHandles[obj->remoteProcId] = NULL;
+}
+
+/*
+ *  ======== NotifyDriverMbx_registerEvent ========
+ */
+Void NotifyDriverMbx_registerEvent(NotifyDriverMbx_Object *obj,
+                                   UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Set the 'registered' bit */
+    SET_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverMbx_unregisterEvent ========
+ */
+Void NotifyDriverMbx_unregisterEvent(NotifyDriverMbx_Object *obj,
+                                     UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Clear the registered bit */
+    CLEAR_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverMbx_sendEvent ========
+ */
+/*
+ *  PUT_NOTIFICATION will spin waiting for enough room in the mailbox FIFO
+ *  to store the number of messages needed for the notification ('numMsgs').
+ *  If spinning is necesssary (i.e. if waitClear is TRUE and there isn't enough
+ *  room in the FIFO) then PUT_NOTIFICATION will allow pre-emption while
+ *  spinning.
+ *
+ *  PUT_NOTIFICATION needs to prevent another local thread from writing to the
+ *  same mailbox after the current thread has
+ *  1) determined that there is enough room to write the notification and
+ *  2) written the first of two messages to the mailbox.
+ *  This is needed to respectively prevent
+ *  1) both threads from incorrectly assuming there is enough space in the FIFO
+ *     for their own notifications
+ *  2) the interrupting thread from writing a notification between two
+ *     two messages that need to be successivly written by the preempted thread.
+ *  Therefore, the check for enough FIFO room and one/both mailbox write(s)
+ *  should all occur atomically (i.e. with interrupts disabled)
+ */
+#define PUT_NOTIFICATION(m)                                                 \
+        key = Hwi_disable();                                                \
+        while(MAILBOX_FIFOLENGTH - REG32(MAILBOX_STATUS(m)) < numMsgs) {    \
+            Hwi_restore(key);                                               \
+            if (!waitClear) {                                               \
+                return (Notify_E_FAIL);                                     \
+            }                                                               \
+            key = Hwi_disable();                                            \
+        };                                                                  \
+        REG32(MAILBOX_MESSAGE(m)) = eventId + smallPayload;                 \
+        if (smallPayload == 0xFFFFFFE0) {                                   \
+            REG32(MAILBOX_MESSAGE(m)) = payload;                            \
+        }                                                                   \
+        Hwi_restore(key);
+
+Int NotifyDriverMbx_sendEvent(NotifyDriverMbx_Object *obj,
+                              UInt32                 eventId,
+                              UInt32                 payload,
+                              Bool                   waitClear)
+{
+    UInt16 remoteProcId = obj->remoteProcId;
+    UInt key, numMsgs;
+    UInt32 smallPayload;
+
+    /* Decide if the payload is small enough to fit in the first mbx msg */
+    if (payload < 0x7FFFFFF) {
+        smallPayload = (payload << 5);
+        numMsgs = 1;
+    }
+    else {
+        smallPayload = 0xFFFFFFE0;
+        numMsgs = 2;
+    }
+
+#if defined(xdc_target__isaCompatible_64)
+    if (remoteProcId == NotifyDriverMbx_hostProcId) {
+        PUT_NOTIFICATION(DSP_TO_HOST)
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        PUT_NOTIFICATION(DSP_TO_VIDEO)
+    }
+    else {
+        PUT_NOTIFICATION(DSP_TO_VPSS)
+    }
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            PUT_NOTIFICATION(VPSS_TO_DSP)
+        }
+        else if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            PUT_NOTIFICATION(VPSS_TO_HOST)
+        }
+        else {
+            PUT_NOTIFICATION(VPSS_TO_VIDEO)
+        }
+    }
+    else {
+        if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            PUT_NOTIFICATION(VIDEO_TO_DSP)
+        }
+        else if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            PUT_NOTIFICATION(VIDEO_TO_HOST)
+        }
+        else {
+            PUT_NOTIFICATION(VIDEO_TO_VPSS)
+        }
+    }
+#else
+    if (remoteProcId == NotifyDriverMbx_dspProcId) {
+        PUT_NOTIFICATION(HOST_TO_DSP)
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        PUT_NOTIFICATION(HOST_TO_VIDEO)
+    }
+    else {
+        PUT_NOTIFICATION(HOST_TO_VPSS)
+    }
+#endif
+
+    return (Notify_S_SUCCESS);
+}
+
+/*
+ *  ======== NotifyDriverMbx_disable ========
+ */
+Void NotifyDriverMbx_disable(NotifyDriverMbx_Object *obj)
+{
+    UInt16 remoteProcId = obj->remoteProcId;
+
+#if defined(xdc_target__isaCompatible_64)
+    if (remoteProcId == NotifyDriverMbx_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(VIDEO_TO_VPSS);
+        }
+    }
+    else {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(VPSS_TO_VIDEO);
+        }
+    }
+#else
+    if (remoteProcId == NotifyDriverMbx_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+#endif
+}
+
+/*
+ *  ======== NotifyDriverMbx_enable ========
+ */
+Void NotifyDriverMbx_enable(NotifyDriverMbx_Object *obj)
+{
+    UInt16 remoteProcId = obj->remoteProcId;
+
+#if defined(xdc_target__isaCompatible_64)
+    if (remoteProcId == NotifyDriverMbx_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(VIDEO_TO_VPSS);
+        }
+    }
+    else {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(VPSS_TO_VIDEO);
+        }
+    }
+#else
+    if (remoteProcId == NotifyDriverMbx_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+#endif
+}
+
+/*
+ *  ======== NotifyDriverMbx_disableEvent ========
+ */
+Void NotifyDriverMbx_disableEvent(NotifyDriverMbx_Object *obj, UInt32 eventId)
+{
+    /* NotifyDriverMbx_disableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverMbx_A_notSupported);
+}
+
+/*
+ *  ======== NotifyDriverMbx_enableEvent ========
+ */
+Void NotifyDriverMbx_enableEvent(NotifyDriverMbx_Object *obj, UInt32 eventId)
+{
+    /* NotifyDriverMbx_enableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverMbx_A_notSupported);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverMbx_isr ========
+ */
+
+/*
+ *  Get a message from the mailbox.  The bottom 5 bits of the message
+ *  contains the eventId.  The top 27 bits of the message contains either
+ *  1) The payload if the payload is less than 0x7FFFFFF
+ *  2) 0x7FFFFFF otherwise
+ *  If the top 27 bits of the first message is 0x7FFFFFF, then the payload
+ *  is in the next mailbox message.
+ */
+#define GET_NOTIFICATION(dst, src)                                          \
+    if (REG32(MAILBOX_STATUS(MBX(src, dst)))) {                             \
+        numProcessed++;                                                     \
+        msg = REG32(MAILBOX_MESSAGE(MBX(src, dst)));                        \
+        eventId = (UInt16)(msg & 0x1F);                                     \
+        payload = msg >> 5;                                                 \
+        if (payload == 0x7FFFFFF) {                                         \
+            while(REG32(MAILBOX_STATUS(MBX(src, dst))) == 0);               \
+            payload = REG32(MAILBOX_MESSAGE(MBX(src, dst)));                \
+        }                                                                   \
+        REG32(MAILBOX_IRQSTATUS_CLR_##dst) =                                \
+                MAILBOX_REG_VAL(MBX(src, dst));                             \
+        obj = NotifyDriverMbx_module->drvHandles[PROCID_##src];             \
+        Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_internal);           \
+        if (TEST_BIT(obj->evtRegMask, eventId)) {                           \
+            ti_sdo_ipc_Notify_exec(obj->notifyHandle,                       \
+                                   eventId,                                 \
+                                   payload);                                \
+        }                                                                   \
+    }
+
+Void NotifyDriverMbx_isr(UArg arg)
+{
+    NotifyDriverMbx_Object *obj;
+    UInt32 msg, payload;
+    UInt16 eventId;
+    Int numProcessed;
+
+#if defined(xdc_target__isaCompatible_64)
+    do {
+        numProcessed = 0;
+        GET_NOTIFICATION(DSP, HOST)
+        GET_NOTIFICATION(DSP, VPSS)
+        GET_NOTIFICATION(DSP, VIDEO)
+    }
+    while (numProcessed != 0);
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+#elif defined(xdc_target__isaCompatible_v7M)
+    do {
+        numProcessed = 0;
+        if (!(BIOS_smpEnabled) && (Core_getId())) {
+            GET_NOTIFICATION(VPSS, HOST)
+            GET_NOTIFICATION(VPSS, DSP)
+            GET_NOTIFICATION(VPSS, VIDEO)
+        }
+        else {
+            GET_NOTIFICATION(VIDEO, HOST)
+            GET_NOTIFICATION(VIDEO, DSP)
+            GET_NOTIFICATION(VIDEO, VPSS)
+        }
+    }
+    while (numProcessed != 0);
+
+#else
+    do {
+        numProcessed = 0;
+        GET_NOTIFICATION(HOST, DSP)
+        GET_NOTIFICATION(HOST, VPSS)
+        GET_NOTIFICATION(HOST, VIDEO)
+    }
+    while (numProcessed != 0);
+
+#endif
+}
+
+/*
+ *  ======== NotifyDriverMbx_setNotifyHandle ========
+ */
+Void NotifyDriverMbx_setNotifyHandle(NotifyDriverMbx_Object *obj,
+                                     Ptr notifyHandle)
+{
+    /* Internally used, so no Assert needed */
+    obj->notifyHandle = (ti_sdo_ipc_Notify_Handle)notifyHandle;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.xdc b/packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.xdc
new file mode 100644 (file)
index 0000000..3f52012
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverMbx.xdc ================
+ */
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.interfaces.INotifyDriver;
+import ti.sdo.ipc.Notify;
+
+import ti.sysbios.hal.Hwi;
+
+import xdc.runtime.Assert;
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== NotifyDriverMbx ========
+ *  A TI81xx hardware mailbox based driver for the Notify Module.
+ *
+ *  This is a {@link ti.sdo.ipc.Notify} driver that uses hardware mailboxes to
+ *  transmit notifications to remote processors.
+ *
+ *  Unlike the Notify drivers available in the {@link ti.sdo.ipc.notifyDrivers}
+ *  package, this driver is not generic and will only work with the TI81xx
+ *  family of devices.
+ *
+ *  The driver uses no shared memory since the event IDs and payloads that
+ *  comprise notifications are transmitted via the hardware mailbox FIFO.  The
+ *  FIFO can hold up to 4 mailbox messages.  The number of notification that can
+ *  be stored in the FIFO depends on the sizes of the payloads being sent via
+ *  Notify_sendEvent.  If the payload is less than 0x7FFFFFF, then a single
+ *  message will be sent per notification.  Otherwise, if the payload is greater
+ *  than or equal to 0x7FFFFFF, two mailbox messages are needed to send the
+ *  notification.
+ *
+ *  The behavior of Notify_sendEvent when the FIFO is full depends on the value
+ *  of the 'waitClear' argument to the function.  If 'waitClear' is TRUE, then
+ *  Notify_sendEvent will spin waiting for enough room in the FIFO for the
+ *  notification before actually sending it.  If 'waitClear' is FALSE, then
+ *  Notify_sendEvent will return Notify_E_FAIL if there isn't enough room in the
+ *  FIFO to store the notification.
+ *
+ *  The Notify_[enable/disable]Event APIs are not supported by this driver.
+ *
+ */
+@InstanceFinalize
+@ModuleStartup
+module NotifyDriverMbx inherits ti.sdo.ipc.interfaces.INotifyDriver
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+        UInt        numIncomingPending;
+        UInt        numOutgoingPending;
+        String      incomingIntStatus;
+        String      outgoingIntStatus;
+        String      registeredEvents;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  Assert raised when trying to use Notify_[enable/disable]Event with
+     *  NotifyDriverMbx
+     */
+    config Assert.Id A_notSupported =
+        {msg: "A_notSupported: [enable/disable]Event not supported by NotifyDriverMbx"};
+
+
+    /*! Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x480C8000;
+
+    /*!
+     *  ======== intVectorId ========
+     *  Interrupt vector ID to be used by the driver.
+     *
+     *  This parameter is only used by the DSP core
+     */
+    config UInt intVectorId = ~1u;
+
+instance:
+
+    /*!
+     *  ======== remoteProcId ========
+     *  The MultiProc ID corresponding to the remote processor
+     */
+    config UInt16 remoteProcId = MultiProc.INVALIDID;
+
+internal:
+
+    config UInt16 dspProcId   = MultiProc.INVALIDID;
+    config UInt16 hostProcId  = MultiProc.INVALIDID;
+    config UInt16 videoProcId = MultiProc.INVALIDID;
+    config UInt16 vpssProcId  = MultiProc.INVALIDID;
+
+    /*!
+     *  Plugs the interrupt and executes the callback functions according
+     *  to event priority
+     */
+    Void isr(UArg arg);
+
+    /*! Instance state structure */
+    struct Instance_State {
+        Bits32           evtRegMask;     /* local event register mask        */
+        Notify.Handle    notifyHandle;   /* Handle to front-end object       */
+        UInt16           remoteProcId;   /* Remote MultiProc id              */
+    }
+
+    struct Module_State {
+        NotifyDriverMbx.Handle drvHandles[4];
+        Hwi.Object hwi;
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.xs b/packages/ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.xs
new file mode 100644 (file)
index 0000000..c8546d3
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverMbx.xs ================
+ */
+
+var NotifyDriverMbx = null;
+var MultiProc       = null;
+var Notify          = null;
+var Hwi             = null;
+var Core            = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverMbx = this;
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Hwi             = xdc.useModule("ti.sysbios.hal.Hwi");
+
+    if (Program.build.target.$name.match(/M3/)) {
+        Core = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
+    }
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+}
+
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    for (var i = 0; i < mod.drvHandles.length; i++) {
+        mod.drvHandles[i] = null;
+    }
+
+    if (Program.build.target.$name.match(/M3/)) {
+        if (Core.id == 0) {
+            Hwi.construct(mod.hwi, 53, NotifyDriverMbx.isr);
+        }
+        else {
+            Hwi.construct(mod.hwi, 54, NotifyDriverMbx.isr);
+        }
+    }
+    else if (Program.build.target.$name.match(/674/)) {
+        var hwiParams = new Hwi.Params();
+        hwiParams.eventId = 56;
+        /*
+         *  NotifyDriverMbx.intVectorId is typically set by the module that
+         *  creates the Notify driver (i.e. the Notify setup module)
+         */
+        Hwi.construct(mod.hwi, this.intVectorId, NotifyDriverMbx.isr,
+                hwiParams);
+    }
+    else if (Program.build.target.$name.match(/A8/)) {
+        Hwi.construct(mod.hwi, 77, NotifyDriverMbx.isr);
+    }
+    else {
+        throw("Invalid target: " + Program.build.target.$name);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  Assigned mailboxes.  Structure is:
+ *  var mailBoxMap = {
+ *      "SRC_PROC_0" : {
+ *          "DST_PROC_1" :  M(SRC_PROC_0_to_DST_PROC_1)
+ *          "DST_PROC_2",   M(SRC_PROC_0_to_DST_PROC_2)
+ *              :
+ *      },
+ *          :
+ *  }
+ */
+var mailboxMap = {
+    "DSP" : {
+        "HOST" :        0,
+        "VIDEO-M3" :    1,
+        "VPSS-M3" :     2,
+    },
+    "HOST" : {
+        "DSP" :         3,
+        "VIDEO-M3" :    4,
+        "VPSS-M3" :     5,
+    },
+    "VIDEO-M3" : {
+        "HOST" :        6,
+        "DSP" :         7,
+        "VPSS-M3" :     10,
+    },
+    "VPSS-M3" : {
+        "HOST" :        8,
+        "DSP" :         9,
+        "VIDEO-M3" :    11,
+    },
+}
+
+/* Used to access core-specific mailbox registers */
+var coreIds = {
+    "HOST" :            0,
+    "DSP" :             1,
+    "VIDEO-M3" :        2,
+    "VPSS-M3" :         3,
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.family.ti81xx.NotifyDriverMbx');
+    var NotifyModCfg    = Program.getModuleConfig('ti.sdo.ipc.Notify');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    /* view.registeredEvents */
+    var registeredEvents = [];
+    for (i = 0; i < NotifyModCfg.numEvents; i++) {
+        print("Checking event #" + i);
+        if (obj.evtRegMask & (1 << i)) {
+            print("registered!");
+            registeredEvents.push(i.toString());
+        }
+    }
+    view.registeredEvents = registeredEvents.join(", ");
+
+    /* view.numPending */
+    var localName = MultiProc.getName$view(MultiProc.self$view());
+    var remoteName = view.remoteProcName;
+
+    var M_in = mailboxMap[remoteName][localName];
+    var M_out = mailboxMap[localName][remoteName];
+
+    try {
+        var MAILBOX_STATUS_IN = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0xC0 + (0x4 * M_in), false);
+        var MAILBOX_STATUS_OUT = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0xC0 + (0x4 * M_out), false);
+        view.numIncomingPending = MAILBOX_STATUS_IN.elem;
+        view.numOutgoingPending = MAILBOX_STATUS_OUT.elem;
+    }
+    catch(e) {
+        throw(e);
+    }
+
+    /* view.intStatus */
+    try {
+        var MAILBOX_IRQENABLE_CLR_LOCAL = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0x10C + (0x10 * coreIds[localName]),
+                false);
+        if (MAILBOX_IRQENABLE_CLR_LOCAL.elem & (1 << 2 * M_in)) {
+            view.incomingIntStatus = "Enabled";
+        }
+        else {
+            view.incomingIntStatus = "Disabled";
+        }
+
+        var MAILBOX_IRQENABLE_CLR_REMOTE = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0x10C + (0x10 * coreIds[remoteName]),
+                false);
+        if (MAILBOX_IRQENABLE_CLR_REMOTE.elem & (1 << 2 * M_out)) {
+            view.outgoingStatus = "Enabled";
+        }
+        else {
+            view.outgoingStatus = "Disabled";
+        }
+    }
+    catch(e) {
+        throw(e);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c b/packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c
new file mode 100644 (file)
index 0000000..96a505c
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyMbxSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include "package/internal/NotifyMbxSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyMbxSetup_attach ========
+ */
+Int NotifyMbxSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverMbx_Params mbxDrvParams;
+    NotifyDriverMbx_Handle mbxDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverMbx_Params_init(&mbxDrvParams);
+    mbxDrvParams.remoteProcId = remoteProcId;
+    mbxDrvHandle = NotifyDriverMbx_create(&mbxDrvParams, &eb);
+    if (mbxDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverMbx_Handle_upCast(mbxDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverMbx_delete(&mbxDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifyMbxSetup_sharedMemReq ========
+ */
+SizeT NotifyMbxSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    return (0);
+}
+
+/*!
+ * ======== NotifyMbxSetup_numIntLines ========
+ */
+UInt16 NotifyMbxSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.xdc b/packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.xdc
new file mode 100644 (file)
index 0000000..d878de5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyMbxSetup.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+
+/*!
+ *  ======== NotifyMbxSetup ========
+ *  Notify setup proxy for NotifyDriverMbx on TI81XX
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notifications using {@link ti.sdo.ipc.family.ti81xx.NotifyDriverMbx}
+ *
+ *  Configure the {@link #dspIntVectId} module config to choose a non-default
+ *  interrupt vector ID on the TI81XX DSP core.
+ */
+
+module NotifyMbxSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for the DSP core on TI81XX.
+     */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    config UInt videoProcId     = MultiProc.INVALIDID;
+    config UInt vpssProcId      = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.xs b/packages/ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.xs
new file mode 100644 (file)
index 0000000..5817755
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyMbxSetup.xs ========
+ */
+
+var Notify          = null;
+var MultiProc       = null;
+var NotifyMbxSetup  = null;
+var NotifyDriverMbx = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverMbx     = xdc.useModule('ti.sdo.ipc.family.ti81xx.NotifyDriverMbx');
+    Notify              = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc           = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifyMbxSetup      = this;
+
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+
+    NotifyDriverMbx.intVectorId = this.dspIntVectId;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifySetup.c b/packages/ti/sdo/ipc/family/c6a8149/NotifySetup.c
new file mode 100644 (file)
index 0000000..59897dd
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    /* Disable cache for inter-ducati NotifyDriverShm instances */
+    if ((MultiProc_self() == NotifySetup_vpssProcId &&
+         remoteProcId == NotifySetup_videoProcId) ||
+        (MultiProc_self() == NotifySetup_videoProcId &&
+         remoteProcId == NotifySetup_vpssProcId)) {
+         notifyShmParams.cacheLineSize = 0;
+         notifyShmParams.cacheEnabled = FALSE;
+    }
+
+    /* Set the intVectorId if on the DSP */
+    if (MultiProc_self() == NotifySetup_dspProcId) {
+        notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
+
+        if (remoteProcId == NotifySetup_eveProcId) {
+            notifyShmParams.intVectorId = NotifySetup_dspIntVectIdForEve;
+        }
+        else {
+            notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
+        }
+    }
+
+    /* Set the intVectorId if on the EVE */
+    if (MultiProc_self() == NotifySetup_eveProcId) {
+        notifyShmParams.intVectorId = NotifySetup_eveIntVectId;
+    }
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params notifyShmParams;
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    /* Disable cache for inter-ducati NotifyDriverShm instances */
+    if ((MultiProc_self() == NotifySetup_vpssProcId &&
+         remoteProcId == NotifySetup_videoProcId) ||
+        (MultiProc_self() == NotifySetup_videoProcId &&
+        remoteProcId == NotifySetup_vpssProcId)) {
+        notifyShmParams.cacheEnabled = FALSE;
+        notifyShmParams.cacheLineSize = 0;
+    }
+
+    memReq = NotifyDriverShm_sharedMemReq(&notifyShmParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 myId = MultiProc_self();
+
+    if (((myId == NotifySetup_eveProcId) &&
+        (remoteProcId == NotifySetup_vpssProcId)) ||
+        ((myId == NotifySetup_vpssProcId) &&
+        (remoteProcId == NotifySetup_eveProcId))) {
+        return (0);
+    }
+
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifySetup.xdc b/packages/ti/sdo/ipc/family/c6a8149/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..19015df
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetup ========
+ *  Notify setup proxy for C6A8149
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on C6A8149.
+ */
+
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for C6A8149/DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+    /*!
+     *  Interrupt vector id for C6A8149/DSP eve mailbox.
+     */
+    config UInt dspIntVectIdForEve = 6;
+
+    /*!
+     *  Interrupt vector id for C6A8149/EVE.
+     */
+    config UInt eveIntVectId = 4;
+
+internal:
+
+    config UInt videoProcId     = MultiProc.INVALIDID;
+    config UInt vpssProcId      = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+    config UInt eveProcId       = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/NotifySetup.xs b/packages/ti/sdo/ipc/family/c6a8149/NotifySetup.xs
new file mode 100644 (file)
index 0000000..f73aec6
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifySetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifySetup     = this;
+
+    this.videoProcId  = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId   = MultiProc.getIdMeta("VPSS-M3");
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+    this.eveProcId    = MultiProc.getIdMeta("EVE");
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/package.bld b/packages/ti/sdo/ipc/family/c6a8149/package.bld
new file mode 100644 (file)
index 0000000..6cb5e22
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_common = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "NotifyMbxSetup",
+      "NotifyDriverMbx",
+];
+
+var objList_674 = [
+      "InterruptDsp",
+].concat(objList_common);
+
+var trgFilter_674 = {
+        field: "isa",
+        list: [ "674" ]
+};
+
+var objList_m3 = [
+      "InterruptDucati",
+].concat(objList_common);
+
+var trgFilter_m3 = {
+        field: "isa",
+        list: [ "v7M" ]
+};
+
+var objList_a8f = [
+      "InterruptHost",
+].concat(objList_common);
+
+var trgFilter_a8f = {
+        field: "isa",
+        list: [ "v7A" ]
+};
+
+var objList_arp32 = [
+      "InterruptEve",
+].concat(objList_common);
+
+var trgFilter_arp32 = {
+        field: "isa",
+        list: [ "arp32" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, arguments);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, arguments);
+IpcBuild.buildLibs(objList_a8f, undefined, trgFilter_a8f, arguments);
+IpcBuild.buildLibs(objList_arp32, undefined, trgFilter_arp32, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, ["profile=smp"]);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, ["profile=smp"]);
+IpcBuild.buildLibs(objList_a8f, undefined, trgFilter_a8f, ["profile=smp"]);
+IpcBuild.buildLibs(objList_arp32, undefined, trgFilter_arp32, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/c6a8149/package.xdc b/packages/ti/sdo/ipc/family/c6a8149/package.xdc
new file mode 100644 (file)
index 0000000..602bec4
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.c6a8149 ========
+ */
+package ti.sdo.ipc.family.c6a8149 [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyMbxSetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptDucati;
+    module    InterruptHost;
+    module    InterruptEve;
+    module    NotifyDriverMbx;
+}
diff --git a/packages/ti/sdo/ipc/family/c6a8149/package.xs b/packages/ti/sdo/ipc/family/c6a8149/package.xs
new file mode 100644 (file)
index 0000000..7c16ec1
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== Package.validate ========
+ */
+function validate()
+{
+    if (!Program.build.target.$name.match(/M3/)) {
+        /* This validation only needs to be done for "M3" */
+        return;
+    }
+    var GateDualCore = xdc.module("ti.sysbios.family.arm.ducati.GateDualCore");
+    var Core         = xdc.module("ti.sysbios.family.arm.ducati.Core");
+    var MultiProc    = xdc.module("ti.sdo.utils.MultiProc");
+
+    /* Check for a mismatch between Core.id and MultiProc name */
+    if (MultiProc.nameList[MultiProc.id] == "VIDEO-M3" && Core.id != 0) {
+        Core.$logError("VIDEO-M3 application should have Core.id " +
+            " set to 0", Core, "id");
+    }
+
+    if (MultiProc.nameList[MultiProc.id] == "VPSS-M3") {
+        if (Core.id != 1) {
+            Core.$logError("VPSS-M3 application should have " +
+                "Core.id set to 1", Core, "id");
+        }
+
+        if (MultiProc.getIdMeta("VIDEO-M3") == MultiProc.INVALIDID &&
+            GateDualCore.initGates == false) {
+            GateDualCore.$logWarning("If VIDEO-M3 core is not being used, " +
+                "VPSS-M3 application must be configured to initialize " +
+                "GateDualCore at startup.  Set GateDualCore.initGates to " +
+                "'true' to configure this.", GateDualCore, "initGates");
+        }
+    }
+}
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/da830/InterruptArm.c b/packages/ti/sdo/ipc/family/da830/InterruptArm.c
new file mode 100644 (file)
index 0000000..34d160e
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArm.c ========
+ *  Arm interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <ti/sysbios/family/arm/da830/Hwi.h>
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include "package/internal/InterruptArm.xdc.h"
+
+/* register use to generate interrupt between cores */
+#define CHIPSIGREG      0x01C14174
+
+/* event ids associated with inter-core interrupts */
+#define DSP2ARM_CHIPINT0        28
+#define DSP2ARM_CHIPINT1        29
+#define ARM2DSP_CHIPINT2        5
+#define ARM2DSP_CHIPINT3        67
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptArm_intEnable ========
+ *  Enable GPP interrupt
+ */
+Void InterruptArm_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->localIntId);
+}
+
+/*!
+ *  ======== InterruptArm_intDisable ========
+ *  Disables GPP interrupt
+ */
+Void InterruptArm_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->localIntId);
+}
+
+/*!
+ *  ======== InterruptArm_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void InterruptArm_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+
+    Assert_isTrue(intInfo->localIntId == DSP2ARM_CHIPINT0 ||
+                  intInfo->localIntId == DSP2ARM_CHIPINT1,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    Assert_isTrue(intInfo->remoteIntId == ARM2DSP_CHIPINT2 ||
+                  intInfo->remoteIntId == ARM2DSP_CHIPINT3,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    /* Register interrupt for communication between ARM and DSP */
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+    hwiAttrs.arg         = arg;
+
+    InterruptArm_intClear(remoteProcId, intInfo);
+    Hwi_create(intInfo->localIntId,
+               (Hwi_FuncPtr)func,
+               &hwiAttrs,
+               NULL);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+    Hwi_enableInterrupt(intInfo->localIntId);
+}
+
+/*!
+ *  ======== InterruptArm_intUnregister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void InterruptArm_intUnregister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+
+    /* Delete the Hwi and disable the corresponding interrupt */
+    hwiHandle = Hwi_getHandle(intInfo->localIntId);
+    Hwi_delete(&hwiHandle);
+}
+
+/*!
+ *  ======== InterruptArm_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptArm_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+
+    switch(intInfo->remoteIntId) {
+        case ARM2DSP_CHIPINT2:
+            intBitPos = 2;
+            break;
+        case ARM2DSP_CHIPINT3:
+            intBitPos = 3;
+            break;
+    }
+
+    chipSigReg[0] = (1 << intBitPos);
+}
+
+/*!
+ *  ======== InterruptArm_intPost ========
+ */
+Void InterruptArm_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+
+    switch(intInfo->localIntId) {
+        case DSP2ARM_CHIPINT0:
+            intBitPos = 0;
+            break;
+        case DSP2ARM_CHIPINT1:
+            intBitPos = 1;
+            break;
+    }
+
+    chipSigReg[0] = (1 << intBitPos);
+}
+
+/*!
+ *  ======== InterruptArm_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptArm_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 statBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+
+    switch(intInfo->localIntId) {
+        case DSP2ARM_CHIPINT0:
+            statBitPos = 0;
+            break;
+        case DSP2ARM_CHIPINT1:
+            statBitPos = 1;
+            break;
+    }
+
+    chipSigReg[1] = (1 << statBitPos);
+
+    switch(intInfo->localIntId) {
+        case DSP2ARM_CHIPINT0:
+            Hwi_clearInterrupt(DSP2ARM_CHIPINT0);
+            break;
+        case DSP2ARM_CHIPINT1:
+            Hwi_clearInterrupt(DSP2ARM_CHIPINT1);
+            break;
+    }
+
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/family/da830/InterruptArm.xdc b/packages/ti/sdo/ipc/family/da830/InterruptArm.xdc
new file mode 100644 (file)
index 0000000..788cda2
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArm.xdc ========
+ *
+ */
+
+
+/*!
+ *  ======== InterruptArm ========
+ *  DA830 based Arm interrupt manager
+ */
+
+module InterruptArm inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+}
diff --git a/packages/ti/sdo/ipc/family/da830/InterruptArm.xs b/packages/ti/sdo/ipc/family/da830/InterruptArm.xs
new file mode 100644 (file)
index 0000000..c0ce54f
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ *
+ */
+
+var Hwi        = null;
+var Ipc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi = xdc.useModule("ti.sysbios.family.arm.da830.Hwi");
+    Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
+}
diff --git a/packages/ti/sdo/ipc/family/da830/InterruptDsp.c b/packages/ti/sdo/ipc/family/da830/InterruptDsp.c
new file mode 100644 (file)
index 0000000..5acc9c1
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Dsp interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* register use to generate interrupt between cores */
+#define CHIPSIGREG  0x01C14174
+
+/* event ids associated with inter-core interrupts */
+#define DSP2ARM_CHIPINT0    28
+#define DSP2ARM_CHIPINT1    29
+#define ARM2DSP_CHIPINT2    5
+#define ARM2DSP_CHIPINT3    67
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable GPP interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables GPP interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+
+    Assert_isTrue(intInfo->intVectorId <= 15,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    Assert_isTrue(intInfo->localIntId == ARM2DSP_CHIPINT2 ||
+                  intInfo->localIntId == ARM2DSP_CHIPINT3,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    InterruptDsp_intClear(remoteProcId, intInfo); //TODO
+
+    /* Register interrupt for communication between ARM and DSP */
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+    hwiAttrs.arg         = arg;
+    hwiAttrs.eventId     = intInfo->localIntId;
+
+    Hwi_create(intInfo->intVectorId,
+               (Hwi_FuncPtr)func,
+               &hwiAttrs,
+               NULL);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+    /* enable the interrupt vector */
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+
+    /* Delete the Hwi (and disable the corresponding interrupt) */
+    hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+    Hwi_delete(&hwiHandle);
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt32 intBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+
+    switch (intInfo->remoteIntId) {
+        case DSP2ARM_CHIPINT0:
+            intBitPos = 0;
+            break;
+        case DSP2ARM_CHIPINT1:
+            intBitPos = 1;
+            break;
+        default:
+            intBitPos = 0;  /* keep Coverity happy */
+        break;
+    }
+
+    chipSigReg[0] = (1 << intBitPos);
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+
+    switch (intInfo->localIntId) {
+        case ARM2DSP_CHIPINT2:
+            intBitPos = 2;
+            break;
+        case ARM2DSP_CHIPINT3:
+            intBitPos = 3;
+            break;
+        default:
+            intBitPos = 0;  /* keep Coverity happy */
+        break;
+    }
+
+    chipSigReg[0] = (1 << intBitPos);
+}
+
+/*!
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt32 statBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+
+    switch (intInfo->localIntId) {
+        case ARM2DSP_CHIPINT2:
+            statBitPos = 2;
+            break;
+        case ARM2DSP_CHIPINT3:
+            statBitPos = 3;
+            break;
+        default:
+            statBitPos = 0; /* keep Coverity happy */
+        break;
+    }
+
+    chipSigReg[1] = (1 << statBitPos);
+
+    return (0);
+}
+
+Bool InterruptDsp_isIntSet(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt32           statBitPos;
+    volatile UInt32 *chipSigReg = (volatile UInt32 *)CHIPSIGREG;
+    UInt32           mask;
+
+    switch (intInfo->localIntId) {
+        case ARM2DSP_CHIPINT2:
+            statBitPos = 2;
+            break;
+        case ARM2DSP_CHIPINT3:
+            statBitPos = 3;
+            break;
+        default:
+            statBitPos = 0; /* keep Coverity happy */
+        break;
+    }
+
+    mask = 1 << statBitPos;
+    if ((chipSigReg[0] & mask) == mask) {
+        return TRUE;
+    }
+    else {
+        return FALSE;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/da830/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/da830/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..0e35ac1
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ *
+ */
+
+/*!
+ *  ======== InterruptDsp ========
+ *  DA830 based Dsp interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /*! returns true when an interrupt has occurred */
+    Bool isIntSet(UInt16 remoteProcId, ti.sdo.ipc.notifyDrivers.IInterrupt.IntInfo *intInfo);
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/da830/InterruptDsp.xs b/packages/ti/sdo/ipc/family/da830/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..f0b9ea1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ *
+ */
+
+var Hwi = null;
+var Ipc = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
+}
diff --git a/packages/ti/sdo/ipc/family/da830/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/da830/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..fc4e7bc
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+
+#ifdef xdc_target__isaCompatible_64
+    NotifyDriverCirc_Handle armDriverHandle0, armDriverHandle1;
+    UInt armProcId = 1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the ARM (Line 0)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_dspRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_armRecvIntId0;
+    notifyShmParams.intVectorId    = NotifyCircSetup_dspIntVectId0;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    armDriverHandle0 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (armDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(armDriverHandle0),
+                  armProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&armDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifyCircSetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the ARM (Line 1)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_dspRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_armRecvIntId1;
+    notifyShmParams.intVectorId    = NotifyCircSetup_dspIntVectId1;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverCirc_sharedMemReq(&notifyShmParams));
+    armDriverHandle1 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+
+    if (armDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(armDriverHandle1),
+                  armProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&armDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#else /* ARM code */
+    NotifyDriverCirc_Handle dspDriverHandle0, dspDriverHandle1;
+    UInt dspProcId =  1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the DSP (Line 0)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_armRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_dspRecvIntId0;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    dspDriverHandle0 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (dspDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(dspDriverHandle0),
+                  dspProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&dspDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifyCircSetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the DSP (Line 1)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_armRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_dspRecvIntId1;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverCirc_sharedMemReq(&notifyShmParams));
+    dspDriverHandle1 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (dspDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(dspDriverHandle1),
+                  dspProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&dspDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#endif
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ *  Return the amount of shared memory required
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params params;
+
+    NotifyDriverCirc_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+
+    if (!NotifyCircSetup_useSecondLine) {
+        memReq = NotifyDriverCirc_sharedMemReq(&params);
+    }
+    else {
+        memReq = 2 * NotifyDriverCirc_sharedMemReq(&params);
+    }
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 numLines;
+
+    if (NotifyCircSetup_useSecondLine) {
+        numLines = 2;
+    }
+    else {
+        numLines = 1;
+    }
+
+    return (numLines);
+}
diff --git a/packages/ti/sdo/ipc/family/da830/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/da830/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..01f6038
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*! Possible incoming interrupt IDs for DSP */
+    enum DSP_INT {
+        DSP_INT0 = 5,
+        DSP_INT1 = 67
+    }
+
+    /*! Possible incoming interrupt IDs for ARM */
+    enum ARM_INT {
+        ARM_INT0 = 28,
+        ARM_INT1 = 29
+    }
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId0 = DSP_INT0;
+
+    /*! Vector ID to use on DSP for line #1 */
+    config UInt dspIntVectId0 = 5;
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId0 = ARM_INT0;
+
+    /*! Enable the second interrupt line */
+    config Bool useSecondLine = false;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId1 = DSP_INT1;
+
+    /*! Vector ID to use on DSP for line #1 */
+    config UInt dspIntVectId1 = 6;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId1 = ARM_INT1;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/da830/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/da830/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..affaa66
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ */
+
+var NotifyDriverCirc = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    if (this.useSecondLine) {
+        Notify.numLines = 2;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/da830/NotifySetup.c b/packages/ti/sdo/ipc/family/da830/NotifySetup.c
new file mode 100644 (file)
index 0000000..44c4e7a
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+
+#ifdef xdc_target__isaCompatible_64
+    NotifyDriverShm_Handle armDriverHandle0, armDriverHandle1;
+    UInt armProcId = 1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the ARM (Line 0)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_dspRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifySetup_armRecvIntId0;
+    notifyShmParams.intVectorId    = NotifySetup_dspIntVectId0;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    armDriverHandle0 = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (armDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(armDriverHandle0),
+                  armProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&armDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifySetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the ARM (Line 1)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_dspRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifySetup_armRecvIntId1;
+    notifyShmParams.intVectorId    = NotifySetup_dspIntVectId1;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverShm_sharedMemReq(&notifyShmParams));
+    armDriverHandle1 = NotifyDriverShm_create(&notifyShmParams, &eb);
+
+    if (armDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(armDriverHandle1),
+                  armProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&armDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#else /* ARM code */
+    NotifyDriverShm_Handle dspDriverHandle0, dspDriverHandle1;
+    UInt dspProcId =  1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the DSP (Line 0)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_armRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifySetup_dspRecvIntId0;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    dspDriverHandle0 = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (dspDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(dspDriverHandle0),
+                  dspProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&dspDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifySetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the DSP (Line 1)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_armRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifySetup_dspRecvIntId1;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverShm_sharedMemReq(&notifyShmParams));
+    dspDriverHandle1 = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (dspDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(dspDriverHandle1),
+                  dspProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&dspDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#endif
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ *  Return the amount of shared memory required
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params params;
+
+    NotifyDriverShm_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+
+    if (!NotifySetup_useSecondLine) {
+        memReq = NotifyDriverShm_sharedMemReq(&params);
+    }
+    else {
+        memReq = 2 * NotifyDriverShm_sharedMemReq(&params);
+    }
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 numLines;
+
+    if (NotifySetup_useSecondLine) {
+        numLines = 2;
+    }
+    else {
+        numLines = 1;
+    }
+
+    return (numLines);
+}
diff --git a/packages/ti/sdo/ipc/family/da830/NotifySetup.xdc b/packages/ti/sdo/ipc/family/da830/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..b4bb03b
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*! Possible incoming interrupt IDs for DSP */
+    enum DSP_INT {
+        DSP_INT0 = 5,
+        DSP_INT1 = 67
+    }
+
+    /*! Possible incoming interrupt IDs for ARM */
+    enum ARM_INT {
+        ARM_INT0 = 28,
+        ARM_INT1 = 29
+    }
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId0 = DSP_INT0;
+
+    /*! Vector ID to use on DSP for line #0 */
+    config UInt dspIntVectId0 = 5;
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId0 = ARM_INT0;
+
+    /*! Enable the second interrupt line */
+    config Bool useSecondLine = false;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId1 = DSP_INT1;
+
+    /*! Vector ID to use on DSP for line #1 */
+    config UInt dspIntVectId1 = 6;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId1 = ARM_INT1;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/da830/NotifySetup.xs b/packages/ti/sdo/ipc/family/da830/NotifySetup.xs
new file mode 100644 (file)
index 0000000..a284324
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm  = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    if (this.useSecondLine) {
+        Notify.numLines = 2;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/da830/package.bld b/packages/ti/sdo/ipc/family/da830/package.bld
new file mode 100644 (file)
index 0000000..37381a2
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_674 = [
+    "InterruptDsp",
+    "NotifySetup",
+    "NotifyCircSetup",
+];
+
+var trgFilter_674 = {
+    field: "isa",
+    list: [ "674" ]
+};
+
+var objList_v5T = [
+    "InterruptArm",
+    "NotifySetup",
+    "NotifyCircSetup",
+];
+
+var trgFilter_v5T = {
+    field: "isa",
+    list: [ "v5T" ]
+};
+
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, arguments);
+IpcBuild.buildLibs(objList_v5T, undefined, trgFilter_v5T, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, ["profile=smp"]);
+IpcBuild.buildLibs(objList_v5T, undefined, trgFilter_v5T, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/da830/package.xdc b/packages/ti/sdo/ipc/family/da830/package.xdc
new file mode 100644 (file)
index 0000000..629835d
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.da830 ========
+ */
+
+package ti.sdo.ipc.family.da830 [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptArm;
+}
diff --git a/packages/ti/sdo/ipc/family/da830/package.xs b/packages/ti/sdo/ipc/family/da830/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/InterruptArm.c b/packages/ti/sdo/ipc/family/dm6446/InterruptArm.c
new file mode 100644 (file)
index 0000000..d536f71
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArm.c ========
+ *  DM6446 based interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/arm/dm6446/Hwi.h>
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptArm.xdc.h"
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+
+/* register use to generate interrupt between cores */
+#define INTGENREG   0x01C40010
+
+/* event ids associated with inter-core interrupts */
+#define DSP_INT0 16
+#define DSP_INT1 17
+#define DSP_INT2 18
+#define DSP_INT3 19
+
+#define ARM_INT0 46
+#define ARM_INT1 47
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptArm_intEnable ========
+ *  Enable GPP interrupt
+ */
+Void InterruptArm_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->localIntId);
+}
+
+/*!
+ *  ======== InterruptArm_intDisable ========
+ *  Disables GPP interrupt
+ */
+Void InterruptArm_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->localIntId);
+}
+
+/*!
+ *  ======== InterruptArm_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void InterruptArm_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+
+    Assert_isTrue(intInfo->localIntId == ARM_INT0 ||
+                  intInfo->localIntId == ARM_INT1,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    Assert_isTrue(intInfo->remoteIntId >= DSP_INT0 &&
+                  intInfo->remoteIntId <= DSP_INT3,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    /* Register interrupt for communication between ARM and DSP */
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+    hwiAttrs.arg         = arg;
+
+    InterruptArm_intClear(remoteProcId, intInfo);
+
+    Hwi_create(intInfo->localIntId, (Hwi_FuncPtr)func, &hwiAttrs, NULL);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+    Hwi_enableInterrupt(intInfo->localIntId);
+}
+
+/*!
+ *  ======== InterruptArm_intUnregister ========
+ */
+Void InterruptArm_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+
+    /* Delete the Hwi and disable the corresponding interrupt */
+    hwiHandle = Hwi_getHandle(intInfo->localIntId);
+    Hwi_delete(&hwiHandle);
+}
+
+/*!
+ *  ======== InterruptArm_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptArm_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+
+    switch(intInfo->remoteIntId) {
+        case DSP_INT0:
+            intBitPos = 4;
+            break;
+        case DSP_INT1:
+            intBitPos = 5;
+            break;
+        case DSP_INT2:
+            intBitPos = 6;
+            break;
+        case DSP_INT3:
+            intBitPos = 7;
+            break;
+    }
+
+    SET_BIT(*((volatile UInt32 *)INTGENREG), (intBitPos));
+}
+
+/*!
+ *  ======== InterruptArm_intPost ========
+ */
+Void InterruptArm_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+
+    switch(intInfo->localIntId) {
+        case ARM_INT0:
+            intBitPos = 12;
+            break;
+        case ARM_INT1:
+            intBitPos = 13;
+            break;
+    }
+
+    SET_BIT(*((volatile UInt32 *)INTGENREG), (intBitPos));
+}
+
+
+/*!
+ *  ======== InterruptArm_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptArm_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 statBitPos;
+
+    switch(intInfo->localIntId) {
+        case ARM_INT0:
+            statBitPos = 28;
+            break;
+        case ARM_INT1:
+            statBitPos = 29;
+            break;
+    }
+
+    CLEAR_BIT(*((volatile UInt32 *)INTGENREG), statBitPos);
+
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/InterruptArm.xdc b/packages/ti/sdo/ipc/family/dm6446/InterruptArm.xdc
new file mode 100644 (file)
index 0000000..f9c23e2
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArm.xdc ========
+ *
+ */
+
+/*!
+ *  ======== InterruptArm ========
+ *  DM6446 based interrupt manager
+ */
+
+module InterruptArm inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/InterruptArm.xs b/packages/ti/sdo/ipc/family/dm6446/InterruptArm.xs
new file mode 100644 (file)
index 0000000..c27d664
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ *
+ */
+var Hwi;
+var Ipc;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arm.dm6446.Hwi");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/InterruptDsp.c b/packages/ti/sdo/ipc/family/dm6446/InterruptDsp.c
new file mode 100644 (file)
index 0000000..69b8f7a
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  DM6446 based interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)    ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)  ((num) &= ~(1u << (pos)))
+
+/* register use to generate interrupt between cores */
+#define INTGENREG   0x01C40010
+
+/* event ids associated with inter-core interrupts */
+#define DSP_INT0 16
+#define DSP_INT1 17
+#define DSP_INT2 18
+#define DSP_INT3 19
+
+#define ARM_INT0 46
+#define ARM_INT1 47
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable GPP interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables GPP interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+
+    Assert_isTrue(intInfo->intVectorId <= 15,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    Assert_isTrue(intInfo->localIntId >= DSP_INT0 &&
+                  intInfo->localIntId <= DSP_INT3,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    Assert_isTrue(intInfo->remoteIntId == ARM_INT0 ||
+                  intInfo->remoteIntId == ARM_INT1,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    /* Register interrupt for communication between ARM and DSP */
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+    hwiAttrs.arg         = arg;
+    hwiAttrs.eventId     = intInfo->localIntId;
+
+    Hwi_create(intInfo->intVectorId,
+               (Hwi_FuncPtr)func,
+               &hwiAttrs,
+               NULL);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+    /* enable the interrupt vector */
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+
+    /* Delete the Hwi (and disable the corresponding interrupt) */
+    hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+    Hwi_delete(&hwiHandle);
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+
+    switch(intInfo->remoteIntId) {
+        case ARM_INT0:
+            intBitPos = 12;
+            break;
+        case ARM_INT1:
+            intBitPos = 13;
+            break;
+    }
+
+    SET_BIT(*((volatile Uint32 *)INTGENREG), (intBitPos));
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt16 intBitPos;
+
+    switch(intInfo->localIntId) {
+        case DSP_INT0:
+            intBitPos = 4;
+            break;
+        case DSP_INT1:
+            intBitPos = 5;
+            break;
+        case DSP_INT2:
+            intBitPos = 6;
+            break;
+        case DSP_INT3:
+            intBitPos = 7;
+            break;
+    }
+
+    SET_BIT(*((volatile Uint32 *)INTGENREG), (intBitPos));
+}
+
+/*!
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 statBitPos;
+
+    switch(intInfo->localIntId) {
+        case DSP_INT0:
+            statBitPos = 20;
+            break;
+        case DSP_INT1:
+            statBitPos = 21;
+            break;
+        case DSP_INT2:
+            statBitPos = 22;
+            break;
+        case DSP_INT3:
+            statBitPos = 23;
+            break;
+    }
+
+    CLEAR_BIT(*((volatile Uint32 *)INTGENREG), statBitPos);
+
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/dm6446/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..f389765
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ *
+ */
+
+/*!
+ *  ======== InterruptDsp ========
+ *  DM6446 based interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/InterruptDsp.xs b/packages/ti/sdo/ipc/family/dm6446/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..be179fc
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ *
+ */
+var Hwi;
+var Ipc;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..fc4e7bc
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+
+#ifdef xdc_target__isaCompatible_64
+    NotifyDriverCirc_Handle armDriverHandle0, armDriverHandle1;
+    UInt armProcId = 1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the ARM (Line 0)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_dspRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_armRecvIntId0;
+    notifyShmParams.intVectorId    = NotifyCircSetup_dspIntVectId0;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    armDriverHandle0 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (armDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(armDriverHandle0),
+                  armProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&armDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifyCircSetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the ARM (Line 1)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_dspRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_armRecvIntId1;
+    notifyShmParams.intVectorId    = NotifyCircSetup_dspIntVectId1;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverCirc_sharedMemReq(&notifyShmParams));
+    armDriverHandle1 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+
+    if (armDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(armDriverHandle1),
+                  armProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&armDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#else /* ARM code */
+    NotifyDriverCirc_Handle dspDriverHandle0, dspDriverHandle1;
+    UInt dspProcId =  1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the DSP (Line 0)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_armRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_dspRecvIntId0;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    dspDriverHandle0 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (dspDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(dspDriverHandle0),
+                  dspProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&dspDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifyCircSetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the DSP (Line 1)
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifyCircSetup_armRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifyCircSetup_dspRecvIntId1;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverCirc_sharedMemReq(&notifyShmParams));
+    dspDriverHandle1 = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (dspDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(dspDriverHandle1),
+                  dspProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverCirc_delete(&dspDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#endif
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ *  Return the amount of shared memory required
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params params;
+
+    NotifyDriverCirc_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+
+    if (!NotifyCircSetup_useSecondLine) {
+        memReq = NotifyDriverCirc_sharedMemReq(&params);
+    }
+    else {
+        memReq = 2 * NotifyDriverCirc_sharedMemReq(&params);
+    }
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 numLines;
+
+    if (NotifyCircSetup_useSecondLine) {
+        numLines = 2;
+    }
+    else {
+        numLines = 1;
+    }
+
+    return (numLines);
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..22c7ad2
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ */
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*! Possible incoming interrupt IDs for DaVinci/DSP */
+    enum DSP_INT {
+        DSP_INT0 = 16,
+        DSP_INT1 = 17,
+        DSP_INT2 = 18,
+        DSP_INT3 = 19
+    }
+
+    /*! Possible incoming interrupt IDs for DaVinci/ARM */
+    enum ARM_INT {
+        ARM_INT0 = 46,
+        ARM_INT1 = 47
+    }
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId0 = DSP_INT0;
+
+    /*! Vector ID to use on DSP for line #0 */
+    config UInt dspIntVectId0 = 5;
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId0 = ARM_INT0;
+
+    /*! Enable the second interrupt line on DaVinci */
+    config Bool useSecondLine = false;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId1 = DSP_INT1;
+
+    /*! Vector ID to use on DSP for line #1 */
+    config UInt dspIntVectId1 = 6;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId1 = ARM_INT1;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/dm6446/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..affaa66
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ */
+
+var NotifyDriverCirc = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    if (this.useSecondLine) {
+        Notify.numLines = 2;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/NotifySetup.c b/packages/ti/sdo/ipc/family/dm6446/NotifySetup.c
new file mode 100644 (file)
index 0000000..44c4e7a
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+
+#ifdef xdc_target__isaCompatible_64
+    NotifyDriverShm_Handle armDriverHandle0, armDriverHandle1;
+    UInt armProcId = 1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the ARM (Line 0)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_dspRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifySetup_armRecvIntId0;
+    notifyShmParams.intVectorId    = NotifySetup_dspIntVectId0;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    armDriverHandle0 = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (armDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(armDriverHandle0),
+                  armProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&armDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifySetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the ARM (Line 1)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_dspRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifySetup_armRecvIntId1;
+    notifyShmParams.intVectorId    = NotifySetup_dspIntVectId1;
+    notifyShmParams.remoteProcId   = armProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverShm_sharedMemReq(&notifyShmParams));
+    armDriverHandle1 = NotifyDriverShm_create(&notifyShmParams, &eb);
+
+    if (armDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(armDriverHandle1),
+                  armProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&armDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#else /* ARM code */
+    NotifyDriverShm_Handle dspDriverHandle0, dspDriverHandle1;
+    UInt dspProcId =  1 - MultiProc_self();
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the DSP (Line 0)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_armRecvIntId0;
+    notifyShmParams.remoteIntId    = NotifySetup_dspRecvIntId0;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+
+    dspDriverHandle0 = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (dspDriverHandle0 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(dspDriverHandle0),
+                  dspProcId,
+                  0,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&dspDriverHandle0);
+        return (Notify_E_FAIL);
+    }
+
+    if (!NotifySetup_useSecondLine) {
+        return (status);
+    }
+    /*
+     *  Setup the notify driver to the DSP (Line 1)
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.localIntId     = NotifySetup_armRecvIntId1;
+    notifyShmParams.remoteIntId    = NotifySetup_dspRecvIntId1;
+    notifyShmParams.remoteProcId   = dspProcId;
+    notifyShmParams.sharedAddr     = (Ptr)((UInt32)sharedAddr +
+        NotifyDriverShm_sharedMemReq(&notifyShmParams));
+    dspDriverHandle1 = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (dspDriverHandle1 == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(dspDriverHandle1),
+                  dspProcId,
+                  1,
+                  NULL,
+                  &eb);
+    if (Error_check(&eb)) {
+        /* Delete the driver and then return */
+        NotifyDriverShm_delete(&dspDriverHandle1);
+        return (Notify_E_FAIL);
+    }
+
+#endif
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ *  Return the amount of shared memory required
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params params;
+
+    NotifyDriverShm_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+
+    if (!NotifySetup_useSecondLine) {
+        memReq = NotifyDriverShm_sharedMemReq(&params);
+    }
+    else {
+        memReq = 2 * NotifyDriverShm_sharedMemReq(&params);
+    }
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 numLines;
+
+    if (NotifySetup_useSecondLine) {
+        numLines = 2;
+    }
+    else {
+        numLines = 1;
+    }
+
+    return (numLines);
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/NotifySetup.xdc b/packages/ti/sdo/ipc/family/dm6446/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..984cf7d
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== NotifySetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*! Possible incoming interrupt IDs for DaVinci/DSP */
+    enum DSP_INT {
+        DSP_INT0 = 16,
+        DSP_INT1 = 17,
+        DSP_INT2 = 18,
+        DSP_INT3 = 19
+    }
+
+    /*! Possible incoming interrupt IDs for DaVinci/ARM */
+    enum ARM_INT {
+        ARM_INT0 = 46,
+        ARM_INT1 = 47
+    }
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId0 = DSP_INT0;
+
+    /*! Vector ID to use on DSP for line #0 */
+    config UInt dspIntVectId0 = 5;
+
+    /*!
+     *  Incoming interrupt ID for line #0 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId0 = ARM_INT0;
+
+    /*! Enable the second interrupt line on DaVinci */
+    config Bool useSecondLine = false;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on DSP
+     *
+     *  See {@link #DSP_INT} for possible values.
+     */
+    config UInt dspRecvIntId1 = DSP_INT1;
+
+    /*! Vector ID to use on DSP for line #1 */
+    config UInt dspIntVectId1 = 6;
+
+    /*!
+     *  Incoming interrupt ID for line #1 line on ARM
+     *
+     *  See {@link #ARM_INT} for possible values.
+     */
+    config UInt armRecvIntId1 = ARM_INT1;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/NotifySetup.xs b/packages/ti/sdo/ipc/family/dm6446/NotifySetup.xs
new file mode 100644 (file)
index 0000000..a284324
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm  = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    if (this.useSecondLine) {
+        Notify.numLines = 2;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/package.bld b/packages/ti/sdo/ipc/family/dm6446/package.bld
new file mode 100644 (file)
index 0000000..4b4abe8
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_64P = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptDsp",
+];
+
+var trgFilter_64P = {
+        field: "isa",
+        list: [ "64P" ]
+};
+
+var objList_v5T = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptArm",
+];
+
+var trgFilter_v5T = {
+        field: "isa",
+        list: [ "v5T" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_64P, undefined, trgFilter_64P, arguments);
+IpcBuild.buildLibs(objList_v5T, undefined, trgFilter_v5T, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_64P, undefined, trgFilter_64P, ["profile=smp"]);
+IpcBuild.buildLibs(objList_v5T, undefined, trgFilter_v5T, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/dm6446/package.xdc b/packages/ti/sdo/ipc/family/dm6446/package.xdc
new file mode 100644 (file)
index 0000000..8a306b8
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.dm6446 ========
+ */
+package ti.sdo.ipc.family.dm6446 [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptArm;
+}
diff --git a/packages/ti/sdo/ipc/family/dm6446/package.xs b/packages/ti/sdo/ipc/family/dm6446/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/doc-files/procNamesHead.inc b/packages/ti/sdo/ipc/family/doc-files/procNamesHead.inc
new file mode 100644 (file)
index 0000000..5028ec3
--- /dev/null
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<TITLE>IPC Supported Devices and Processor Names</TITLE>
+<STYLE TYPE="text/css" MEDIA=screen>
+<!--
+    .bold       { font-weight: bolder; color: black; }
+    .shaded     { background: rgb(234,234,234); }
+    td,th       { font-family: verdana, arial, sans-serif;
+                  font-size: 80%;
+                  line-height: 1.5em;
+                  cursor: default;
+                  text-align: left;
+                  padding: 5px;
+                }
+    h2, th      { color: rgb(0,127,102); }
+    a           { color: black; text-decoration: underline; }
+    a:hover     { color: rgb(0,127,102); }
+    body        { font-family: verdana, arial, sans-serif;
+                  background: white; padding: .35in}
+    .xdocHdrSummary 
+                {
+                  color: rgb(0,127,102);
+                  font-size: 155%;
+                  font-weight: bold;
+                  line-height: 1.2em;
+                  margin: 0 0 1em .20in;
+                }
+
+    .xdocDate   { border-top: 1px solid #e2dcc8;
+                  margin-top: .5in;
+                  color: rgb(0,127,102);
+                  font-size: 95%;
+                  text-align: right;
+                }
+
+-->
+</STYLE>
+</HEAD>
+<BODY>
+<H2>Supported Devices and Valid Processor Names</H2>
+<P>The processor names listed for each device are the only 
+   valid names that can be used for configuration of the 
+   MultiProc module.  Refer to the 
+   <a href="../../../utils/MultiProc.html">cdoc for MultiProc</a> for 
+   more information.</P>
+<TABLE BORDER="1">
+<TR><TH>Device name</TH><TH>Valid processor names</TH></TR>
diff --git a/packages/ti/sdo/ipc/family/f28m35x/IpcMgr.c b/packages/ti/sdo/ipc/family/f28m35x/IpcMgr.c
new file mode 100644 (file)
index 0000000..e99abad
--- /dev/null
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IpcMgr.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/family/f28m35x/NameServerBlock.h>
+#include <ti/sdo/ipc/family/f28m35x/TransportCirc.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/IpcMgr.xdc.h"
+
+/* For the M3 */
+#define CTOMIPCACK  (0x400FB700)
+#define CTOMIPCSTS  (CTOMIPCACK + 0x4)
+#define MTOCIPCSET  (CTOMIPCACK + 0x8)
+#define MTOCIPCCLR  (CTOMIPCACK + 0xC)
+#define MTOCIPCFLG  (CTOMIPCACK + 0x10)
+
+/* For the C28 */
+#define CTOMIPCSET  (0x00004E00)
+#define CTOMIPCCLR  (CTOMIPCSET + 0x2)
+#define CTOMIPCFLG  (CTOMIPCSET + 0x4)
+#define MTOCIPCACK  (CTOMIPCSET + 0x6)
+#define MTOCIPCSTS  (CTOMIPCSET + 0x8)
+
+#define M3_IPCFLAG  10
+#define C28_IPCFLAG 11
+
+/*
+ *  ======== IpcMgr_Module_startup ========
+ *  In this function the M3 processors is used to enable shared memory.
+ *  In addition, the owner of each block of memory is initialized and
+ *  the write access set based on the static configuration parameters.
+ *  IPC flags are used by the M3 and C28 respectively for synchronization.
+ *
+ *  The M3 starts by creating its driver instances and then sets the
+ *  C28's IPC flag to let the C28 proceed.  Then the M3 waits for its
+ *  IPC flag to be set before proceeding.  Once its IPC flag is set
+ *  by the C28, the M3 clears its IPC flag and continues.
+ *
+ *  The C28 starts by waiting for its IPC flag to be set by the M3.
+ *  Once its IPC flag is set by the M3, the C28 clears its IPC flag and
+ *  proceeds to create its driver instances.  The C28 then sets the M3's
+ *  IPC flag to let the M3 proceed.
+ *
+ *  The shared memory usage looks like the following:
+ *
+ *      |--------------------|
+ *      | Notify Driver      |
+ *      |                    |
+ *      |--------------------|
+ *      | NameServer         |
+ *      | Remote Driver      |
+ *      |--------------------|
+ *      | MessageQ Transport |
+ *      |                    |
+ *      |--------------------|
+ */
+Int IpcMgr_Module_startup(Int phase)
+{
+    Int status;
+    SizeT memReq;
+    Ptr writeAddr = (UInt32 *)IpcMgr_writeAddr;
+    Ptr readAddr = (UInt32 *)IpcMgr_readAddr;
+    UInt16 remoteProcId;
+    NotifyDriverCirc_Params notifyDrvParams;
+    TransportCirc_Params transportParams;
+#ifdef xdc_target__isaCompatible_v7M
+    UInt32 i;
+    volatile UInt32 *memcnf  = (volatile UInt32 *)IpcMgr_MEMCNF;
+    volatile UInt32 *msmsel  = (volatile UInt32 *)IpcMgr_MSxMSEL;
+    volatile UInt32 *mssrcr  = (volatile UInt32 *)IpcMgr_MSxSRCR;
+    volatile UInt32 *set = (volatile UInt32 *)MTOCIPCSET;
+    volatile UInt32 *stat = (volatile UInt32 *)CTOMIPCSTS;
+    volatile UInt32 *ack = (volatile UInt32 *)CTOMIPCACK;
+#else
+    volatile UInt32 *set = (volatile UInt32 *)CTOMIPCSET;
+    volatile UInt32 *stat = (volatile UInt32 *)MTOCIPCSTS;
+    volatile UInt32 *ack = (volatile UInt32 *)MTOCIPCACK;
+#endif
+
+    /*
+     *  This code assumes that the device's C28 and M3 MultiProc Ids
+     *  are next to each other (e.g. n and n + 1) and that the first
+     *  one is even (e.g. n is even).
+     */
+    if (MultiProc_self() & 1) {
+        /* I'm odd */
+        remoteProcId = MultiProc_self() - 1;
+    }
+    else {
+        /* I'm even */
+        remoteProcId = MultiProc_self() + 1;
+    }
+
+    /* wait for Hwi module to initialize first because of NotifyDriverCirc  */
+    if (!Hwi_Module_startupDone()) {
+        return Startup_NOTDONE;
+    }
+
+#ifdef xdc_target__isaCompatible_v7M
+    /*
+     *  The M3 writes the shared memory enable and owner select
+     *  registers before either processor starts using shared memory.
+     */
+
+    /* write the shared memory configuration register */
+    *memcnf = IpcMgr_sharedMemoryEnable;
+
+    /* write the owner select register */
+    *msmsel = IpcMgr_sharedMemoryOwnerMask;
+
+    /* init the owner write access registers */
+    for (i = 0; i < 2; i++) {
+        mssrcr[i] = (IpcMgr_sharedMemoryAccess[(i * 4)])           |
+                    (IpcMgr_sharedMemoryAccess[(i * 4) + 1] << 8)  |
+                    (IpcMgr_sharedMemoryAccess[(i * 4) + 2] << 16) |
+                    (IpcMgr_sharedMemoryAccess[(i * 4) + 3] << 24);
+    }
+
+#else
+
+    /* wait for M3 to set C28's IPC flag */
+    while (!(*stat & (1 << C28_IPCFLAG))) {
+    }
+
+    /* clear own IPC flag */
+    *ack = 1 << C28_IPCFLAG;
+
+#endif
+
+    /* determine the amount of memory required for NotifyDriverCirc */
+    NotifyDriverCirc_Params_init(&notifyDrvParams);
+    notifyDrvParams.writeAddr = writeAddr;
+    memReq = NotifyDriverCirc_sharedMemReq(&notifyDrvParams);
+
+    /* call NotifyCircSetup attach to remote processor */
+    status = IpcMgr_notifyCircAttach(remoteProcId,
+                 writeAddr, readAddr);
+
+    Assert_isTrue(status >= 0, IpcMgr_A_internal);
+
+    /* update the read/write address */
+    writeAddr = (Ptr)((UInt32)writeAddr + memReq);
+    readAddr = (Ptr)((UInt32)readAddr + memReq);
+
+    /* determine the amount of memory required for NameServerBlock */
+    memReq = NameServerBlock_sharedMemReq(NULL);
+
+    /* call NameServerBlock attach to remote processor */
+    status = IpcMgr_nameServerAttach(remoteProcId, writeAddr, readAddr);
+
+    Assert_isTrue(status >= 0, IpcMgr_A_internal);
+
+    /* update the read/write address */
+    writeAddr = (Ptr)((UInt32)writeAddr + memReq);
+    readAddr = (Ptr)((UInt32)readAddr + memReq);
+
+    /* determine the amount of memory required for TransportCirc */
+    TransportCirc_Params_init(&transportParams);
+    transportParams.writeAddr = writeAddr;
+    memReq = TransportCirc_sharedMemReq(&transportParams);
+
+    /* call TransportCircSetup attach to remote processor */
+    status = IpcMgr_transportCircAttach(remoteProcId,
+                 writeAddr, readAddr);
+
+    Assert_isTrue(status >= 0, IpcMgr_A_internal);
+
+#ifdef xdc_target__isaCompatible_v7M
+
+    /* set C28 IPC flag to tell C28 to proceed */
+    *set = 1 << C28_IPCFLAG;
+
+    /* wait for C28 to set M3's IPC flag */
+    while (!(*stat & (1 << M3_IPCFLAG))) {
+    }
+
+    /* clear own IPC flag */
+    *ack = 1 << M3_IPCFLAG;
+
+#else
+
+    /* set M3's IPC flag to tell M3 to proceed */
+    *set = 1 << M3_IPCFLAG;
+
+#endif
+
+    return (Startup_DONE);
+}
+
+/*
+ *  ======== IpcMgr_init ========
+ *  Init CTOMMSGRAM and MTOCMSGRAM
+ */
+Void IpcMgr_init()
+{
+#ifdef xdc_target__isaCompatible_v7M
+    volatile UInt32 *mwrallow  = (volatile UInt32 *)IpcMgr_MWRALLOW;
+    volatile UInt32 *mtocrTestInit = (volatile UInt32 *)IpcMgr_MTOCRTESTINIT;
+    volatile UInt32 *mtocrInitDone = (volatile UInt32 *)IpcMgr_MTOCRINITDONE;
+
+    /* allow writes to protected registers. */
+    *mwrallow = 0xA5A5A5A5;
+
+    /* init MtoCMsgRam */
+    *mtocrTestInit |= 0x1;
+
+    /* make sure init is done */
+    while ((*mtocrInitDone & 0x1) != 0x1) {
+    }
+
+    /* Disable writes to protected registers. */
+    *mwrallow = 0;
+
+#else
+
+    volatile UInt32 *c28rTestInit = (volatile UInt32 *)IpcMgr_C28RTESTINIT;
+    volatile UInt32 *c28rInitDone = (volatile UInt32 *)IpcMgr_C28RINITDONE;
+
+    asm(" EALLOW");
+
+    /* init CtoMMsgRam */
+    *c28rTestInit |= (0x1 << 4);
+
+    /* make sure init is done */
+    while ((*c28rInitDone & (0x1 << 4)) != (0x1 << 4)) {
+    }
+
+    asm(" EDIS");
+
+#endif
+}
+
+
+/*
+ *  ======== IpcMgr_notifyCircAttach ========
+ *  Initialize interrupt
+ */
+Int IpcMgr_notifyCircAttach(UInt16 remoteProcId, Ptr writeAddr, Ptr readAddr)
+{
+    NotifyDriverCirc_Params notifyDrvParams;
+    NotifyDriverCirc_Handle notifyDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* Setup the notify driver to the remote processor */
+    NotifyDriverCirc_Params_init(&notifyDrvParams);
+
+    /* set the read/write address of the param */
+    notifyDrvParams.readAddr = readAddr;
+    notifyDrvParams.writeAddr = writeAddr;
+
+    /* create the notify driver instance */
+    notifyDrvHandle = NotifyDriverCirc_create(&notifyDrvParams, &eb);
+    if (notifyDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    /* create the notify instance */
+    notifyHandle = ti_sdo_ipc_Notify_create(
+                       NotifyDriverCirc_Handle_upCast(notifyDrvHandle),
+                       remoteProcId, 0, NULL, &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&notifyDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== IpcMgr_nameServerAttach ========
+ */
+Int IpcMgr_nameServerAttach(UInt16 remoteProcId, Ptr writeAddr, Ptr readAddr)
+{
+    NameServerBlock_Params nsbParams;
+    NameServerBlock_Handle handle;
+    Int status = NameServerBlock_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* Init the param */
+    NameServerBlock_Params_init(&nsbParams);
+
+    /* set the read/write addresses */
+    nsbParams.readAddr  = readAddr;
+    nsbParams.writeAddr = writeAddr;
+
+    /* create only if notify driver has been created to remote proc */
+    if (Notify_intLineRegistered(remoteProcId, 0)) {
+        handle = NameServerBlock_create(remoteProcId,
+                                        &nsbParams,
+                                        &eb);
+        if (handle != NULL) {
+            status = NameServerBlock_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== IpcMgr_transportCircAttach ========
+ */
+Int IpcMgr_transportCircAttach(UInt16 remoteProcId, Ptr writeAddr,
+    Ptr readAddr)
+{
+    TransportCirc_Handle handle;
+    TransportCirc_Params params;
+    Int status = MessageQ_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* init the transport parameters */
+    TransportCirc_Params_init(&params);
+    params.readAddr = readAddr;
+    params.writeAddr = writeAddr;
+
+    /* make sure notify driver has been created */
+    if (Notify_intLineRegistered(remoteProcId, 0)) {
+        handle = TransportCirc_create(remoteProcId, &params, &eb);
+
+        if (handle != NULL) {
+            status = MessageQ_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/IpcMgr.xdc b/packages/ti/sdo/ipc/family/f28m35x/IpcMgr.xdc
new file mode 100644 (file)
index 0000000..513947a
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IpcMgr.xdc ========
+ */
+
+import xdc.runtime.Assert;
+import xdc.runtime.Error;
+
+/*!
+ *  ======== IpcMgr ========
+ *  IPC Manager
+ *
+ *  This modules is used only for F28M35x devices.  Users can statically
+ *  configure which shared memory segments to enable, the owner processor
+ *  and the owner's write access.  This module used for specifying shared
+ *  memory for IPC between the M3 and C28 processors.
+ *
+ *  There are no API's that need to be called.  The necessary drivers for
+ *  IPC are all created within this module's startup function.  The shared
+ *  memory is also programmed within this function.  There is handshake
+ *  between the processors.  The M3 releases the C28 and both processors
+ *  will synchronize at this point.
+ *
+ *  The {@link #readAddr} must point to shared memory which is writeable
+ *  by the remote core while the {@link #writeAddr} must point to shared
+ *  memory which is writeable by the local core.  The {@link #readAddr}
+ *  and {@link #writeAddr} pointers must point to different shared memory
+ *  blocks.  Memory addresses must be specified in the local core's
+ *  memory space.
+ *
+ *  For example on the M3:
+ *  @p(code)
+ *  var IpcMgr = xdc.useModule('ti.sdo.ipc.family.f28m35x.IpcMgr');
+ *  IpcMgr.readAddr  = 0x20016000;
+ *  IpcMgr.writeAddr = 0x20014000;
+ *  IpcMgr.sharedMemoryOwnerMask = 0x80;
+ *  @p
+ *
+ *  On the C28:
+ *  @p(code)
+ *  var IpcMgr = xdc.useModule('ti.sdo.ipc.family.f28m35x.IpcMgr');
+ *  IpcMgr.readAddr  = 0x12000;
+ *  IpcMgr.writeAddr = 0x13000;
+ *  @p
+ */
+
+@ModuleStartup
+
+module IpcMgr
+{
+    /*!
+     *  This value is used for setting {@link #sharedMemoryAccess}.
+     *  If value specified, fetch is not allowed by owner.
+     */
+    const Bits32 NOFETCH    = 1;
+
+    /*!
+     *  This value is used for setting {@link #sharedMemoryAccess}.
+     *  If value specified, DMA writes are not allowed by owner.
+     */
+    const Bits32 NODMAWRITE = 2;
+
+    /*!
+     *  This value is used for setting {@link #sharedMemoryAccess}.
+     *  If value specified, CPU writes are not allowed by owner.
+     */
+    const Bits32 NOCPUWRITE = 4;
+
+    /*
+     *************************************************************************
+     *                       Generic Errors/Asserts
+     *************************************************************************
+     */
+
+    /*!
+     *  ======== A_internal ========
+     *  Assert raised when an internal error is encountered
+     */
+    config Assert.Id A_internal = {
+        msg: "A_internal: An internal error has occurred"
+    };
+
+    /*!
+     *  ======== A_invParam ========
+     *  Assert raised when a parameter is invalid
+     */
+    config Assert.Id A_invParam  = {
+        msg: "A_invParam: Invalid configuration parameter supplied"
+    };
+
+    /*!
+     *  ======== A_notEnoughMemory ========
+     *  Assert raised when there's not enough memory for creating instances.
+     */
+    config Assert.Id A_notEnoughMemory  = {
+        msg: "A_notEnoughMemory: There is not enough memory for operation"
+    };
+
+    /*!
+     *  ======== A_nullArgument ========
+     *  Assert raised when a required argument is null
+     */
+    config Assert.Id A_nullArgument  = {
+        msg: "A_nullArgument: Required argument is null"
+    };
+
+    /*!
+     *  ======== E_internal ========
+     *  Error raised when an internal error occured
+     */
+    config Error.Id E_internal  = {
+        msg: "E_internal: An internal error occurred"
+    };
+
+    /*
+     *************************************************************************
+     *                       Module-wide Config Parameters
+     *************************************************************************
+     */
+
+    /*!
+     *  ======== genLinkerSections ========
+     *  For generating or not generating the linker sections
+     *
+     *  By default this is set to 'true' so the following linker sections
+     *  are generated for the amount of memory used for IPC. For the
+     *  read address - "ti.sdo.ipc.family.f28m35x.IpcMgr.readSect" and for
+     *  the write address - "ti.sdo.ipc.family.f28m35x.IpcMgr.writeSect".
+     *  To disable generation, set this to 'false'.
+     */
+    metaonly config Bool genLinkerSections = true;
+
+    /*!
+     *  ======== ipcSetFlag ========
+     *  The IPC set flag used for generating IPC interrupt
+     *
+     *  Only a value of 0, 1, 2, or 3 are valid since only those flags
+     *  have an interrupt associated with them. This value must be the
+     *  same on both processors.
+     */
+    config UInt32 ipcSetFlag = 3;
+
+    /*!
+     *  ======== messageQSize ========
+     *  The largest MessageQ size (in bytes) supported by the transport
+     *
+     *  This value must be large enough to handle the largest message.
+     *  The size must be specified in bytes.
+     */
+    config UInt32 messageQSize = 128;
+
+    /*!
+     *  ======== messageQEventId ========
+     *  Notify event ID for MessageQ transport.
+     */
+    config UInt16 messageQEventId = 2;
+
+    /*!
+     *  ======== nameServerEventId ========
+     *  Notify event ID for NameServer.
+     */
+    config UInt16 nameServerEventId = 4;
+
+    /*!
+     *  ======== numNotifyMsgs ========
+     *  The number of messages for the Notify driver's circular buffer
+     *
+     *  This is use to determine the size of the put and get buffers.
+     *  This value must be a power of 2.  A value of 'N' allows 'N-1'
+     *  outstanding notifications.
+     */
+    config UInt32 numNotifyMsgs = 32;
+
+    /*!
+     *  ======== numMessageQMsgs ========
+     *  The number of messages for the MessageQ transport's circular buffer
+     *
+     *  This is use to determine the size of the put and get buffers.
+     *  This value must be a power of 2.  A value of 'N' allows 'N-1'
+     *  outstanding notifications.
+     */
+    config UInt32 numMessageQMsgs = 4;
+
+    /*!
+     *  ======== sharedMemoryEnable ========
+     *  Shared RAM memory configuration.
+     *
+     *  This parameter is only applicable to the M3 processor.  It is
+     *  used for writing the MEMCNF register from the M3.
+     *  By default, all shared RAM segments will be enabled at runtime.
+     *  To disable a shared RAM segment, set the corresponding bit to 0.
+     *  If any data is loaded to a shared RAM segment, the segment must
+     *  be enabled prior to loading the program through other means.
+     */
+    config Bits32 sharedMemoryEnable = 0xffffffff;
+
+    /*!
+     *  ======== sharedMemoryOwnerMask ========
+     *  Shared RAM owner select configuration.
+     *
+     *  This parameter is only applicable to the M3 processor.  It is
+     *  used for writing the MSxMSEL register from the M3.
+     *  By default, each value of each shared RAM select bit is '0'.
+     *  This means the M3 is the owner and has write access based upon
+     *  the sharedMemoryAccess bits.  Setting a '1' in any bit position
+     *  makes the C28 the owner of that shared RAM segment.
+     */
+    config Bits32 sharedMemoryOwnerMask = 0;
+
+    /*!
+     *  ======== sharedMemoryAccess ========
+     *  Shared RAM write configuration.
+     *
+     *  This parameter is only applicable to the M3 processor.  It is
+     *  used for writing the MSxSRCR register from the M3.
+     *  It determines the owner write access to each shared RAM segment.
+     *  By default, the owner is allowed to fetch, DMA write, and CPU write.
+     */
+    config Bits32 sharedMemoryAccess[8];
+
+    /*!
+     *  ======== readAddr ========
+     *  The base address of read-only shared memory.
+     *
+     *  The address must be specified in the local core's memory space.
+     *  It must point to the same physical address as the writeAddr for
+     *  the remote processor.
+     */
+    config Ptr readAddr;
+
+    /*!
+     *  ======== writeAddr ========
+     *  The base address of read/write shared memory.
+     *
+     *  The address must be specified in the local core's memory space.
+     *  It must point to the same physical address as the readAddr for
+     *  the remote processor.
+     */
+    config Ptr writeAddr;
+
+internal:
+
+    /* M3 control registers */
+    const UInt32 MWRALLOW = 0x400FB980;
+    const UInt32 MEMCNF  = 0x400FB930;
+    const UInt32 MSxMSEL = 0x400FB210;
+    const UInt32 MSxSRCR = 0x400FB220;
+    const UInt32 C28RTESTINIT = 0x4920;
+    const UInt32 C28RINITDONE = 0x4930;
+    const UInt32 MTOCRTESTINIT = 0x400FB260;
+    const UInt32 MTOCRINITDONE = 0x400FB288;
+
+    /* the amount of shared memory used */
+    config UInt32 sharedMemSizeUsed;
+
+    /* initialize the MsgRams */
+    Void init();
+
+    /* function to create NotifyCirc driver instances */
+    Int notifyCircAttach(UInt16 remoteProcId, Ptr writeAddr, Ptr readAddr);
+
+    /* function to create NameServer remote instances */
+    Int nameServerAttach(UInt16 remoteProcId, Ptr writeAddr, Ptr readAddr);
+
+    /* function to create MessageQ transport instances */
+    Int transportCircAttach(UInt16 remoteProcId, Ptr writeAddr, Ptr readAddr);
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/IpcMgr.xs b/packages/ti/sdo/ipc/family/f28m35x/IpcMgr.xs
new file mode 100644 (file)
index 0000000..a53ab97
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IpcMgr.xs ========
+ */
+
+var IpcMgr           = null;
+var Startup          = null;
+var MultiProc        = null;
+var NotifyDriverCirc = null;
+var NameServerBlock  = null;
+var TransportCirc    = null;
+var Hwi              = null;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    IpcMgr = this;
+
+    /* initialize the config parameter */
+    for (var i=0; i < IpcMgr.sharedMemoryAccess.length; i++) {
+        IpcMgr.sharedMemoryAccess[i] = 0;
+    }
+
+    var NameServer = xdc.useModule('ti.sdo.utils.NameServer');
+    NameServer.SetupProxy = xdc.useModule('ti.sdo.ipc.family.f28m35x.NameServerBlock');
+
+    var Startup = xdc.useModule('xdc.runtime.Startup');
+
+    /* RAMINIT */
+    Startup.firstFxns.$add(IpcMgr.init);
+}
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
+    NotifyDriverCirc =
+        xdc.useModule("ti.sdo.ipc.family.f28m35x.NotifyDriverCirc");
+    NameServerBlock =
+        xdc.useModule("ti.sdo.ipc.family.f28m35x.NameServerBlock");
+    TransportCirc =
+        xdc.useModule("ti.sdo.ipc.family.f28m35x.TransportCirc");
+    Hwi = xdc.useModule("ti.sysbios.hal.Hwi");
+    Startup = xdc.useModule("xdc.runtime.Startup");
+
+    /* Init the number of messages for notify driver */
+    NotifyDriverCirc.numMsgs = IpcMgr.numNotifyMsgs;
+
+    /* Init the number of messages for messageQ transport */
+    TransportCirc.numMsgs = IpcMgr.numMessageQMsgs;
+    TransportCirc.maxMsgSizeInBytes = IpcMgr.messageQSize;
+    TransportCirc.notifyEventId = IpcMgr.messageQEventId;
+
+    /* Make sure that sharedMemoryOwnerMask is only configured on the M3 */
+    if (!Program.build.target.name.match(/M3.*/) &&
+        IpcMgr.$written("sharedMemoryOwnerMask") == true) {
+        this.$logWarning("Warning: IpcMgr.sharedMemoryOwnerMask must only be " +
+        "configured on the M3 core.  Configuring this on the C28 core has no " +
+        "effect", this);
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* check to make sure readAddr and writeAddr have been set */
+    if (params.readAddr == undefined) {
+        IpcMgr.$logError("IpcMgr.readAddr is undefined", IpcMgr);
+    }
+
+    if (params.writeAddr == undefined) {
+        IpcMgr.$logError("IpcMgr.writeAddr is undefined", IpcMgr);
+    }
+
+
+    /* init the interrupt ids */
+    if (params.ipcSetFlag < 0 || params.ipcSetFlag > 3) {
+        IpcMgr.$logError("IpcMgr.ipcSetFlag must be 0, 1, 2, or 3 " +
+            "because they are the only flags associated with an interrupt.",
+            IpcMgr);
+    }
+
+    /* calculate the amount of shared memory used */
+    IpcMgr.sharedMemSizeUsed = NotifyDriverCirc.sharedMemReqMeta(null) +
+                               NameServerBlock.sharedMemReqMeta(null) +
+                               TransportCirc.sharedMemReqMeta(null);
+
+    /* validate sharedMemoryOwnerMask is correct for the readAddr/writeAddr */
+    if (Program.build.target.name.match(/M3.*/)) {
+        if ((IpcMgr.writeAddr >= 0x20008000) &&
+            (IpcMgr.writeAddr < 0x20018000)) {
+            /*
+             *  Determine segment being used for the M3 writeAddr.
+             *  The shared RAM base address starts 0x20008000 to 0x20016000.
+             *  Each segment with a length of 0x2000 (byte addressing).
+             */
+            var writeSeg = (IpcMgr.writeAddr - 0x20008000) >> 13;
+
+            /* The M3 must be owner of writeAddr shared memory segment */
+            if (IpcMgr.sharedMemoryOwnerMask & (1 << writeSeg)) {
+                IpcMgr.$logError("IpcMgr.writeAddr is set to address: " +
+                utils.toHex(IpcMgr.writeAddr) + "," +
+                " but IpcMgr.sharedMemoryOwnerMask bit: " + writeSeg +
+                " must not be set. Unset this bit to make M3 the owner.", IpcMgr);
+            }
+        }
+
+        if ((IpcMgr.readAddr >= 0x20008000) &&
+            (IpcMgr.readAddr < 0x20018000)) {
+            /*
+             *  Determine segment being used for the M3 readAddr.
+             *  The shared RAM base address starts 0x20008000 to 0x20016000.
+             *  Each segment with a length of 0x2000 (byte addressing).
+             */
+            var readSeg = (IpcMgr.readAddr - 0x20008000) >> 13;
+
+            /* The C28 must be owner of readAddr shared memory segment */
+            if (!(IpcMgr.sharedMemoryOwnerMask & (1 << readSeg))) {
+                IpcMgr.$logError("IpcMgr.readAddr is set to address: " +
+                utils.toHex(IpcMgr.readAddr) + "," +
+                " but IpcMgr.sharedMemoryOwnerMask bit: " + readSeg +
+                " is not set. This bit must be set so C28 is the owner.", IpcMgr);
+            }
+        }
+    }
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if ((xdc.module('ti.sdo.ipc.Ipc').$used) ||
+        (xdc.module('ti.sdo.ipc.GateMP').$used) ||
+        (xdc.module('ti.sdo.ipc.SharedRegion').$used) ||
+        (xdc.module('ti.sdo.ipc.ListMP').$used)) {
+        IpcMgr.$logError("One or more of the following modules " +
+            "[Ipc, GateMP, ListMP, SharedRegion] are being used " +
+            "but are not supported on this device.", IpcMgr);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.c b/packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.c
new file mode 100644 (file)
index 0000000..fdb1263
--- /dev/null
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerBlock.c ========
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/knl/ISync.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/knl/Swi.h>
+#include <ti/sysbios/knl/Semaphore.h>
+
+#include <ti/sdo/ipc/family/f28m35x/IpcMgr.h>
+
+#include "package/internal/NameServerBlock.xdc.h"
+
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+
+/* Need to use reserved notify events */
+#undef NameServerBlock_notifyEventId
+#define NameServerBlock_notifyEventId \
+        ti_sdo_ipc_family_f28m35x_NameServerBlock_notifyEventId + \
+                    (UInt32)((UInt32)Notify_SYSTEMKEY << 16)
+
+
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+Int NameServerBlock_Instance_init(NameServerBlock_Object *obj,
+        UInt16 remoteProcId,
+        const NameServerBlock_Params *params,
+        Error_Block *eb)
+{
+    Int               status;
+    Semaphore_Params  semParams;
+    Semaphore_Handle  semRemoteWait;
+    Semaphore_Handle  semMultiBlock;
+    Swi_Handle        swiHandle;
+    Swi_Params        swiParams;
+
+    /* Assert that a NameServerBlock_Params has been supplied */
+    Assert_isTrue(params != NULL, IpcMgr_A_nullArgument);
+
+    /* Assert that remoteProcId is valid */
+    Assert_isTrue(remoteProcId != MultiProc_self() &&
+                  remoteProcId != MultiProc_INVALIDID,
+                  IpcMgr_A_invParam);
+
+    semRemoteWait = NameServerBlock_Instance_State_semRemoteWait(obj);
+    semMultiBlock = NameServerBlock_Instance_State_semMultiBlock(obj);
+    swiHandle = NameServerBlock_Instance_State_swiObj(obj);
+
+    obj->readRequest = (NameServerBlock_Message *)(params->readAddr);
+    obj->readResponse = (NameServerBlock_Message *)(
+                        (UInt32)params->readAddr +
+                        sizeof(NameServerBlock_Message));
+    obj->writeRequest = (NameServerBlock_Message *)(params->writeAddr);
+    obj->writeResponse = (NameServerBlock_Message *)(
+                         (UInt32)params->writeAddr +
+                         sizeof(NameServerBlock_Message));
+    obj->remoteProcId = remoteProcId;
+
+    /* construct the Semaphore */
+    Semaphore_Params_init(&semParams);
+    Semaphore_construct(Semaphore_struct(semRemoteWait), 0, &semParams);
+
+    /* construct the semaphore */
+    Semaphore_construct(Semaphore_struct(semMultiBlock), 1, &semParams);
+
+    /* swi created with lowest priority and fxn = swiFxn */
+    Swi_Params_init(&swiParams);
+    swiParams.arg0 = (UArg)obj;
+    swiParams.priority = 0;
+    Swi_construct(Swi_struct(swiHandle),
+                 (ti_sysbios_knl_Swi_FuncPtr)NameServerBlock_swiFxn,
+                 &swiParams, eb);
+
+    /* initialize own side of message struct only */
+    obj->writeRequest->request = 0;
+    obj->writeRequest->value = 0;
+    obj->writeRequest->valueLen = 0;
+
+    memset(obj->writeRequest->instanceName, 0,
+               sizeof(obj->writeRequest->instanceName));
+    memset(obj->writeRequest->name, 0,
+               sizeof(obj->writeRequest->name));
+
+    obj->writeResponse->response = 0;
+    obj->writeResponse->requestStatus = 0;
+
+    /* register the call back function and event Id with notify */
+    status = Notify_registerEventSingle(
+                remoteProcId,
+                0,
+                NameServerBlock_notifyEventId,
+                (Notify_FnNotifyCbck)NameServerBlock_cbFxn,
+                (UArg)swiHandle);
+
+    /* if not successful return */
+    if (status < 0) {
+        Error_raise(eb, IpcMgr_E_internal, 0, 0);
+        return (1);
+    }
+
+    /* register the remote driver with NameServer */
+    ti_sdo_utils_NameServer_registerRemoteDriver(
+            NameServerBlock_Handle_upCast(obj), remoteProcId);
+
+    return (0);
+}
+
+/*
+ *  ======== NameServerBlock_Instance_finalize ========
+ */
+Void NameServerBlock_Instance_finalize(NameServerBlock_Object *obj,
+    Int status)
+{
+    Semaphore_Handle  semRemoteWait;
+    Semaphore_Handle  semMultiBlock;
+    Swi_Handle        swiHandle;
+
+    if (status == 0) {
+        /* unregister remote driver from NameServer module */
+        ti_sdo_utils_NameServer_unregisterRemoteDriver(obj->remoteProcId);
+
+        /* unregister event from Notify module */
+        Notify_unregisterEventSingle(
+                       obj->remoteProcId,
+                       0,
+                       NameServerBlock_notifyEventId);
+    }
+
+    semRemoteWait = NameServerBlock_Instance_State_semRemoteWait(obj);
+    if (semRemoteWait != NULL) {
+        Semaphore_destruct(Semaphore_struct(semRemoteWait));
+    }
+
+    semMultiBlock = NameServerBlock_Instance_State_semMultiBlock(obj);
+    if (semMultiBlock != NULL) {
+        Semaphore_destruct(Semaphore_struct(semMultiBlock));
+    }
+
+    swiHandle = NameServerBlock_Instance_State_swiObj(obj);
+    if (swiHandle != NULL) {
+        Swi_destruct(Swi_struct(swiHandle));
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NameServerBlock_attach ========
+ */
+Int NameServerBlock_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    return (NameServerBlock_E_FAIL);
+}
+
+/*
+ *  ======== NameServerBlock_cbFxn ========
+ */
+Void NameServerBlock_cbFxn(UInt16 procId,
+                                  UInt16 lineId,
+                                  UInt32 eventId,
+                                  UArg arg,
+                                  UInt32 payload)
+{
+    Swi_Handle swiHandle;
+
+    /* Swi_Handle was passed as arg in register */
+    swiHandle = (Swi_Handle)arg;
+
+    /* post the Swi */
+    Swi_post(swiHandle);
+}
+
+/*
+ *  ======== NameServerBlock_detach ========
+ */
+Int NameServerBlock_detach(UInt16 remoteProcId)
+{
+    return (NameServerBlock_E_FAIL);
+}
+
+/*
+ *  ======== NameServerBlock_get ========
+ */
+Int NameServerBlock_get(NameServerBlock_Object *obj,
+                        String instanceName,
+                        String name,
+                        Ptr value,
+                        UInt32 *valueLen,
+                        ISync_Handle syncHandle,
+                        Error_Block *eb)
+{
+    Int len;
+    Int retval = NameServer_E_NOTFOUND;
+    Int status;
+    Semaphore_Handle semRemoteWait;
+    Semaphore_Handle semMultiBlock;
+
+    Assert_isTrue(*valueLen <= (NameServerBlock_bufLen * sizeof(Bits32)),
+                  NameServerBlock_A_invalidValueLen);
+
+    semRemoteWait = NameServerBlock_Instance_State_semRemoteWait(obj);
+    semMultiBlock = NameServerBlock_Instance_State_semMultiBlock(obj);
+
+    /* prevent multiple threads from entering */
+    Semaphore_pend(semMultiBlock, BIOS_WAIT_FOREVER);
+
+    /* this is a request message */
+    obj->writeRequest->request = 1;
+    obj->writeRequest->response = 0;
+    obj->writeRequest->valueLen = *valueLen;
+
+#ifdef xdc_target__isaCompatible_28
+    /*
+     *  On C28, sizeof(Bits32) is 2. When requesting a value from the M3,
+     *  this value needs to be doubled because sizeof(Bits32) is 4 on M3.
+     */
+    obj->writeRequest->valueLen = obj->writeRequest->valueLen << 1;
+
+#else
+    /*
+     *  On M3, sizeof(Bits32) is 4. When requesting a value from the C28,
+     *  this value needs to be halved because sizeof(Bits32) is 2 on C28.
+     */
+    obj->writeRequest->valueLen = obj->writeRequest->valueLen >> 1;
+
+#endif
+
+    /* copy the name of instance into shared memory */
+    len = strlen(instanceName);
+    NameServerBlock_strncpy((Char *)obj->writeRequest->instanceName,
+                            instanceName,
+                            len + 1);
+
+    /* copy the name of nameserver entry into shared memory */
+    len = strlen(name);
+    NameServerBlock_strncpy((Char *)obj->writeRequest->name,
+                            name,
+                            len + 1);
+
+    /* send the notification to remote processor */
+    status = Notify_sendEvent(
+                       obj->remoteProcId,
+                       0,
+                       NameServerBlock_notifyEventId,
+                       0,
+                       FALSE);
+
+    if (status < 0) {
+        /* undo previous options */
+        obj->writeRequest->request = 0;
+        obj->writeRequest->valueLen = 0;
+
+        /* post the semaphore to make sure it doesn't block */
+        Semaphore_post(semMultiBlock);
+
+        return (retval);
+    }
+
+    /* pend here until we get a notification back from remote processor */
+    status = Semaphore_pend(semRemoteWait, BIOS_WAIT_FOREVER);
+
+    if (status == FALSE) {
+        retval = NameServer_E_OSFAILURE;
+    }
+    else {
+        /* if successful request then copy to value */
+        if (obj->readResponse->requestStatus == TRUE) {
+            /* copy to value */
+            if (obj->readResponse->valueLen <= sizeof(UInt32)) {
+                memcpy(value, &(obj->readResponse->value), sizeof(UInt32));
+            }
+            else {
+                memcpy(value, &(obj->readResponse->valueBuf),
+                       obj->readResponse->valueLen);
+            }
+
+            /* set length to amount of data that was copied */
+            *valueLen = obj->readResponse->valueLen;
+
+            /* set the status */
+            retval = NameServer_S_SUCCESS;
+        }
+
+        /* clear out the request */
+        obj->writeRequest->request = 0;
+    }
+
+    Semaphore_post(semMultiBlock);
+
+    return (retval);
+}
+
+/*
+ *  ======== NameServerBlock_sharedMemReq ========
+ */
+SizeT NameServerBlock_sharedMemReq(Ptr sharedAddr)
+{
+    /*
+     *  Four Message structs are required.
+     *  One for sending request and one for sending response.
+     *  One for receiving request and one for receiving response.
+     */
+    if (ti_sdo_utils_MultiProc_numProcessors > 1) {
+        return (4 * sizeof(NameServerBlock_Message));
+    }
+
+    return (0);
+}
+
+#ifdef xdc_target__isaCompatible_28
+/*
+ *  ======== NameServerBlock_strncpy ========
+ *  Copies the source string into the destination string as a
+ *  packed string.  The length includes the null terminating
+ *  character.
+ */
+Char* NameServerBlock_strncpy(Char *dest, Char *src, SizeT len)
+{
+    Int i;
+    UInt half = len >> 1;
+
+    /* copy and pack the string */
+    for (i = 0; i < half; i++) {
+        dest[i] = src[i << 1] | (src[(i << 1) + 1] << 8);
+    }
+
+    /* The terminating character */
+    if (len & 1) {
+        /*
+         *  (len = odd) ==> name has even number of characters.
+         *  The next byte is (len >> 1), so zero that out.
+         */
+        dest[half] = '\0';
+    }
+    else {
+        /*
+         *  (len = even) ==> name has odd number of characters.
+         *  Zero out the upper half of the last byte.
+         */
+        dest[half - 1] |= ('\0' << 8);
+    }
+
+    return (dest);
+}
+
+#else
+/*
+ *  ======== NameServerBlock_strncpy ========
+ */
+Char* NameServerBlock_strncpy(Char *dest, Char *src, SizeT len)
+{
+    return (strncpy(dest, src, len));
+}
+
+#endif
+
+/*
+ *  ======== NameServerBlock_swiFxn ========
+ */
+Void NameServerBlock_swiFxn(UArg arg)
+{
+    UInt32 valueLen;
+    UInt hwiKey;
+    NameServer_Handle handle;
+    NameServerBlock_Object *obj;
+#ifdef xdc_target__isaCompatible_28
+    static Char instanceName[64];
+    static Char name[64];
+    String ptrIName;
+    String ptrName;
+    Int i;
+#else
+    String instanceName;
+    String name;
+#endif
+    Int status;
+
+    obj = (NameServerBlock_Object *)arg;
+
+    /* In case of request */
+    if (obj->readRequest->request == TRUE) {
+#ifdef xdc_target__isaCompatible_28
+        ptrIName = (String)obj->readRequest->instanceName;
+        ptrName = (String)obj->readRequest->name;
+
+        /* Unpack the string for the C28 */
+        for (i = 0; i < 64; i++) {
+            if (i & 1) {
+                /* odd values are taken from the upper 8 bits shifted */
+                instanceName[i] = ptrIName[i >> 1] >> 8;
+                name[i] = ptrName[i >> 1] >> 8;
+            }
+            else {
+                /* even values are taken from the lower 8 bits */
+                instanceName[i] = ptrIName[i >> 1] & 0xFF;
+                name[i] = ptrName[i >> 1] & 0xFF;
+            }
+        }
+#else
+        /* Strings are in the correct format already */
+        instanceName = (String)obj->readRequest->instanceName;
+        name = (String)obj->readRequest->name;
+#endif
+        /* get the NameServer handle */
+        handle = NameServer_getHandle((String)instanceName);
+        valueLen = obj->readRequest->valueLen;
+
+        if (handle != NULL) {
+            /* Search for the NameServer entry */
+            if (valueLen <= sizeof(UInt32)) {
+                status = NameServer_getLocalUInt32(handle,
+                    (String)name,
+                    &obj->writeResponse->value);
+            }
+            else {
+                status = NameServer_getLocal(handle,
+                    (String)name,
+                    &obj->writeResponse->valueBuf, &valueLen);
+            }
+        }
+        else {
+            status = NameServer_E_FAIL;
+        }
+
+        /*
+         *  If an entry was found, set requestStatus to TRUE
+         *  and valueLen to the size of data that was copied.
+         */
+        if (status == NameServer_S_SUCCESS) {
+            obj->writeResponse->requestStatus = TRUE;
+#ifdef xdc_target__isaCompatible_28
+            obj->writeResponse->valueLen = (valueLen << 1);
+#else
+            obj->writeResponse->valueLen = (valueLen >> 1);
+#endif
+        }
+        else {
+            obj->writeResponse->requestStatus = FALSE;
+            obj->writeResponse->valueLen = 0;
+        }
+
+        /* Send a response back */
+        obj->writeResponse->response = TRUE;
+
+        /*
+         *  The Notify line must be active at this point for this processor to
+         *  have received a request
+         */
+        status = Notify_sendEvent(obj->remoteProcId,
+                0, NameServerBlock_notifyEventId, 0, FALSE);
+
+        /* The NS query could fail, but the reply should never fail */
+        Assert_isTrue(status >= 0, IpcMgr_A_internal);
+    }
+
+    /* in case of response */
+    if (obj->readResponse->response == TRUE &&
+        obj->writeRequest->response == FALSE) {
+
+        /* disable interrupts */
+        hwiKey = Hwi_disable();
+
+        /* acknowledge receive of response atomically with posting semaphore */
+        obj->writeRequest->response = TRUE;
+
+        /* post the Semaphore */
+        Semaphore_post(
+            NameServerBlock_Instance_State_semRemoteWait(obj));
+
+        /* restore interrupts */
+        Hwi_restore(hwiKey);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.xdc b/packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.xdc
new file mode 100644 (file)
index 0000000..ae3e9e7
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerBlock.xdc ========
+ */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import ti.sysbios.knl.Swi;
+import ti.sysbios.knl.Semaphore;
+import ti.sdo.utils.INameServerRemote;
+
+/*! @_nodoc
+ *  ======== NameServerBlock ========
+ *  Used by NameServer to communicate to remote processors.
+ *
+ *  This module is used by {@link ti.sdo.utils.NameServer} to communicate
+ *  to remote processors using {@link ti.sdo.ipc.Notify} and shared memory.
+ *  There needs to be one instance between each two cores in the system.
+ *  Interrupts must be enabled before using this module.  Currently
+ *  supports transferring up to 44-bytes between two cores.
+ */
+@InstanceInitError
+@InstanceFinalize
+
+module NameServerBlock inherits INameServerRemote
+{
+    /* structure in shared memory for retrieving value */
+    struct Message {
+        Bits32  request;            /* if this is a request set to 1    */
+        Bits32  response;           /* if this is a response set to 1   */
+        Bits32  requestStatus;      /* if request sucessful set to 1    */
+        Bits32  value;              /* holds value if len <= 4          */
+        Bits32  valueLen;           /* len of value                     */
+        Bits32  instanceName[8];    /* name of NameServer instance      */
+        Bits32  name[8];            /* name of NameServer entry         */
+        Bits32  valueBuf[bufLen];   /* supports up to 44-byte value     */
+    };
+
+    /*!
+     *  Assert raised when length of value larger then 44 bytes.
+     */
+    config xdc.runtime.Assert.Id A_invalidValueLen =
+        {msg: "A_invalidValueLen: Invalid valueLen (too large)"};
+
+    /*! @_nodoc
+     *  ======== notifyEventId ========
+     *  The Notify event ID.
+     */
+    config UInt32 notifyEventId = 4;
+
+    /*! @_nodoc
+     *  ======== sharedMemReqMeta ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to the parameters that will be used in
+     *                      create.
+     *
+     *  @a(returns)         Size of shared memory in MAUs on local processor.
+     */
+    metaonly SizeT sharedMemReqMeta(const Params *params);
+
+instance:
+
+    /*!
+     *  ======== readAddr ========
+     *  Read address of the shared memory
+     *
+     *  The address must be specified in the local core's memory space.
+     *  It must point to the same physical address as the writeAddr for
+     *  the remote processor.
+     */
+    config Ptr readAddr = null;
+
+    /*!
+     *  ======== writeAddr ========
+     *  Write address of the shared memory
+     *
+     *  The address must be specified in the local core's memory space.
+     *  It must point to the same physical address as the readAddr for
+     *  the remote processor.
+     */
+    config Ptr writeAddr = null;
+
+internal:
+
+    /*! used by Message struct for length of valueBuf */
+    const UInt bufLen = 11;
+
+    /*!
+     *  ======== cbFxn ========
+     *  The call back function registered with Notify.
+     *
+     *  This function is registered with Notify as a call back function
+     *  when the specified event is triggered.  This function simply posts
+     *  a Swi which will process the event.
+     *
+     *  @param(procId)          Source proc id
+     *  @param(lineId)          Interrupt line id
+     *  @param(eventId)         the Notify event id.
+     *  @param(arg)             the argument for the function.
+     *  @param(payload)         a 32-bit payload value.
+     */
+    Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+               UInt32 payload);
+
+    /*!
+     *  ======== strncpy ========
+     *  Copies the source string into the destination string.
+     *
+     *  For the M3, this function calls the 'C' runtime strncpy().
+     *  For the C28, this function packs the source string into
+     *  the destination string.
+     *
+     *  @param(dest)        Destination string.
+     *  @param(src)         Source string.
+     *  @param(len)         len of string to copy.
+     *
+     *  @a(returns)         Destination string.
+     */
+    Char* strncpy(Char *dest, Char *src, SizeT len);
+
+    /*!
+     *  ======== swiFxn ========
+     *  The swi function that will be executed during the call back.
+     *
+     *  @param(arg)     argument to swi function
+     */
+    Void swiFxn(UArg arg);
+
+    /* instance state */
+    struct Instance_State {
+        Message             *readRequest;
+        Message             *readResponse;
+        Message             *writeRequest;  /* Ptrs to messages in shared mem */
+        Message             *writeResponse; /* Ptrs to messages in shared mem */
+        UInt16              regionId;       /* SharedRegion ID                */
+        Semaphore.Object    semRemoteWait;  /* sem to wait on remote proc     */
+        Semaphore.Object    semMultiBlock;  /* sem to block multiple threads  */
+        Swi.Object          swiObj;         /* instance swi object            */
+        UInt16              remoteProcId;   /* remote MultiProc id            */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.xs b/packages/ti/sdo/ipc/family/f28m35x/NameServerBlock.xs
new file mode 100644 (file)
index 0000000..d8f034b
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerBlock.xs ========
+ */
+
+var NameServerBlock = null;
+var NameServer      = null;
+var MultiProc       = null;
+var Notify          = null;
+var Semaphore       = null;
+var Swi             = null;
+var IpcMgr          = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NameServerBlock = this;
+    NameServer      = xdc.useModule("ti.sdo.utils.NameServer");
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Semaphore       = xdc.useModule("ti.sysbios.knl.Semaphore");
+    Swi             = xdc.useModule("ti.sysbios.knl.Swi");
+    IpcMgr          = xdc.useModule('ti.sdo.ipc.family.f28m35x.IpcMgr');
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (Notify.numEvents <= NameServerBlock.notifyEventId) {
+        NameServerBlock.$logFatal(
+            "NameServerBlock.notifyEventId (" +
+            NameServerBlock.notifyEventId +
+            ") is too big: Notify.numEvents = " + Notify.numEvents,
+            NameServerBlock);
+    }
+}
+
+/*
+ *  ======== sharedMemReqMeta ========
+ */
+function sharedMemReqMeta(params)
+{
+    /*
+     *  Four Message structs are required.
+     *  One for sending request and one for sending response.
+     *  One for receiving request and one for receiving response.
+     */
+    if (MultiProc.numProcessors > 1) {
+        return (4 * NameServerBlock.Message.$sizeof());
+    }
+
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.c b/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.c
new file mode 100644 (file)
index 0000000..3edbe7c
--- /dev/null
@@ -0,0 +1,449 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverCirc.c ========
+ */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Timestamp.h>
+
+#ifdef xdc_target__isaCompatible_v7M
+#include <ti/sysbios/family/arm/m3/Hwi.h>
+#else
+#include <ti/sysbios/family/c28/Hwi.h>
+#endif
+
+#include <ti/sdo/ipc/family/f28m35x/IpcMgr.h>
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+
+#include "package/internal/NotifyDriverCirc.xdc.h"
+
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+/* For the M3 */
+#define CTOMIPCACK  (0x400FB700)
+#define CTOMIPCSTS  (CTOMIPCACK + 0x4)
+#define MTOCIPCSET  (CTOMIPCACK + 0x8)
+#define MTOCIPCCLR  (CTOMIPCACK + 0xC)
+#define MTOCIPCFLG  (CTOMIPCACK + 0x10)
+
+/* For the C28 */
+#define CTOMIPCSET  (0x00004E00)
+#define CTOMIPCCLR  (CTOMIPCSET + 0x2)
+#define CTOMIPCFLG  (CTOMIPCSET + 0x4)
+#define MTOCIPCACK  (CTOMIPCSET + 0x6)
+#define MTOCIPCSTS  (CTOMIPCSET + 0x8)
+
+/*
+ **************************************************************
+ *                       Instance functions
+ **************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverCirc_Instance_init ========
+ */
+Void NotifyDriverCirc_Instance_init(NotifyDriverCirc_Object *obj,
+    const NotifyDriverCirc_Params *params)
+{
+    SizeT  ctrlSize, circBufSize;
+    Hwi_Params  hwiParams;
+
+    /*
+     *  This code assumes that the device's C28 and M3 MultiProc Ids
+     *  are next to each other (e.g. n and n + 1) and that the first
+     *  one is even (e.g. n is even).
+     */
+    /* set the remote processor's id */
+    if (MultiProc_self() & 1) {
+        /* I'm odd */
+        obj->remoteProcId = MultiProc_self() - 1;
+    }
+    else {
+        /* I'm even */
+        obj->remoteProcId = MultiProc_self() + 1;
+    }
+
+    /* calculate the circular buffer size one-way */
+    circBufSize = sizeof(NotifyDriverCirc_EventEntry) *
+                  NotifyDriverCirc_numMsgs;
+
+    /* calculate the control size one-way */
+    ctrlSize = sizeof(Bits32);
+
+    /*
+     *  Init put/get buffer and index pointers.
+     */
+    obj->putBuffer = params->writeAddr;
+
+    obj->putWriteIndex = (Bits32 *)((UInt32)obj->putBuffer + circBufSize);
+
+    obj->getBuffer = params->readAddr;
+
+    obj->getWriteIndex = (Bits32 *)((UInt32)obj->getBuffer + circBufSize);
+
+    obj->putReadIndex = (Bits32 *)((UInt32)obj->getWriteIndex + ctrlSize);
+
+    obj->getReadIndex = (Bits32 *)((UInt32)obj->putWriteIndex + ctrlSize);
+
+    /* init the putWrite and getRead Index to 0 */
+    obj->putWriteIndex[0] = 0;
+    obj->getReadIndex[0] = 0;
+
+    /* clear interrupt */
+    NotifyDriverCirc_intClear();
+
+    /* plugged interrupt */
+    Hwi_Params_init(&hwiParams);
+    hwiParams.arg = (UArg)obj;
+    Hwi_create(NotifyDriverCirc_localIntId,
+              (Hwi_FuncPtr)NotifyDriverCirc_isr,
+              &hwiParams,
+              NULL);
+
+    /* Enable the interrupt */
+    Hwi_enableInterrupt(NotifyDriverCirc_localIntId);
+}
+
+/*
+ *  ======== NotifyDriverCirc_Instance_finalize ========
+ */
+Void NotifyDriverCirc_Instance_finalize(NotifyDriverCirc_Object *obj)
+{
+    Hwi_Handle  hwiHandle;
+
+    /* Disable the interrupt source */
+    NotifyDriverCirc_intDisable();
+
+    /* Delete the Hwi */
+    hwiHandle = Hwi_getHandle(NotifyDriverCirc_localIntId);
+    Hwi_delete(&hwiHandle);
+}
+
+/*
+ *  ======== NotifyDriverCirc_registerEvent ========
+ */
+Void NotifyDriverCirc_registerEvent(NotifyDriverCirc_Object *obj,
+                                    UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Set the 'registered' bit */
+    SET_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverCirc_unregisterEvent ========
+ */
+Void NotifyDriverCirc_unregisterEvent(NotifyDriverCirc_Object *obj,
+                                      UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Clear the registered bit */
+    CLEAR_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverCirc_sendEvent ========
+ */
+Int NotifyDriverCirc_sendEvent(NotifyDriverCirc_Object *obj,
+                               UInt32 eventId,
+                               UInt32 payload,
+                               Bool  waitClear)
+{
+    Bool loop = FALSE;
+    UInt hwiKey;
+    UInt32 writeIndex, readIndex;
+    NotifyDriverCirc_EventEntry *eventEntry;
+
+    /* Retrieve the get Index. */
+    readIndex = obj->putReadIndex[0];
+
+    do {
+        /* disable interrupts */
+        hwiKey = Hwi_disable();
+
+        /* retrieve the put index */
+        writeIndex = obj->putWriteIndex[0];
+
+        /* if slot available 'break' out of loop */
+        if (((writeIndex + 1) & NotifyDriverCirc_maxIndex) != readIndex) {
+            break;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(hwiKey);
+
+        /* check to make sure code has looped */
+        if (loop && !waitClear) {
+            /* if no slot available and waitClear is 'FALSE' */
+            return (Notify_E_FAIL);
+        }
+
+        /* re-read the get count */
+        readIndex = obj->putReadIndex[0];
+
+        /* convey that the code has looped around */
+        loop = TRUE;
+
+    } while (1);
+
+    /* interrupts are disabled at this point */
+
+    /* calculate the next available entry */
+    eventEntry = (NotifyDriverCirc_EventEntry *)((UInt32)obj->putBuffer +
+                 (writeIndex * sizeof(NotifyDriverCirc_EventEntry)));
+
+    /* Set the eventId field and payload for the entry */
+    eventEntry->eventid = eventId;
+    eventEntry->payload = payload;
+
+    /* update the putWriteIndex */
+    obj->putWriteIndex[0] = (writeIndex + 1) & NotifyDriverCirc_maxIndex;
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    /* Send an interrupt to the Remote Processor */
+    NotifyDriverCirc_intSend();
+
+    return (Notify_S_SUCCESS);
+}
+
+/*
+ *  ======== NotifyDriverCirc_disable ========
+ */
+Void NotifyDriverCirc_disable(NotifyDriverCirc_Object *obj)
+{
+    /* Disable the incoming interrupt line */
+    NotifyDriverCirc_intDisable();
+}
+
+/*
+ *  ======== NotifyDriverCirc_enable ========
+ */
+Void NotifyDriverCirc_enable(NotifyDriverCirc_Object *obj)
+{
+    /* NotifyDriverCirc_enableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverCirc_A_notSupported);
+}
+
+/*
+ *  ======== NotifyDriverCirc_disableEvent ========
+ *  This function disbales all events.
+ */
+Void NotifyDriverCirc_disableEvent(NotifyDriverCirc_Object *obj,
+                                   UInt32 eventId)
+{
+    /* NotifyDriverCirc_disableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverCirc_A_notSupported);
+}
+
+/*
+ *  ======== NotifyDriverCirc_enableEvent ========
+ *  This function enables all events.
+ */
+Void NotifyDriverCirc_enableEvent(NotifyDriverCirc_Object *obj,
+                                  UInt32 eventId)
+{
+    /* Enable the incoming interrupt line */
+    NotifyDriverCirc_intEnable();
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverCirc_sharedMemReq ========
+ */
+SizeT NotifyDriverCirc_sharedMemReq(const NotifyDriverCirc_Params *params)
+{
+    SizeT memReq;
+
+    /* Ensure that params is non-NULL */
+    Assert_isTrue(params != NULL, IpcMgr_A_internal);
+
+    /*
+     *  Amount of shared memory:
+     *  1 putBuffer with numMsgs +
+     *  1 putWriteIndex ptr      +
+     *  1 putReadIndex ptr
+     */
+    memReq =
+        (sizeof(NotifyDriverCirc_EventEntry) * NotifyDriverCirc_numMsgs)
+        + (2 * sizeof(Bits32));
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+/*
+ *  ======== NotifyDriverCirc_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void NotifyDriverCirc_intEnable()
+{
+    Hwi_enableInterrupt(NotifyDriverCirc_localIntId);
+}
+
+/*
+ *  ======== NotifyDriverCirc_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void NotifyDriverCirc_intDisable()
+{
+    Hwi_disableInterrupt(NotifyDriverCirc_localIntId);
+}
+
+/*
+ *  ======== NotifyDriverCirc_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void NotifyDriverCirc_intSend()
+{
+#ifdef xdc_target__isaCompatible_v7M
+    volatile UInt32 *set = (volatile UInt32 *)MTOCIPCSET;
+#else
+    volatile UInt16 *set = (volatile UInt16 *)CTOMIPCSET;
+#endif
+
+    *set = 1 << IpcMgr_ipcSetFlag;
+}
+
+/*
+ *  ======== NotifyDriverCirc_intClear ========
+ *  Clear interrupt
+ */
+UInt NotifyDriverCirc_intClear()
+{
+#ifdef xdc_target__isaCompatible_v7M
+    volatile UInt32 *ack = (volatile UInt32 *)CTOMIPCACK;
+#else
+    volatile UInt16 *ack = (volatile UInt16 *)MTOCIPCACK;
+#endif
+
+    *ack = 1 << IpcMgr_ipcSetFlag;
+
+    return (0);
+}
+
+/*
+ *  ======== NotifyDriverCirc_isr ========
+ */
+Void NotifyDriverCirc_isr(UArg arg)
+{
+    NotifyDriverCirc_EventEntry *eventEntry;
+    NotifyDriverCirc_Object     *obj;
+    UInt32 writeIndex, readIndex;
+
+    obj = (NotifyDriverCirc_Object *)arg;
+
+    /* Make sure the NotifyDriverCirc_Object is not NULL */
+    Assert_isTrue(obj != NULL, IpcMgr_A_internal);
+
+    /* Clear the remote interrupt */
+    NotifyDriverCirc_intClear();
+
+    /* get the writeIndex and readIndex */
+    writeIndex = obj->getWriteIndex[0];
+    readIndex = obj->getReadIndex[0];
+
+    /* get the event */
+    eventEntry = &(obj->getBuffer[readIndex]);
+
+    /* if writeIndex != readIndex then there is an event to process */
+    while (writeIndex != readIndex) {
+        /*
+         *  Check to make sure event is registered. If the event
+         *  is not registered, the event is not processed and is lost.
+         */
+        if (TEST_BIT(obj->evtRegMask, eventEntry->eventid)) {
+            /* Execute the callback function */
+            ti_sdo_ipc_Notify_exec(obj->notifyHandle,
+                                   eventEntry->eventid,
+                                   eventEntry->payload);
+        }
+
+        /* update the readIndex. */
+        readIndex = ((readIndex + 1) & NotifyDriverCirc_maxIndex);
+
+        /* set the getReadIndex */
+        obj->getReadIndex[0] = readIndex;
+
+        /* get the next event */
+        eventEntry = &(obj->getBuffer[readIndex]);
+    }
+}
+
+/*
+ *  ======== NotifyDriverCirc_setNotifyHandle ========
+ */
+Void NotifyDriverCirc_setNotifyHandle(NotifyDriverCirc_Object *obj,
+                                      Ptr notifyHandle)
+{
+    /* Internally used, so no Assert needed */
+    obj->notifyHandle = (ti_sdo_ipc_Notify_Handle)notifyHandle;
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xdc b/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xdc
new file mode 100644 (file)
index 0000000..f65b6e0
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverCirc.xdc ================
+ */
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.interfaces.INotifyDriver;
+import ti.sdo.ipc.notifyDrivers.IInterrupt;
+import ti.sdo.ipc.Notify;
+
+import xdc.rov.ViewInfo;
+
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== NotifyDriverCirc ========
+ *  Shared memory driver using circular buffer for F28M35x devices.
+ *
+ *  This is a {@link ti.sdo.ipc.Notify} driver that utilizes shared memory
+ *  and inter-processor hardware interrupts for notification between cores.
+ *
+ *  This driver is designed to work with only F28M35x family of devices.
+ *  This module needs to be plugged with an appropriate module that implements
+ *  the {@link ti.sdo.ipc.notifyDrivers.IInterrupt} interface for a given
+ *  device.
+ *
+ *  The driver utilizes shared memory in the manner indicated by the following
+ *  diagram.
+ *
+ *  @p(code)
+ *
+ *  NOTE: Processor '0' corresponds to the M3 and '1' corresponds to the C28
+ *
+ * sharedAddr -> --------------------------- bytes
+ *               |  eventEntry0  (0)       | 8
+ *               |  eventEntry1  (0)       | 8
+ *               |  ...                    |
+ *               |  eventEntry15 (0)       | 8
+ *               |                         |
+ *               |-------------------------|
+ *               |  eventEntry16 (0)       | 8
+ *               |  eventEntry17 (0)       | 8
+ *               |  ...                    |
+ *               |  eventEntry31 (0)       | 8
+ *               |                         |
+ *               |-------------------------|
+ *               |  putWriteIndex (0)      | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  getReadIndex (1)       | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  eventEntry0  (1)       | 8
+ *               |  eventEntry1  (1)       | 8
+ *               |  ...                    |
+ *               |  eventEntry15 (1)       | 8
+ *               |                         |
+ *               |-------------------------|
+ *               |  eventEntry16 (1)       | 8
+ *               |  eventEntry17 (1)       | 8
+ *               |  ...                    |
+ *               |  eventEntry31 (1)       | 8
+ *               |                         |
+ *               |-------------------------|
+ *               |  putWriteIndex (1)      | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  getReadIndex (0)       | 4
+ *               |                         |
+ *               |-------------------------|
+ *
+ *
+ *  Legend:
+ *  (0), (1) : belongs to the respective processor
+ *
+ *  @p
+ */
+
+@InstanceFinalize
+
+module NotifyDriverCirc inherits ti.sdo.ipc.interfaces.INotifyDriver
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+        UInt        bufSize;
+        UInt        spinCount;
+        UInt        maxSpinWait;
+    }
+
+    /*! @_nodoc */
+    metaonly struct EventDataView {
+        UInt        index;
+        String      buffer;
+        Ptr         addr;
+        UInt        eventId;
+        Ptr         payload;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Events',
+                    {
+                        type: ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'EventDataView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  Assert raised when trying to use Notify_[enable/disable]Event with
+     *  NotifyDriverCirc
+     */
+    config Assert.Id A_notSupported =
+        {msg: "A_notSupported: [enable/disable]Event not supported by NotifyDriverCirc"};
+
+    /*! @_nodoc
+     *  ======== numMsgs ========
+     *  The number of messages or slots in the circular buffer
+     *
+     *  This is use to determine the size of the put and get buffers.
+     *  Each eventEntry is two 32bits wide, therefore the total size
+     *  of each circular buffer is [numMsgs * sizeof(eventEntry)].
+     */
+    config UInt numMsgs = 16;
+
+    /*!
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to parameters that will be used in the
+     *                      create
+     *
+     *  @a(returns)         Number of MAUs in shared memory needed to create
+     *                      the instance.
+     */
+    SizeT sharedMemReq(const Params *params);
+
+    /*! @_nodoc
+     *  ======== sharedMemReqMeta ========
+     *  Amount of shared memory required
+     *
+     *  @param(params)      Pointer to the parameters that will be used in
+     *                      create.
+     *
+     *  @a(returns)         Size of shared memory in MAUs on local processor.
+     */
+    metaonly SizeT sharedMemReqMeta(const Params *params);
+
+instance:
+
+    /*!
+     *  ======== readAddr ========
+     *  Address in shared memory where buffer is placed
+     *
+     *  Use {@link #sharedMemReq} to determine the amount of shared memory
+     *  required.
+     */
+    config Ptr readAddr = null;
+
+    /*!
+     *  ======== writeAddr ========
+     *  Address in shared memory where buffer is placed
+     *
+     *  Use {@link #sharedMemReq} to determine the amount of shared memory
+     *  required.
+     */
+    config Ptr writeAddr = null;
+
+internal:
+
+    /*!
+     *  ======== localIntId ========
+     *  Local interrupt ID for interrupt line
+     *
+     *  For devices that support multiple inter-processor interrupt lines, this
+     *  configuration parameter allows selecting a specific line to use for
+     *  receiving an interrupt.  The value specified here corresponds to the
+     *  incoming interrupt line on the local processor.
+     */
+    config UInt localIntId;
+
+    /*!
+     *  ======== remoteIntId ========
+     *  Remote interrupt ID for interrupt line
+     *
+     *  For devices that support multiple inter-processor interrupt lines, this
+     *  configuration parameter allows selecting a specific line to use for
+     *  receiving an interrupt.  The value specified here corresponds to the
+     *  incoming interrupt line on the remote processor.
+     */
+    config UInt remoteIntId;
+
+    /*! The max index set to (numMsgs - 1) */
+    config UInt maxIndex;
+
+    /*!
+     *  The modulo index value. Set to (numMsgs / 4).
+     *  Used in the isr for doing cache_wb of readIndex.
+     */
+    config UInt modIndex;
+
+    /*!
+     *  enable IPC interrupt
+     */
+    Void intEnable();
+
+    /*!
+     *  disable IPC interrupt
+     */
+    Void intDisable();
+
+    /*!
+     *  trigger IPC interrupt
+     */
+    Void intSend();
+
+    /*!
+     *  clear IPC interrupt
+     */
+    UInt intClear();
+
+    /*!
+     *  executes the callback functions according to event priority
+     */
+    Void isr(UArg arg);
+
+    /*!
+     *  Structure for each event. This struct is placed in shared memory.
+     */
+    struct EventEntry {
+        volatile Bits32 eventid;
+        volatile Bits32 payload;
+    }
+
+    /*! Instance state structure */
+    struct Instance_State {
+        EventEntry       *putBuffer;     /* buffer used to put events        */
+        Bits32           *putReadIndex;  /* ptr to readIndex for put buffer  */
+        Bits32           *putWriteIndex; /* ptr to writeIndex for put buffer */
+        EventEntry       *getBuffer;     /* buffer used to get events        */
+        Bits32           *getReadIndex;  /* ptr to readIndex for get buffer  */
+        Bits32           *getWriteIndex; /* ptr to writeIndex for put buffer */
+        Bits32           evtRegMask;     /* local event register mask        */
+        Notify.Handle    notifyHandle;   /* Handle to front-end object       */
+        UInt16           remoteProcId;   /* Remote MultiProc id              */
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xs b/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xs
new file mode 100644 (file)
index 0000000..61cf07d
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverCirc.xs ================
+ */
+
+var NotifyDriverCirc = null;
+var IpcMgr           = null;
+var MultiProc        = null;
+var Notify           = null;
+var Hwi              = null;
+
+var MTOCIPC = [ 112, 113, 114, 115 ];
+var CTOMIPC = [ 96, 97, 98, 99 ];
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = this;
+    IpcMgr           = xdc.useModule("ti.sdo.ipc.family.f28m35x.IpcMgr");
+    MultiProc        = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify           = xdc.useModule("ti.sdo.ipc.Notify");
+    Hwi              = xdc.useModule("ti.sysbios.hal.Hwi");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    NotifyDriverCirc.maxIndex = NotifyDriverCirc.numMsgs - 1;
+    NotifyDriverCirc.modIndex = NotifyDriverCirc.numMsgs / 4;
+
+    /* determine the local and remote interrupt id */
+    if (Program.build.target.name.match(/C28.*/)) {
+        NotifyDriverCirc.localIntId = MTOCIPC[IpcMgr.ipcSetFlag];
+        NotifyDriverCirc.remoteIntId = CTOMIPC[IpcMgr.ipcSetFlag];
+    }
+    else {
+        NotifyDriverCirc.localIntId = CTOMIPC[IpcMgr.ipcSetFlag];
+        NotifyDriverCirc.remoteIntId = MTOCIPC[IpcMgr.ipcSetFlag];
+    }
+}
+
+/*
+ *  ======== sharedMemReqMeta ========
+ */
+function sharedMemReqMeta(params)
+{
+    /*
+     *  Amount of shared memory:
+     *  1 putBuffer with numMsgs +
+     *  1 putWriteIndex ptr      +
+     *  1 putReadIndex ptr
+     */
+    memReq =
+        (NotifyDriverCirc.EventEntry.$sizeof() * NotifyDriverCirc.numMsgs) +
+        (2 * Program.build.target.stdTypes['t_Int32'].size);
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.family.f28m35x.NotifyDriverCirc');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    /* view obj information */
+    view.bufSize      = modCfg.numMsgs;
+    view.spinCount    = obj.spinCount;
+    view.maxSpinWait  = obj.spinWaitTime;;
+}
+
+/*
+ *  ======== getEventData ========
+ *  Helper function for use within viewInitData
+ */
+function getEventData(view, obj, bufferPtr, putIndex, getIndex)
+{
+    var NotifyDriverCirc =
+        xdc.useModule('ti.sdo.ipc.family.f28m35x.NotifyDriverCirc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.family.f28m35x.NotifyDriverCirc');
+
+    if (bufferPtr == obj.putBuffer) {
+        var bufferName = "put";
+    }
+    else {
+        var bufferName = "get";
+    }
+
+    try {
+        var putBuffer = Program.fetchArray(obj.putBuffer$fetchDesc,
+                                           bufferPtr,
+                                           modCfg.numMsgs);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putBuffer struct from shared memory"));
+    }
+
+    var i = getIndex;
+
+    while (i != putIndex) {
+        /* The event is registered */
+        var elem = Program.newViewStruct(
+                'ti.sdo.ipc.family.f28m35x.NotifyDriverCirc',
+                'Events');
+
+        elem.index = i;
+        elem.buffer = bufferName;
+        elem.addr = utils.toHex(putBuffer[i].$addr);
+        elem.eventId = putBuffer[i].eventid;
+        elem.payload = utils.toHex(putBuffer[i].payload);
+
+        /* Create a new row in the instance data view */
+        view.elements.$add(elem);
+
+        i++;
+    }
+}
+
+
+/*
+ *  ======== viewInitData ========
+ *  Instance data view.
+ */
+function viewInitData(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    try {
+        var notifyObj = Program.scanHandleView('ti.sdo.ipc.Notify',
+            obj.notifyHandle, 'Basic');
+    }
+    catch (e) {
+        throw (new Error("Error fetching Notify instance view"));
+    }
+
+    /* Display the instance label in the tree */
+    view.label = "remoteProcId = " + obj.remoteProcId + " lineId = " +
+        notifyObj.lineId;
+
+    /* Fetch put/get index's */
+    try {
+        var putWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.putWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putWriteIndex " +
+                         "struct from shared memory"));
+    }
+
+    try {
+        var putReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.putReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putReadIndex " +
+                         "struct from shared memory"));
+    }
+
+    try {
+        var getWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.getWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getWriteIndex " +
+                         "struct from shared memory"));
+    }
+
+    try {
+        var getReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.getReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getReadIndex " +
+                         "struct from shared memory"));
+    }
+
+    /* Get event data for the put buffer */
+    getEventData(view, obj, obj.putBuffer, putWriteIndex.elem,
+                 putReadIndex.elem);
+
+    /* Get event data for the get buffer */
+    getEventData(view, obj, obj.getBuffer, getWriteIndex.elem,
+                 getReadIndex.elem);
+
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.c b/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.c
new file mode 100644 (file)
index 0000000..bbbc7fd
--- /dev/null
@@ -0,0 +1,394 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportCirc.c ========
+ */
+
+#include <string.h>  /* for memcpy() */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/knl/Swi.h>
+
+#include <ti/sdo/ipc/family/f28m35x/IpcMgr.h>
+
+#include "package/internal/TransportCirc.xdc.h"
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+
+/* Need to use reserved notify events */
+#undef TransportCirc_notifyEventId
+#define TransportCirc_notifyEventId \
+    ti_sdo_ipc_family_f28m35x_TransportCirc_notifyEventId + \
+    (UInt32)((UInt32)Notify_SYSTEMKEY << 16)
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportCirc_Instance_init ========
+ */
+Int TransportCirc_Instance_init(TransportCirc_Object *obj,
+        UInt16 remoteProcId, const TransportCirc_Params *params,
+        Error_Block *eb)
+{
+    Int        status;
+    Bool       flag;
+    Swi_Handle swiHandle;
+    Swi_Params swiParams;
+    SizeT      circBufSize;
+
+    swiHandle = TransportCirc_Instance_State_swiObj(obj);
+
+    /* init the object fields */
+    obj->priority     = params->priority;
+    obj->remoteProcId = remoteProcId;
+
+    /* construct the swi with lowest priority */
+    Swi_Params_init(&swiParams);
+    swiParams.arg0 = (UArg)obj;
+    Swi_construct(Swi_struct(swiHandle),
+                 (Swi_FuncPtr)TransportCirc_swiFxn,
+                 &swiParams, eb);
+
+    /* calculate the circular buffer size one-way */
+    circBufSize = TransportCirc_msgSize * TransportCirc_numMsgs;
+
+    /* Init put/get buffer and index pointers. */
+    obj->putBuffer = params->writeAddr;
+
+    obj->putWriteIndex = (Bits32 *)((UInt32)obj->putBuffer + circBufSize);
+
+    obj->getBuffer = params->readAddr;
+
+    obj->getWriteIndex = (Bits32 *)((UInt32)obj->getBuffer + circBufSize);
+
+    obj->putReadIndex = (Bits32 *)((UInt32)obj->getWriteIndex + sizeof(Bits32));
+
+    obj->getReadIndex = (Bits32 *)((UInt32)obj->putWriteIndex + sizeof(Bits32));
+
+    /* init the putWrite and getRead Index to 0 */
+    obj->putWriteIndex[0] = 0;
+    obj->getReadIndex[0] = 0;
+
+    /* register the event with Notify */
+    status = Notify_registerEventSingle(
+                 remoteProcId,    /* remoteProcId */
+                 0,         /* lineId */
+                 TransportCirc_notifyEventId,
+                 (Notify_FnNotifyCbck)TransportCirc_notifyFxn,
+                 (UArg)swiHandle);
+
+    if (status < 0) {
+        Error_raise(eb, IpcMgr_E_internal, 0, 0);
+        return (1);
+    }
+
+    /* Register the transport with MessageQ */
+    flag = ti_sdo_ipc_MessageQ_registerTransport(
+        TransportCirc_Handle_upCast(obj), remoteProcId, params->priority);
+
+    if (flag == FALSE) {
+        Error_raise(eb, IpcMgr_E_internal, 0, 0);
+        return (2);
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== TransportCirc_Instance_finalize ========
+ */
+Void TransportCirc_Instance_finalize(TransportCirc_Object* obj, Int status)
+{
+    Swi_Handle     swiHandle;
+
+    switch(status) {
+        case 0:
+            /* MessageQ_registerTransport succeeded */
+            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId,
+                obj->priority);
+
+            /* OK to fall thru */
+
+        case 1: /* Notify_registerEventSingle failed */
+
+            /* OK to fall thru */
+
+        case 2: /* MessageQ_registerTransport failed */
+            Notify_unregisterEventSingle(
+                obj->remoteProcId,
+                0,
+                TransportCirc_notifyEventId);
+            break;
+    }
+
+    /* Destruct the swi */
+    swiHandle = TransportCirc_Instance_State_swiObj(obj);
+    if (swiHandle != NULL) {
+        Swi_destruct(Swi_struct(swiHandle));
+    }
+}
+
+/*
+ *  ======== TransportCirc_put ========
+ *  Assuming MessageQ_put is making sure that the arguments are ok
+ */
+Bool TransportCirc_put(TransportCirc_Object *obj, Ptr msg)
+{
+    Int status;
+    UInt msgSize;
+    UInt hwiKey;
+    Ptr writeAddr;
+    UInt writeIndex, readIndex;
+
+    do {
+        /* disable interrupts */
+        hwiKey = Hwi_disable();
+
+        /* get the writeIndex and readIndex */
+        readIndex  = obj->putReadIndex[0];
+        writeIndex = obj->putWriteIndex[0];
+
+        /* if slot available 'break' out of loop */
+        if (((writeIndex + 1) & TransportCirc_maxIndex) != readIndex) {
+            break;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(hwiKey);
+
+    } while (1);
+
+    /* interrupts are disabled at this point */
+
+    /* get a free buffer and copy the message into it */
+    writeAddr = (Ptr)((UInt32)obj->putBuffer +
+                (writeIndex * TransportCirc_msgSize));
+
+    /* get the size of the message */
+    msgSize = MessageQ_getMsgSize(msg);
+
+    Assert_isTrue(msgSize <= TransportCirc_msgSize, IpcMgr_A_internal);
+
+    /* copy message to the write buffer */
+    memcpy(writeAddr, (Ptr)msg, msgSize);
+
+    /* update the writeIndex */
+    obj->putWriteIndex[0] = (writeIndex + 1) & TransportCirc_maxIndex;
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    /* free the app's message */
+    if (((MessageQ_Msg)msg)->heapId != ti_sdo_ipc_MessageQ_STATICMSG) {
+        MessageQ_free(msg);
+    }
+
+    /* Notify the remote processor */
+    status = Notify_sendEvent(
+                 obj->remoteProcId,
+                 0,
+                 TransportCirc_notifyEventId,
+                 (UInt32)NULL,
+                 FALSE);
+
+    /* check the status of the sendEvent */
+    if (status < 0) {
+        return (FALSE);
+    }
+
+    return (TRUE);
+}
+
+/*
+ *  ======== TransportCirc_control ========
+ */
+Bool TransportCirc_control(TransportCirc_Object *obj, UInt cmd,
+    UArg cmdArg)
+{
+    return (FALSE);
+}
+
+/*
+ *  ======== TransportCirc_getStatus ========
+ */
+Int TransportCirc_getStatus(TransportCirc_Object *obj)
+{
+    return (0);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportCirc_notifyFxn ========
+ */
+Void TransportCirc_notifyFxn(UInt16 procId,
+                             UInt16 lineId,
+                             UInt32 eventId,
+                             UArg arg,
+                             UInt32 payload)
+{
+    Swi_Handle swiHandle;
+
+    /* Swi_Handle was passed as arg in register */
+    swiHandle = (Swi_Handle)arg;
+
+    /* post the Swi */
+    Swi_post(swiHandle);
+}
+
+/*
+ *  ======== TransportCirc_swiFxn ========
+ */
+Void TransportCirc_swiFxn(UArg arg)
+{
+    UInt32 queueId;
+    TransportCirc_Object *obj = (TransportCirc_Object *)arg;
+    MessageQ_Msg msg = NULL;
+    MessageQ_Msg buf = NULL;
+    SizeT msgSize;
+    UInt writeIndex, readIndex;
+    UInt offset;
+
+    /* Make sure the TransportCirc_Object is not NULL */
+    Assert_isTrue(obj != NULL, IpcMgr_A_internal);
+
+    /* get the writeIndex and readIndex */
+    writeIndex = obj->getWriteIndex[0];
+    readIndex  = obj->getReadIndex[0];
+
+    while (writeIndex != readIndex) {
+        /* determine where the message from remote core is */
+        offset = (readIndex * TransportCirc_msgSize);
+
+        /* get the message */
+        msg = (MessageQ_Msg)((UInt32)obj->getBuffer + offset);
+
+#ifdef xdc_target__isaCompatible_28
+        /*
+         *  The message size needs to be halved because it was
+         *  specified in bytes and the units on the c28 is 16-bit
+         *  words.
+         */
+        msgSize = MessageQ_getMsgSize(msg) >> 1;
+#else
+        /*
+         *  The message size needs to be doubled because it was
+         *  specified in 16-bit words and the units on the m3 is
+         *  in bytes.
+         */
+        msgSize = MessageQ_getMsgSize(msg) << 1;
+#endif
+
+        /* alloc a message from msg->heapId to copy the msg to */
+        buf = MessageQ_alloc(msg->heapId, msgSize);
+
+        /* Make sure buf is not NULL */
+        Assert_isTrue(buf != NULL, IpcMgr_A_internal);
+
+        /* copy the message to the buffer allocated, set the heap id */
+        memcpy((Ptr)buf, (Ptr)msg, msgSize);
+
+        /* overwrite the msgSize in the msg */
+        buf->msgSize = msgSize;
+
+        /* retrieve the detination queue id */
+        queueId = MessageQ_getDstQueue(msg);
+
+        /* put the message to the destination queue */
+        MessageQ_put(queueId, buf);
+
+        /* update the local readIndex. */
+        readIndex = ((readIndex + 1) & TransportCirc_maxIndex);
+
+        /* set the readIndex */
+        obj->getReadIndex[0] = readIndex;
+    }
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportCirc_close ========
+ */
+Void TransportCirc_close(TransportCirc_Handle *handle)
+{
+    TransportCirc_delete(handle);
+}
+
+/*
+ *  ======== TransportCirc_sharedMemReq ========
+ */
+SizeT TransportCirc_sharedMemReq(const TransportCirc_Params *params)
+{
+    SizeT memReq;
+
+    /* Ensure that params is non-NULL */
+    Assert_isTrue(params != NULL, IpcMgr_A_internal);
+
+    /*
+     *  Amount of shared memory:
+     *  1 putBuffer (msgSize * numMsgs) +
+     *  1 putWriteIndex ptr             +
+     *  1 putReadIndex ptr              +
+     */
+    memReq = (TransportCirc_msgSize * TransportCirc_numMsgs) +
+             (2 * sizeof(Bits32));
+
+    return (memReq);
+}
+
+/*
+ *  ======== TransportCirc_setErrFxn ========
+ */
+Void TransportCirc_setErrFxn(TransportCirc_ErrFxn errFxn)
+{
+    /* Ignore the errFxn */
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xdc b/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xdc
new file mode 100644 (file)
index 0000000..57f02f3
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportCirc.xdc ========
+ */
+
+import ti.sysbios.knl.Swi;
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== TransportCirc ========
+ *  Transport for MessageQ that uses a circular buffer.
+ *
+ *  This is a {@link ti.sdo.ipc.MessageQ} transport that utilizes shared
+ *  memory for passing messages between multiple processors.
+ *
+ *  The transport utilizes shared memory in the manner indicated by the
+ *  following diagram.
+ *
+ *  @p(code)
+ *
+ *  NOTE: Processor '0' corresponds to the M3 and '1' corresponds to the C28
+ *
+ * sharedAddr -> --------------------------- bytes
+ *               |  entry0  (0) [Put]      | 4
+ *               |  entry1  (0)            | 4
+ *               |  ...                    |
+ *               |  entryN  (0)            | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  putWriteIndex (0)      | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  getReadIndex (1)       | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  entry0  (1) [Get]      | 4
+ *               |  entry1  (1)            | 4
+ *               |  ...                    |
+ *               |  entryN  (1)            | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  putWriteIndex (1)      | 4
+ *               |                         |
+ *               |-------------------------|
+ *               |  getReadIndex (0)       | 4
+ *               |                         |
+ *               |-------------------------|
+ *
+ *
+ *  Legend:
+ *  (0), (1) : belongs to the respective processor
+ *  (N)      : length of buffer
+ *
+ *  @p
+ */
+
+@InstanceFinalize
+@InstanceInitError
+
+module TransportCirc inherits ti.sdo.ipc.interfaces.IMessageQTransport
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+    }
+
+    /*! @_nodoc */
+    metaonly struct EventDataView {
+        UInt        index;
+        String      buffer;
+        Ptr         addr;
+        Ptr         message;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Events',
+                    {
+                        type: ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'EventDataView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== close ========
+     *  Close an opened instance
+     *
+     *  Closing an instance will free local memory consumed by the opened
+     *  instance.  Instances that are opened should be closed before the
+     *  instance is deleted.
+     *
+     *  @param(handle)  handle that is returned from an {@link #openByAddr}
+     */
+    Void close(Handle *handle);
+
+    /*! @_nodoc
+     *  ======== notifyEventId ========
+     *  Notify event ID for transport.
+     */
+    config UInt16 notifyEventId = 2;
+
+    /*! @_nodoc
+     *  ======== numMsgs ========
+     *  The maximum number of outstanding messages
+     *
+     *  This number must be greater than 0 and a power of 2.
+     *  If the transport reaches this threshold, it spins waiting for
+     *  another message slot to be freed by the remote processor.
+     */
+    config UInt numMsgs = 4;
+
+    /*! @_nodoc
+     *  ======== maxMsgSizeInBytes ========
+     *  The maximum message size (in bytes) that is supported
+     */
+    config UInt maxMsgSizeInBytes = 128;
+
+    /*! @_nodoc
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to the parameters that will be used in
+     *                      create.
+     *
+     *  @a(returns)         Number of MAUs needed to create the instance.
+     */
+    SizeT sharedMemReq(const Params *params);
+
+    /*! @_nodoc
+     *  ======== sharedMemReqMeta ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to the parameters that will be used in
+     *                      create.
+     *
+     *  @a(returns)         Size of shared memory in MAUs on local processor.
+     */
+    metaonly SizeT sharedMemReqMeta(const Params *params);
+
+instance:
+
+    /*! @_nodoc
+     *  ======== openFlag ========
+     *  Set to 'true' by the open() call. No one else should touch this!
+     */
+    config Bool openFlag = false;
+
+    /*!
+     *  ======== readAddr ========
+     *  Physical address of the read address in shared memory
+     *
+     *  This address should be specified in the local processor's memory
+     *  space.  It must point to the same physical write address of the
+     *  remote processor its communicating with.
+     */
+    config Ptr readAddr = null;
+
+    /*!
+     *  ======== writeAddr ========
+     *  Physical address of the write address in shared memory
+     *
+     *  This address should be specified in the local processor's memory
+     *  space.  It must point to the same physical read address of the
+     *  remote processor its communicating with.
+     */
+    config Ptr writeAddr = null;
+
+internal:
+
+    /*! The max index set to (numMsgs - 1) */
+    config UInt maxIndex;
+
+    /*!
+     *  The message size calculated based on the target.
+     */
+    config UInt msgSize;
+
+    /*!
+     *  ======== swiFxn ========
+     *  This function takes the messages from the transport ListMP and
+     *  calls MessageQ_put to send them to their destination queue.
+     *  This function is posted by the NotifyFxn.
+     *
+     *  @param(arg)     argument for the function
+     */
+    Void swiFxn(UArg arg);
+
+    /*!
+     *  ======== notifyFxn ========
+     *  This is a callback function registered with Notify.  It is called
+     *  when a remote processor does a Notify_sendEvent().  It is executed
+     *  at ISR level.  It posts the instance Swi object to execute swiFxn.
+     *
+     *  @param(procId)  remote processor id
+     *  @param(lineId)  Notify line id
+     *  @param(eventId) Notify event id
+     *  @param(arg)     argument for the function
+     *  @param(payload) 32-bit payload value.
+     */
+    Void notifyFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+                   UInt32 payload);
+
+    /* Instance State object */
+    struct Instance_State {
+        Ptr             *putBuffer;     /* buffer used to put message       */
+        Bits32          *putReadIndex;  /* ptr to readIndex for put buffer  */
+        Bits32          *putWriteIndex; /* ptr to writeIndex for put buffer */
+        Ptr             *getBuffer;     /* buffer used to get message       */
+        Bits32          *getReadIndex;  /* ptr to readIndex for get buffer  */
+        Bits32          *getWriteIndex; /* ptr to writeIndex for put buffer */
+        Swi.Object      swiObj;         /* Each instance has a swi          */
+        SizeT           allocSize;      /* Shared memory allocated          */
+        UInt16          remoteProcId;   /* dst proc id                      */
+        UInt16          priority;       /* priority to register             */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xs b/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xs
new file mode 100644 (file)
index 0000000..462e293
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportCirc.xs ========
+ */
+
+var TransportCirc = null;
+var MessageQ     = null;
+var Notify       = null;
+var MultiProc    = null;
+var Swi          = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportCirc = this;
+    MessageQ     = xdc.useModule("ti.sdo.ipc.MessageQ");
+    Notify       = xdc.useModule("ti.sdo.ipc.Notify");
+    MultiProc    = xdc.useModule("ti.sdo.utils.MultiProc");
+    Swi          = xdc.useModule("ti.sysbios.knl.Swi");
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    var target = Program.build.target;
+    var bitsPerByte = 8;
+    var bitsPerChar = target.bitsPerChar;
+
+    /* calculate the msgSize */
+    TransportCirc.msgSize = TransportCirc.maxMsgSizeInBytes *
+                              (bitsPerByte / bitsPerChar);
+
+    /* calculate the maxIndex */
+    TransportCirc.maxIndex = TransportCirc.numMsgs - 1;
+
+    /* determine numMsgs is a power of 2 */
+    if (TransportCirc.numMsgs & (TransportCirc.maxIndex)) {
+        TransportCirc.$logFatal("TransportCirc.numMsgs: " +
+                TransportCirc.numMsgs +
+                " is not a power of 2", TransportCirc);
+    }
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (Notify.numEvents <= TransportCirc.notifyEventId) {
+        TransportCirc.$logFatal("TransportCirc.notifyEventId (" +
+                TransportCirc.notifyEventId +
+                ") is too big: Notify.numEvents = " + Notify.numEvents,
+                TransportCirc);
+    }
+}
+
+/*
+ *  ======== sharedMemReqMeta ========
+ */
+function sharedMemReqMeta(params)
+{
+    var target = Program.build.target;
+    var bitsPerByte = 8;
+    var bitsPerChar = target.bitsPerChar;
+
+    /* calculate the msgSize */
+    var msgSize = TransportCirc.maxMsgSizeInBytes *
+                  (bitsPerByte / bitsPerChar);
+
+    /*
+     *  Amount of shared memory:
+     *  1 putBuffer (msgSize * numMsgs) +
+     *  1 putWriteIndex ptr             +
+     *  1 putReadIndex ptr              +
+     */
+    var memReq = (msgSize * TransportCirc.numMsgs) +
+                 (2 *  Program.build.target.stdTypes['t_Int32'].size);
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+}
+
+/*
+ *  ======== getEventData ========
+ *  Helper function for use within viewInitData
+ */
+function getEventData(view, obj, bufferPtr, putIndex, getIndex)
+{
+    var TransportCirc =
+        xdc.useModule('ti.sdo.ipc.family.f28m35x.TransportCirc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.family.f28m35x.TransportCirc');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    if (bufferPtr == obj.putBuffer) {
+        var bufferName = "put";
+    }
+    else {
+        var bufferName = "get";
+    }
+
+    try {
+        var putBuffer = Program.fetchArray(TransportCirc.msgSize$fetchDesc,
+                                           bufferPtr,
+                                           modCfg.numMsgs);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putBuffer struct from shared memory"));
+    }
+
+    var i = getIndex;
+
+    while (i != putIndex) {
+        /* The event is registered */
+        var elem = Program.newViewStruct(
+                'ti.sdo.ipc.family.f28m35x.TransportCirc',
+                'Events');
+
+        elem.index = i;
+        elem.buffer = bufferName;
+        elem.addr = utils.toHex(putBuffer[i].$addr);
+        elem.message = utils.toHex(putBuffer[i].elem);
+
+        /* Create a new row in the instance data view */
+        view.elements.$add(elem);
+
+        i++;
+    }
+}
+
+
+/*
+ *  ======== viewInitData ========
+ *  Instance data view.
+ */
+function viewInitData(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* Display the instance label in the tree */
+    view.label = "remoteProcId = " + obj.remoteProcId;
+
+    /* Fetch put/get index's */
+    try {
+        var putWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.putWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putWriteIndex struct from shared memory"));
+    }
+
+    try {
+        var putReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.putReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putReadIndex struct from shared memory"));
+    }
+
+    try {
+        var getWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.getWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getWriteIndex struct from shared memory"));
+    }
+
+    try {
+        var getReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.getReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getReadIndex struct from shared memory"));
+    }
+
+    /* Get event data for the put buffer */
+    getEventData(view, obj, obj.putBuffer, putWriteIndex.elem, putReadIndex.elem);
+
+    /* Get event data for the get buffer */
+    getEventData(view, obj, obj.getBuffer, getWriteIndex.elem, getReadIndex.elem);
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/linkcmd.xdt b/packages/ti/sdo/ipc/family/f28m35x/linkcmd.xdt
new file mode 100644 (file)
index 0000000..162adde
--- /dev/null
@@ -0,0 +1,63 @@
+%%{
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%%{
+/*
+ *  Add writeAddr with writeAddrSize to linker cmd file.
+ *  This is to prevent the user from placing other code/data
+ *  in the same memory location.
+ */
+%%}
+%var IpcMgr = xdc.module("ti.sdo.ipc.family.f28m35x.IpcMgr");
+%
+%
+
+SECTIONS
+{
+%    var readSectName = "ti.sdo.ipc.family.f28m35x.IpcMgr.readSect";
+%    var writeSectName = "ti.sdo.ipc.family.f28m35x.IpcMgr.writeSect";
+%    if (IpcMgr.genLinkerSections && (IpcMgr.readAddr || IpcMgr.writeAddr)) {
+%        var readAddr = utils.toHex(IpcMgr.readAddr);
+%        var writeAddr = utils.toHex(IpcMgr.writeAddr);
+%        var len  = utils.toHex(IpcMgr.sharedMemSizeUsed);
+%
+%        if (Program.build.target.name.match(/C28.*/)) {
+    `readSectName`:  { . += `len`;} run > `readAddr` PAGE 1, type = NOLOAD
+    `writeSectName`:  { . += `len`;} run > `writeAddr` PAGE 1, type = NOLOAD
+%        }
+%        else {
+    `readSectName`:  { . += `len`;} run > `readAddr`, type = NOLOAD
+    `writeSectName`:  { . += `len`;} run > `writeAddr`, type = NOLOAD
+%        }
+%    }
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/package.bld b/packages/ti/sdo/ipc/family/f28m35x/package.bld
new file mode 100644 (file)
index 0000000..78f7473
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_28FP = [
+      "IpcMgr",
+      "NotifyDriverCirc",
+      "NameServerBlock",
+      "TransportCirc",
+];
+
+var trgFilter_28FP = {
+        field: "isa",
+        list: [ "28FP" ]
+};
+
+var objList_m3 = [
+      "IpcMgr",
+      "NotifyDriverCirc",
+      "NameServerBlock",
+      "TransportCirc",
+];
+var trgFilter_m3 = {
+        field: "isa",
+        list: [ "v7M" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_28FP, undefined, trgFilter_28FP, arguments);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_28FP, undefined, trgFilter_28FP, ["profile=smp"]);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld", "linkcmd.xdt" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/f28m35x/package.xdc b/packages/ti/sdo/ipc/family/f28m35x/package.xdc
new file mode 100644 (file)
index 0000000..50b6994
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.f28m35x ========
+ */
+package ti.sdo.ipc.family.f28m35x [1,0,0,0] {
+    module    IpcMgr;
+    module    NameServerBlock;
+    module    NotifyDriverCirc;
+    module    TransportCirc;
+}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/package.xs b/packages/ti/sdo/ipc/family/f28m35x/package.xs
new file mode 100644 (file)
index 0000000..bfbb889
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== Package.getSects ========
+ */
+function getSects()
+{
+    return "ti/sdo/ipc/family/f28m35x/linkcmd.xdt";
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/InterruptDsp.c b/packages/ti/sdo/ipc/family/omap3530/InterruptDsp.c
new file mode 100644 (file)
index 0000000..1164a8c
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Mailbox based interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+#include <ti/sysbios/family/c64p/omap3430/Wugen.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Register access method. */
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Mailbox management values */
+#define MAILBOX_BASE           0x48094000
+#define MAILBOX_MESSAGE_0      MAILBOX_BASE + 0x40
+#define MAILBOX_MESSAGE_1      MAILBOX_BASE + 0x44
+#define MAILBOX_MSGSTATUS_0    MAILBOX_BASE + 0xC0
+#define MAILBOX_MSGSTATUS_1    MAILBOX_BASE + 0xC4
+#define MAILBOX_IRQSTATUS_GPP  MAILBOX_BASE + 0x100
+#define MAILBOX_IRQSTATUS_DSP  MAILBOX_BASE + 0x108
+#define MAILBOX_IRQENABLE_GPP  MAILBOX_BASE + 0x104
+#define MAILBOX_IRQENABLE_DSP  MAILBOX_BASE + 0x10C
+
+#define DSPINT  55
+#define ARMINT  26
+
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+
+    /* Make sure that we're trying to talk to the HOST */
+    Assert_isTrue(remoteProcId == MultiProc_getId("HOST"),
+            ti_sdo_ipc_Ipc_A_invArgument);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    /* Register interrupt for communication between ARM and DSP */
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+    hwiAttrs.arg         = arg;
+    hwiAttrs.eventId     = DSPINT;
+    Hwi_create(intInfo->intVectorId,
+               (Hwi_FuncPtr)func,
+               &hwiAttrs,
+               NULL);
+
+    /* Enable the mailbox interrupt to the DSP */
+    REG32(MAILBOX_IRQENABLE_DSP) = 0x1; /* Mailbox 0 */
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+    /* Unmask IVA_2_IRQ[10] to allow interrupt to come into DSP */
+    Wugen_enableEvent(DSPINT);
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+
+    /* Delete the Hwi (and disable the corresponding interrupt) */
+    hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+    Hwi_delete(&hwiHandle);
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    /* Put into the GPP's mailbox to generate the interrupt. */
+    REG32(MAILBOX_MESSAGE_1) = arg;
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    /* Put into the GPP's mailbox to generate the interrupt. */
+    REG32(MAILBOX_MESSAGE_0) = arg;
+}
+
+/*!
+ *  ======== Interrupt_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    /* Read into val. */
+    arg = REG32(MAILBOX_MESSAGE_0);
+
+    /*
+     * Clear the IRQ status.
+     * If there are more in the mailbox FIFO, it will re-assert.
+     */
+    REG32(MAILBOX_IRQSTATUS_DSP) = 0x1; /* Mailbox 0 */
+
+    return (arg);
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/omap3530/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..5af41d8
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ *
+ */
+
+
+/*!
+ *  ======== InterruptDsp ========
+ *  OMAP3/DSP interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/InterruptDsp.xs b/packages/ti/sdo/ipc/family/omap3530/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..7f1502d
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Wugen       = null;
+var MultiProc   = null;
+var Ipc         = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Wugen       = xdc.useModule('ti.sysbios.family.c64p.omap3430.Wugen');
+    Ipc         = xdc.useModule('ti.sdo.ipc.Ipc');
+    MultiProc   = xdc.useModule('ti.sdo.utils.MultiProc');
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/InterruptHost.c b/packages/ti/sdo/ipc/family/omap3530/InterruptHost.c
new file mode 100644 (file)
index 0000000..f927db5
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.c ========
+ *  Mailbox based interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/arm/a8/intcps/Hwi.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptHost.xdc.h"
+
+/* Register access method. */
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Mailbox management values */
+#define MAILBOX_BASE           0x48094000
+#define MAILBOX_MESSAGE_0      MAILBOX_BASE + 0x40
+#define MAILBOX_MESSAGE_1      MAILBOX_BASE + 0x44
+#define MAILBOX_MSGSTATUS_0    MAILBOX_BASE + 0xC0
+#define MAILBOX_MSGSTATUS_1    MAILBOX_BASE + 0xC4
+#define MAILBOX_IRQSTATUS_GPP  MAILBOX_BASE + 0x100
+#define MAILBOX_IRQSTATUS_DSP  MAILBOX_BASE + 0x108
+#define MAILBOX_IRQENABLE_GPP  MAILBOX_BASE + 0x104
+#define MAILBOX_IRQENABLE_DSP  MAILBOX_BASE + 0x10C
+
+#define DSPINT  55
+#define HOSTINT 26
+
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptHost_intEnable ========
+ */
+Void InterruptHost_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(HOSTINT);
+}
+
+/*!
+ *  ======== InterruptHost_intDisable ========
+ */
+Void InterruptHost_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(HOSTINT);
+}
+
+/*!
+ *  ======== InterruptHost_intRegister ========
+ */
+Void InterruptHost_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Hwi_Params  hwiAttrs;
+
+    /* Make sure that we're trying to talk to the HOST */
+    Assert_isTrue(remoteProcId == MultiProc_getId("DSP"),
+            ti_sdo_ipc_Ipc_A_invArgument);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    InterruptHost_intClear(remoteProcId, intInfo);
+
+    /* Register interrupt for communication between ARM and DSP */
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+    hwiAttrs.arg         = arg;
+    Hwi_create(HOSTINT,
+               (Hwi_FuncPtr)func,
+               &hwiAttrs,
+               NULL);
+
+    /* Enable the mailbox interrupt to the DSP */
+    REG32(MAILBOX_IRQENABLE_GPP) = 0x4; /* Mailbox 0 */
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+    /* Unmask IVA_2_IRQ[10] to allow interrupt to come into DSP */
+    Hwi_enableInterrupt(HOSTINT);
+}
+
+/*!
+ *  ======== InterruptHost_intUnregister ========
+ */
+Void InterruptHost_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+
+    /* Delete the Hwi (and disable the corresponding interrupt) */
+    hwiHandle = Hwi_getHandle(HOSTINT);
+    Hwi_delete(&hwiHandle);
+}
+
+/*!
+ *  ======== InterruptHost_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptHost_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    /* Put into the DSP's mailbox to generate the interrupt. */
+    REG32(MAILBOX_MESSAGE_0) = arg;
+}
+
+/*!
+ *  ======== InterruptHost_intPost ========
+ */
+Void InterruptHost_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    /* Put into the GPP's mailbox to generate the interrupt. */
+    REG32(MAILBOX_MESSAGE_1) = arg;
+}
+
+/*!
+ *  ======== Interrupt_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptHost_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    /* Read into val. */
+    arg = REG32(MAILBOX_MESSAGE_1);
+
+    /*
+     * Clear the IRQ status.
+     * If there are more in the mailbox FIFO, it will re-assert.
+     */
+    REG32(MAILBOX_IRQSTATUS_GPP) = 0x4; /* Mailbox 0 */
+
+    return (arg);
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/InterruptHost.xdc b/packages/ti/sdo/ipc/family/omap3530/InterruptHost.xdc
new file mode 100644 (file)
index 0000000..b4537a4
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xdc ========
+ */
+
+
+/*!
+ *  ======== InterruptHost ========
+ *  OMAP3/GPP interrupt manager
+ */
+
+module InterruptHost inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/InterruptHost.xs b/packages/ti/sdo/ipc/family/omap3530/InterruptHost.xs
new file mode 100644 (file)
index 0000000..e5751c1
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Wugen       = null;
+var MultiProc   = null;
+var Ipc         = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule('ti.sysbios.family.arm.a8.intcps.Hwi');
+    Ipc         = xdc.useModule('ti.sdo.ipc.Ipc');
+    MultiProc   = xdc.useModule('ti.sdo.utils.MultiProc');
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..789d4c3
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    NotifyDriverCirc_Handle hostDriverHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+    UInt hostProcId = 1 - MultiProc_self();
+
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the HOST
+     */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.remoteProcId   = hostProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+    notifyShmParams.intVectorId    = NotifyCircSetup_dspIntVectId;
+
+    hostDriverHandle = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (hostDriverHandle == NULL) {
+        status = Notify_E_FAIL;
+    }
+
+    /* Register the Notify driver with the Notify module */
+    notifyHandle = ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(hostDriverHandle),
+                  hostProcId,
+                  0,        /* lineId */
+                  NULL,     /* params */
+                  &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&hostDriverHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params params;
+
+    NotifyDriverCirc_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+
+    memReq = NotifyDriverCirc_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..b3cadac
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifyCircSetup ========
+ */
+
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*! Interrupt vector id for OMAP3530/DSP. */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/omap3530/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..4f9a893
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ */
+
+var NotifyDriverCirc = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify           = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc        = xdc.useModule('ti.sdo.utils.MultiProc');
+
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/NotifySetup.c b/packages/ti/sdo/ipc/family/omap3530/NotifySetup.c
new file mode 100644 (file)
index 0000000..1f822c1
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle hostDriverHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+    Int status = Notify_S_SUCCESS;
+
+    Error_init(&eb);
+
+    /*
+     *  Setup the notify driver to the HOST
+     */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.remoteProcId   = remoteProcId;
+    notifyShmParams.sharedAddr     = sharedAddr;
+    notifyShmParams.intVectorId    = NotifySetup_dspIntVectId;
+
+    hostDriverHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (hostDriverHandle == NULL) {
+        status = Notify_E_FAIL;
+    }
+
+    /* Register the Notify driver with the Notify module */
+    notifyHandle = ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(hostDriverHandle),
+                  remoteProcId,
+                  0,        /* lineId */
+                  NULL,     /* params */
+                  &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&hostDriverHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params params;
+
+    NotifyDriverShm_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+
+    memReq = NotifyDriverShm_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/NotifySetup.xdc b/packages/ti/sdo/ipc/family/omap3530/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..ebdc9ae
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetup ========
+ */
+
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*! Interrupt vector id for OMAP3530/DSP. */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/NotifySetup.xs b/packages/ti/sdo/ipc/family/omap3530/NotifySetup.xs
new file mode 100644 (file)
index 0000000..777aa1e
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm  = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/package.bld b/packages/ti/sdo/ipc/family/omap3530/package.bld
new file mode 100644 (file)
index 0000000..c60860e
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_64P = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptDsp",
+];
+
+var trgFilter_64P = {
+        field: "isa",
+        list: [ "64P" ]
+};
+
+var objList_a8f = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptHost",
+];
+
+var trgFilter_a8f = {
+        field: "isa",
+        list: [ "v7A" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_64P, undefined, trgFilter_64P, arguments);
+IpcBuild.buildLibs(objList_a8f, undefined, trgFilter_a8f, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_64P, undefined, trgFilter_64P, ["profile=smp"]);
+IpcBuild.buildLibs(objList_a8f, undefined, trgFilter_a8f, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/omap3530/package.xdc b/packages/ti/sdo/ipc/family/omap3530/package.xdc
new file mode 100644 (file)
index 0000000..bf71c70
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.omap3530 ========
+ */
+package ti.sdo.ipc.family.omap3530 [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptHost;
+}
diff --git a/packages/ti/sdo/ipc/family/omap3530/package.xs b/packages/ti/sdo/ipc/family/omap3530/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/InterruptDsp.c b/packages/ti/sdo/ipc/family/omap4430/InterruptDsp.c
new file mode 100644 (file)
index 0000000..938585d
--- /dev/null
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Mailbox based interrupt manager
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+#include <ti/sysbios/family/c64p/tesla/Wugen.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+#define MPUINT                 26
+#define DSPINT                 55
+#define M3INT_MBX              50
+
+/* Assigned mailboxes */
+#define DSP_TO_MPU             0
+#define DSP_TO_M3              1
+#define M3_TO_DSP              2
+#define MPU_TO_DSP             3
+#define MPU_TO_M3              4
+#define M3_TO_MPU              5
+
+#define MAILBOX_MESSAGE(M) \
+    InterruptDsp_mailboxBaseAddr + 0x040 + (0x4 * M)
+#define MAILBOX_STATUS(M) \
+    InterruptDsp_mailboxBaseAddr + 0x0C0 + (0x4 * M)
+
+#define MAILBOX_IRQSTATUS_CLR_DSP   InterruptDsp_mailboxBaseAddr + 0x114
+#define MAILBOX_IRQENABLE_SET_DSP   InterruptDsp_mailboxBaseAddr + 0x118
+#define MAILBOX_IRQENABLE_CLR_DSP   InterruptDsp_mailboxBaseAddr + 0x11C
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = 0x40;
+    }
+    else if (remoteProcId == InterruptDsp_core0ProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = 0x10;
+    }
+    else {
+        /* DSP cannot talk to CORE1 */
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = 0x40;
+    }
+    else if (remoteProcId == InterruptDsp_core0ProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = 0x10;
+    }
+    else {
+        /* DSP cannot talk to CORE1 */
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Int         index;
+    InterruptDsp_FxnTable *table;
+    Hwi_Params  hwiParams;
+
+    /* Ensure that our ID is set correctly */
+    Assert_isTrue(InterruptDsp_dspProcId == MultiProc_self(),
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Ensure that remoteProcId is valid */
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_invArgument);
+
+    /* Ensure that proper intVectorId has been supplied */
+    Assert_isTrue(intInfo->intVectorId <= 15, ti_sdo_ipc_Ipc_A_internal);
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDsp_core0ProcId) {
+        index = 1;
+    }
+    else {
+        /* DSP cannot talk to CORE1 */
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptDsp_module->numPlugged++;
+    if (InterruptDsp_module->numPlugged == 1) {
+        Hwi_Params_init(&hwiParams);
+        hwiParams.eventId = DSPINT;
+        Hwi_create(intInfo->intVectorId,
+                   (Hwi_FuncPtr)InterruptDsp_intShmStub,
+                   &hwiParams,
+                   NULL);
+
+        /* Enable the interrupt */
+        Wugen_enableEvent(DSPINT);
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+
+    /* Enable the mailbox interrupt to the DSP */
+    InterruptDsp_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    InterruptDsp_FxnTable *table;
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDsp_core0ProcId) {
+        index = 1;
+    }
+    else {
+        /* DSP cannot talk to CORE1 */
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+
+
+    /* Disable the mailbox interrupt source */
+    InterruptDsp_intDisable(remoteProcId, intInfo);
+
+    InterruptDsp_module->numPlugged--;
+    if (InterruptDsp_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = NULL;
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     */
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        /* Using mailbox 0 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_MPU)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_MPU)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptDsp_core0ProcId) {
+        /* Using mailbox 1 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_M3)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_M3)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptDsp_hostProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(MPU_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(MPU_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptDsp_core0ProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(M3_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(M3_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        /* Mailbox 3 */
+        arg = REG32(MAILBOX_MESSAGE(MPU_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = 0x40;
+    }
+    else if (remoteProcId == InterruptDsp_core0ProcId) {
+        /* Mailbox 2 */
+        arg = REG32(MAILBOX_MESSAGE(M3_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = 0x10;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intShmStub ========
+ */
+Void InterruptDsp_intShmStub(UArg arg)
+{
+    InterruptDsp_FxnTable *table;
+
+    /* Process messages from  HOST */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & 0x40) &&
+        REG32(MAILBOX_STATUS(MPU_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from CORE0 */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & 0x10) &&
+        REG32(MAILBOX_STATUS(M3_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/omap4430/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..2b26098
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDsp ========
+ *  @_nodoc
+ *  OMAP4430/DSP interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x4A0F4000;
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt core0ProcId = MultiProc.INVALIDID;
+    config UInt core1ProcId = MultiProc.INVALIDID;
+
+    /* Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub used to plug Hwi
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable    fxnTable[2];
+        UInt        numPlugged;
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/InterruptDsp.xs b/packages/ti/sdo/ipc/family/omap4430/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..321a0b7
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ *
+ */
+
+var Hwi             = null;
+var MultiProc       = null;
+var Wugen           = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Wugen       = xdc.useModule("ti.sysbios.family.c64p.tesla.Wugen");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.core0ProcId    = MultiProc.getIdMeta("CORE0");
+    this.core1ProcId    = MultiProc.getIdMeta("CORE1");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* Host to c674 */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* M3 Core 0 to C674 */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/InterruptDucati.c b/packages/ti/sdo/ipc/family/omap4430/InterruptDucati.c
new file mode 100644 (file)
index 0000000..b3c931a
--- /dev/null
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.c ========
+ *  OMAP4430/Ducati Interrupt Manger
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/arm/m3/Hwi.h>
+#include <ti/sysbios/family/arm/ducati/Core.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptDucati.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+#define HOSTINT                26
+#define DSPINT                 55
+#define M3INT_MBX              50
+#define M3INT                  19
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST            0
+#define DSP_TO_M3              1
+#define M3_TO_DSP              2
+#define HOST_TO_DSP            3
+#define HOST_TO_M3             4
+#define M3_TO_HOST             5
+
+#define MAILBOX_MESSAGE(M)   InterruptDucati_mailboxBaseAddr + 0x040 + (0x4 * M)
+#define MAILBOX_STATUS(M)    InterruptDucati_mailboxBaseAddr + 0x0C0 + (0x4 * M)
+
+#define MAILBOX_IRQSTATUS_CLR_M3    InterruptDucati_mailboxBaseAddr + 0x124
+#define MAILBOX_IRQENABLE_SET_M3    InterruptDucati_mailboxBaseAddr + 0x128
+#define MAILBOX_IRQENABLE_CLR_M3    InterruptDucati_mailboxBaseAddr + 0x12C
+
+/*
+ *  Ducati control register that maintains inter-core interrupt bits.
+ *
+ *  Using separate core0 and core1 values to do 16-bit reads/writes
+ *  because we do not want to overwrite the other cores value.
+ */
+#define INTERRUPT_CORE_0       (InterruptDucati_ducatiCtrlBaseAddr)
+#define INTERRUPT_CORE_1       (InterruptDucati_ducatiCtrlBaseAddr + 2)
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDucati_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDucati_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    /*
+     *  If the remote processor communicates via mailboxes, we should enable
+     *  the Mailbox IRQ instead of enabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    if (Core_getId() == 0) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_M3) = 0x100;
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_M3) = 0x4;
+        }
+        else {
+            Hwi_enableInterrupt(M3INT);
+        }
+    }
+    else {
+        Hwi_enableInterrupt(M3INT);
+    }
+}
+
+/*!
+ *  ======== InterruptDucati_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDucati_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    /*
+     *  If the remote processor communicates via mailboxes, we should disable
+     *  the Mailbox IRQ instead of disabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    if (Core_getId() == 0) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_M3) = 0x100;
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_M3) = 0x4;
+        }
+        else {
+            Hwi_disableInterrupt(M3INT);
+        }
+    }
+    else {
+        Hwi_disableInterrupt(M3INT);
+    }
+}
+
+/*!
+ *  ======== InterruptDucati_intRegister ========
+ */
+Void InterruptDucati_intRegister(UInt16 remoteProcId,
+                                 IInterrupt_IntInfo *intInfo,
+                                 Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+    Int         index;
+    InterruptDucati_FxnTable *table;
+
+    /* Ensure that remoteProcId is valid */
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Ensure that our ID is set correctly */
+    Assert_isTrue((InterruptDucati_core0ProcId == MultiProc_self()) ||
+                  (InterruptDucati_core1ProcId == MultiProc_self()),
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /* Ensure that, if on CORE1, we're only talking to CORE0 */
+    Assert_isTrue(Core_getId() == 0 ||
+                  remoteProcId == InterruptDucati_core0ProcId,
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    if (remoteProcId == InterruptDucati_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        index = 1;
+    }
+    else {
+        /* Going to the other M3 */
+        index = 2;
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDucati_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDucati_intClear(remoteProcId, intInfo);
+
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;
+
+    /* Make sure the interrupt only gets plugged once */
+    if (remoteProcId == InterruptDucati_core0ProcId ||
+        remoteProcId == InterruptDucati_core1ProcId) {
+        Hwi_create(M3INT,
+                   (Hwi_FuncPtr) InterruptDucati_intShmDucatiStub,
+                   &hwiAttrs,
+                   NULL);
+    }
+    else {
+        InterruptDucati_module->numPlugged++;
+        if (InterruptDucati_module->numPlugged == 1) {
+            Hwi_create(M3INT_MBX,
+                       (Hwi_FuncPtr) InterruptDucati_intShmMbxStub,
+                       &hwiAttrs,
+                       NULL);
+
+
+            /* Interrupt_intEnable won't enable the Hwi */
+            Hwi_enableInterrupt(M3INT_MBX);
+        }
+    }
+
+    /* Enable the mailbox interrupt to the M3 core */
+    InterruptDucati_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+
+}
+
+/*!
+ *  ======== InterruptDucati_intUnregister ========
+ */
+Void InterruptDucati_intUnregister(UInt16 remoteProcId,
+                                   IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+    Int index;
+    InterruptDucati_FxnTable *table;
+
+    if (remoteProcId == InterruptDucati_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        index = 1;
+    }
+    else {
+        /* Going to the other M3 */
+        index = 2;
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptDucati_intDisable(remoteProcId, intInfo);
+
+    /* Delete/disable the Hwi */
+    if (remoteProcId == InterruptDucati_core0ProcId ||
+        remoteProcId == InterruptDucati_core1ProcId) {
+        hwiHandle = Hwi_getHandle(M3INT);
+        Hwi_delete(&hwiHandle);
+    }
+    else {
+        InterruptDucati_module->numPlugged--;
+        if (InterruptDucati_module->numPlugged == 0) {
+            hwiHandle = Hwi_getHandle(M3INT_MBX);
+            Hwi_delete(&hwiHandle);
+        }
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptDucati_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+/*!
+ *  ======== InterruptDucati_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDucati_intSend(UInt16 remoteProcId,
+                             IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+     /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     */
+    if (remoteProcId == InterruptDucati_core0ProcId ||
+        remoteProcId == InterruptDucati_core1ProcId) {
+        if (Core_getId() == 1) {
+            REG16(INTERRUPT_CORE_0) |= 0x1;
+        }
+        else {
+            REG16(INTERRUPT_CORE_1) |= 0x1;
+        }
+    }
+    else if (remoteProcId == InterruptDucati_dspProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(M3_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(M3_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* HOSTINT */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(M3_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(M3_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*!
+ *  ======== InterruptDucati_intPost ========
+ *  Simulate interrupt from remote processor
+ */
+Void InterruptDucati_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptDucati_core0ProcId ||
+        srcProcId == InterruptDucati_core1ProcId) {
+        if (Core_getId() == 1) {
+            REG16(INTERRUPT_CORE_1) |= 0x1;
+        }
+        else {
+            REG16(INTERRUPT_CORE_0) |= 0x1;
+        }
+    }
+    else if (srcProcId == InterruptDucati_dspProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_M3)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_M3)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* HOSTINT */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_M3)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_M3)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*!
+ *  ======== InterruptDucati_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDucati_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptDucati_core0ProcId ||
+        remoteProcId == InterruptDucati_core1ProcId) {
+        arg = REG32(InterruptDucati_ducatiCtrlBaseAddr);
+
+        /* Look at BIOS's ducati Core id */
+        if (Core_getId() == 0) {
+            if ((REG16(INTERRUPT_CORE_0) & 0x1) == 0x1) {
+                REG16(INTERRUPT_CORE_0) &= ~(0x1);
+            }
+        }
+        else {
+            if ((REG16(INTERRUPT_CORE_1) & 0x1) == 0x1) {
+                REG16(INTERRUPT_CORE_1) &= ~(0x1);
+            }
+        }
+    }
+    else {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            arg = REG32(MAILBOX_MESSAGE(HOST_TO_M3));
+            REG32(MAILBOX_IRQSTATUS_CLR_M3) = 0x100; /* Mbx 4 */
+        }
+        else {
+            arg = REG32(MAILBOX_MESSAGE(DSP_TO_M3));
+            REG32(MAILBOX_IRQSTATUS_CLR_M3) = 0x4; /* Mbx 1 */
+        }
+    }
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internal functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDucati_intShmStub ========
+ */
+Void InterruptDucati_intShmDucatiStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    table = &(InterruptDucati_module->fxnTable[2]);
+    (table->func)(table->arg);
+}
+
+/*!
+ *  ======== InterruptDucati_intShmMbxStub ========
+ */
+Void InterruptDucati_intShmMbxStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    /* Process messages from the DSP  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_M3) & 0x4) &&
+        REG32(MAILBOX_STATUS(DSP_TO_M3)) != 0) {
+        table = &(InterruptDucati_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from the HOST  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_M3) & 0x100) &&
+        REG32(MAILBOX_STATUS(HOST_TO_M3)) != 0) {
+        table = &(InterruptDucati_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/InterruptDucati.xdc b/packages/ti/sdo/ipc/family/omap4430/InterruptDucati.xdc
new file mode 100644 (file)
index 0000000..b7c2146
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDucati ========
+ *  OMAP4430/Ducati IPC interrupt manager
+ */
+
+module InterruptDucati inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x4A0F4000;
+
+    /* Base address for the Ducati CTRL register */
+    config UInt32 ducatiCtrlBaseAddr = 0x40001000;
+
+internal:
+
+    /* Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to plug the inter-Ducati hwi */
+    Void intShmDucatiStub(UArg arg);
+
+    /*! Stub to plug the Mailbox hwi */
+    Void intShmMbxStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[3];
+        UInt       numPlugged;
+    };
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt core0ProcId = MultiProc.INVALIDID;
+    config UInt core1ProcId = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/InterruptDucati.xs b/packages/ti/sdo/ipc/family/omap4430/InterruptDucati.xs
new file mode 100644 (file)
index 0000000..288bd9a
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.xs ========
+ *
+ */
+
+var Hwi             = null;
+var Core            = null;
+var MultiProc       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arm.m3.Hwi");
+    Core        = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.core0ProcId  = MultiProc.getIdMeta("CORE0");
+    this.core1ProcId  = MultiProc.getIdMeta("CORE1");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* M3 to C674 */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* HOST to M3 */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* Inter-M3 interrupt */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..6660422
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    UInt16 myId = MultiProc_self();
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    if (myId == NotifyCircSetup_core1ProcId &&
+        remoteProcId != NotifyCircSetup_core0ProcId ||
+        myId != NotifyCircSetup_core0ProcId &&
+        remoteProcId == NotifyCircSetup_core1ProcId) {
+        Error_raise(&eb, NotifyCircSetup_E_noInterruptLine,
+            MultiProc_getName(remoteProcId), NULL);
+        System_exit(1);
+    }
+
+    /* Disable cache for inter-ducati NotifyDriverCirc instances */
+    if ((myId == NotifyCircSetup_core1ProcId &&
+         remoteProcId == NotifyCircSetup_core0ProcId) ||
+        (myId == NotifyCircSetup_core0ProcId &&
+        remoteProcId == NotifyCircSetup_core1ProcId)) {
+        notifyShmParams.cacheLineSize = 0;
+        notifyShmParams.cacheEnabled = FALSE;
+    }
+
+    /* Only used by the DSP */
+    notifyShmParams.intVectorId   = NotifyCircSetup_dspIntVectId;
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(NotifyDriverCirc_Handle_upCast(shmDrvHandle),
+                                 remoteProcId, 0, NULL, &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params notifyShmParams;
+    UInt16 myId = MultiProc_self();
+
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    /* Disable cache for inter-ducati NotifyDriverCirc instances */
+    if ((myId == NotifyCircSetup_core1ProcId &&
+         remoteProcId == NotifyCircSetup_core0ProcId) ||
+        (myId == NotifyCircSetup_core0ProcId &&
+        remoteProcId == NotifyCircSetup_core1ProcId)) {
+        notifyShmParams.cacheLineSize = 0;
+        notifyShmParams.cacheEnabled = FALSE;
+    }
+
+    memReq = NotifyDriverCirc_sharedMemReq(&notifyShmParams);
+
+    return (memReq);
+}
+
+/*
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 myId = MultiProc_self();
+
+    if (myId == NotifyCircSetup_core1ProcId &&
+        remoteProcId != NotifyCircSetup_core0ProcId ||
+        myId != NotifyCircSetup_core0ProcId &&
+        remoteProcId == NotifyCircSetup_core1ProcId) {
+        return (0);
+    }
+
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..699da47
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+import xdc.runtime.Error;
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Notify setup proxy for OMAP4430
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on OMAP4430.
+ */
+
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Assert raised when trying to attach between OMAP4430/CORE1 and
+     *  either the DSP or the HOST
+     */
+    config Error.Id E_noInterruptLine  = {
+        msg: "E_noInterruptLine: Trying to attach between CORE1 and %s"
+    };
+
+    /*!
+     *  Interrupt vector id for OMAP4430/DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt core0ProcId     = MultiProc.INVALIDID;
+    config UInt core1ProcId     = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/omap4430/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..1301714
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ *
+ */
+
+var NotifyDriverCirc = null;
+var Notify           = null;
+var MultiProc        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify           = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc        = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.core0ProcId  = MultiProc.getIdMeta("CORE0");
+    this.core1ProcId  = MultiProc.getIdMeta("CORE1");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/NotifySetup.c b/packages/ti/sdo/ipc/family/omap4430/NotifySetup.c
new file mode 100644 (file)
index 0000000..441f53d
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    UInt16 myId = MultiProc_self();
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    if (myId == NotifySetup_core1ProcId &&
+        remoteProcId != NotifySetup_core0ProcId ||
+        myId != NotifySetup_core0ProcId &&
+        remoteProcId == NotifySetup_core1ProcId) {
+        Error_raise(&eb, NotifySetup_E_noInterruptLine,
+            MultiProc_getName(remoteProcId), NULL);
+        System_exit(1);
+    }
+
+    /* Disable cache for inter-ducati NotifyDriverShm instances */
+    if ((myId == NotifySetup_core1ProcId &&
+         remoteProcId == NotifySetup_core0ProcId) ||
+        (myId == NotifySetup_core0ProcId &&
+        remoteProcId == NotifySetup_core1ProcId)) {
+        notifyShmParams.cacheLineSize = 0;
+        notifyShmParams.cacheEnabled = FALSE;
+    }
+
+    /* Only used by the DSP */
+    notifyShmParams.intVectorId   = NotifySetup_dspIntVectId;
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(NotifyDriverShm_Handle_upCast(shmDrvHandle),
+                                 remoteProcId, 0, NULL, &eb);
+
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params notifyShmParams;
+    UInt16 myId = MultiProc_self();
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    /* Disable cache for inter-ducati NotifyDriverShm instances */
+    if ((myId == NotifySetup_core1ProcId &&
+         remoteProcId == NotifySetup_core0ProcId) ||
+        (myId == NotifySetup_core0ProcId &&
+        remoteProcId == NotifySetup_core1ProcId)) {
+        notifyShmParams.cacheLineSize = 0;
+        notifyShmParams.cacheEnabled = FALSE;
+    }
+
+    memReq = NotifyDriverShm_sharedMemReq(&notifyShmParams);
+
+    return (memReq);
+}
+
+/*
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    UInt16 myId = MultiProc_self();
+
+    if (myId == NotifySetup_core1ProcId &&
+        remoteProcId != NotifySetup_core0ProcId ||
+        myId != NotifySetup_core0ProcId &&
+        remoteProcId == NotifySetup_core1ProcId) {
+        return (0);
+    }
+
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/NotifySetup.xdc b/packages/ti/sdo/ipc/family/omap4430/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..c75c3d2
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+import xdc.runtime.Error;
+
+/*!
+ *  ======== NotifySetup ========
+ *  Notify setup proxy for OMAP4430
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on OMAP4430.
+ */
+
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Assert raised when trying to attach between OMAP4430/CORE1 and
+     *  either the DSP or the HOST
+     */
+    config Error.Id E_noInterruptLine  = {
+        msg: "E_noInterruptLine: Trying to attach between CORE1 and %s"
+    };
+
+    /*!
+     *  Interrupt vector id for OMAP4430/DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt core0ProcId     = MultiProc.INVALIDID;
+    config UInt core1ProcId     = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/NotifySetup.xs b/packages/ti/sdo/ipc/family/omap4430/NotifySetup.xs
new file mode 100644 (file)
index 0000000..12efd2f
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm = null;
+var Notify          = null;
+var MultiProc       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.core0ProcId  = MultiProc.getIdMeta("CORE0");
+    this.core1ProcId  = MultiProc.getIdMeta("CORE1");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/package.bld b/packages/ti/sdo/ipc/family/omap4430/package.bld
new file mode 100644 (file)
index 0000000..22010f7
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_64T = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptDsp",
+];
+
+var trgFilter_64T = {
+        field: "isa",
+        list: [ "64T" ]
+};
+
+var objList_m3 = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "InterruptDucati",
+];
+
+var trgFilter_m3 = {
+        field: "isa",
+        list: [ "v7M" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_64T, undefined, trgFilter_64T, arguments);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_64T, undefined, trgFilter_64T, ["profile=smp"]);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/omap4430/package.xdc b/packages/ti/sdo/ipc/family/omap4430/package.xdc
new file mode 100644 (file)
index 0000000..6ce1446
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.omap4430 ========
+ */
+package ti.sdo.ipc.family.omap4430 [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptDucati;
+}
diff --git a/packages/ti/sdo/ipc/family/omap4430/package.xs b/packages/ti/sdo/ipc/family/omap4430/package.xs
new file mode 100644 (file)
index 0000000..def5404
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== Package.validate ========
+ */
+function validate()
+{
+    if (!Program.build.target.$name.match(/M3/)) {
+        /* This validation only needs to be done for "M3" */
+        return;
+    }
+
+    var GateDualCore = xdc.module("ti.sysbios.family.arm.ducati.GateDualCore");
+    var Core         = xdc.module("ti.sysbios.family.arm.ducati.Core");
+    var MultiProc    = xdc.module("ti.sdo.utils.MultiProc");
+
+    /* Check for a mismatch between Core.id and MultiProc name */
+    if (MultiProc.nameList[MultiProc.id] == "CORE0" && Core.id != 0) {
+        Core.$logError("CORE0 application should have Core.id " +
+            " set to 0", Core, "id");
+    }
+
+    if (MultiProc.nameList[MultiProc.id] == "CORE1") {
+        if (Core.id != 1) {
+            Core.$logError("CORE1 application should have " +
+                "Core.id set to 1", Core, "id");
+        }
+
+        if (MultiProc.getIdMeta("CORE0") == MultiProc.INVALIDID &&
+            GateDualCore.initGates == false) {
+            GateDualCore.$logWarning("If CORE0 core is not being used, " +
+                "CORE1 application must be configured to initialize " +
+                "GateDualCore at startup.  Set GateDualCore.initGates to " +
+                "'true' to configure this.", GateDualCore, "initGates");
+        }
+    }
+}
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/package.bld b/packages/ti/sdo/ipc/family/package.bld
new file mode 100644 (file)
index 0000000..829bf1b
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+//Pkg.makePrologue = "include custom.mak";
+xdc.loadCapsule('procNamesDocGen.xs');
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList = [
+];
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld", "doc-files", "procNamesDocGen.xs" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/package.xdc b/packages/ti/sdo/ipc/family/package.xdc
new file mode 100644 (file)
index 0000000..003b5b3
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.sdo.ipc.family ========
+ */
+
+package ti.sdo.ipc.family [1,0,0,0] {
+    module    Settings;
+}
diff --git a/packages/ti/sdo/ipc/family/package.xs b/packages/ti/sdo/ipc/family/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/procNamesDocGen.xs b/packages/ti/sdo/ipc/family/procNamesDocGen.xs
new file mode 100644 (file)
index 0000000..2771a51
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== delegateDocGen.xs ========
+ *
+ */
+
+outFileName = "doc-files/procNames.html";
+
+var blacklist = [
+    'TMS320CTCI6497',
+    'TMS320CTCI6498',
+    'TMS320DM8168',
+    'TMS320DM8148',
+    'TMS320CDM740',
+    'Arctic',
+    'Sonata',
+    'T16v200',
+];
+
+/*
+ *  ======== getFamilyIndex ========
+ *  Returns a list of families corresponding to each target
+ */
+function getProcNames()
+{
+    var settings = xdc.loadCapsule("Settings.xs");
+
+    return (settings.procNames);
+}
+
+/*
+ * ======== getHTML ========
+ */
+function getHTML(procNames)
+{
+    var html = "";
+
+    html += getFileContents("doc-files/procNamesHead.inc");
+
+    procNamesArr = [];
+    for (var deviceName in procNames) {
+        procNamesArr.push(deviceName);
+    }
+    procNamesArr.sort();
+    for (var i = 0; i < procNamesArr.length; i++) {
+        deviceName = procNamesArr[i];
+        if (blacklist.indexOf(deviceName) != -1) {
+            /* Device is blacklisted. Skip it */
+            continue;
+        }
+        html += "<TR><TD>" + deviceName + "</TD><TD>";
+        for each (var procName in procNames[deviceName]) {
+            html += procName + " ";
+        }
+        html += "</TD></TR>\n";
+    }
+
+    html += "</TABLE>\n";
+
+    var d = new Date();
+    html += "<DIV class=\"xdocDate\">generated on "
+               + d.toUTCString() + "</DIV>\n";
+
+    html += "</BODY></HTML>\n";
+
+    return (html);
+}
+
+/*
+ *  ======== writeFile ========
+ *  Given a string and a filename, writeFile() writes the string to a new file
+ *  located at 'out'
+ */
+function writeFile(filename, out)
+{
+    try {
+        var outputFile = java.io.File(filename);
+        if (outputFile.exists()) {
+            outputFile["delete"]();
+        }
+        var fos = java.io.FileWriter(outputFile);
+        fos.write(out);
+        fos.close();
+    }
+    catch (e) {
+        throw("Error writing file '" + filename + "'");
+    }
+}
+
+/*
+ *  ======== getFileContents ========
+ *  Returns a string containing the contents of file at 'filename'
+ */
+function getFileContents(filename)
+{
+    try {
+        var input = "";
+        var inputFile = java.io.File(filename);
+        var fos = java.io.FileReader(inputFile);
+        var reader = new java.io.BufferedReader(fos);
+        var line;
+        while ((line = reader.readLine()) != null)
+            input += line + '\n';
+        reader.close();
+
+        return (input);
+    }
+    catch (e) {
+        throw("Error reading file '" + filename + "'");
+    }
+}
+
+/* Execution starts here */
+var procNames = getProcNames();
+writeFile(outFileName, getHTML(procNames));
diff --git a/packages/ti/sdo/ipc/family/tci663x/Interrupt.c b/packages/ti/sdo/ipc/family/tci663x/Interrupt.c
new file mode 100644 (file)
index 0000000..65c1efd
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.c ========
+ *  C647x based interrupt manager.
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+#include <ti/sdo/ipc/family/tci663x/MultiProcSetup.h>
+
+#include "package/internal/Interrupt.xdc.h"
+
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Interrupt_Module_startup ========
+ */
+Int Interrupt_Module_startup(Int phase)
+{
+    UInt16 procId = MultiProc_self();
+
+    /*
+     *  Wait for Startup to be done (if MultiProc id not yet set) because a
+     *  user fxn should set it
+     */
+    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
+        return (Startup_NOTDONE);
+    }
+
+    return (Startup_DONE);
+}
+
+/*
+ *  ======== Interrupt_intEnable ========
+ *  Enable interrupt
+ */
+Void Interrupt_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_enableInterrupt(intInfo->intVectorId);
+}
+
+/*
+ *  ======== Interrupt_intDisable ========
+ *  Disables interrupts
+ */
+Void Interrupt_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_disableInterrupt(intInfo->intVectorId);
+}
+
+/*
+ *  ======== Interrupt_intRegister ========
+ *  Register ISR for remote processor interrupt
+ */
+Void Interrupt_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                           Fxn func, UArg arg)
+{
+    UInt key, i;
+    Hwi_Params hwiAttrs;
+    extern volatile cregister Uns DNUM;
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    /* setup the function args using the same Hwi int */
+    Interrupt_module->args[remoteProcId] = arg;
+
+    /* Make sure the interrupt only gets plugged once */
+    Interrupt_module->numPlugged++;
+    if (Interrupt_module->numPlugged == 1) {
+        /* set the function */
+        Interrupt_module->func = func;
+
+        /* Clear any pending interrupt */
+        for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+            Interrupt_intClear(i, NULL);
+        }
+
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.maskSetting = Hwi_MaskingOption_SELF;
+        hwiAttrs.arg         = arg;
+        hwiAttrs.eventId     = Interrupt_INTERDSPINT;
+
+        Hwi_create(intInfo->intVectorId,
+            (Hwi_FuncPtr)Interrupt_intShmStub, &hwiAttrs, NULL);
+
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== Interrupt_intUnregister ========
+ */
+Void Interrupt_intUnregister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle hwiHandle;
+
+    Interrupt_module->numPlugged--;
+    if (Interrupt_module->numPlugged == 0) {
+        /* No need to disable interrupt: Hwi_delete takes care of this */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+
+        /* unset the function */
+        Interrupt_module->func = NULL;
+    }
+
+    /* Unset the function arg */
+    Interrupt_module->args[remoteProcId] = 0;
+}
+
+/*
+ *  ======== Interrupt_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                       UArg arg)
+{
+    UInt32 val;
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+
+    /*
+     *  bit 0 is set to generate interrupt.
+     *  bits 4-7 is set to specify the interrupt generation source.
+     *  The convention is that bit 4 (SRCS0) is used for core 0,
+     *  bit 5 (SRCS1) for core 1, etc... .
+     */
+    val = (1 << (DNUM + Interrupt_SRCSx_SHIFT)) | 1;
+
+    ipcgr[MultiProcSetup_procMap[remoteProcId]] =  val;
+}
+
+/*
+ *  ======== Interrupt_intPost ========
+ *  Send interrupt to the remote processor
+ */
+Void Interrupt_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                       UArg arg)
+{
+    UInt32 val;
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
+
+    /*
+     *  bit 0 is set to generate interrupt.
+     *  bits 4-7 is set to specify the interrupt generation source.
+     *  The convention is that bit 4 (SRCS0) is used for core 0,
+     *  bit 5 (SRCS1) for core 1, etc... .
+     */
+    val = (1 << (MultiProcSetup_procMap[srcProcId] + Interrupt_SRCSx_SHIFT)) | 1;
+
+    ipcgr[DNUM] =  val;
+}
+
+/*
+ *  ======== Interrupt_intClear ========
+ *  Acknowledge interrupt by clearing the corresponding source bit.
+ *  Does not clear the IFR bit by way of ICR write because that should
+ *  only be done during init time.
+ */
+UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+
+    ipcar[DNUM] =  (1 << (MultiProcSetup_procMap[remoteProcId] +
+            Interrupt_SRCSx_SHIFT));
+
+    return (0);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== Interrupt_intShmStub ========
+ */
+Void Interrupt_intShmStub(UArg arg)
+{
+    Int i;
+    extern volatile cregister Uns DNUM;
+    volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
+    UInt32 ipcarVal = ipcar[DNUM];
+
+    for (i = 0; i < ti_sdo_utils_MultiProc_numProcsInCluster; i++) {
+        if ((ipcarVal) &
+            (1 << (MultiProcSetup_procMap[i + MultiProc_getBaseIdOfCluster()]
+            + Interrupt_SRCSx_SHIFT))) {
+
+            Interrupt_module->func(Interrupt_module->args[i +
+                MultiProc_getBaseIdOfCluster()]);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/Interrupt.xdc b/packages/ti/sdo/ipc/family/tci663x/Interrupt.xdc
new file mode 100644 (file)
index 0000000..7861603
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xdc ========
+ */
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== Interrupt ========
+ *  TCI663x based interrupt manager
+ */
+@ModuleStartup
+
+module Interrupt inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* @_nodoc */
+    metaonly struct InterruptDataStruct {
+        UInt    remoteCoreId;
+        String  isrFxn;
+        String  isrArg;
+        Bool    isFlagged;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Registered Interrupts',
+                    {
+                        type: ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInterruptsData',
+                        structName: 'InterruptDataStruct'
+                    }
+                ],
+            ]
+        });
+
+internal:
+
+    /*! Shift value used for setting/identifying interrupt source */
+    const UInt SRCSx_SHIFT = 4;
+
+    /*! Ptr to the IPC Generation Registers */
+    config Ptr IPCGR0;
+
+    /*! Ptr to the IPC Acknowledgment Registers */
+    config Ptr IPCAR0;
+
+    /*! Inter-processor interrupt id (varies per device) */
+    config UInt INTERDSPINT;
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub function plugged as interrupt handler
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        Fxn     func;
+        UArg    args[];     /* One entry for each core */
+        UInt    numPlugged; /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/Interrupt.xs b/packages/ti/sdo/ipc/family/tci663x/Interrupt.xs
new file mode 100644 (file)
index 0000000..c7f30da
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ */
+
+var deviceSettings = {
+    'Kepler' : {
+        IPCGR0:         0x02620240,
+        IPCAR0:         0x02620280,
+        INTERDSPINT:    105,
+    },
+}
+var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
+Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
+
+var Hwi;
+var Interrupt;
+var Ipc;
+var MultiProc;
+var SharedRegion;
+var MultiProcSetup;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    var settings = deviceSettings[Program.cpu.deviceName];
+
+    this.IPCGR0         = settings.IPCGR0;
+    this.IPCAR0         = settings.IPCAR0;
+    this.INTERDSPINT    = settings.INTERDSPINT;
+}
+
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Interrupt       = this;
+    Hwi             = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    MultiProcSetup  = xdc.useModule("ti.sdo.ipc.family.tci663x.MultiProcSetup");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    var args = Interrupt.$object.args;
+    var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
+
+    /* The function table length should be the number of processors */
+    args.length = MultiProc.numProcessors;
+    for (var i = 0; i < args.length; i++) {
+        args[i] = 0;
+    }
+
+    mod.func = null;
+    mod.numPlugged = 0;
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInterruptsData ========
+ *  Module data view
+ */
+function viewInterruptsData(view)
+{
+    var Interrupt       = xdc.useModule('ti.sdo.ipc.family.tci663x.Interrupt');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* Retrieve the module state. */
+    var rawView = Program.scanRawView('ti.sdo.ipc.family.tci663x.Interrupt');
+    var mod = rawView.modState;
+    /* Retrieve the module configuration. */
+    var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.tci663x.Interrupt');
+    var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+
+    var args = Program.fetchArray(Interrupt.args$fetchDesc,
+                                      mod.args,
+                                      MultiProcCfg.numProcessors);
+
+    var localId = MultiProc.self$view();
+
+    if (localId != MultiProc.INVALIDID) {
+        var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
+            $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
+    }
+
+    for (var i = 0; i < MultiProcCfg.numProcessors; i++) {
+        var entryView =
+                Program.newViewStruct('ti.sdo.ipc.family.tci663x.Interrupt',
+                'Registered Interrupts');
+        entryView.remoteCoreId = i;
+        if (Number(mod.func) != 0) {
+            entryView.isrFxn =
+                    Program.lookupFuncName(Number(mod.func))[0];
+            entryView.isrArg = "0x" + Number(args[i]).toString(16);
+        }
+        else {
+            entryView.isrFxn = "(unplugged)";
+            entryView.isrArg = "";
+        }
+
+        if (localId != MultiProc.INVALIDID) {
+            var enableFlag = ipcar0[localId].elem;
+
+            if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
+                entryView.isFlagged = true;
+            }
+            else {
+                entryView.isFlagged = false;
+            }
+        }
+
+
+        view.elements.$add(entryView);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.c b/packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.c
new file mode 100644 (file)
index 0000000..45e0695
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProcSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/family/tci663x/Interrupt.h>
+#include <xdc/runtime/Assert.h>
+
+#include "package/internal/MultiProcSetup.xdc.h"
+
+/*!
+ *  ======== MultiProcSetup_init ========
+ */
+Void MultiProcSetup_init()
+{
+    extern cregister volatile UInt DNUM;
+    UInt16 procId;
+
+    /* Skip if the procId has already been set */
+    if (MultiProc_self() != MultiProc_INVALIDID) {
+        return;
+    }
+
+    procId = MultiProcSetup_getProcId(DNUM);
+
+    /*
+     *  Assert that image is being loaded onto a core that was included in the
+     *  MultiProc name list (via setConfig)
+     */
+    Assert_isTrue(procId != MultiProc_INVALIDID,
+            MultiProcSetup_A_invalidProcessor);
+
+    /* Set the local ID */
+    MultiProc_setLocalId(procId);
+}
+
+
+/*
+ *  ======== MultiProcSetup_getProcId ========
+ */
+UInt16 MultiProcSetup_getProcId(UInt coreId)
+{
+    UInt i;
+    for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+        if (MultiProcSetup_procMap[i] == coreId) {
+            return (i);
+        }
+    }
+
+    return (MultiProc_INVALIDID);
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xdc b/packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xdc
new file mode 100644 (file)
index 0000000..ff76df5
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProcSetup.xdc ========
+ */
+
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== MultiProcSetup ========
+ */
+
+module MultiProcSetup
+{
+    /*!
+     * By default the MultiProcSetup module will set the ID at startup.
+     *
+     * By setting this flag to false, the initialization step is suppressed.
+     */
+    config Bool configureProcId = true;
+
+    /*!
+     *  Assert raised when the target core is not in the MultiProc name list
+     */
+    config Assert.Id A_invalidProcessor  = {
+        msg: "A_invalidProcessor: This core is not present in the MultiProc name list"
+    };
+
+    /*! ProcId -> CoreId mapping (indexed by procId) */
+    config UInt16 procMap[];
+
+internal:
+
+    /*!
+     *  ======== getProcId ========
+     *  Returns the MultiProc ID corresponding to a specific core
+     */
+    UInt16 getProcId(UInt coreId);
+
+    Void init();
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xs b/packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xs
new file mode 100644 (file)
index 0000000..51e122f
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProcSetup.xs ========
+ */
+
+var MultiProcSetup  = null;
+var MultiProc       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    MultiProcSetup = this;
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /*
+     *  Only configure the local procId if the user hasn't disabled the config
+     *  and if the procId hasn't been statically set
+     */
+    if (MultiProcSetup.configureProcId == true &&
+            MultiProc.id == MultiProc.INVALIDID) {
+        var Startup = xdc.useModule('xdc.runtime.Startup');
+        Startup.firstFxns.$add(MultiProcSetup.init);
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+
+    /* The procMap is based upon the MuliProc id, init it here */
+    this.procMap.length = MultiProc.numProcessors;
+    for (var i = 0; i < this.procMap.length; i++) {
+        this.procMap[i] = -1;
+    }
+
+    /* Set the procMap based on the configured names in MultiProc.setConfig */
+    for (var i = MultiProc.baseIdOfCluster; i < MultiProc.baseIdOfCluster +
+        MultiProc.numProcsInCluster; i++) {
+
+        /* The nameList is based on an index */
+        if (MultiProc.nameList[i - MultiProc.baseIdOfCluster] == null) {
+            /* nameList is NULL, don't need to set the procMap */
+            break;
+        }
+
+        this.procMap[i] = Number(MultiProc.nameList[i -
+            MultiProc.baseIdOfCluster].substring("CORE".length));
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..f13509d
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include <xdc/runtime/Error.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyShmParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* init params and set default values */
+    NotifyDriverCirc_Params_init(&notifyShmParams);
+    notifyShmParams.intVectorId     = NotifyCircSetup_dspIntVectId;
+    notifyShmParams.sharedAddr      = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverCirc_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
+            &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+
+        return (Notify_E_FAIL);
+    }
+
+    return (Notify_S_SUCCESS);
+}
+
+/*!
+ * ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params params;
+
+    NotifyDriverCirc_Params_init(&params);
+    params.sharedAddr      = sharedAddr;
+    params.intVectorId     = NotifyCircSetup_dspIntVectId;
+    params.remoteProcId    = remoteProcId;
+
+    memReq = NotifyDriverCirc_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..a68a718
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/tci663x/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..0648fbb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ *
+ */
+
+var NotifyCircSetup  = null;
+var MultiProc    = null;
+var MultiProcSetup = null;
+var Notify       = null;
+var NotifyDriverShm = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyCircSetup = this;
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.tci663x.MultiProcSetup');
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/NotifySetup.c b/packages/ti/sdo/ipc/family/tci663x/NotifySetup.c
new file mode 100644 (file)
index 0000000..e1cb1ec
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include <xdc/runtime/Error.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*!
+ *  ======== NotifySetup_attach ========
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Error_Block eb;
+
+    /* Initialize the error block */
+    Error_init(&eb);
+
+    /* init params and set default values */
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.intVectorId     = NotifySetup_dspIntVectId;
+    notifyShmParams.sharedAddr      = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0, NULL,
+            &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+
+        return (Notify_E_FAIL);
+    }
+
+    return (Notify_S_SUCCESS);
+}
+
+/*!
+ * ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params params;
+
+    NotifyDriverShm_Params_init(&params);
+    params.sharedAddr      = sharedAddr;
+    params.intVectorId     = NotifySetup_dspIntVectId;
+    params.remoteProcId    = remoteProcId;
+
+    memReq = NotifyDriverShm_sharedMemReq(&params);
+
+    return(memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/NotifySetup.xdc b/packages/ti/sdo/ipc/family/tci663x/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..a88552b
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== NotifySetup ========
+ *  Manages setup of the default Notify driver handles
+ *
+ *  Creates the default notify drivers for each pair of processors.
+ */
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* The interrupt vector id */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/NotifySetup.xs b/packages/ti/sdo/ipc/family/tci663x/NotifySetup.xs
new file mode 100644 (file)
index 0000000..25fb1e7
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifySetup  = null;
+var MultiProc    = null;
+var MultiProcSetup = null;
+var Notify       = null;
+var NotifyDriverShm = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifySetup = this;
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.tci663x.MultiProcSetup');
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/package.bld b/packages/ti/sdo/ipc/family/tci663x/package.bld
new file mode 100644 (file)
index 0000000..196230a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_66 = [
+      "Interrupt",
+      "MultiProcSetup",
+      "NotifySetup",
+      "NotifyCircSetup",
+];
+
+var trgFilter_66 = {
+        field: "isa",
+        list: [ "66" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_66, undefined, trgFilter_66, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_66, undefined, trgFilter_66, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/tci663x/package.xdc b/packages/ti/sdo/ipc/family/tci663x/package.xdc
new file mode 100644 (file)
index 0000000..7d0cd40
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.tci663x ========
+ */
+package ti.sdo.ipc.family.tci663x [1,0,0,0] {
+    module    Interrupt;
+    module    MultiProcSetup;
+    module    NotifySetup;
+    module    NotifyCircSetup;
+}
diff --git a/packages/ti/sdo/ipc/family/tci663x/package.xs b/packages/ti/sdo/ipc/family/tci663x/package.xs
new file mode 100644 (file)
index 0000000..ae45afa
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.c b/packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.c
new file mode 100644 (file)
index 0000000..a913c1a
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Mailbox based interrupt manager
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST      0
+#define DSP_TO_VIDEO     1
+#define DSP_TO_VPSS      2
+#define HOST_TO_DSP      3
+#define HOST_TO_VIDEO    4
+#define HOST_TO_VPSS     5
+#define VIDEO_TO_HOST    6
+#define VIDEO_TO_DSP     7
+#define VPSS_TO_HOST     8
+#define VPSS_TO_DSP      9
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M)   (InterruptDsp_mailboxBaseAddr + 0x40 + (0x4 * M))
+#define MAILBOX_STATUS(M)    (InterruptDsp_mailboxBaseAddr + 0xC0 + (0x4 * M))
+
+#define MAILBOX_IRQSTATUS_CLR_DSP   (InterruptDsp_mailboxBaseAddr + 0x114)
+#define MAILBOX_IRQENABLE_SET_DSP   (InterruptDsp_mailboxBaseAddr + 0x118)
+#define MAILBOX_IRQENABLE_CLR_DSP   (InterruptDsp_mailboxBaseAddr + 0x11C)
+#define MAILBOX_EOI_REG             (InterruptDsp_mailboxBaseAddr + 0x140)
+
+#define HOSTINT                77
+#define M3VIDEOINT             53
+#define M3DSSINT               54
+#define DSPINT                 56
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Int         index;
+    InterruptDsp_FxnTable *table;
+
+    Assert_isTrue(intInfo->intVectorId <= 15, ti_sdo_ipc_Ipc_A_internal);
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        index = 2;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;    /* keep Coverity happy */
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptDsp_module->numPlugged++;
+    if (InterruptDsp_module->numPlugged == 1) {
+        /* Map the interrupt number to HWI vector */
+        Hwi_eventMap(intInfo->intVectorId, DSPINT);
+
+        Hwi_create(intInfo->intVectorId,
+                   (Hwi_FuncPtr)InterruptDsp_intShmStub,
+                   NULL,
+                   NULL);
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+
+    /* Enable the mailbox interrupt to the DSP */
+    InterruptDsp_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    InterruptDsp_FxnTable *table;
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptDsp_vpssProcId) {
+        index = 2;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;    /* keep Coverity happy */
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptDsp_intDisable(remoteProcId, intInfo);
+
+    InterruptDsp_module->numPlugged--;
+    if (InterruptDsp_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = NULL;
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     *
+     *  Note regarding possible race condition between local 'intSend' and
+     *  remote 'intClear':
+     *  It is possible that we we read the MAILBOX_MSGSTATUS_X register during
+     *  the remote side's intClear.  Therefore, we might choose _not_ to send
+     *  write to the mailbox even though the mailbox is about to be cleared a
+     *  few cycles later. In this case, the interrupt will be lost.
+     *  This is OK, however. intClear should always be called by the Notify
+     *  driver _before_ shared memory is read, so the event will be picked up
+     *  anyway by the previous interrupt that caused intClear to be called.
+     */
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_VIDEO)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_VIDEO)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* VPSS-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_VPSS)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_VPSS)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptDsp_vpssProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VPSS_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(VPSS_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptDsp_videoProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VIDEO_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(VIDEO_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else {  /* hostProcId */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*!
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptDsp_hostProcId) {
+        arg = REG32(MAILBOX_MESSAGE(HOST_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == InterruptDsp_videoProcId) {
+        arg = REG32(MAILBOX_MESSAGE(VIDEO_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else { /* VPSS-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VPSS_TO_DSP));
+        REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intShmStub ========
+ */
+Void InterruptDsp_intShmStub(UArg arg)
+{
+    InterruptDsp_FxnTable *table;
+
+    /* Process messages from the HOST */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(HOST_TO_DSP))
+        && REG32(MAILBOX_STATUS(HOST_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VIDEO  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(VIDEO_TO_DSP))
+        && REG32(MAILBOX_STATUS(VIDEO_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VPSS  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(VPSS_TO_DSP))
+        && REG32(MAILBOX_STATUS(VPSS_TO_DSP)) != 0) {
+        table = &(InterruptDsp_module->fxnTable[2]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..b6ea9d6
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDsp ========
+ *  TI81xx/DSP interrupt manager
+ */
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /*! @_nodoc */
+    metaonly struct InterruptDataView {
+        String      remoteProcName;
+        Bool        registered;
+        Bool        enabled;
+        Bool        intPending;
+        Ptr         payload;
+    };
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['IncomingInterrupts',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitInterrupt',
+                        structName: 'InterruptDataView'
+                    }
+                ],
+            ]
+        });
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x080C8000;
+
+internal:
+
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[3];
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.xs b/packages/ti/sdo/ipc/family/ti81xx/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..f6c8fa0
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xs ========
+ */
+
+var Hwi             = null;
+var MultiProc       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+}
+
+function module$static$init(mod, params)
+{
+    /* HOST to DSP */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* VIDEO-M3 to DSP */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* VPSS-M3 to DSP */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    mod.numPlugged = 0;
+}
+
+/*
+ *  ======== viewInitInterrupt ========
+ */
+function viewInitInterrupt(view)
+{
+    var InterruptDspModStr = "ti.sdo.ipc.family.ti81xx.InterruptDsp";
+    var Program             = xdc.useModule('xdc.rov.Program');
+    var InterruptDsp       = xdc.useModule(InterruptDspModStr);
+    var MultiProc           = xdc.useModule('ti.sdo.utils.MultiProc');
+    var MultiProcCfg        = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+    var InterruptDspCfg    = Program.getModuleConfig(InterruptDspModStr);
+    var ScalarStructs       = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var mod                 = Program.scanRawView(InterruptDspModStr).modState;
+
+    var remoteProcIds = [
+        /*
+         * [remoteProcId,
+         *  fxnTable index,
+         *  MBX# (from remote),
+         *  MBX# (to remote)]
+         */
+        [InterruptDspCfg.hostProcId, 0, 3, 0],
+        [InterruptDspCfg.videoProcId, 1, 7, 1],
+        [InterruptDspCfg.vpssProcId, 2, 9, 2]
+    ];
+
+    var MAILBOX_IRQSTATUS_CLR_DSP = (InterruptDspCfg.mailboxBaseAddr + 0x114);
+    var MAILBOX_IRQENABLE_SET_DSP = (InterruptDspCfg.mailboxBaseAddr + 0x118);
+    var MAILBOX_IRQENABLE_CLR_DSP = (InterruptDspCfg.mailboxBaseAddr + 0x11C);
+
+    function MAILBOX_MESSAGE(M) {
+        return (InterruptDspCfg.mailboxBaseAddr + 0x040 + (0x4 * M));
+    }
+
+    function MAILBOX_STATUS(M) {
+        return (InterruptDspCfg.mailboxBaseAddr + 0x0C0 + (0x4 * M));
+    }
+
+    function MAILBOX_REG_VAL(M) {
+        return (0x1 << (2 * M));
+    }
+
+    for each (procId in remoteProcIds) {
+        if (procId[0] != MultiProc.INVALIDID) {
+            var entryView = Program.newViewStruct(InterruptDspModStr,
+                    'IncomingInterrupts');
+            entryView.remoteProcName = MultiProc.getName$view(procId[0]) + " ("
+                    + procId[0] + ")";
+            entryView.registered = (Number(mod.fxnTable[procId[1]].func) != 0);
+            print(entryView.remoteProcName + ": " + mod.fxnTable[procId[1]].func);
+
+            var enabled = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_IRQENABLE_SET_DSP), false).elem;
+            entryView.enabled = ((enabled & MAILBOX_REG_VAL(procId[2])) != 0);
+
+            var intPending = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_STATUS(procId[2])), false).elem;
+            entryView.intPending = (intPending != 0);
+
+            entryView.payload = $addr(Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_MESSAGE(procId[2])), false).elem);
+
+            view.elements.$add(entryView);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.c b/packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.c
new file mode 100644 (file)
index 0000000..34b65e6
--- /dev/null
@@ -0,0 +1,533 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.c ========
+ *  Ducati/TI81xx based interupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/family/arm/m3/Hwi.h>
+#include <ti/sysbios/family/arm/ducati/Core.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptDucati.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/*
+ *  Ducati control register that maintains inter-core interrupt bits.
+ *
+ *  Using separate VIDEO and VPSS values to do 16-bit reads/writes
+ *  because we do not want to overwrite the other cores value.
+ */
+#define INTERRUPT_VIDEO           (InterruptDucati_ducatiCtrlBaseAddr)
+#define INTERRUPT_VPSS            (InterruptDucati_ducatiCtrlBaseAddr + 2)
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST      0
+#define DSP_TO_VIDEO     1
+#define DSP_TO_VPSS      2
+#define HOST_TO_DSP      3
+#define HOST_TO_VIDEO    4
+#define HOST_TO_VPSS     5
+#define VIDEO_TO_HOST    6
+#define VIDEO_TO_DSP     7
+#define VPSS_TO_HOST     8
+#define VPSS_TO_DSP      9
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(M) (InterruptDucati_mailboxBaseAddr + 0x040 + (0x4 * M))
+#define MAILBOX_STATUS(M)  (InterruptDucati_mailboxBaseAddr + 0x0C0 + (0x4 * M))
+
+/* VIDEO registers */
+#define MAILBOX_IRQSTATUS_CLR_VIDEO    (InterruptDucati_mailboxBaseAddr + 0x124)
+#define MAILBOX_IRQENABLE_SET_VIDEO    (InterruptDucati_mailboxBaseAddr + 0x128)
+#define MAILBOX_IRQENABLE_CLR_VIDEO    (InterruptDucati_mailboxBaseAddr + 0x12C)
+
+/* VPSS registers */
+#define MAILBOX_IRQSTATUS_CLR_VPSS     (InterruptDucati_mailboxBaseAddr + 0x134)
+#define MAILBOX_IRQENABLE_SET_VPSS     (InterruptDucati_mailboxBaseAddr + 0x138)
+#define MAILBOX_IRQENABLE_CLR_VPSS     (InterruptDucati_mailboxBaseAddr + 0x13C)
+
+#define HOSTINT                77
+#define M3VIDEOINT             53
+#define M3DSSINT               54
+#define DSPINT                 56
+#define M3INT                  19
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDucati_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDucati_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    /*
+     *  If the remote processor communicates via mailboxes, we should enable
+     *  the Mailbox IRQ instead of enabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            Hwi_enableInterrupt(M3INT);
+        }
+    }
+    else {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            Hwi_enableInterrupt(M3INT);
+        }
+    }
+}
+
+/*!
+ *  ======== InterruptDucati_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDucati_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    /*
+     *  If the remote processor communicates via mailboxes, we should disable
+     *  the Mailbox IRQ instead of disabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            Hwi_disableInterrupt(M3INT);
+        }
+    }
+    else {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == InterruptDucati_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            Hwi_disableInterrupt(M3INT);
+        }
+    }
+}
+
+/*!
+ *  ======== InterruptDucati_intRegister ========
+ */
+Void InterruptDucati_intRegister(UInt16 remoteProcId,
+                                 IInterrupt_IntInfo *intInfo,
+                                 Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+    Int         index;
+    InterruptDucati_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptDucati_videoProcId == MultiProc_self()) ||
+                  (InterruptDucati_vpssProcId == MultiProc_self()),
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    /*
+     *  VPSS-M3 & VIDEO-M3 each have a unique interrupt ID for receiving
+     *  interrupts external to the Ducati subsystem.  (M3DSSINT & M3VIDEOINT).
+     *  However, they have a separate interrupt ID for receving interrupt from
+     *  each other(M3INT).
+     *
+     *  Store the interrupt id in the intInfo so it can be used during
+     *  intUnregiseter.
+     */
+    if (remoteProcId == InterruptDucati_dspProcId) {
+        index = 0;
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            intInfo->localIntId = M3VIDEOINT;
+        }
+        else {
+            intInfo->localIntId = M3DSSINT;
+        }
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        index = 1;
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            intInfo->localIntId = M3VIDEOINT;
+        }
+        else {
+            intInfo->localIntId = M3DSSINT;
+        }
+    }
+    else {
+        /* Going to the other M3 */
+        index = 2;
+        intInfo->localIntId = M3INT;
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDucati_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDucati_intClear(remoteProcId, intInfo);
+
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;
+
+    /* Make sure the interrupt only gets plugged once */
+    if (remoteProcId == InterruptDucati_videoProcId ||
+        remoteProcId == InterruptDucati_vpssProcId) {
+        Hwi_create(intInfo->localIntId,
+                   (Hwi_FuncPtr)InterruptDucati_intShmDucatiStub,
+                   &hwiAttrs,
+                   NULL);
+    }
+    else {
+        InterruptDucati_module->numPlugged++;
+        if (InterruptDucati_module->numPlugged == 1) {
+            Hwi_create(intInfo->localIntId,
+                       (Hwi_FuncPtr)InterruptDucati_intShmMbxStub,
+                       &hwiAttrs,
+                       NULL);
+
+            /* Interrupt_intEnable won't enable the Hwi */
+            Hwi_enableInterrupt(intInfo->localIntId);
+        }
+    }
+
+    InterruptDucati_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDucati_intUnregister ========
+ */
+Void InterruptDucati_intUnregister(UInt16 remoteProcId,
+                                   IInterrupt_IntInfo *intInfo)
+{
+    Int         index;
+    InterruptDucati_FxnTable *table;
+    Hwi_Handle  hwiHandle;
+
+    if (remoteProcId == InterruptDucati_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptDucati_hostProcId) {
+        index = 1;
+    }
+    else {
+        /* Going to the other M3 */
+        index = 2;
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptDucati_intDisable(remoteProcId, intInfo);
+
+    /* Disable the interrupt itself */
+    if (remoteProcId == InterruptDucati_videoProcId ||
+        remoteProcId == InterruptDucati_vpssProcId) {
+        hwiHandle = Hwi_getHandle(M3INT);
+        Hwi_delete(&hwiHandle);
+    }
+    else {
+        InterruptDucati_module->numPlugged--;
+        if (InterruptDucati_module->numPlugged == 0) {
+            hwiHandle = Hwi_getHandle(intInfo->localIntId);
+            Hwi_delete(&hwiHandle);
+        }
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptDucati_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*!
+ *  ======== InterruptDucati_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDucati_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    if (remoteProcId == InterruptDucati_videoProcId ||
+        remoteProcId == InterruptDucati_vpssProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VPSS-M3 to VIDEO-M3 */
+            REG16(INTERRUPT_VIDEO) |= 0x1;
+        }
+        else {
+            /* VIDEO-M3 to VPSS-M3 */
+            REG16(INTERRUPT_VPSS) |= 0x1;
+        }
+    }
+    else if (remoteProcId == InterruptDucati_dspProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VPSS-M3 to DSP */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VPSS_TO_DSP)) == 0) {
+                REG32(MAILBOX_MESSAGE(VPSS_TO_DSP)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* VIDEO-M3 to DSP */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VIDEO_TO_DSP)) == 0) {
+                REG32(MAILBOX_MESSAGE(VIDEO_TO_DSP)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+    else { /* HOSTINT */
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VPSS-M3 to HOST */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VPSS_TO_HOST)) == 0) {
+                REG32(MAILBOX_MESSAGE(VPSS_TO_HOST)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* VIDEO-M3 to HOST */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(VIDEO_TO_HOST)) == 0) {
+                REG32(MAILBOX_MESSAGE(VIDEO_TO_HOST)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+}
+
+
+/*!
+ *  ======== InterruptDucati_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptDucati_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptDucati_videoProcId ||
+        srcProcId == InterruptDucati_vpssProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* VIDEO-M3 to VPSS-M3 */
+            REG16(INTERRUPT_VPSS) |= 0x1;
+        }
+        else {
+            /* VPSS-M3 to VIDEO-M3 */
+            REG16(INTERRUPT_VIDEO) |= 0x1;
+        }
+    }
+    else if (srcProcId == InterruptDucati_dspProcId) {
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* DSP to VPSS-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(DSP_TO_VPSS)) == 0) {
+                REG32(MAILBOX_MESSAGE(DSP_TO_VPSS)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* DSP to VIDEO-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(DSP_TO_VIDEO)) == 0) {
+                REG32(MAILBOX_MESSAGE(DSP_TO_VIDEO)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+    else { /* HOSTINT */
+        if (!(BIOS_smpEnabled) && (Core_getId() == 1)) {
+            /* HOST to VPSS-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(HOST_TO_VPSS)) == 0) {
+                REG32(MAILBOX_MESSAGE(HOST_TO_VPSS)) = arg;
+            }
+            Hwi_restore(key);
+        }
+        else {
+            /* HOST to VIDEO-M3 */
+            key = Hwi_disable();
+            if (REG32(MAILBOX_STATUS(HOST_TO_VIDEO)) == 0) {
+                REG32(MAILBOX_MESSAGE(HOST_TO_VIDEO)) = arg;
+            }
+            Hwi_restore(key);
+        }
+    }
+}
+
+
+/*!
+ *  ======== InterruptDucati_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDucati_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptDucati_videoProcId ||
+        remoteProcId == InterruptDucati_vpssProcId) {
+        arg = REG32(InterruptDucati_ducatiCtrlBaseAddr);
+
+        /* Look at BIOS's ducati Core id */
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            if ((REG16(INTERRUPT_VIDEO) & 0x1) == 0x1) {
+                /* VPSS-M3 to VIDEO-M3 */
+                REG16(INTERRUPT_VIDEO) &= ~(0x1);
+            }
+        }
+        else {
+            if ((REG16(INTERRUPT_VPSS) & 0x1) == 0x1) {
+                /* VIDEO-M3 to VPSS-M3 */
+                REG16(INTERRUPT_VPSS) &= ~(0x1);
+            }
+        }
+    }
+    else if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            /* HOST to VIDEO-M3 */
+            arg = REG32(MAILBOX_MESSAGE(HOST_TO_VIDEO));
+            REG32(MAILBOX_IRQSTATUS_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else {
+            /* DSP to VIDEO-M3 */
+            arg = REG32(MAILBOX_MESSAGE(DSP_TO_VIDEO));
+            REG32(MAILBOX_IRQSTATUS_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+    }
+    else { /* M3DSSINT */
+        if (remoteProcId == InterruptDucati_hostProcId) {
+            /* HOST to VPSS-M3 */
+            arg = REG32(MAILBOX_MESSAGE(HOST_TO_VPSS));
+            REG32(MAILBOX_IRQSTATUS_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else {
+            /* DSP to VPSS-M3 */
+            arg = REG32(MAILBOX_MESSAGE(DSP_TO_VPSS));
+            REG32(MAILBOX_IRQSTATUS_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+    }
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDucati_intShmDucatiStub ========
+ */
+Void InterruptDucati_intShmDucatiStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    table = &(InterruptDucati_module->fxnTable[2]);
+    (table->func)(table->arg);
+}
+
+/*!
+ *  ======== InterruptDucati_intShmMbxStub ========
+ */
+Void InterruptDucati_intShmMbxStub(UArg arg)
+{
+    InterruptDucati_FxnTable *table;
+
+    if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+        if ((REG32(MAILBOX_IRQENABLE_SET_VIDEO) &
+                MAILBOX_REG_VAL(DSP_TO_VIDEO)) &&
+            REG32(MAILBOX_STATUS(DSP_TO_VIDEO)) != 0) { /* DSP to VIDEO-M3 */
+            table = &(InterruptDucati_module->fxnTable[0]);
+            (table->func)(table->arg);
+        }
+        if ((REG32(MAILBOX_IRQENABLE_SET_VIDEO) &
+                MAILBOX_REG_VAL(HOST_TO_VIDEO)) &&
+            REG32(MAILBOX_STATUS(HOST_TO_VIDEO)) != 0) { /* HOST to VIDEO-M3 */
+            table = &(InterruptDucati_module->fxnTable[1]);
+            (table->func)(table->arg);
+        }
+    }
+    else {
+        if ((REG32(MAILBOX_IRQENABLE_SET_VPSS) &
+                MAILBOX_REG_VAL(DSP_TO_VPSS)) &&
+             REG32(MAILBOX_STATUS(DSP_TO_VPSS)) != 0) { /* DSP to VPSS-M3 */
+            table = &(InterruptDucati_module->fxnTable[0]);
+            (table->func)(table->arg);
+        }
+        if ((REG32(MAILBOX_IRQENABLE_SET_VPSS) &
+                MAILBOX_REG_VAL(HOST_TO_VPSS)) &&
+            REG32(MAILBOX_STATUS(HOST_TO_VPSS)) != 0) { /* HOST to VPSS-M3 */
+            table = &(InterruptDucati_module->fxnTable[1]);
+            (table->func)(table->arg);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.xdc b/packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.xdc
new file mode 100644 (file)
index 0000000..29f8108
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDucati ========
+ *  TI81xx/Ducati based interrupt manager
+ */
+
+module InterruptDucati inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x480C8000;
+
+    /* Base address for the Ducati CTRL register */
+    config UInt32 ducatiCtrlBaseAddr = 0x40001000;
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to be plugged for inter-ducati interrupts */
+    Void intShmDucatiStub(UArg arg);
+
+    /*! Stub to be plugged for intra-ducati interrupts */
+    Void intShmMbxStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[3];
+        UInt       numPlugged;
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.xs b/packages/ti/sdo/ipc/family/ti81xx/InterruptDucati.xs
new file mode 100644 (file)
index 0000000..e8c1df5
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDucati.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Core        = null;
+var MultiProc   = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arm.m3.Hwi");
+    Core        = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.videoProcId  = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId    = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    /* M3 to C674 */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* M3 to HOST */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* Inter-M3 interrupt */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptHost.c b/packages/ti/sdo/ipc/family/ti81xx/InterruptHost.c
new file mode 100644 (file)
index 0000000..8f2f625
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.c ========
+ *  Mailbox based interrupt manager
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/family/arm/a8/intcps/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptHost.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST      0
+#define DSP_TO_VIDEO     1
+#define DSP_TO_VPSS      2
+#define HOST_TO_DSP      3
+#define HOST_TO_VIDEO    4
+#define HOST_TO_VPSS     5
+#define VIDEO_TO_HOST    6
+#define VIDEO_TO_DSP     7
+#define VPSS_TO_HOST     8
+#define VPSS_TO_DSP      9
+
+#define MAILBOX_MESSAGE(M)   (InterruptHost_mailboxBaseAddr + 0x040 + (0x4 * M))
+#define MAILBOX_STATUS(M)    (InterruptHost_mailboxBaseAddr + 0x0C0 + (0x4 * M))
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_IRQSTATUS_CLR_HOST  (InterruptHost_mailboxBaseAddr + 0x104)
+#define MAILBOX_IRQENABLE_SET_HOST  (InterruptHost_mailboxBaseAddr + 0x108)
+#define MAILBOX_IRQENABLE_CLR_HOST  (InterruptHost_mailboxBaseAddr + 0x10C)
+
+#define HOSTINT                77
+#define M3VIDEOINT             53
+#define M3DSSINT               54
+#define DSPINT                 56
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptHost_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptHost_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptHost_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptHost_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptHost_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    if (remoteProcId == InterruptHost_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+    }
+}
+
+/*!
+ *  ======== InterruptHost_intRegister ========
+ */
+Void InterruptHost_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    Int         index;
+    InterruptHost_FxnTable *table;
+
+    if (remoteProcId == InterruptHost_dspProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        index = 2;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;   /* keep Coverity happy */
+    }
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptHost_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptHost_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptHost_module->numPlugged++;
+    if (InterruptHost_module->numPlugged == 1) {
+        Hwi_create(HOSTINT,
+                   (Hwi_FuncPtr)InterruptHost_intShmStub,
+                   NULL,
+                   NULL);
+        Hwi_enableInterrupt(HOSTINT);
+    }
+
+    /* Enable the mailbox interrupt to the HOST core */
+    InterruptHost_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptHost_intUnregister ========
+ */
+Void InterruptHost_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    InterruptHost_FxnTable *table;
+
+    if (remoteProcId == InterruptHost_hostProcId) {
+        index = 0;
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        index = 1;
+    }
+    else if (remoteProcId == InterruptHost_vpssProcId) {
+        index = 2;
+    }
+    else {
+        Assert_isTrue(FALSE, ti_sdo_ipc_Ipc_A_internal);
+        return;   /* keep Coverity happy */
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptHost_intDisable(remoteProcId, intInfo);
+
+    InterruptHost_module->numPlugged--;
+    if (InterruptHost_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(HOSTINT);
+        Hwi_delete(&hwiHandle);
+    }
+
+    table = &(InterruptHost_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = NULL;
+}
+
+/*!
+ *  ======== InterruptHost_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptHost_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     *
+     *  Note regarding possible race condition between local 'intSend' and
+     *  remote 'intClear':
+     *  It is possible that we we read the MAILBOX_MSGSTATUS_X register during
+     *  the remote side's intClear.  Therefore, we might choose _not_ to send
+     *  write to the mailbox even though the mailbox is about to be cleared a
+     *  few cycles later. In this case, the interrupt will be lost.
+     *  This is OK, however. intClear should always be called by the Notify
+     *  driver _before_ shared memory is read, so the event will be picked up
+     *  anyway by the previous interrupt that caused intClear to be called.
+     */
+    if (remoteProcId == InterruptHost_dspProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_DSP)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_DSP)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_VIDEO)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_VIDEO)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else { /* VPSS-M3 */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(HOST_TO_VPSS)) == 0) {
+            REG32(MAILBOX_MESSAGE(HOST_TO_VPSS)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*!
+ *  ======== InterruptHost_intPost ========
+ */
+Void InterruptHost_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+
+    if (srcProcId == InterruptHost_vpssProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VPSS_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(VPSS_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else if (srcProcId == InterruptHost_videoProcId) {
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(VIDEO_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(VIDEO_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+    else {  /* dspProcId */
+        key = Hwi_disable();
+        if (REG32(MAILBOX_STATUS(DSP_TO_HOST)) == 0) {
+            REG32(MAILBOX_MESSAGE(DSP_TO_HOST)) = arg;
+        }
+        Hwi_restore(key);
+    }
+}
+
+/*!
+ *  ======== InterruptHost_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptHost_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+
+    if (remoteProcId == InterruptHost_dspProcId) {
+        arg = REG32(MAILBOX_MESSAGE(DSP_TO_HOST));
+        REG32(MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == InterruptHost_videoProcId) {
+        arg = REG32(MAILBOX_MESSAGE(VIDEO_TO_HOST));
+        REG32(MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else { /* VPSS-M3 */
+        arg = REG32(MAILBOX_MESSAGE(VPSS_TO_HOST));
+        REG32(MAILBOX_IRQSTATUS_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+
+    // /* Write to EOI (End Of Interrupt) register */
+    // REG32(MAILBOX_EOI_REG) = 0x1;
+//    Hwi_intc.ISR_CLEAR2 = (1 << (HOSTINT - 64));
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptHost_intShmStub ========
+ */
+Void InterruptHost_intShmStub(UArg arg)
+{
+    InterruptHost_FxnTable *table;
+
+    /* Process messages from the DSP */
+    if ((REG32(MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(DSP_TO_HOST))
+        && REG32(MAILBOX_STATUS(DSP_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[0]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VIDEO  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(VIDEO_TO_HOST))
+        && REG32(MAILBOX_STATUS(VIDEO_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[1]);
+        (table->func)(table->arg);
+    }
+
+    /* Process messages from VPSS  */
+    if ((REG32(MAILBOX_IRQENABLE_SET_HOST) & MAILBOX_REG_VAL(VPSS_TO_HOST))
+        && REG32(MAILBOX_STATUS(VPSS_TO_HOST)) != 0) {
+        table = &(InterruptHost_module->fxnTable[2]);
+        (table->func)(table->arg);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptHost.xdc b/packages/ti/sdo/ipc/family/ti81xx/InterruptHost.xdc
new file mode 100644 (file)
index 0000000..381c4cc
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptHost ========
+ *  TI81xx/A8 interrupt manager
+ */
+
+module InterruptHost inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /*! @_nodoc */
+    metaonly struct InterruptDataView {
+        String      remoteProcName;
+        Bool        registered;
+        Bool        enabled;
+        Bool        intPending;
+        Ptr         payload;
+    };
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['IncomingInterrupts',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitInterrupt',
+                        structName: 'InterruptDataView'
+                    }
+                ],
+            ]
+        });
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x480C8000;
+
+internal:
+
+    config UInt dspProcId   = MultiProc.INVALIDID;
+    config UInt hostProcId  = MultiProc.INVALIDID;
+    config UInt videoProcId = MultiProc.INVALIDID;
+    config UInt vpssProcId   = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        FxnTable   fxnTable[3];
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/InterruptHost.xs b/packages/ti/sdo/ipc/family/ti81xx/InterruptHost.xs
new file mode 100644 (file)
index 0000000..8c3175a
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xs ========
+ *
+ */
+
+var Hwi             = null;
+var MultiProc       = null;
+var Ipc             = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi         = xdc.useModule("ti.sysbios.family.arm.a8.intcps.Hwi");
+    MultiProc   = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc         = xdc.useModule("ti.sdo.ipc.Ipc");
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+}
+
+function module$static$init(mod, params)
+{
+    /* DSP to HOST */
+    mod.fxnTable[0].func  = null;
+    mod.fxnTable[0].arg   = 0;
+
+    /* VIDEO-M3 to HOST */
+    mod.fxnTable[1].func  = null;
+    mod.fxnTable[1].arg   = 0;
+
+    /* VPSS-M3 to HOST */
+    mod.fxnTable[2].func  = null;
+    mod.fxnTable[2].arg   = 0;
+
+    mod.numPlugged = 0;
+}
+
+/*
+ *  ======== viewInitInterrupt ========
+ */
+function viewInitInterrupt(view)
+{
+    var InterruptHostModStr = "ti.sdo.ipc.family.ti81xx.InterruptHost";
+    var Program             = xdc.useModule('xdc.rov.Program');
+    var InterruptHost       = xdc.useModule(InterruptHostModStr);
+    var MultiProc           = xdc.useModule('ti.sdo.utils.MultiProc');
+    var MultiProcCfg        = Program.getModuleConfig('ti.sdo.utils.MultiProc');
+    var InterruptHostCfg    = Program.getModuleConfig(InterruptHostModStr);
+    var ScalarStructs       = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var mod                 = Program.scanRawView(InterruptHostModStr).modState;
+
+    var remoteProcIds = [
+        /*
+         * [remoteProcId,
+         *  fxnTable index,
+         *  MBX# (from remote),
+         *  MBX# (to remote)]
+         */
+        [InterruptHostCfg.dspProcId, 0, 0, 3],
+        [InterruptHostCfg.videoProcId, 1, 6, 4],
+        [InterruptHostCfg.vpssProcId, 2, 8, 5]
+    ];
+
+    var MAILBOX_IRQSTATUS_CLR_HOST = (InterruptHostCfg.mailboxBaseAddr + 0x104);
+    var MAILBOX_IRQENABLE_SET_HOST = (InterruptHostCfg.mailboxBaseAddr + 0x108);
+    var MAILBOX_IRQENABLE_CLR_HOST = (InterruptHostCfg.mailboxBaseAddr + 0x10C);
+
+    function MAILBOX_MESSAGE(M) {
+        return (InterruptHostCfg.mailboxBaseAddr + 0x040 + (0x4 * M));
+    }
+
+    function MAILBOX_STATUS(M) {
+        return (InterruptHostCfg.mailboxBaseAddr + 0x0C0 + (0x4 * M));
+    }
+
+    function MAILBOX_REG_VAL(M) {
+        return (0x1 << (2 * M));
+    }
+
+    for each (procId in remoteProcIds) {
+        if (procId[0] != MultiProc.INVALIDID) {
+            var entryView = Program.newViewStruct(InterruptHostModStr,
+                    'IncomingInterrupts');
+            entryView.remoteProcName = MultiProc.getName$view(procId[0]) + " ("
+                    + procId[0] + ")";
+            entryView.registered = (Number(mod.fxnTable[procId[1]].func) != 0);
+            print(entryView.remoteProcName + ": " + mod.fxnTable[procId[1]].func);
+
+            var enabled = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_IRQENABLE_SET_HOST), false).elem;
+            entryView.enabled = ((enabled & MAILBOX_REG_VAL(procId[2])) != 0);
+
+            var intPending = Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_STATUS(procId[2])), false).elem;
+            entryView.intPending = (intPending != 0);
+
+            entryView.payload = $addr(Program.fetchStruct(
+                    ScalarStructs.S_Bits32$fetchDesc,
+                    $addr(MAILBOX_MESSAGE(procId[2])), false).elem);
+
+            view.elements.$add(entryView);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c b/packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c
new file mode 100644 (file)
index 0000000..19def48
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyCircSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyCircSetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifyCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverCirc_Params notifyCircParams;
+    NotifyDriverCirc_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverCirc_Params_init(&notifyCircParams);
+    notifyCircParams.sharedAddr = sharedAddr;
+    notifyCircParams.remoteProcId  = remoteProcId;
+
+    /* Disable cache for inter-ducati NotifyDriverCirc instances */
+    if ((MultiProc_self() == NotifyCircSetup_vpssProcId &&
+         remoteProcId == NotifyCircSetup_videoProcId) ||
+        (MultiProc_self() == NotifyCircSetup_videoProcId &&
+         remoteProcId == NotifyCircSetup_vpssProcId)) {
+         notifyCircParams.cacheLineSize = 0;
+         notifyCircParams.cacheEnabled = FALSE;
+    }
+
+    /* Set the intVectorId if on the DSP */
+    if (MultiProc_self() == NotifyCircSetup_dspProcId) {
+        notifyCircParams.intVectorId = NotifyCircSetup_dspIntVectId;
+    }
+
+    shmDrvHandle = NotifyDriverCirc_create(&notifyCircParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverCirc_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverCirc_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifyCircSetup_sharedMemReq ========
+ */
+SizeT NotifyCircSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverCirc_Params notifyCircParams;
+
+    NotifyDriverCirc_Params_init(&notifyCircParams);
+    notifyCircParams.sharedAddr = sharedAddr;
+    /* Disable cache for inter-ducati NotifyDriverCirc instances */
+    if ((MultiProc_self() == NotifyCircSetup_vpssProcId &&
+         remoteProcId == NotifyCircSetup_videoProcId) ||
+        (MultiProc_self() == NotifyCircSetup_videoProcId &&
+        remoteProcId == NotifyCircSetup_vpssProcId)) {
+        notifyCircParams.cacheEnabled = FALSE;
+        notifyCircParams.cacheLineSize = 0;
+    }
+
+    memReq = NotifyDriverCirc_sharedMemReq(&notifyCircParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifyCircSetup_numIntLines ========
+ */
+UInt16 NotifyCircSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.xdc b/packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.xdc
new file mode 100644 (file)
index 0000000..97eba92
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifyCircSetup ========
+ *  Notify setup proxy for TI81xx
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on TI81xx.
+ */
+
+module NotifyCircSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for TI81xx/DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    config UInt videoProcId     = MultiProc.INVALIDID;
+    config UInt vpssProcId      = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.xs b/packages/ti/sdo/ipc/family/ti81xx/NotifyCircSetup.xs
new file mode 100644 (file)
index 0000000..ddd2c43
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyCircSetup.xs ========
+ *
+ */
+
+var NotifyDriverCirc = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifyCircSetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifyCircSetup     = this;
+
+    this.videoProcId  = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId   = MultiProc.getIdMeta("VPSS-M3");
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c b/packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c
new file mode 100644 (file)
index 0000000..b909e2c
--- /dev/null
@@ -0,0 +1,585 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== NotifyDriverMbx.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Hwi.h>
+#ifdef xdc_target__isaCompatible_v7M
+#include <ti/sysbios/family/arm/ducati/Core.h>
+#endif
+
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifyDriverMbx.xdc.h"
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+/* Assigned mailboxes */
+#define DSP_TO_HOST         0
+#define DSP_TO_VIDEO        1
+#define DSP_TO_VPSS         2
+#define HOST_TO_DSP         3
+#define HOST_TO_VIDEO       4
+#define HOST_TO_VPSS        5
+#define VIDEO_TO_HOST       6
+#define VIDEO_TO_DSP        7
+#define VPSS_TO_HOST        8
+#define VPSS_TO_DSP         9
+#define VIDEO_TO_VPSS       10
+#define VPSS_TO_VIDEO       11
+
+#define MAILBOX_REG_VAL(M)            (0x1 << (2 * M))
+
+/* Register access method. */
+#define REG16(A)                      (*(volatile UInt16 *) (A))
+#define REG32(A)                      (*(volatile UInt32 *) (A))
+
+#define MAILBOX_FIFOLENGTH      4
+
+#define MAILBOX_MESSAGE(M) \
+        (NotifyDriverMbx_mailboxBaseAddr + 0x40 + (0x4 * M))
+#define MAILBOX_FIFOSTATUS(M) \
+        (NotifyDriverMbx_mailboxBaseAddr + 0x80 + (0x4 * M))
+#define MAILBOX_STATUS(M) \
+        (NotifyDriverMbx_mailboxBaseAddr + 0xC0 + (0x4 * M))
+
+/* HOST registers */
+#define MAILBOX_IRQSTATUS_CLR_HOST    (NotifyDriverMbx_mailboxBaseAddr + 0x104)
+#define MAILBOX_IRQENABLE_SET_HOST    (NotifyDriverMbx_mailboxBaseAddr + 0x108)
+#define MAILBOX_IRQENABLE_CLR_HOST    (NotifyDriverMbx_mailboxBaseAddr + 0x10C)
+
+/* DSP registers */
+#define MAILBOX_IRQSTATUS_CLR_DSP     (NotifyDriverMbx_mailboxBaseAddr + 0x114)
+#define MAILBOX_IRQENABLE_SET_DSP     (NotifyDriverMbx_mailboxBaseAddr + 0x118)
+#define MAILBOX_IRQENABLE_CLR_DSP     (NotifyDriverMbx_mailboxBaseAddr + 0x11C)
+
+/* VIDEO registers */
+#define MAILBOX_IRQSTATUS_CLR_VIDEO   (NotifyDriverMbx_mailboxBaseAddr + 0x124)
+#define MAILBOX_IRQENABLE_SET_VIDEO   (NotifyDriverMbx_mailboxBaseAddr + 0x128)
+#define MAILBOX_IRQENABLE_CLR_VIDEO   (NotifyDriverMbx_mailboxBaseAddr + 0x12C)
+
+/* VPSS registers */
+#define MAILBOX_IRQSTATUS_CLR_VPSS    (NotifyDriverMbx_mailboxBaseAddr + 0x134)
+#define MAILBOX_IRQENABLE_SET_VPSS    (NotifyDriverMbx_mailboxBaseAddr + 0x138)
+#define MAILBOX_IRQENABLE_CLR_VPSS    (NotifyDriverMbx_mailboxBaseAddr + 0x13C)
+
+#define MAILBOX_EOI_REG               (NotifyDriverMbx_mailboxBaseAddr + 0x140)
+
+#define MBX(src, dst)                 (src##_TO_##dst)
+
+#define PROCID_HOST                   NotifyDriverMbx_hostProcId
+#define PROCID_VPSS                   NotifyDriverMbx_vpssProcId
+#define PROCID_VIDEO                  NotifyDriverMbx_videoProcId
+#define PROCID_DSP                    NotifyDriverMbx_dspProcId
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverMbx_Module_startup ========
+ */
+
+/* The INIT macro empties the mailbox that corresponds to 'src'-to-'dst' */
+#define INIT(src, dst)                                                  \
+    while (REG32(MAILBOX_STATUS(MBX(src, dst)))) {                      \
+        REG32(MAILBOX_MESSAGE(MBX(src, dst)));                          \
+    }                                                                   \
+    REG32(MAILBOX_IRQSTATUS_CLR_##dst)                                  \
+            = MAILBOX_REG_VAL(MBX(src, dst));
+
+Int NotifyDriverMbx_Module_startup(Int phase)
+{
+#if defined(xdc_target__isaCompatible_64)
+
+    INIT(HOST, DSP)
+    INIT(VIDEO, DSP)
+    INIT(VPSS, DSP)
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        INIT(DSP, VPSS)
+        INIT(HOST, VPSS)
+        INIT(VIDEO, VPSS)
+    }
+    else {
+        INIT(DSP, VIDEO)
+        INIT(HOST, VIDEO)
+        INIT(VPSS, VIDEO)
+    }
+
+#else
+    INIT(DSP, HOST)
+    INIT(VIDEO, HOST)
+    INIT(VPSS, HOST)
+
+#endif
+
+    return (Startup_DONE);
+}
+
+
+/*
+ **************************************************************
+ *                       Instance functions
+ **************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverMbx_Instance_init ========
+ */
+Void NotifyDriverMbx_Instance_init(NotifyDriverMbx_Object *obj,
+        const NotifyDriverMbx_Params *params)
+{
+    UInt        key;
+
+    /*
+     * Check whether remote proc ID has been set and isn't the same as the
+     * local proc ID
+     */
+    Assert_isTrue ((params->remoteProcId != MultiProc_INVALIDID) &&
+                   (params->remoteProcId != MultiProc_self()),
+                   ti_sdo_ipc_Notify_A_internal);
+
+    if (params->remoteProcId >= MultiProc_getNumProcessors() ||
+        params->remoteProcId == MultiProc_INVALIDID) {
+        return;    /* keep Coverity happy */
+    }
+
+    obj->remoteProcId = params->remoteProcId;
+    obj->evtRegMask = 0;
+    obj->notifyHandle = NULL;
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    /* Store the driver handle so it can be retreived in the isr */
+    NotifyDriverMbx_module->drvHandles[obj->remoteProcId] = obj;
+
+    /* Enable the mailbox interrupt from the remote core */
+    NotifyDriverMbx_enable(obj);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== NotifyDriverMbx_Instance_finalize ========
+ */
+Void NotifyDriverMbx_Instance_finalize(NotifyDriverMbx_Object *obj)
+{
+    /* Disable the mailbox interrupt source */
+    NotifyDriverMbx_disable(obj);
+
+    NotifyDriverMbx_module->drvHandles[obj->remoteProcId] = NULL;
+}
+
+/*
+ *  ======== NotifyDriverMbx_registerEvent ========
+ */
+Void NotifyDriverMbx_registerEvent(NotifyDriverMbx_Object *obj,
+                                   UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Set the 'registered' bit */
+    SET_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverMbx_unregisterEvent ========
+ */
+Void NotifyDriverMbx_unregisterEvent(NotifyDriverMbx_Object *obj,
+                                     UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Clear the registered bit */
+    CLEAR_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverMbx_sendEvent ========
+ */
+/*
+ *  PUT_NOTIFICATION will spin waiting for enough room in the mailbox FIFO
+ *  to store the number of messages needed for the notification ('numMsgs').
+ *  If spinning is necesssary (i.e. if waitClear is TRUE and there isn't enough
+ *  room in the FIFO) then PUT_NOTIFICATION will allow pre-emption while
+ *  spinning.
+ *
+ *  PUT_NOTIFICATION needs to prevent another local thread from writing to the
+ *  same mailbox after the current thread has
+ *  1) determined that there is enough room to write the notification and
+ *  2) written the first of two messages to the mailbox.
+ *  This is needed to respectively prevent
+ *  1) both threads from incorrectly assuming there is enough space in the FIFO
+ *     for their own notifications
+ *  2) the interrupting thread from writing a notification between two
+ *     two messages that need to be successivly written by the preempted thread.
+ *  Therefore, the check for enough FIFO room and one/both mailbox write(s)
+ *  should all occur atomically (i.e. with interrupts disabled)
+ */
+#define PUT_NOTIFICATION(m)                                                 \
+        key = Hwi_disable();                                                \
+        while(MAILBOX_FIFOLENGTH - REG32(MAILBOX_STATUS(m)) < numMsgs) {    \
+            Hwi_restore(key);                                               \
+            if (!waitClear) {                                               \
+                return (Notify_E_FAIL);                                     \
+            }                                                               \
+            key = Hwi_disable();                                            \
+        };                                                                  \
+        REG32(MAILBOX_MESSAGE(m)) = eventId + smallPayload;                 \
+        if (smallPayload == 0xFFFFFFE0) {                                   \
+            REG32(MAILBOX_MESSAGE(m)) = payload;                            \
+        }                                                                   \
+        Hwi_restore(key);
+
+Int NotifyDriverMbx_sendEvent(NotifyDriverMbx_Object *obj,
+                              UInt32                 eventId,
+                              UInt32                 payload,
+                              Bool                   waitClear)
+{
+    UInt16 remoteProcId = obj->remoteProcId;
+    UInt key, numMsgs;
+    UInt32 smallPayload;
+
+    /* Decide if the payload is small enough to fit in the first mbx msg */
+    if (payload < 0x7FFFFFF) {
+        smallPayload = (payload << 5);
+        numMsgs = 1;
+    }
+    else {
+        smallPayload = 0xFFFFFFE0;
+        numMsgs = 2;
+    }
+
+#if defined(xdc_target__isaCompatible_64)
+    if (remoteProcId == NotifyDriverMbx_hostProcId) {
+        PUT_NOTIFICATION(DSP_TO_HOST)
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        PUT_NOTIFICATION(DSP_TO_VIDEO)
+    }
+    else {
+        PUT_NOTIFICATION(DSP_TO_VPSS)
+    }
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            PUT_NOTIFICATION(VPSS_TO_DSP)
+        }
+        else if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            PUT_NOTIFICATION(VPSS_TO_HOST)
+        }
+        else {
+            PUT_NOTIFICATION(VPSS_TO_VIDEO)
+        }
+    }
+    else {
+        if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            PUT_NOTIFICATION(VIDEO_TO_DSP)
+        }
+        else if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            PUT_NOTIFICATION(VIDEO_TO_HOST)
+        }
+        else {
+            PUT_NOTIFICATION(VIDEO_TO_VPSS)
+        }
+    }
+#else
+    if (remoteProcId == NotifyDriverMbx_dspProcId) {
+        PUT_NOTIFICATION(HOST_TO_DSP)
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        PUT_NOTIFICATION(HOST_TO_VIDEO)
+    }
+    else {
+        PUT_NOTIFICATION(HOST_TO_VPSS)
+    }
+#endif
+
+    return (Notify_S_SUCCESS);
+}
+
+/*
+ *  ======== NotifyDriverMbx_disable ========
+ */
+Void NotifyDriverMbx_disable(NotifyDriverMbx_Object *obj)
+{
+    UInt16 remoteProcId = obj->remoteProcId;
+
+#if defined(xdc_target__isaCompatible_64)
+    if (remoteProcId == NotifyDriverMbx_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_CLR_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(VIDEO_TO_VPSS);
+        }
+    }
+    else {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(VPSS_TO_VIDEO);
+        }
+    }
+#else
+    if (remoteProcId == NotifyDriverMbx_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+#endif
+}
+
+/*
+ *  ======== NotifyDriverMbx_enable ========
+ */
+Void NotifyDriverMbx_enable(NotifyDriverMbx_Object *obj)
+{
+    UInt16 remoteProcId = obj->remoteProcId;
+
+#if defined(xdc_target__isaCompatible_64)
+    if (remoteProcId == NotifyDriverMbx_hostProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(HOST_TO_DSP);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VIDEO_TO_DSP);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_SET_DSP) = MAILBOX_REG_VAL(VPSS_TO_DSP);
+    }
+#elif defined(xdc_target__isaCompatible_v7M)
+    if (!(BIOS_smpEnabled) && (Core_getId())) {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(VIDEO_TO_VPSS);
+        }
+    }
+    else {
+        if (remoteProcId == NotifyDriverMbx_hostProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
+        }
+        else if (remoteProcId == NotifyDriverMbx_dspProcId) {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
+        }
+        else {
+            REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(VPSS_TO_VIDEO);
+        }
+    }
+#else
+    if (remoteProcId == NotifyDriverMbx_dspProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
+    }
+    else if (remoteProcId == NotifyDriverMbx_videoProcId) {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
+    }
+    else {
+        REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
+    }
+#endif
+}
+
+/*
+ *  ======== NotifyDriverMbx_disableEvent ========
+ */
+Void NotifyDriverMbx_disableEvent(NotifyDriverMbx_Object *obj, UInt32 eventId)
+{
+    /* NotifyDriverMbx_disableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverMbx_A_notSupported);
+}
+
+/*
+ *  ======== NotifyDriverMbx_enableEvent ========
+ */
+Void NotifyDriverMbx_enableEvent(NotifyDriverMbx_Object *obj, UInt32 eventId)
+{
+    /* NotifyDriverMbx_enableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverMbx_A_notSupported);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverMbx_isr ========
+ */
+
+/*
+ *  Get a message from the mailbox.  The bottom 5 bits of the message
+ *  contains the eventId.  The top 27 bits of the message contains either
+ *  1) The payload if the payload is less than 0x7FFFFFF
+ *  2) 0x7FFFFFF otherwise
+ *  If the top 27 bits of the first message is 0x7FFFFFF, then the payload
+ *  is in the next mailbox message.
+ */
+#define GET_NOTIFICATION(dst, src)                                          \
+    if (REG32(MAILBOX_STATUS(MBX(src, dst)))) {                             \
+        numProcessed++;                                                     \
+        msg = REG32(MAILBOX_MESSAGE(MBX(src, dst)));                        \
+        eventId = (UInt16)(msg & 0x1F);                                     \
+        payload = msg >> 5;                                                 \
+        if (payload == 0x7FFFFFF) {                                         \
+            while(REG32(MAILBOX_STATUS(MBX(src, dst))) == 0);               \
+            payload = REG32(MAILBOX_MESSAGE(MBX(src, dst)));                \
+        }                                                                   \
+        REG32(MAILBOX_IRQSTATUS_CLR_##dst) =                                \
+                MAILBOX_REG_VAL(MBX(src, dst));                             \
+        obj = NotifyDriverMbx_module->drvHandles[PROCID_##src];             \
+        Assert_isTrue(obj != NULL, ti_sdo_ipc_Notify_A_internal);           \
+        if (TEST_BIT(obj->evtRegMask, eventId)) {                           \
+            ti_sdo_ipc_Notify_exec(obj->notifyHandle,                       \
+                                   eventId,                                 \
+                                   payload);                                \
+        }                                                                   \
+    }
+
+Void NotifyDriverMbx_isr(UArg arg)
+{
+    NotifyDriverMbx_Object *obj;
+    UInt32 msg, payload;
+    UInt16 eventId;
+    Int numProcessed;
+
+#if defined(xdc_target__isaCompatible_64)
+    do {
+        numProcessed = 0;
+        GET_NOTIFICATION(DSP, HOST)
+        GET_NOTIFICATION(DSP, VPSS)
+        GET_NOTIFICATION(DSP, VIDEO)
+    }
+    while (numProcessed != 0);
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG) = 0x1;
+
+#elif defined(xdc_target__isaCompatible_v7M)
+    do {
+        numProcessed = 0;
+        if (!(BIOS_smpEnabled) && (Core_getId())) {
+            GET_NOTIFICATION(VPSS, HOST)
+            GET_NOTIFICATION(VPSS, DSP)
+            GET_NOTIFICATION(VPSS, VIDEO)
+        }
+        else {
+            GET_NOTIFICATION(VIDEO, HOST)
+            GET_NOTIFICATION(VIDEO, DSP)
+            GET_NOTIFICATION(VIDEO, VPSS)
+        }
+    }
+    while (numProcessed != 0);
+
+#else
+    do {
+        numProcessed = 0;
+        GET_NOTIFICATION(HOST, DSP)
+        GET_NOTIFICATION(HOST, VPSS)
+        GET_NOTIFICATION(HOST, VIDEO)
+    }
+    while (numProcessed != 0);
+
+#endif
+}
+
+/*
+ *  ======== NotifyDriverMbx_setNotifyHandle ========
+ */
+Void NotifyDriverMbx_setNotifyHandle(NotifyDriverMbx_Object *obj,
+                                     Ptr notifyHandle)
+{
+    /* Internally used, so no Assert needed */
+    obj->notifyHandle = (ti_sdo_ipc_Notify_Handle)notifyHandle;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.xdc b/packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.xdc
new file mode 100644 (file)
index 0000000..3f52012
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverMbx.xdc ================
+ */
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.interfaces.INotifyDriver;
+import ti.sdo.ipc.Notify;
+
+import ti.sysbios.hal.Hwi;
+
+import xdc.runtime.Assert;
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== NotifyDriverMbx ========
+ *  A TI81xx hardware mailbox based driver for the Notify Module.
+ *
+ *  This is a {@link ti.sdo.ipc.Notify} driver that uses hardware mailboxes to
+ *  transmit notifications to remote processors.
+ *
+ *  Unlike the Notify drivers available in the {@link ti.sdo.ipc.notifyDrivers}
+ *  package, this driver is not generic and will only work with the TI81xx
+ *  family of devices.
+ *
+ *  The driver uses no shared memory since the event IDs and payloads that
+ *  comprise notifications are transmitted via the hardware mailbox FIFO.  The
+ *  FIFO can hold up to 4 mailbox messages.  The number of notification that can
+ *  be stored in the FIFO depends on the sizes of the payloads being sent via
+ *  Notify_sendEvent.  If the payload is less than 0x7FFFFFF, then a single
+ *  message will be sent per notification.  Otherwise, if the payload is greater
+ *  than or equal to 0x7FFFFFF, two mailbox messages are needed to send the
+ *  notification.
+ *
+ *  The behavior of Notify_sendEvent when the FIFO is full depends on the value
+ *  of the 'waitClear' argument to the function.  If 'waitClear' is TRUE, then
+ *  Notify_sendEvent will spin waiting for enough room in the FIFO for the
+ *  notification before actually sending it.  If 'waitClear' is FALSE, then
+ *  Notify_sendEvent will return Notify_E_FAIL if there isn't enough room in the
+ *  FIFO to store the notification.
+ *
+ *  The Notify_[enable/disable]Event APIs are not supported by this driver.
+ *
+ */
+@InstanceFinalize
+@ModuleStartup
+module NotifyDriverMbx inherits ti.sdo.ipc.interfaces.INotifyDriver
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+        UInt        numIncomingPending;
+        UInt        numOutgoingPending;
+        String      incomingIntStatus;
+        String      outgoingIntStatus;
+        String      registeredEvents;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  Assert raised when trying to use Notify_[enable/disable]Event with
+     *  NotifyDriverMbx
+     */
+    config Assert.Id A_notSupported =
+        {msg: "A_notSupported: [enable/disable]Event not supported by NotifyDriverMbx"};
+
+
+    /*! Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr = 0x480C8000;
+
+    /*!
+     *  ======== intVectorId ========
+     *  Interrupt vector ID to be used by the driver.
+     *
+     *  This parameter is only used by the DSP core
+     */
+    config UInt intVectorId = ~1u;
+
+instance:
+
+    /*!
+     *  ======== remoteProcId ========
+     *  The MultiProc ID corresponding to the remote processor
+     */
+    config UInt16 remoteProcId = MultiProc.INVALIDID;
+
+internal:
+
+    config UInt16 dspProcId   = MultiProc.INVALIDID;
+    config UInt16 hostProcId  = MultiProc.INVALIDID;
+    config UInt16 videoProcId = MultiProc.INVALIDID;
+    config UInt16 vpssProcId  = MultiProc.INVALIDID;
+
+    /*!
+     *  Plugs the interrupt and executes the callback functions according
+     *  to event priority
+     */
+    Void isr(UArg arg);
+
+    /*! Instance state structure */
+    struct Instance_State {
+        Bits32           evtRegMask;     /* local event register mask        */
+        Notify.Handle    notifyHandle;   /* Handle to front-end object       */
+        UInt16           remoteProcId;   /* Remote MultiProc id              */
+    }
+
+    struct Module_State {
+        NotifyDriverMbx.Handle drvHandles[4];
+        Hwi.Object hwi;
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.xs b/packages/ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.xs
new file mode 100644 (file)
index 0000000..c8546d3
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverMbx.xs ================
+ */
+
+var NotifyDriverMbx = null;
+var MultiProc       = null;
+var Notify          = null;
+var Hwi             = null;
+var Core            = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverMbx = this;
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Hwi             = xdc.useModule("ti.sysbios.hal.Hwi");
+
+    if (Program.build.target.$name.match(/M3/)) {
+        Core = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
+    }
+
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+}
+
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    for (var i = 0; i < mod.drvHandles.length; i++) {
+        mod.drvHandles[i] = null;
+    }
+
+    if (Program.build.target.$name.match(/M3/)) {
+        if (Core.id == 0) {
+            Hwi.construct(mod.hwi, 53, NotifyDriverMbx.isr);
+        }
+        else {
+            Hwi.construct(mod.hwi, 54, NotifyDriverMbx.isr);
+        }
+    }
+    else if (Program.build.target.$name.match(/674/)) {
+        var hwiParams = new Hwi.Params();
+        hwiParams.eventId = 56;
+        /*
+         *  NotifyDriverMbx.intVectorId is typically set by the module that
+         *  creates the Notify driver (i.e. the Notify setup module)
+         */
+        Hwi.construct(mod.hwi, this.intVectorId, NotifyDriverMbx.isr,
+                hwiParams);
+    }
+    else if (Program.build.target.$name.match(/A8/)) {
+        Hwi.construct(mod.hwi, 77, NotifyDriverMbx.isr);
+    }
+    else {
+        throw("Invalid target: " + Program.build.target.$name);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  Assigned mailboxes.  Structure is:
+ *  var mailBoxMap = {
+ *      "SRC_PROC_0" : {
+ *          "DST_PROC_1" :  M(SRC_PROC_0_to_DST_PROC_1)
+ *          "DST_PROC_2",   M(SRC_PROC_0_to_DST_PROC_2)
+ *              :
+ *      },
+ *          :
+ *  }
+ */
+var mailboxMap = {
+    "DSP" : {
+        "HOST" :        0,
+        "VIDEO-M3" :    1,
+        "VPSS-M3" :     2,
+    },
+    "HOST" : {
+        "DSP" :         3,
+        "VIDEO-M3" :    4,
+        "VPSS-M3" :     5,
+    },
+    "VIDEO-M3" : {
+        "HOST" :        6,
+        "DSP" :         7,
+        "VPSS-M3" :     10,
+    },
+    "VPSS-M3" : {
+        "HOST" :        8,
+        "DSP" :         9,
+        "VIDEO-M3" :    11,
+    },
+}
+
+/* Used to access core-specific mailbox registers */
+var coreIds = {
+    "HOST" :            0,
+    "DSP" :             1,
+    "VIDEO-M3" :        2,
+    "VPSS-M3" :         3,
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.family.ti81xx.NotifyDriverMbx');
+    var NotifyModCfg    = Program.getModuleConfig('ti.sdo.ipc.Notify');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    /* view.registeredEvents */
+    var registeredEvents = [];
+    for (i = 0; i < NotifyModCfg.numEvents; i++) {
+        print("Checking event #" + i);
+        if (obj.evtRegMask & (1 << i)) {
+            print("registered!");
+            registeredEvents.push(i.toString());
+        }
+    }
+    view.registeredEvents = registeredEvents.join(", ");
+
+    /* view.numPending */
+    var localName = MultiProc.getName$view(MultiProc.self$view());
+    var remoteName = view.remoteProcName;
+
+    var M_in = mailboxMap[remoteName][localName];
+    var M_out = mailboxMap[localName][remoteName];
+
+    try {
+        var MAILBOX_STATUS_IN = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0xC0 + (0x4 * M_in), false);
+        var MAILBOX_STATUS_OUT = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0xC0 + (0x4 * M_out), false);
+        view.numIncomingPending = MAILBOX_STATUS_IN.elem;
+        view.numOutgoingPending = MAILBOX_STATUS_OUT.elem;
+    }
+    catch(e) {
+        throw(e);
+    }
+
+    /* view.intStatus */
+    try {
+        var MAILBOX_IRQENABLE_CLR_LOCAL = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0x10C + (0x10 * coreIds[localName]),
+                false);
+        if (MAILBOX_IRQENABLE_CLR_LOCAL.elem & (1 << 2 * M_in)) {
+            view.incomingIntStatus = "Enabled";
+        }
+        else {
+            view.incomingIntStatus = "Disabled";
+        }
+
+        var MAILBOX_IRQENABLE_CLR_REMOTE = Program.fetchStruct(
+                ScalarStructs.S_Bits32$fetchDesc,
+                modCfg.mailboxBaseAddr + 0x10C + (0x10 * coreIds[remoteName]),
+                false);
+        if (MAILBOX_IRQENABLE_CLR_REMOTE.elem & (1 << 2 * M_out)) {
+            view.outgoingStatus = "Enabled";
+        }
+        else {
+            view.outgoingStatus = "Disabled";
+        }
+    }
+    catch(e) {
+        throw(e);
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c b/packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c
new file mode 100644 (file)
index 0000000..96a505c
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyMbxSetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include "package/internal/NotifyMbxSetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifyMbxSetup_attach ========
+ */
+Int NotifyMbxSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverMbx_Params mbxDrvParams;
+    NotifyDriverMbx_Handle mbxDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverMbx_Params_init(&mbxDrvParams);
+    mbxDrvParams.remoteProcId = remoteProcId;
+    mbxDrvHandle = NotifyDriverMbx_create(&mbxDrvParams, &eb);
+    if (mbxDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverMbx_Handle_upCast(mbxDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverMbx_delete(&mbxDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifyMbxSetup_sharedMemReq ========
+ */
+SizeT NotifyMbxSetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    return (0);
+}
+
+/*!
+ * ======== NotifyMbxSetup_numIntLines ========
+ */
+UInt16 NotifyMbxSetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.xdc b/packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.xdc
new file mode 100644 (file)
index 0000000..d878de5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyMbxSetup.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+
+/*!
+ *  ======== NotifyMbxSetup ========
+ *  Notify setup proxy for NotifyDriverMbx on TI81XX
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notifications using {@link ti.sdo.ipc.family.ti81xx.NotifyDriverMbx}
+ *
+ *  Configure the {@link #dspIntVectId} module config to choose a non-default
+ *  interrupt vector ID on the TI81XX DSP core.
+ */
+
+module NotifyMbxSetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for the DSP core on TI81XX.
+     */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    config UInt videoProcId     = MultiProc.INVALIDID;
+    config UInt vpssProcId      = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.xs b/packages/ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.xs
new file mode 100644 (file)
index 0000000..5817755
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyMbxSetup.xs ========
+ */
+
+var Notify          = null;
+var MultiProc       = null;
+var NotifyMbxSetup  = null;
+var NotifyDriverMbx = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverMbx     = xdc.useModule('ti.sdo.ipc.family.ti81xx.NotifyDriverMbx');
+    Notify              = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc           = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifyMbxSetup      = this;
+
+    this.videoProcId    = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId     = MultiProc.getIdMeta("VPSS-M3");
+    this.dspProcId      = MultiProc.getIdMeta("DSP");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+
+    NotifyDriverMbx.intVectorId = this.dspIntVectId;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifySetup.c b/packages/ti/sdo/ipc/family/ti81xx/NotifySetup.c
new file mode 100644 (file)
index 0000000..d56f6cc
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    /* Disable cache for inter-ducati NotifyDriverShm instances */
+    if ((MultiProc_self() == NotifySetup_vpssProcId &&
+         remoteProcId == NotifySetup_videoProcId) ||
+        (MultiProc_self() == NotifySetup_videoProcId &&
+         remoteProcId == NotifySetup_vpssProcId)) {
+         notifyShmParams.cacheLineSize = 0;
+         notifyShmParams.cacheEnabled = FALSE;
+    }
+
+    /* Set the intVectorId if on the DSP */
+    if (MultiProc_self() == NotifySetup_dspProcId) {
+        notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
+    }
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params notifyShmParams;
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    /* Disable cache for inter-ducati NotifyDriverShm instances */
+    if ((MultiProc_self() == NotifySetup_vpssProcId &&
+         remoteProcId == NotifySetup_videoProcId) ||
+        (MultiProc_self() == NotifySetup_videoProcId &&
+        remoteProcId == NotifySetup_vpssProcId)) {
+        notifyShmParams.cacheEnabled = FALSE;
+        notifyShmParams.cacheLineSize = 0;
+    }
+
+    memReq = NotifyDriverShm_sharedMemReq(&notifyShmParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    return (1);
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifySetup.xdc b/packages/ti/sdo/ipc/family/ti81xx/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..2197a88
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetup ========
+ *  Notify setup proxy for TI81xx
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on TI81xx.
+ */
+
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /*!
+     *  Interrupt vector id for TI81xx/DSP.
+     */
+    config UInt dspIntVectId = 5;
+
+internal:
+
+    config UInt videoProcId     = MultiProc.INVALIDID;
+    config UInt vpssProcId      = MultiProc.INVALIDID;
+    config UInt dspProcId       = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/NotifySetup.xs b/packages/ti/sdo/ipc/family/ti81xx/NotifySetup.xs
new file mode 100644 (file)
index 0000000..55aa93f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifySetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifySetup     = this;
+
+    this.videoProcId  = MultiProc.getIdMeta("VIDEO-M3");
+    this.vpssProcId   = MultiProc.getIdMeta("VPSS-M3");
+    this.dspProcId    = MultiProc.getIdMeta("DSP");
+    this.hostProcId   = MultiProc.getIdMeta("HOST");
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/package.bld b/packages/ti/sdo/ipc/family/ti81xx/package.bld
new file mode 100644 (file)
index 0000000..da90e0c
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== package.bld ========
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_common = [
+      "NotifySetup",
+      "NotifyCircSetup",
+      "NotifyMbxSetup",
+      "NotifyDriverMbx",
+];
+
+var objList_674 = [
+      "InterruptDsp",
+].concat(objList_common);
+
+var trgFilter_674 = {
+        field: "isa",
+        list: [ "674" ]
+};
+
+var objList_m3 = [
+      "InterruptDucati",
+].concat(objList_common);
+
+var trgFilter_m3 = {
+        field: "isa",
+        list: [ "v7M" ]
+};
+
+var objList_a8f = [
+      "InterruptHost",
+].concat(objList_common);
+
+var trgFilter_a8f = {
+        field: "isa",
+        list: [ "v7A", "v7A8" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, arguments);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, arguments);
+IpcBuild.buildLibs(objList_a8f, undefined, trgFilter_a8f, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_674, undefined, trgFilter_674, ["profile=smp"]);
+IpcBuild.buildLibs(objList_m3, undefined, trgFilter_m3, ["profile=smp"]);
+IpcBuild.buildLibs(objList_a8f, undefined, trgFilter_a8f, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/ti81xx/package.xdc b/packages/ti/sdo/ipc/family/ti81xx/package.xdc
new file mode 100644 (file)
index 0000000..e7756c1
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.ti81xx ========
+ */
+package ti.sdo.ipc.family.ti81xx [1,0,0,0] {
+    module    NotifySetup;
+    module    NotifyMbxSetup;
+    module    NotifyCircSetup;
+    module    InterruptDsp;
+    module    InterruptDucati;
+    module    InterruptHost;
+    module    NotifyDriverMbx;
+}
diff --git a/packages/ti/sdo/ipc/family/ti81xx/package.xs b/packages/ti/sdo/ipc/family/ti81xx/package.xs
new file mode 100644 (file)
index 0000000..7c16ec1
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== Package.validate ========
+ */
+function validate()
+{
+    if (!Program.build.target.$name.match(/M3/)) {
+        /* This validation only needs to be done for "M3" */
+        return;
+    }
+    var GateDualCore = xdc.module("ti.sysbios.family.arm.ducati.GateDualCore");
+    var Core         = xdc.module("ti.sysbios.family.arm.ducati.Core");
+    var MultiProc    = xdc.module("ti.sdo.utils.MultiProc");
+
+    /* Check for a mismatch between Core.id and MultiProc name */
+    if (MultiProc.nameList[MultiProc.id] == "VIDEO-M3" && Core.id != 0) {
+        Core.$logError("VIDEO-M3 application should have Core.id " +
+            " set to 0", Core, "id");
+    }
+
+    if (MultiProc.nameList[MultiProc.id] == "VPSS-M3") {
+        if (Core.id != 1) {
+            Core.$logError("VPSS-M3 application should have " +
+                "Core.id set to 1", Core, "id");
+        }
+
+        if (MultiProc.getIdMeta("VIDEO-M3") == MultiProc.INVALIDID &&
+            GateDualCore.initGates == false) {
+            GateDualCore.$logWarning("If VIDEO-M3 core is not being used, " +
+                "VPSS-M3 application must be configured to initialize " +
+                "GateDualCore at startup.  Set GateDualCore.initGates to " +
+                "'true' to configure this.", GateDualCore, "initGates");
+        }
+    }
+}
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptArp32.c b/packages/ti/sdo/ipc/family/vayu/InterruptArp32.c
new file mode 100644 (file)
index 0000000..5a21efd
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArp32.c ========
+ *  ARP32 mailbox based interrupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/family/arp32/Hwi.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptArp32.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+#define PROCID(IDX)               (InterruptArp32_procIdTable[IDX])
+#define MBX_TABLE_IDX(SRC, DST)   ((PROCID(SRC) * InterruptArp32_NUM_CORES) + \
+                                    PROCID(DST))
+#define SUBMBX_IDX(IDX)           (InterruptArp32_mailboxTable[IDX] & 0xFF)
+#define MBX_USER_IDX(IDX)         ((InterruptArp32_mailboxTable[IDX] >> 8) \
+                                    & 0xFF)
+#define MBX_BASEADDR_IDX(IDX)     ((InterruptArp32_mailboxTable[IDX] >> 16) \
+                                    & 0xFFFF)
+
+#define MAILBOX_REG_VAL(M)   (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(IDX) (InterruptArp32_mailboxBaseAddr[  \
+                                MBX_BASEADDR_IDX(IDX)] + 0x040 \
+                                + (0x4 * SUBMBX_IDX(IDX)))
+#define MAILBOX_STATUS(IDX)  (InterruptArp32_mailboxBaseAddr[  \
+                                MBX_BASEADDR_IDX(IDX)] + 0x0C0 \
+                                + (0x4 * SUBMBX_IDX(IDX)))
+
+#define MAILBOX_IRQSTATUS_CLR(IDX)  (InterruptArp32_mailboxBaseAddr[   \
+                                        MBX_BASEADDR_IDX(IDX)] + 0x104 \
+                                        + (MBX_USER_IDX(IDX) * 0x10))
+#define MAILBOX_IRQENABLE_SET(IDX)  (InterruptArp32_mailboxBaseAddr[   \
+                                        MBX_BASEADDR_IDX(IDX)] + 0x108 \
+                                        + (MBX_USER_IDX(IDX) * 0x10))
+#define MAILBOX_IRQENABLE_CLR(IDX)  (InterruptArp32_mailboxBaseAddr[   \
+                                        MBX_BASEADDR_IDX(IDX)] + 0x10C \
+                                        + (MBX_USER_IDX(IDX) * 0x10))
+
+#define MAILBOX_EOI_REG(IDX)        (InterruptArp32_mailboxBaseAddr[   \
+                                        MBX_BASEADDR_IDX(IDX)] + 0x140)
+
+/* This needs to match the virtual id from the TableInit.xs */
+#define DSP1_ID     4
+#define DSP2_ID     5
+#define IPU1_ID     6
+#define IPU2_ID     7
+#define HOST_ID     8
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptArp32_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptArp32_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+
+    REG32(MAILBOX_IRQENABLE_SET(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptArp32_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptArp32_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+
+    REG32(MAILBOX_IRQENABLE_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptArp32_intRegister ========
+ */
+Void InterruptArp32_intRegister(UInt16 remoteProcId,
+                                 IInterrupt_IntInfo *intInfo,
+                                 Fxn func, UArg arg)
+{
+    UInt        key;
+    UInt16      index;
+    UInt        mbxIdx;
+    Hwi_Params  hwiAttrs;
+    Error_Block eb;
+    InterruptArp32_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+           ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptArp32_eve1ProcId == MultiProc_self()) ||
+                  (InterruptArp32_eve2ProcId == MultiProc_self()) ||
+                  (InterruptArp32_eve3ProcId == MultiProc_self()) ||
+                  (InterruptArp32_eve4ProcId == MultiProc_self()),
+                   ti_sdo_ipc_Ipc_A_internal);
+
+    /* init error block */
+    Error_init(&eb);
+
+    index = PROCID(remoteProcId);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptArp32_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptArp32_intClear(remoteProcId, intInfo);
+
+    if ((index == DSP1_ID) || (index == IPU1_ID) || (index == HOST_ID)) {
+        mbxIdx = 0;
+    }
+    else if ((index == DSP2_ID) || (index == IPU2_ID)) {
+        mbxIdx = 1;
+    }
+    else if (index < InterruptArp32_NUM_EVES) {
+        mbxIdx = 2;
+    }
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptArp32_module->numPlugged[mbxIdx]++;
+    if (InterruptArp32_module->numPlugged[mbxIdx] == 1) {
+        /* Register interrupt to remote processor */
+        Hwi_Params_init(&hwiAttrs);
+        hwiAttrs.arg = arg;
+        hwiAttrs.vectorNum = intInfo->intVectorId;
+
+        Hwi_create(InterruptArp32_eveInterruptTable[index],
+                  (Hwi_FuncPtr)InterruptArp32_intShmStub,
+                   &hwiAttrs,
+                   &eb);
+        Hwi_enableInterrupt(InterruptArp32_eveInterruptTable[index]);
+    }
+
+    /* enable the mailbox and Hwi */
+    InterruptArp32_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptArp32_intUnregister ========
+ */
+Void InterruptArp32_intUnregister(UInt16 remoteProcId,
+                                   IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+    UInt   mbxIdx;
+    Hwi_Handle  hwiHandle;
+    InterruptArp32_FxnTable *table;
+
+    index = PROCID(remoteProcId);
+
+    if ((remoteProcId == DSP1_ID) || (remoteProcId == IPU1_ID) || (remoteProcId == HOST_ID)) {
+        mbxIdx = 0;
+    }
+    else if ((remoteProcId == DSP2_ID) || (remoteProcId == IPU2_ID)) {
+        mbxIdx = 1;
+    }
+    else if (remoteProcId < InterruptArp32_NUM_EVES) {
+        mbxIdx = 2;
+    }
+
+    /* Disable the mailbox interrupt source */
+    InterruptArp32_intDisable(remoteProcId, intInfo);
+
+    InterruptArp32_module->numPlugged[mbxIdx]--;
+    if (InterruptArp32_module->numPlugged[mbxIdx] == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(InterruptArp32_eveInterruptTable[index]);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptArp32_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*!
+ *  ======== InterruptArp32_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptArp32_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(MultiProc_self(), remoteProcId);
+
+    /* disable interrupts */
+    key = Hwi_disable();
+
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        /* write the mailbox message to remote proc */
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+
+    /* restore interrupts */
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptArp32_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptArp32_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(srcProcId, MultiProc_self());
+
+    /* disable interrupts */
+    key = Hwi_disable();
+
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        /* write the mailbox message to arp32 */
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+
+    /* restore interrupts */
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptArp32_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptArp32_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+
+    arg = REG32(MAILBOX_MESSAGE(index));
+    /* clear the dsp mailbox */
+    REG32(MAILBOX_IRQSTATUS_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG(index)) = 0x1;
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptArp32_intShmStub ========
+ */
+Void InterruptArp32_intShmStub(UArg arg)
+{
+    UInt16 index;
+    UInt16 selfIdx;
+    UInt16 loopIdx;
+    InterruptArp32_FxnTable *table;
+
+    selfIdx = MultiProc_self();
+
+    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {
+
+        if (loopIdx == selfIdx) {
+            continue;
+        }
+
+        index = MBX_TABLE_IDX(loopIdx, selfIdx);
+
+        if ((REG32(MAILBOX_STATUS(index)) != 0) &&
+            (REG32(MAILBOX_IRQENABLE_SET(index)) &
+             MAILBOX_REG_VAL(SUBMBX_IDX(index)))) {
+            /* call function with arg */
+            table = &(InterruptArp32_module->fxnTable[PROCID(loopIdx)]);
+            (table->func)(table->arg);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptArp32.xdc b/packages/ti/sdo/ipc/family/vayu/InterruptArp32.xdc
new file mode 100644 (file)
index 0000000..98cd892
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArp32.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptArp32 ========
+ *  ARP32 based interrupt manager
+ */
+
+module InterruptArp32 inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Total number of cores on Vayu SoC */
+    const UInt8 NUM_CORES = 9;
+
+    /* Number of Cores in EVE Sub-system */
+    const UInt8 NUM_EVES = 4;
+
+    /* Number of Internal EVE mailboxes */
+    const UInt8 NUM_EVE_MBX = 12;
+
+    /* Number of System Mailboxes */
+    const UInt8 NUM_SYS_MBX = 3;
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
+
+    /*
+     * Mailbox table for storing encoded Base Address, mailbox user Id,
+     * and sub-mailbox index.
+     */
+    config UInt32 mailboxTable[NUM_CORES * NUM_CORES];
+
+    config UInt32 eveInterruptTable[NUM_CORES];
+
+    config UInt32 procIdTable[NUM_CORES];
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt eve1ProcId     = MultiProc.INVALIDID;
+    config UInt eve2ProcId     = MultiProc.INVALIDID;
+    config UInt eve3ProcId     = MultiProc.INVALIDID;
+    config UInt eve4ProcId     = MultiProc.INVALIDID;
+    config UInt dsp1ProcId     = MultiProc.INVALIDID;
+    config UInt dsp2ProcId     = MultiProc.INVALIDID;
+    config UInt ipu1ProcId     = MultiProc.INVALIDID;
+    config UInt ipu2ProcId     = MultiProc.INVALIDID;
+    config UInt hostProcId     = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to be plugged for dsp-arp32 interrupts */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        /*
+         * Create a function table of length 8 (Total number of cores in the
+         * System) for each EVE core.
+         */
+        FxnTable   fxnTable[NUM_CORES];
+
+        /*
+         * numPlugged is used to track number of times the interrupt was
+         * registered.
+         *
+         * numPlugged array length equals number of internal mailboxes per
+         * EVE.
+         */
+        UInt numPlugged[NUM_EVE_MBX/NUM_EVES];
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptArp32.xs b/packages/ti/sdo/ipc/family/vayu/InterruptArp32.xs
new file mode 100644 (file)
index 0000000..c0720f4
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptArp32.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Core        = null;
+var MultiProc   = null;
+var InterruptArp32       = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi              = xdc.useModule("ti.sysbios.family.arp32.Hwi");
+    MultiProc        = xdc.useModule("ti.sdo.utils.MultiProc");
+    Ipc              = xdc.useModule("ti.sdo.ipc.Ipc");
+    InterruptArp32   = xdc.useModule("ti.sdo.ipc.family.vayu.InterruptArp32");
+    TableInit        = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
+
+    /* Initialize procIdTable */
+    TableInit.initProcId(InterruptArp32);
+
+    /* Initialize mailboxTable */
+    TableInit.generateTable(InterruptArp32);
+
+    /* Initialize mailbox base address table */
+    this.mailboxBaseAddr[0]  = 0x4008B000;
+    this.mailboxBaseAddr[1]  = 0x4008C000;
+    this.mailboxBaseAddr[2]  = 0x4008D000;
+    this.mailboxBaseAddr[3]  = 0x4008B000;
+    this.mailboxBaseAddr[4]  = 0x4008C000;
+    this.mailboxBaseAddr[5]  = 0x4218D000;
+    this.mailboxBaseAddr[6]  = 0x4008B000;
+    this.mailboxBaseAddr[7]  = 0x4008C000;
+    this.mailboxBaseAddr[8]  = 0x4228D000;
+    this.mailboxBaseAddr[9]  = 0x4008B000;
+    this.mailboxBaseAddr[10] = 0x4008C000;
+    this.mailboxBaseAddr[11] = 0x4238D000;
+    this.mailboxBaseAddr[12] = 0x48844000;
+    this.mailboxBaseAddr[13] = 0x48842000;
+    this.mailboxBaseAddr[14] = 0x48840000;
+
+    if (MultiProc.id == this.eve2ProcId) {
+        this.mailboxBaseAddr[2] = 0x4208D000;
+        this.mailboxBaseAddr[5] = 0x4008D000;
+    }
+    else if (MultiProc.id == this.eve3ProcId) {
+        this.mailboxBaseAddr[2]  = 0x4208D000;
+        this.mailboxBaseAddr[8] = 0x4008D000;
+    }
+    else if (MultiProc.id == this.eve4ProcId) {
+        this.mailboxBaseAddr[2]  = 0x4208D000;
+        this.mailboxBaseAddr[11] = 0x4008D000;
+    }
+
+    this.eveInterruptTable[0] = 60; /* EVE1 - Group1/INTC1 */
+    this.eveInterruptTable[1] = 60; /* EVE2 - Group1/INTC1 */
+    this.eveInterruptTable[2] = 60; /* EVE3 - Group1/INTC1 */
+    this.eveInterruptTable[3] = 60; /* EVE4 - Group1/INTC1 */
+    this.eveInterruptTable[4] = 29; /* DSP1 - Group0/INTC0 */
+    this.eveInterruptTable[5] = 30; /* DSP2 - Group0/INTC0 */
+    this.eveInterruptTable[6] = 29; /* IPU1 */
+    this.eveInterruptTable[7] = 30; /* IPU2 */
+    this.eveInterruptTable[8] = 29; /* HOST */
+
+    /*
+     * In case of a spec change, follow the process shown below:
+     * 1. Update the mailboxBaseAddr Table.
+     * 2. Update the dspInterruptTable.
+     * 3. Update Virtual Index assignment.
+     * 4. Update NUMCORES, NUMEVES and EVEMBX2BASEIDX variables
+     *    in order to correctly intialize the mailboxTable.
+     */
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    var idx;
+    var remoteProcId;
+
+    for (remoteProcId=0; remoteProcId < InterruptArp32.procIdTable.length; remoteProcId++) {
+        mod.fxnTable[remoteProcId].func  = null;
+        mod.fxnTable[remoteProcId].arg   = 0;
+    }
+
+    for (idx = 0; idx < (InterruptArp32.NUM_EVE_MBX/InterruptArp32.NUM_EVES); idx++) {
+        mod.numPlugged[idx] = 0;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptDsp.c b/packages/ti/sdo/ipc/family/vayu/InterruptDsp.c
new file mode 100644 (file)
index 0000000..24ce4d3
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.c ========
+ *  Mailbox based interrupt manager
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+
+#include <ti/sysbios/hal/vayu/IntXbar.h>
+
+#include <ti/sysbios/family/c64p/Hwi.h>
+#include <ti/sysbios/family/c64p/EventCombiner.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_Ipc.h>
+
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+
+#include "package/internal/InterruptDsp.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+#define PROCID(IDX)               (InterruptDsp_procIdTable[IDX])
+#define MBX_TABLE_IDX(SRC, DST)   ((PROCID(SRC) * InterruptDsp_NUM_CORES) + \
+                                    PROCID(DST))
+#define SUBMBX_IDX(IDX)           (InterruptDsp_mailboxTable[IDX] & 0xFF)
+#define MBX_USER_IDX(IDX)         ((InterruptDsp_mailboxTable[IDX] >> 8) & 0xFF)
+#define MBX_BASEADDR_IDX(IDX)     ((InterruptDsp_mailboxTable[IDX] >> 16) & 0xFFFF)
+
+#define MAILBOX_REG_VAL(M)        (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(IDX)      (InterruptDsp_mailboxBaseAddr[  \
+                                    MBX_BASEADDR_IDX(IDX)] + 0x40 \
+                                    + (0x4 * SUBMBX_IDX(IDX)))
+#define MAILBOX_STATUS(IDX)       (InterruptDsp_mailboxBaseAddr[  \
+                                    MBX_BASEADDR_IDX(IDX)] + 0xC0 \
+                                    + (0x4 * SUBMBX_IDX(IDX)))
+
+#define MAILBOX_IRQSTATUS_CLR_DSP(IDX)   (InterruptDsp_mailboxBaseAddr[ \
+                                           MBX_BASEADDR_IDX(IDX)] +     \
+                                           (0x10 * MBX_USER_IDX(IDX)) + 0x104)
+#define MAILBOX_IRQENABLE_SET_DSP(IDX)   (InterruptDsp_mailboxBaseAddr[ \
+                                           MBX_BASEADDR_IDX(IDX)] +     \
+                                           (0x10 * MBX_USER_IDX(IDX)) + 0x108)
+#define MAILBOX_IRQENABLE_CLR_DSP(IDX)   (InterruptDsp_mailboxBaseAddr[ \
+                                           MBX_BASEADDR_IDX(IDX)] +     \
+                                           (0x10 * MBX_USER_IDX(IDX)) + 0x10C)
+#define MAILBOX_EOI_REG(IDX)             (InterruptDsp_mailboxBaseAddr[ \
+                                           MBX_BASEADDR_IDX(IDX)] + 0x140)
+#define EVENT_GROUP_SIZE                 32
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_Module_startup ========
+ */
+Int InterruptDsp_Module_startup(Int phase)
+{
+    extern cregister volatile UInt DNUM;
+
+    if (IntXbar_Module_startupDone()) {
+        /* connect mailbox interrupts at startup */
+        if (DNUM) {                    /* DSP1 */
+            IntXbar_connect(33, 287);  // eve1 mailbox
+            IntXbar_connect(34, 296);  // eve2 mailbox
+            IntXbar_connect(35, 305);  // eve3 mailbox
+            IntXbar_connect(36, 314);  // eve4 mailbox
+            IntXbar_connect(37, 258);  // system mailbox 7
+            IntXbar_connect(38, 254);  // system mailbox 6 user 1
+        }
+        else {                         /* DSP0 */
+            IntXbar_connect(33, 284);  // eve1 mailbox
+            IntXbar_connect(34, 293);  // eve2 mailbox
+            IntXbar_connect(35, 302);  // eve3 mailbox
+            IntXbar_connect(36, 311);  // eve4 mailbox
+            IntXbar_connect(37, 257);  // system mailbox 7
+            IntXbar_connect(38, 253);  // system mailbox 6 user 0
+        }
+        return (Startup_DONE);
+    }
+
+    return (Startup_NOTDONE);
+}
+
+/*!
+ *  ======== InterruptDsp_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptDsp_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    Assert_isTrue(((remoteProcId < MultiProc_getNumProcsInCluster()) &&
+            (remoteProcId != MultiProc_self())), ti_sdo_ipc_Ipc_A_internal);
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+
+    REG32(MAILBOX_IRQENABLE_SET_DSP(index))=MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptDsp_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptDsp_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    Assert_isTrue(((remoteProcId < MultiProc_getNumProcsInCluster()) &&
+            (remoteProcId != MultiProc_self())), ti_sdo_ipc_Ipc_A_internal);
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+
+    REG32(MAILBOX_IRQENABLE_CLR_DSP(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptDsp_intRegister ========
+ */
+Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    UInt        key;
+    UInt        eventId;
+    UInt        combinedEventId;
+    Int         index;
+    Hwi_Params  params;
+    InterruptDsp_FxnTable *table;
+
+    Assert_isTrue(((remoteProcId < MultiProc_getNumProcsInCluster()) &&
+                   (remoteProcId != MultiProc_self())), ti_sdo_ipc_Ipc_A_internal);
+
+    index = PROCID(remoteProcId);
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptDsp_intClear(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    eventId = InterruptDsp_dspInterruptTable[index];
+
+    InterruptDsp_module->numPlugged++;
+
+    if (InterruptDsp_module->numPlugged == 1) {
+        EventCombiner_dispatchPlug(eventId,
+            (Hwi_FuncPtr)InterruptDsp_intShmStub, eventId, TRUE);
+        Hwi_Params_init(&params);
+
+        combinedEventId = eventId / EVENT_GROUP_SIZE;
+
+        params.eventId = combinedEventId;
+        params.arg = combinedEventId;
+        params.enableInt = TRUE;
+        Hwi_create(intInfo->intVectorId, &ti_sysbios_family_c64p_EventCombiner_dispatch,
+                   &params, NULL);
+        Hwi_enableInterrupt(intInfo->intVectorId);
+    }
+    else {
+        EventCombiner_dispatchPlug(eventId,
+                (Hwi_FuncPtr)InterruptDsp_intShmStub, eventId, TRUE);
+    }
+
+    /* Enable the mailbox interrupt to the DSP */
+    InterruptDsp_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intUnregister ========
+ */
+Void InterruptDsp_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    Hwi_Handle  hwiHandle;
+    Int         index;
+    UInt        eventId;
+    InterruptDsp_FxnTable *table;
+
+    Assert_isTrue(((remoteProcId < MultiProc_getNumProcsInCluster()) &&
+                   (remoteProcId == MultiProc_self())), ti_sdo_ipc_Ipc_A_internal);
+
+    index = PROCID(remoteProcId);
+
+    /* Disable the mailbox interrupt source */
+    InterruptDsp_intDisable(remoteProcId, intInfo);
+
+    /* Make sure the interrupt only gets plugged once */
+    eventId = InterruptDsp_dspInterruptTable[index];
+
+    InterruptDsp_module->numPlugged--;
+
+    EventCombiner_disableEvent(eventId);
+
+    if (InterruptDsp_module->numPlugged == 0) {
+        /* Delete the Hwi */
+        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    table = &(InterruptDsp_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = NULL;
+}
+
+/*!
+ *  ======== InterruptDsp_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(MultiProc_self(), remoteProcId);
+
+    /*
+     *  Before writing to a mailbox, check whehter it already contains a message
+     *  If so, then don't write to the mailbox since we want one and only one
+     *  message per interrupt.  Disable interrupts between reading
+     *  the MSGSTATUS_X register and writing to the mailbox to protect from
+     *  another thread doing an intSend at the same time
+     *
+     *  Note regarding possible race condition between local 'intSend' and
+     *  remote 'intClear':
+     *  It is possible that we we read the MAILBOX_MSGSTATUS_X register during
+     *  the remote side's intClear.  Therefore, we might choose _not_ to send
+     *  write to the mailbox even though the mailbox is about to be cleared a
+     *  few cycles later. In this case, the interrupt will be lost.
+     *  This is OK, however. intClear should always be called by the Notify
+     *  driver _before_ shared memory is read, so the event will be picked up
+     *  anyway by the previous interrupt that caused intClear to be called.
+     */
+    key = Hwi_disable();
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intPost ========
+ */
+Void InterruptDsp_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                          UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(srcProcId, MultiProc_self());
+
+    key = Hwi_disable();
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptDsp_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptDsp_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+
+    arg = REG32(MAILBOX_MESSAGE(index));
+    REG32(MAILBOX_IRQSTATUS_CLR_DSP(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+
+    /* Write to EOI (End Of Interrupt) register */
+    REG32(MAILBOX_EOI_REG(index)) = 0x1;
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptDsp_intShmStub ========
+ */
+Void InterruptDsp_intShmStub(UArg arg)
+{
+    UInt16 index;
+    UInt16 selfIdx;
+    UInt16 loopIdx;
+    InterruptDsp_FxnTable *table;
+
+    selfIdx = MultiProc_self();
+
+    /*
+     * Loop through each Sub-mailbox to determine which one generated
+     * interrupt.
+     */
+    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {
+
+        if (loopIdx == selfIdx) {
+            continue;
+        }
+
+        index = MBX_TABLE_IDX(loopIdx, selfIdx);
+
+        if ((REG32(MAILBOX_STATUS(index)) != 0) &&
+            (REG32(MAILBOX_IRQENABLE_SET_DSP(index)) &
+             MAILBOX_REG_VAL(SUBMBX_IDX(index)))) {
+            table = &(InterruptDsp_module->fxnTable[PROCID(loopIdx)]);
+            (table->func)(table->arg);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptDsp.xdc b/packages/ti/sdo/ipc/family/vayu/InterruptDsp.xdc
new file mode 100644 (file)
index 0000000..874c7d6
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xdc ========
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptDsp ========
+ *  Vayu/DSP interrupt manager
+ */
+
+@ModuleStartup
+
+module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /*! @_nodoc */
+    metaonly struct InterruptDataView {
+        String      remoteProcName;
+        Bool        registered;
+        Bool        enabled;
+        Bool        intPending;
+        Ptr         payload;
+    };
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['IncomingInterrupts',
+                    {
+                        type: xdc.rov.ViewInfo.MODULE_DATA,
+                        viewInitFxn: 'viewInitInterrupt',
+                        structName: 'InterruptDataView'
+                    }
+                ],
+            ]
+        });
+
+    /* Total number of cores on Vayu SoC */
+    const UInt8 NUM_CORES = 9;
+
+    /* Number of Cores in EVE Sub-system */
+    const UInt8 NUM_EVES = 4;
+
+    /* Number of Cores in DSP Sub-system */
+    const UInt8 NUM_DSP_CORES = 2;
+
+    /* Number of Internal EVE mailboxes */
+    const UInt8 NUM_EVE_MBX = 12;
+
+    /* Number of System Mailboxes */
+    const UInt8 NUM_SYS_MBX = 3;
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
+
+    /*
+     * Mailbox table for storing encoded Base Address, mailbox user Id,
+     * and sub-mailbox index.
+     */
+    config UInt32 mailboxTable[NUM_CORES * NUM_CORES];
+
+    config UInt32 dspInterruptTable[NUM_CORES];
+
+    config UInt32 procIdTable[NUM_CORES];
+
+internal:
+
+    config UInt eve1ProcId     = MultiProc.INVALIDID;
+    config UInt eve2ProcId     = MultiProc.INVALIDID;
+    config UInt eve3ProcId     = MultiProc.INVALIDID;
+    config UInt eve4ProcId     = MultiProc.INVALIDID;
+    config UInt dsp1ProcId     = MultiProc.INVALIDID;
+    config UInt dsp2ProcId     = MultiProc.INVALIDID;
+    config UInt ipu1ProcId     = MultiProc.INVALIDID;
+    config UInt ipu2ProcId     = MultiProc.INVALIDID;
+    config UInt hostProcId     = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        /*
+         * Create a function table of length 8 (Total number of cores in the
+         * System) for each DSP core.
+         */
+        FxnTable   fxnTable[NUM_CORES];
+        /*
+         * Number of numPlugged counters is equal to the number of combined
+         * events used by the mailbox interrupts.
+         */
+        UInt       numPlugged;  /* # of times the interrupt was registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptDsp.xs b/packages/ti/sdo/ipc/family/vayu/InterruptDsp.xs
new file mode 100644 (file)
index 0000000..fda75f6
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptDsp.xs ========
+ */
+
+var Hwi             = null;
+var InterruptDsp    = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi              = xdc.useModule("ti.sysbios.family.c64p.Hwi");
+    EventCombiner    = xdc.useModule("ti.sysbios.family.c64p.EventCombiner");
+    Ipc              = xdc.useModule("ti.sdo.ipc.Ipc");
+    InterruptDsp     = xdc.useModule("ti.sdo.ipc.family.vayu.InterruptDsp");
+    Xbar             = xdc.useModule("ti.sysbios.hal.vayu.IntXbar");
+    TableInit        = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
+
+    /* Initialize procIdTable */
+    TableInit.initProcId(InterruptDsp);
+
+    /* Initialize mailboxTable */
+    TableInit.generateTable(InterruptDsp);
+
+    /* Initialize mailbox base address table */
+    this.mailboxBaseAddr[0]  = 0x4208B000;
+    this.mailboxBaseAddr[1]  = 0x4208C000;
+    this.mailboxBaseAddr[2]  = 0x4208D000;
+    this.mailboxBaseAddr[3]  = 0x4218B000;
+    this.mailboxBaseAddr[4]  = 0x4218C000;
+    this.mailboxBaseAddr[5]  = 0x4218D000;
+    this.mailboxBaseAddr[6]  = 0x4228B000;
+    this.mailboxBaseAddr[7]  = 0x4228C000;
+    this.mailboxBaseAddr[8]  = 0x4228D000;
+    this.mailboxBaseAddr[9]  = 0x4238B000;
+    this.mailboxBaseAddr[10] = 0x4238C000;
+    this.mailboxBaseAddr[11] = 0x4238D000;
+    this.mailboxBaseAddr[12] = 0x48844000;
+    this.mailboxBaseAddr[13] = 0x48842000;
+    this.mailboxBaseAddr[14] = 0x48840000;
+
+    /* Initialize Dsp Interrupt Id Table */
+    this.dspInterruptTable[0] = 64; /* EVE1 */
+    this.dspInterruptTable[1] = 65; /* EVE2 */
+    this.dspInterruptTable[2] = 66; /* EVE3 */
+    this.dspInterruptTable[3] = 67; /* EVE4 */
+    this.dspInterruptTable[4] = 69; /* DSP1 */
+    this.dspInterruptTable[5] = 69; /* DSP2 */
+    this.dspInterruptTable[6] = 68; /* IPU1 */
+    this.dspInterruptTable[7] = 68; /* IPU2 */
+    this.dspInterruptTable[8] = 69; /* HOST */
+
+    /*
+     * In case of a spec change, follow the process shown below:
+     * 1. Update the mailboxBaseAddr Table.
+     * 2. Update the dspInterruptTable.
+     * 3. Update Virtual Index assignment.
+     * 4. Update NUMCORES, NUMEVES and EVEMBX2BASEIDX variables
+     *    in order to correctly intialize the mailboxTable.
+     */
+}
+
+function module$static$init(mod, params)
+{
+    var remoteProcId;
+    var idx;
+
+    for (remoteProcId = 0; remoteProcId < InterruptDsp.procIdTable.length; remoteProcId++) {
+        mod.fxnTable[remoteProcId].func  = null;
+        mod.fxnTable[remoteProcId].arg   = 0;
+    }
+
+    /* Intialize numPlugged */
+    mod.numPlugged = 0;
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptHost.c b/packages/ti/sdo/ipc/family/vayu/InterruptHost.c
new file mode 100644 (file)
index 0000000..e1fd576
--- /dev/null
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.c ========
+ *  Ducati/A8 based interupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/hal/vayu/IntXbar.h>
+#include <ti/sysbios/family/arm/gic/Hwi.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptHost.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+#define PROCID(IDX)               (InterruptHost_procIdTable[(IDX)])
+#define MBX_TABLE_IDX(SRC, DST)   ((PROCID(SRC) * InterruptHost_NUM_CORES) + \
+                                    PROCID(DST))
+#define SUBMBX_IDX(IDX)           (InterruptHost_mailboxTable[(IDX)] & 0xFF)
+#define MBX_USER_IDX(IDX)         ((InterruptHost_mailboxTable[(IDX)] >> 8) \
+                                    & 0xFF)
+#define MBX_BASEADDR_IDX(IDX)     ((InterruptHost_mailboxTable[(IDX)] >> 16) \
+                                    & 0xFFFF)
+
+#define MAILBOX_REG_VAL(M)        (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(IDX)      (InterruptHost_mailboxBaseAddr[  \
+                                    MBX_BASEADDR_IDX(IDX)] + 0x40 +   \
+                                    (0x4 * SUBMBX_IDX(IDX)))
+#define MAILBOX_STATUS(IDX)       (InterruptHost_mailboxBaseAddr[  \
+                                    MBX_BASEADDR_IDX(IDX)] + 0xC0 +   \
+                                    (0x4 * SUBMBX_IDX(IDX)))
+
+#define MAILBOX_IRQSTATUS_CLR(IDX)   (InterruptHost_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + (0x10 * \
+                                        MBX_USER_IDX(IDX)) + 0x104)
+#define MAILBOX_IRQENABLE_SET(IDX)   (InterruptHost_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + (0x10 * \
+                                        MBX_USER_IDX(IDX)) + 0x108)
+#define MAILBOX_IRQENABLE_CLR(IDX)   (InterruptHost_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + (0x10 * \
+                                        MBX_USER_IDX(IDX)) + 0x10C)
+#define MAILBOX_EOI_REG(IDX)         (InterruptHost_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + 0x140)
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptHost_Module_startup ========
+ */
+Int InterruptHost_Module_startup(Int phase)
+{
+    if (IntXbar_Module_startupDone()) {
+        /* connect mailbox interrupts at startup */
+        //M4 Core 0
+        IntXbar_connect(42, 286);  // eve1 mailbox 0 user 3
+        IntXbar_connect(43, 295);  // eve2 mailbox 0 user 3
+        IntXbar_connect(44, 304);  // eve3 mailbox 0 user 3
+        IntXbar_connect(45, 313);  // eve4 mailbox 0 user 3
+        IntXbar_connect(46, 255);  // system mailbox 6 user 2
+        IntXbar_connect(47, 251);  // system mailbox 5 user 2
+        return (Startup_DONE);
+    }
+
+    return (Startup_NOTDONE);
+}
+
+/*!
+ *  ======== InterruptHost_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptHost_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+    /*
+     *  If the remote processor communicates via mailboxes, we should enable
+     *  the Mailbox IRQ instead of enabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    REG32(MAILBOX_IRQENABLE_SET(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptHost_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptHost_intDisable(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+    /*
+     *  If the remote processor communicates via mailboxes, we should disable
+     *  the Mailbox IRQ instead of disabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    REG32(MAILBOX_IRQENABLE_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptHost_intRegister ========
+ */
+Void InterruptHost_intRegister(UInt16 remoteProcId,
+                                 IInterrupt_IntInfo *intInfo,
+                                 Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+    UInt        mbxIdx;
+    Int         index;
+    InterruptHost_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptHost_hostProcId == MultiProc_self()),
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));
+
+    index = PROCID(remoteProcId);
+
+    intInfo->localIntId = InterruptHost_hostInterruptTable[index];
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptHost_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptHost_intClear(remoteProcId, intInfo);
+
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptHost_module->numPlugged[mbxIdx]++;
+    if (InterruptHost_module->numPlugged[mbxIdx] == 1) {
+        Hwi_create(intInfo->localIntId,
+                   (Hwi_FuncPtr)InterruptHost_intShmStub,
+                    &hwiAttrs,
+                    NULL);
+
+        /* Interrupt_intEnable won't enable the Hwi */
+        Hwi_enableInterrupt(intInfo->localIntId);
+    }
+
+    InterruptHost_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptHost_intUnregister ========
+ */
+Void InterruptHost_intUnregister(UInt16 remoteProcId,
+                                   IInterrupt_IntInfo *intInfo)
+{
+    UInt                       mbxIdx;
+    Int                        index;
+    InterruptHost_FxnTable *table;
+    Hwi_Handle                 hwiHandle;
+
+    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));
+
+    index = PROCID(remoteProcId);
+
+    /* Disable the mailbox interrupt source */
+    InterruptHost_intDisable(remoteProcId, intInfo);
+
+    /* Disable the interrupt itself */
+    InterruptHost_module->numPlugged[mbxIdx]--;
+    if (InterruptHost_module->numPlugged[mbxIdx] == 0) {
+        hwiHandle = Hwi_getHandle(intInfo->localIntId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptHost_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*!
+ *  ======== InterruptHost_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptHost_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(MultiProc_self(), remoteProcId);
+    key = Hwi_disable();
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptHost_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptHost_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(srcProcId, MultiProc_self());
+    key = Hwi_disable();
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptHost_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptHost_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+    arg = REG32(MAILBOX_MESSAGE(index));
+    REG32(MAILBOX_IRQSTATUS_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptHost_intShmMbxStub ========
+ */
+Void InterruptHost_intShmStub(UArg arg)
+{
+    UInt16 index;
+    UInt16 selfIdx;
+    UInt16 loopIdx;
+    InterruptHost_FxnTable *table;
+
+    selfIdx = MultiProc_self();
+
+    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {
+
+        if (loopIdx == selfIdx) {
+            continue;
+        }
+
+        index = MBX_TABLE_IDX(loopIdx, selfIdx);
+
+        if (((REG32(MAILBOX_STATUS(index)) != 0) &&
+             (REG32(MAILBOX_IRQENABLE_SET(index)) &
+              MAILBOX_REG_VAL(SUBMBX_IDX(index))))) {
+            table = &(InterruptHost_module->fxnTable[PROCID(loopIdx)]);
+            (table->func)(table->arg);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptHost.xdc b/packages/ti/sdo/ipc/family/vayu/InterruptHost.xdc
new file mode 100644 (file)
index 0000000..00793b6
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptHost ========
+ *  TI81xx/A8 based interrupt manager
+ */
+
+@ModuleStartup
+
+module InterruptHost inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Total number of cores on Vayu SoC */
+    const UInt8 NUM_CORES = 9;
+
+    /* Number of Cores in EVE Sub-system */
+    const UInt8 NUM_EVES = 4;
+
+    /* Number of Cores in IPU Sub-system */
+    const UInt8 NUM_BENELLI_CORES = 2;
+
+    /* Number of Cores in A15 Sub-system */
+    const UInt8 NUM_HOST_CORES = 1;
+
+    /* Number of Internal EVE mailboxes */
+    const UInt8 NUM_EVE_MBX = 12;
+
+    /* Number of System Mailboxes */
+    const UInt8 NUM_SYS_MBX = 3;
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
+
+    /*
+     * Mailbox table for storing encoded Base Address, mailbox user Id,
+     * and sub-mailbox index.
+     */
+    config UInt32 mailboxTable[NUM_CORES * NUM_CORES];
+
+    config UInt32 hostInterruptTable[NUM_CORES - 1];
+
+    config UInt32 procIdTable[NUM_CORES];
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt eve1ProcId     = MultiProc.INVALIDID;
+    config UInt eve2ProcId     = MultiProc.INVALIDID;
+    config UInt eve3ProcId     = MultiProc.INVALIDID;
+    config UInt eve4ProcId     = MultiProc.INVALIDID;
+    config UInt dsp1ProcId     = MultiProc.INVALIDID;
+    config UInt dsp2ProcId     = MultiProc.INVALIDID;
+    config UInt ipu1ProcId     = MultiProc.INVALIDID;
+    config UInt ipu2ProcId     = MultiProc.INVALIDID;
+    config UInt hostProcId     = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*!
+     *  ======== intShmStub ========
+     *  Stub to be plugged
+     */
+    Void intShmStub(UArg arg);
+
+    struct Module_State {
+        /*
+         * Create a function table of length NUM_CORES (Total number of cores
+         * in the System).
+         */
+        FxnTable   fxnTable[NUM_CORES];
+        /* # of times interrupt registered */
+        UInt       numPlugged[NUM_EVE_MBX + NUM_SYS_MBX];
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptHost.xs b/packages/ti/sdo/ipc/family/vayu/InterruptHost.xs
new file mode 100644 (file)
index 0000000..e28d10e
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptHost.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Host        = null;
+var Ipc         = null;
+var Xbar        = null;
+var Mmu         = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi              = xdc.useModule("ti.sysbios.family.arm.gic.Hwi");
+    Ipc              = xdc.useModule("ti.sdo.ipc.Ipc");
+    Host             = xdc.useModule("ti.sdo.ipc.family.vayu.InterruptHost");
+    Xbar             = xdc.useModule("ti.sysbios.hal.vayu.IntXbar");
+    Mmu              = xdc.useModule("ti.sysbios.family.arm.a15.Mmu");
+    TableInit        = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
+
+    /* Initisalize procIdTable */
+    TableInit.initProcId(Host);
+
+    /* Initialize mailboxTable */
+    TableInit.generateTable(Host);
+
+    /* Initialize mailbox base address table */
+    this.mailboxBaseAddr[0]  = 0x4208B000;  /* EVE1 Internal Mailbox 0 */
+    this.mailboxBaseAddr[1]  = 0x4208C000;  /* EVE1 Internal Mailbox 1 */
+    this.mailboxBaseAddr[2]  = 0x4208D000;  /* EVE1 Internal Mailbox 2 */
+    this.mailboxBaseAddr[3]  = 0x4218B000;  /* EVE2 Internal Mailbox 0 */
+    this.mailboxBaseAddr[4]  = 0x4218C000;  /* EVE2 Internal Mailbox 1 */
+    this.mailboxBaseAddr[5]  = 0x4218D000;  /* EVE2 Internal Mailbox 2 */
+    this.mailboxBaseAddr[6]  = 0x4228B000;  /* EVE3 Internal Mailbox 0 */
+    this.mailboxBaseAddr[7]  = 0x4228C000;  /* EVE3 Internal Mailbox 1 */
+    this.mailboxBaseAddr[8]  = 0x4228D000;  /* EVE3 Internal Mailbox 2 */
+    this.mailboxBaseAddr[9]  = 0x4238B000;  /* EVE4 Internal Mailbox 0 */
+    this.mailboxBaseAddr[10] = 0x4238C000;  /* EVE4 Internal Mailbox 1 */
+    this.mailboxBaseAddr[11] = 0x4238D000;  /* EVE4 Internal Mailbox 2 */
+    this.mailboxBaseAddr[12] = 0x48844000;  /* System Mailbox 7 */
+    this.mailboxBaseAddr[13] = 0x48842000;  /* System Mailbox 6 */
+    this.mailboxBaseAddr[14] = 0x48840000;  /* System Mailbox 5 */
+
+    this.hostInterruptTable[0] = 79;        /* EVE1 */
+    this.hostInterruptTable[1] = 80;        /* EVE2 */
+    this.hostInterruptTable[2] = 81;        /* EVE3 */
+    this.hostInterruptTable[3] = 82;        /* EVE4 */
+    this.hostInterruptTable[4] = 83;        /* DSP1 */
+    this.hostInterruptTable[5] = 83;        /* DSP2 */
+    this.hostInterruptTable[6] = 84;        /* IPU1 */
+    this.hostInterruptTable[7] = 84;        /* IPU2 */
+
+    /*
+     * In case of a spec change, follow the process shown below:
+     * 1. Update the mailboxBaseAddr Table.
+     * 2. Update the dspInterruptTable.
+     * 3. Update Virtual Index assignment.
+     * 4. Update numCores, numEves and eveMbx2BaseIdx variables
+     *    in order to correctly intialize the mailboxTable.
+     */
+
+    /* Add mailbox addresses to the Mmu table */
+    /* Force mailbox addresses to be NON cacheable */
+    var peripheralAttrs = {
+        type : Mmu.DescriptorType_BLOCK,  // BLOCK descriptor
+        accPerm    : 0,                   // read/write at PL1
+        noExecute  : true,                // not executable
+        attrIndx   : 1                    // MAIR0 Byte1 describes mem attr
+    };
+
+    /* Configure the corresponding MMU page descriptor accordingly */
+    Mmu.setSecondLevelDescMeta(0x42000000,
+                               0x42000000,
+                               peripheralAttrs);
+
+    Mmu.setSecondLevelDescMeta(0x42200000,
+                               0x42200000,
+                               peripheralAttrs);
+
+    Mmu.setSecondLevelDescMeta(0x48800000,
+                               0x48800000,
+                               peripheralAttrs);
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    var remoteProcId;
+    var mbxId;
+
+    for (remoteProcId = 0; remoteProcId < Host.procIdTable.length; remoteProcId++) {
+        mod.fxnTable[remoteProcId].func  = null;
+        mod.fxnTable[remoteProcId].arg   = 0;
+    }
+
+    for (mbxId = 0; mbxId < Host.mailboxBaseAddr.length; mbxId++) {
+        mod.numPlugged[mbxId] = 0;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptIpu.c b/packages/ti/sdo/ipc/family/vayu/InterruptIpu.c
new file mode 100644 (file)
index 0000000..ad8b6d2
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptIpu.c ========
+ *  Ducati/TI81xx based interupt manager
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/hal/vayu/IntXbar.h>
+#include <ti/sysbios/family/arm/m3/Hwi.h>
+#include <ti/sysbios/family/arm/ducati/Core.h>
+#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/InterruptIpu.xdc.h"
+
+/* Register access method. */
+#define REG16(A)   (*(volatile UInt16 *) (A))
+#define REG32(A)   (*(volatile UInt32 *) (A))
+
+#define PROCID(IDX)               (InterruptIpu_procIdTable[(IDX)])
+#define MBX_TABLE_IDX(SRC, DST)   ((PROCID(SRC) * InterruptIpu_NUM_CORES) + \
+                                    PROCID(DST))
+#define SUBMBX_IDX(IDX)           (InterruptIpu_mailboxTable[(IDX)] & 0xFF)
+#define MBX_USER_IDX(IDX)         ((InterruptIpu_mailboxTable[(IDX)] >> 8) \
+                                    & 0xFF)
+#define MBX_BASEADDR_IDX(IDX)    ((InterruptIpu_mailboxTable[(IDX)] >> 16) \
+                                    & 0xFFFF)
+
+#define MAILBOX_REG_VAL(M)        (0x1 << (2 * M))
+
+#define MAILBOX_MESSAGE(IDX)      (InterruptIpu_mailboxBaseAddr[  \
+                                    MBX_BASEADDR_IDX(IDX)] + 0x40 +   \
+                                    (0x4 * SUBMBX_IDX(IDX)))
+#define MAILBOX_STATUS(IDX)       (InterruptIpu_mailboxBaseAddr[  \
+                                    MBX_BASEADDR_IDX(IDX)] + 0xC0 +   \
+                                    (0x4 * SUBMBX_IDX(IDX)))
+
+#define MAILBOX_IRQSTATUS_CLR(IDX)   (InterruptIpu_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + (0x10 * \
+                                        MBX_USER_IDX(IDX)) + 0x104)
+#define MAILBOX_IRQENABLE_SET(IDX)   (InterruptIpu_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + (0x10 * \
+                                        MBX_USER_IDX(IDX)) + 0x108)
+#define MAILBOX_IRQENABLE_CLR(IDX)   (InterruptIpu_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + (0x10 * \
+                                        MBX_USER_IDX(IDX)) + 0x10C)
+#define MAILBOX_EOI_REG(IDX)         (InterruptIpu_mailboxBaseAddr[  \
+                                        MBX_BASEADDR_IDX(IDX)] + 0x140)
+
+#define PID0_ADDRESS           0xE00FFFE0
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptIpu_Module_startup ========
+ */
+Int InterruptIpu_Module_startup(Int phase)
+{
+    if (IntXbar_Module_startupDone()) {
+        /* connect mailbox interrupts at startup */
+        if (Core_ipuId == 1) {
+            /* IPU1 */
+            IntXbar_connect(42, 285);  // eve1 mailbox
+            IntXbar_connect(43, 294);  // eve2 mailbox
+            IntXbar_connect(44, 303);  // eve3 mailbox
+            IntXbar_connect(45, 312);  // eve4 mailbox
+            IntXbar_connect(46, 259);  // system mailbox 7
+            IntXbar_connect(47, 249);  // system mailbox 5 user 0
+        }
+        else {
+            /* IPU2 */
+            IntXbar_connect(42, 288);  // eve1 mailbox 1 user 2
+            IntXbar_connect(43, 297);  // eve2 mailbox 1 user 2
+            IntXbar_connect(44, 306);  // eve3 mailbox 1 user 2
+            IntXbar_connect(45, 315);  // eve4 mailbox 1 user 2
+            IntXbar_connect(46, 260);  // system mailbox 7 user 3
+            IntXbar_connect(47, 250);  // system mailbox 5 user 1
+        }
+
+        return (Startup_DONE);
+    }
+
+    return (Startup_NOTDONE);
+}
+
+/*!
+ *  ======== InterruptIpu_intEnable ========
+ *  Enable remote processor interrupt
+ */
+Void InterruptIpu_intEnable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+    /*
+     *  If the remote processor communicates via mailboxes, we should enable
+     *  the Mailbox IRQ instead of enabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    REG32(MAILBOX_IRQENABLE_SET(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptIpu_intDisable ========
+ *  Disables remote processor interrupt
+ */
+Void InterruptIpu_intDisable(UInt16 remoteProcId,
+                             IInterrupt_IntInfo *intInfo)
+{
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+    /*
+     *  If the remote processor communicates via mailboxes, we should disable
+     *  the Mailbox IRQ instead of disabling the Hwi because multiple mailboxes
+     *  share the same Hwi
+     */
+    REG32(MAILBOX_IRQENABLE_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+}
+
+/*!
+ *  ======== InterruptIpu_intRegister ========
+ */
+Void InterruptIpu_intRegister(UInt16 remoteProcId,
+                              IInterrupt_IntInfo *intInfo,
+                              Fxn func, UArg arg)
+{
+    Hwi_Params  hwiAttrs;
+    UInt        key;
+    UInt        mbxIdx;
+    Int         index;
+    InterruptIpu_FxnTable *table;
+
+    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Assert that our MultiProc id is set correctly */
+    Assert_isTrue((InterruptIpu_ipu1ProcId == MultiProc_self() ||
+                   InterruptIpu_ipu2ProcId == MultiProc_self()),
+                  ti_sdo_ipc_Ipc_A_internal);
+
+    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));
+
+    index = PROCID(remoteProcId);
+
+    intInfo->localIntId = InterruptIpu_IpuInterruptTable[index];
+
+    /* Disable global interrupts */
+    key = Hwi_disable();
+
+    table = &(InterruptIpu_module->fxnTable[index]);
+    table->func = func;
+    table->arg  = arg;
+
+    InterruptIpu_intClear(remoteProcId, intInfo);
+
+    Hwi_Params_init(&hwiAttrs);
+    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;
+
+    /* Make sure the interrupt only gets plugged once */
+    InterruptIpu_module->numPlugged[mbxIdx]++;
+    if (InterruptIpu_module->numPlugged[mbxIdx] == 1) {
+        Hwi_create(intInfo->localIntId,
+                   (Hwi_FuncPtr)InterruptIpu_intShmMbxStub,
+                    &hwiAttrs,
+                    NULL);
+
+        /* Interrupt_intEnable won't enable the Hwi */
+        Hwi_enableInterrupt(intInfo->localIntId);
+    }
+
+    InterruptIpu_intEnable(remoteProcId, intInfo);
+
+    /* Restore global interrupts */
+    Hwi_restore(key);
+}
+
+/*!
+ *  ======== InterruptIpu_intUnregister ========
+ */
+Void InterruptIpu_intUnregister(UInt16 remoteProcId,
+                                IInterrupt_IntInfo *intInfo)
+{
+    UInt                       mbxIdx;
+    Int                        index;
+    InterruptIpu_FxnTable *table;
+    Hwi_Handle                 hwiHandle;
+
+    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));
+
+    index = PROCID(remoteProcId);
+
+    /* Disable the mailbox interrupt source */
+    InterruptIpu_intDisable(remoteProcId, intInfo);
+
+    /* Disable the interrupt itself */
+    InterruptIpu_module->numPlugged[mbxIdx]--;
+    if (InterruptIpu_module->numPlugged[mbxIdx] == 0) {
+        hwiHandle = Hwi_getHandle(intInfo->localIntId);
+        Hwi_delete(&hwiHandle);
+    }
+
+    /* Clear the FxnTable entry for the remote processor */
+    table = &(InterruptIpu_module->fxnTable[index]);
+    table->func = NULL;
+    table->arg  = 0;
+}
+
+
+/*!
+ *  ======== InterruptIpu_intSend ========
+ *  Send interrupt to the remote processor
+ */
+Void InterruptIpu_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(MultiProc_self(), remoteProcId);
+    key = Hwi_disable();
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptIpu_intPost ========
+ *  Simulate an interrupt from a remote processor
+ */
+Void InterruptIpu_intPost(UInt16 srcProcId, IInterrupt_IntInfo *intInfo,
+                             UArg arg)
+{
+    UInt key;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(srcProcId, MultiProc_self());
+    key = Hwi_disable();
+    if (REG32(MAILBOX_STATUS(index)) == 0) {
+        REG32(MAILBOX_MESSAGE(index)) = arg;
+    }
+    Hwi_restore(key);
+}
+
+
+/*!
+ *  ======== InterruptIpu_intClear ========
+ *  Clear interrupt
+ */
+UInt InterruptIpu_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+{
+    UInt arg;
+    UInt16 index;
+
+    index = MBX_TABLE_IDX(remoteProcId, MultiProc_self());
+    arg = REG32(MAILBOX_MESSAGE(index));
+    REG32(MAILBOX_IRQSTATUS_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
+
+    return (arg);
+}
+
+/*
+ *************************************************************************
+ *                      Internals functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== InterruptIpu_intShmMbxStub ========
+ */
+Void InterruptIpu_intShmMbxStub(UArg arg)
+{
+    UInt16 index;
+    UInt16 selfIdx;
+    UInt16 loopIdx;
+    InterruptIpu_FxnTable *table;
+
+    selfIdx = MultiProc_self();
+
+    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {
+
+        if (loopIdx == selfIdx) {
+            continue;
+        }
+
+        index = MBX_TABLE_IDX(loopIdx, selfIdx);
+
+        if (((REG32(MAILBOX_STATUS(index)) != 0) &&
+             (REG32(MAILBOX_IRQENABLE_SET(index)) &
+              MAILBOX_REG_VAL(SUBMBX_IDX(index))))) {
+            table = &(InterruptIpu_module->fxnTable[PROCID(loopIdx)]);
+            (table->func)(table->arg);
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptIpu.xdc b/packages/ti/sdo/ipc/family/vayu/InterruptIpu.xdc
new file mode 100644 (file)
index 0000000..4628823
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptIpu.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== InterruptIpu ========
+ *  TI81xx/Ducati based interrupt manager
+ */
+
+@ModuleStartup
+
+module InterruptIpu inherits ti.sdo.ipc.notifyDrivers.IInterrupt
+{
+    /* Total number of cores on Vayu SoC */
+    const UInt8 NUM_CORES = 9;
+
+    /* Number of Cores in EVE Sub-system */
+    const UInt8 NUM_EVES = 4;
+
+    /* Number of Cores in Ipu Sub-system */
+    const UInt8 NUM_Ipu_CORES = 2;
+
+    /* Number of Internal EVE mailboxes */
+    const UInt8 NUM_EVE_MBX = 12;
+
+    /* Number of System Mailboxes */
+    const UInt8 NUM_SYS_MBX = 3;
+
+    /* Base address for the Mailbox subsystem */
+    config UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
+
+    /*
+     * Mailbox table for storing encoded Base Address, mailbox user Id,
+     * and sub-mailbox index.
+     */
+    config UInt32 mailboxTable[NUM_CORES * NUM_CORES];
+
+    /* Base address for the Ducati CTRL register */
+    config UInt32 ducatiCtrlBaseAddr = 0x40001000;
+
+    config UInt32 IpuInterruptTable[NUM_CORES];
+
+    config UInt32 procIdTable[NUM_CORES];
+
+internal:
+
+    /*! Statically retrieve procIds to avoid doing this at runtime */
+    config UInt eve1ProcId     = MultiProc.INVALIDID;
+    config UInt eve2ProcId     = MultiProc.INVALIDID;
+    config UInt eve3ProcId     = MultiProc.INVALIDID;
+    config UInt eve4ProcId     = MultiProc.INVALIDID;
+    config UInt dsp1ProcId     = MultiProc.INVALIDID;
+    config UInt dsp2ProcId     = MultiProc.INVALIDID;
+    config UInt ipu1ProcId     = MultiProc.INVALIDID;
+    config UInt ipu2ProcId     = MultiProc.INVALIDID;
+    config UInt hostProcId     = MultiProc.INVALIDID;
+
+    /*! Function table */
+    struct FxnTable {
+        Fxn    func;
+        UArg   arg;
+    }
+
+    /*! Stub to be plugged for intra-ducati interrupts */
+    Void intShmMbxStub(UArg arg);
+
+    struct Module_State {
+        /*
+         * Create a function table of length 8 (Total number of cores in the
+         * System) for each M4 core.
+         */
+        FxnTable   fxnTable[NUM_CORES];
+        UInt       numPlugged[NUM_EVE_MBX + NUM_SYS_MBX]; /* # of times interrupt registered */
+    };
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptIpu.xs b/packages/ti/sdo/ipc/family/vayu/InterruptIpu.xs
new file mode 100644 (file)
index 0000000..124639a
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== InterruptIpu.xs ========
+ *
+ */
+
+var Hwi         = null;
+var Core        = null;
+var Ipu     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi              = xdc.useModule("ti.sysbios.family.arm.m3.Hwi");
+    Core             = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
+    Ipc              = xdc.useModule("ti.sdo.ipc.Ipc");
+    Ipu              = xdc.useModule("ti.sdo.ipc.family.vayu.InterruptIpu");
+    Xbar             = xdc.useModule("ti.sysbios.hal.vayu.IntXbar");
+    TableInit        = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
+
+    /* Initisalize procIdTable */
+    TableInit.initProcId(Ipu);
+
+    /* Initialize mailboxTable */
+    TableInit.generateTable(Ipu);
+
+    /* Initialize mailbox base address table */
+    this.mailboxBaseAddr[0]  = 0x9208B000;
+    this.mailboxBaseAddr[1]  = 0x9208C000;
+    this.mailboxBaseAddr[2]  = 0x9208D000;
+    this.mailboxBaseAddr[3]  = 0x9218B000;
+    this.mailboxBaseAddr[4]  = 0x9218C000;
+    this.mailboxBaseAddr[5]  = 0x9218D000;
+    this.mailboxBaseAddr[6]  = 0x9228B000;
+    this.mailboxBaseAddr[7]  = 0x9228C000;
+    this.mailboxBaseAddr[8]  = 0x9228D000;
+    this.mailboxBaseAddr[9]  = 0x9238B000;
+    this.mailboxBaseAddr[10] = 0x9238C000;
+    this.mailboxBaseAddr[11] = 0x9238D000;
+    this.mailboxBaseAddr[12] = 0x48844000;
+    this.mailboxBaseAddr[13] = 0x48842000;
+    this.mailboxBaseAddr[14] = 0x48840000;
+
+    this.IpuInterruptTable[0] = 64; /* EVE1 */
+    this.IpuInterruptTable[1] = 65; /* EVE2 */
+    this.IpuInterruptTable[2] = 66; /* EVE3 */
+    this.IpuInterruptTable[3] = 67; /* EVE4 */
+    this.IpuInterruptTable[4] = 68; /* DSP1 */
+    this.IpuInterruptTable[5] = 68; /* DSP2 */
+    this.IpuInterruptTable[6] = 69; /* Ipu1 */
+    this.IpuInterruptTable[7] = 69; /* Ipu2 */
+    this.IpuInterruptTable[8] = 69; /* HOST */
+
+    /*
+     * In case of a spec change, follow the process shown below:
+     * 1. Update the mailboxBaseAddr Table.
+     * 2. Update the dspInterruptTable.
+     * 3. Update Virtual Index assignment.
+     * 4. Update numCores, numEves and eveMbx2BaseIdx variables
+     *    in order to correctly intialize the mailboxTable.
+     */
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    var remoteProcId;
+    var mbxId;
+
+    for (remoteProcId = 0; remoteProcId < Ipu.procIdTable.length; remoteProcId++) {
+        mod.fxnTable[remoteProcId].func  = null;
+        mod.fxnTable[remoteProcId].arg   = 0;
+    }
+
+    for (mbxId = 0; mbxId < Ipu.mailboxBaseAddr.length; mbxId++) {
+        mod.numPlugged[mbxId] = 0;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/NotifySetup.c b/packages/ti/sdo/ipc/family/vayu/NotifySetup.c
new file mode 100644 (file)
index 0000000..023a1c2
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/notifyDrivers/NotifyDriverShm.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/Ipc.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/NotifySetup.xdc.h"
+
+#define PROCID(IDX)               (NotifySetup_procIdTable[(IDX)])
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetup_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NotifyDriverShm_Params notifyShmParams;
+    NotifyDriverShm_Handle shmDrvHandle;
+    ti_sdo_ipc_Notify_Handle notifyHandle;
+    Int status = Notify_S_SUCCESS;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+    notifyShmParams.remoteProcId  = remoteProcId;
+
+    /* Set the intVectorId if on the DSP */
+    if ((MultiProc_self() == NotifySetup_dsp1ProcId) ||
+        (MultiProc_self() == NotifySetup_dsp2ProcId)) {
+            notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
+    }
+
+    /* Set the intVectorId if on the EVE */
+    if ((MultiProc_self() == NotifySetup_eve1ProcId) ||
+        (MultiProc_self() == NotifySetup_eve2ProcId) ||
+        (MultiProc_self() == NotifySetup_eve3ProcId) ||
+        (MultiProc_self() == NotifySetup_eve4ProcId)) {
+        if (PROCID(remoteProcId) < 4) {
+            notifyShmParams.intVectorId = NotifySetup_eveIntVectId_INTC1;
+        }
+        else {
+            notifyShmParams.intVectorId = NotifySetup_eveIntVectId_INTC0;
+        }
+    }
+
+    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
+    if (shmDrvHandle == NULL) {
+        return (Notify_E_FAIL);
+    }
+
+    notifyHandle = ti_sdo_ipc_Notify_create(
+            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0,
+            NULL, &eb);
+    if (notifyHandle == NULL) {
+        NotifyDriverShm_delete(&shmDrvHandle);
+        status = Notify_E_FAIL;
+    }
+
+    return (status);
+}
+
+
+/*!
+ *  ======== NotifySetup_sharedMemReq ========
+ */
+SizeT NotifySetup_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    SizeT memReq;
+    NotifyDriverShm_Params notifyShmParams;
+
+    NotifyDriverShm_Params_init(&notifyShmParams);
+    notifyShmParams.sharedAddr = sharedAddr;
+
+    memReq = NotifyDriverShm_sharedMemReq(&notifyShmParams);
+
+    return (memReq);
+}
+
+/*!
+ * ======== NotifySetup_numIntLines ========
+ */
+UInt16 NotifySetup_numIntLines(UInt16 remoteProcId)
+{
+    return 1;
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/NotifySetup.xdc b/packages/ti/sdo/ipc/family/vayu/NotifySetup.xdc
new file mode 100644 (file)
index 0000000..9d01f0a
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetup ========
+ *  Notify setup proxy for Vayu
+ *
+ *  This module creates and registers all drivers necessary for inter-processor
+ *  notification on Vayu.
+ */
+
+module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+    /* Total number of cores on Vayu SoC */
+    const UInt8 NUM_CORES = 9;
+
+    /*!
+     *  Interrupt vector id for Vayu/DSP.
+     */
+    config UInt dspIntVectId = 4;
+
+    /*!
+     *  Interrupt vector id for Vayu/EVE
+     */
+    config UInt eveIntVectId_INTC0 = -1;
+    config UInt eveIntVectId_INTC1 = -1;
+
+    config UInt32 procIdTable[NUM_CORES];
+
+internal:
+
+    config UInt eve1ProcId      = MultiProc.INVALIDID;
+    config UInt eve2ProcId      = MultiProc.INVALIDID;
+    config UInt eve3ProcId      = MultiProc.INVALIDID;
+    config UInt eve4ProcId      = MultiProc.INVALIDID;
+    config UInt dsp1ProcId      = MultiProc.INVALIDID;
+    config UInt dsp2ProcId      = MultiProc.INVALIDID;
+    config UInt ipu1ProcId      = MultiProc.INVALIDID;
+    config UInt ipu2ProcId      = MultiProc.INVALIDID;
+    config UInt hostProcId      = MultiProc.INVALIDID;
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/NotifySetup.xs b/packages/ti/sdo/ipc/family/vayu/NotifySetup.xs
new file mode 100644 (file)
index 0000000..f4e1e86
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetup.xs ========
+ *
+ */
+
+var NotifyDriverShm = null;
+var Notify          = null;
+var MultiProc       = null;
+var NotifySetup     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    Notify          = xdc.useModule('ti.sdo.ipc.Notify');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+    NotifySetup     = this;
+
+    var loopIdx;
+
+    for (loopIdx = 0; loopIdx < this.NUM_CORES; loopIdx++) {
+        this.procIdTable[loopIdx] = -1;
+    }
+
+    this.eve1ProcId     = MultiProc.getIdMeta("EVE1");
+    this.eve2ProcId     = MultiProc.getIdMeta("EVE2");
+    this.eve3ProcId     = MultiProc.getIdMeta("EVE3");
+    this.eve4ProcId     = MultiProc.getIdMeta("EVE4");
+    this.dsp1ProcId     = MultiProc.getIdMeta("DSP1");
+    this.dsp2ProcId     = MultiProc.getIdMeta("DSP2");
+    this.ipu1ProcId     = MultiProc.getIdMeta("IPU1");
+    this.ipu2ProcId     = MultiProc.getIdMeta("IPU2");
+    this.hostProcId     = MultiProc.getIdMeta("HOST");
+
+    if (this.eve1ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.eve1ProcId] = 0;
+    }
+    if (this.eve2ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.eve2ProcId] = 1;
+    }
+    if (this.eve3ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.eve3ProcId] = 2;
+    }
+    if (this.eve4ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.eve4ProcId] = 3;
+    }
+    if (this.dsp1ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.dsp1ProcId] = 4;
+    }
+    if (this.dsp2ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.dsp2ProcId] = 5;
+    }
+    if (this.ipu1ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.ipu1ProcId] = 6;
+    }
+    if (this.ipu2ProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.ipu2ProcId] = 7;
+    }
+    if (this.hostProcId != MultiProc.INVALIDID) {
+        this.procIdTable[this.hostProcId] = 8;
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/TableInit.xdc b/packages/ti/sdo/ipc/family/vayu/TableInit.xdc
new file mode 100644 (file)
index 0000000..ccd4da6
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TableInit.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== TableInit ========
+ */
+
+module TableInit
+{
+    /*!
+     *  ======== initProcId ========
+     */
+    metaonly Void initProcId(Any InterruptCore);
+
+    /*!
+     *  ======== generateTable ========
+     */
+    metaonly Void generateTable(Any InterruptCore);
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/TableInit.xs b/packages/ti/sdo/ipc/family/vayu/TableInit.xs
new file mode 100644 (file)
index 0000000..5f8d308
--- /dev/null
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TableInit.xs ========
+ *
+ */
+
+/*
+ * When assigning virtual indexes to each core make sure
+ * to assign even virtual indexes to DSP/M4 cores with
+ * even Core Ids, and assign odd virtual indexes to DSP/M4
+ * cores with odd Core Ids.
+ *
+ * Example:
+ *     DSP physical Core Id = 0 -> Virtual Index = 4;
+ *     DSP physical Core Id = 1 -> Virtual Index = 5;
+ *
+ * Virtual Index Assignment:
+ *
+ * | EVE1 -> 0 | EVE2 -> 1 | EVE3 -> 2 | EVE4 -> 3 |
+ * | DSP1 -> 4 | DSP2 -> 5 | IPU1 -> 6 | IPU2 -> 7 |
+ * | HOST -> 8
+ *
+ */
+var eve1VirtId    = 0;
+var eve2VirtId    = 1;
+var eve3VirtId    = 2;
+var eve4VirtId    = 3;
+var dsp1VirtId    = 4;
+var dsp2VirtId    = 5;
+var ipu1VirtId    = 6;
+var ipu2VirtId    = 7;
+var hostVirtId    = 8;
+
+/*
+ * Function to initialize coreIds.
+ */
+function initProcId(InterruptCore)
+{
+    var MultiProc        = xdc.useModule("ti.sdo.utils.MultiProc");
+
+    for (var loopIdx=0 ;loopIdx<InterruptCore.procIdTable.length ;loopIdx++) {
+        InterruptCore.procIdTable[loopIdx] = -1;
+    }
+
+    InterruptCore.eve1ProcId     = MultiProc.getIdMeta("EVE1");
+    InterruptCore.eve2ProcId     = MultiProc.getIdMeta("EVE2");
+    InterruptCore.eve3ProcId     = MultiProc.getIdMeta("EVE3");
+    InterruptCore.eve4ProcId     = MultiProc.getIdMeta("EVE4");
+    InterruptCore.dsp1ProcId     = MultiProc.getIdMeta("DSP1");
+    InterruptCore.dsp2ProcId     = MultiProc.getIdMeta("DSP2");
+    InterruptCore.ipu1ProcId     = MultiProc.getIdMeta("IPU1");
+    InterruptCore.ipu2ProcId     = MultiProc.getIdMeta("IPU2");
+    InterruptCore.hostProcId     = MultiProc.getIdMeta("HOST");
+
+    if (InterruptCore.eve1ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.eve1ProcId] = eve1VirtId;
+    }
+    if (InterruptCore.eve2ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.eve2ProcId] = eve2VirtId;
+    }
+    if (InterruptCore.eve3ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.eve3ProcId] = eve3VirtId;
+    }
+    if (InterruptCore.eve4ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.eve4ProcId] = eve4VirtId;
+    }
+    if (InterruptCore.dsp1ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.dsp1ProcId] = dsp1VirtId;
+    }
+    if (InterruptCore.dsp2ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.dsp2ProcId] = dsp2VirtId;
+    }
+    if (InterruptCore.ipu1ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.ipu1ProcId] = ipu1VirtId;
+    }
+    if (InterruptCore.ipu2ProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.ipu2ProcId] = ipu2VirtId;
+    }
+    if (InterruptCore.hostProcId != MultiProc.INVALIDID) {
+        InterruptCore.procIdTable[InterruptCore.hostProcId] = hostVirtId;
+    }
+}
+
+/*
+ * Function to generate mailbox table
+ */
+function generateTable(InterruptCore)
+{
+    var SYS_MBX5_OFFSET = 2;
+    var SYS_MBX6_OFFSET = 1;
+    var SYS_MBX7_OFFSET = 0;
+    var eveMbx2BaseIdx = 2;
+
+    var subMbxIdx;
+    var tableEntry;
+    var mbxUserIdx;
+    var mbxBaseAddrIdx;
+
+    /*
+     * Each entry in the mailbox table stores 3 indexes.
+     * The breakup of each entry is shown below:
+     * Entry format : 0xAAAABBCC
+     *         AAAA : Mailbox base address table index
+     *           BB : Mailbox User Id
+     *           CC : Sub-mailbox index
+     *
+     * In order to lookup the User Id, Sub-mailbox Index and mailbox base
+     * address for a given src and dst core from the mailboxTable, the
+     * procedure shown below is followed:
+     *     1. Find the right entry for the given src and dst core.
+     *        mailboxTable index is given by:
+     *            Index = (src * NumCores) + dst
+     *     2. Mbx BaseAddr Index = mailboxTable[Index] >> 16
+     *     2. dst Mailbox UserId = (mailboxTable[Index] >> 8) & 0xFF
+     *     3. Sub-Mailbox Index  = mailboxTable[Index] & 0xFF
+     */
+
+    /*
+     * 'i' is src core index, and
+     * 'j' is dst core index
+     */
+    for (var i = 0; i < InterruptCore.NUM_CORES; i++) {
+        for (var j = 0; j < InterruptCore.NUM_CORES; j++) {
+            /* EVE Internal Mailbox 2 */
+            if ((i < InterruptCore.NUM_EVES) && (j < InterruptCore.NUM_EVES)) {
+
+                /* Generate 3 masks forming a single table entry */
+                mbxBaseAddrIdx = ((j * 3) + eveMbx2BaseIdx) << 16;
+
+                /*
+                 * Determined based on the send remote receive local
+                 * methodology being followed for EVE-to-EVE communication.
+                 */
+                mbxUserIdx = 0 << 8;
+                subMbxIdx = i;
+
+                tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
+                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                continue;
+            }
+
+            /* EVE Internal Mailbox 0/1 */
+            if ((i < InterruptCore.NUM_EVES) || (j < InterruptCore.NUM_EVES)) {
+                if (i < InterruptCore.NUM_EVES) {
+                    mbxBaseAddrIdx = ((i * 3) + (j % 2)) << 16;
+
+                    if ((j == dsp1VirtId) || (j == dsp2VirtId)) {
+                        /* Destination is DSP1 or DSP2 */
+                        mbxUserIdx = 1 << 8;
+                        subMbxIdx = 0;
+                    }
+                    else if ((j == ipu1VirtId) || (j == ipu2VirtId)) {
+                        /* Destination is IPU1 or IPU2 */
+                        mbxUserIdx = 2 << 8;
+                        subMbxIdx = 2;
+                    }
+                    else {
+                        /* Destination is Host */
+                        mbxUserIdx = 3 << 8;
+                        subMbxIdx = 4;
+                    }
+
+                    tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
+                    InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                    continue;
+                }
+                else if (j < InterruptCore.NUM_EVES) {
+                    mbxBaseAddrIdx = ((j * 3) + (i % 2)) << 16;
+                    mbxUserIdx = 0 << 8; /* destination is always EVE */
+
+                    if ((i == dsp1VirtId) || (i == dsp2VirtId)) {
+                        /* Source is DSP1 or DSP2 */
+                        subMbxIdx = 1;
+                    }
+                    else if ((i == ipu1VirtId) || (i == ipu2VirtId)) {
+                        /* Source is IPU1 or IPU2 */
+                        subMbxIdx = 3;
+                    }
+                    else {
+                        /* Source is Host */
+                        subMbxIdx = 5;
+                    }
+
+                    tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
+                    InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                    continue;
+                }
+            }
+
+            /* System Mailbox 5 */
+            /* For communication between HOST and IPU1/2 and inter IPU */
+            if (((i == ipu1VirtId) || (i == ipu2VirtId) || (i == hostVirtId)) &&
+                ((j == ipu1VirtId) || (j == ipu2VirtId) || (j == hostVirtId))) {
+                mbxBaseAddrIdx = ((InterruptCore.NUM_EVES * 3) +
+                                  SYS_MBX5_OFFSET) << 16;
+                if (j == ipu1VirtId) {
+                    mbxUserIdx = 0;
+                    if (i == ipu2VirtId) {
+                        subMbxIdx = 2;
+                    }
+                    else if (i == hostVirtId) {
+                        subMbxIdx = 4;
+                    }
+                }
+                else if (j == ipu2VirtId) {
+                    mbxUserIdx = 1 << 8;
+                    if (i == ipu1VirtId) {
+                        subMbxIdx = 0;
+                    }
+                    else if (i == hostVirtId) {
+                        subMbxIdx = 5;
+                    }
+                }
+                else {
+                    mbxUserIdx = 2 << 8;
+                    if (i == ipu1VirtId) {
+                        subMbxIdx = 1;
+                    }
+                    else if (i == ipu2VirtId) {
+                        subMbxIdx = 3;
+                    }
+                }
+
+                tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
+                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                continue;
+            }
+
+            /* System Mailbox 6 */
+            /* For communication between HOST and DSP1/2 and inter DSP */
+            if (((i == dsp1VirtId) || (i == dsp2VirtId) || (i == hostVirtId)) &&
+                ((j == dsp1VirtId) || (j == dsp2VirtId) || (j == hostVirtId))) {
+                mbxBaseAddrIdx = ((InterruptCore.NUM_EVES * 3) +
+                                   SYS_MBX6_OFFSET) << 16;
+
+                if (j == dsp1VirtId) {
+                    mbxUserIdx = 0;
+                    if (i == dsp2VirtId) {
+                        subMbxIdx = 2;
+                    }
+                    else if (i == hostVirtId) {
+                        subMbxIdx = 4;
+                    }
+                }
+                else if (j == dsp2VirtId) {
+                    mbxUserIdx = 1 << 8;
+                    if (i == dsp1VirtId) {
+                        subMbxIdx = 0;
+                    }
+                    else if (i == hostVirtId) {
+                        subMbxIdx = 5;
+                    }
+                }
+                else {
+                    mbxUserIdx = 2 << 8;
+                    if (i == dsp1VirtId) {
+                        subMbxIdx = 1;
+                    }
+                    else if (i == dsp2VirtId) {
+                        subMbxIdx = 3;
+                    }
+                }
+
+                tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
+                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                continue;
+            }
+
+            /* System Mailbox 7 */
+            /* For communication between DSP1/2 and IPU1/2 */
+            /* Not to be used for Inter DSP or Inter IPU communication */
+            if (((i >= dsp1VirtId) && (i <= ipu2VirtId)) &&
+                ((j >= dsp1VirtId) && (j <= ipu2VirtId))) {
+
+                mbxBaseAddrIdx = ((InterruptCore.NUM_EVES * 3) +
+                                  SYS_MBX7_OFFSET) << 16;
+                mbxUserIdx = (j - InterruptCore.NUM_EVES) << 8;
+
+                /* skip all ther inter IPU and DSP communication */
+                if (i == j) {
+                    continue;
+                }
+                if ((i == ipu1VirtId && j == ipu2VirtId) ||
+                    (i == ipu2VirtId && j == ipu1VirtId)) {
+                    continue;
+                }
+                if ((i == dsp1VirtId && j == dsp2VirtId) ||
+                    (i == dsp2VirtId && j == dsp1VirtId)) {
+                    continue;
+                }
+
+                if (i == dsp1VirtId) {
+                    subMbxIdx = j - 6;  /* j = ipu1 or ipu2 */
+                }
+                else if (i == dsp2VirtId) {
+                    subMbxIdx = j - 4;  /* j = ipu1 or ipu2 */
+                }
+                else if (i == ipu1VirtId) {
+                    subMbxIdx = j;      /* j = dsp1 or dsp2 */
+                }
+                else if (i == ipu2VirtId) {
+                    subMbxIdx = j + 2;  /* j = dsp1 or dsp2 */
+                }
+
+                tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
+                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+            }
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/package.bld b/packages/ti/sdo/ipc/family/vayu/package.bld
new file mode 100644 (file)
index 0000000..8b2cfd5
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_common = [
+      "NotifySetup",
+];
+
+var objList_66 = [
+      "InterruptDsp",
+].concat(objList_common);
+
+var trgFilter_66 = {
+        field: "isa",
+        list: [ "66" ]
+};
+
+var objList_m4 = [
+      "InterruptIpu",
+].concat(objList_common);
+
+var trgFilter_m4 = {
+        field: "isa",
+        list: [ "v7M", "v7M4" ]
+};
+
+var objList_arp32 = [
+      "InterruptArp32",
+].concat(objList_common);
+
+var trgFilter_arp32 = {
+        field: "isa",
+        list: [ "arp32" ]
+};
+
+var objList_host = [
+      "InterruptHost",
+].concat(objList_common);
+
+var trgFilter_host = {
+        field: "isa",
+        list: [ "v7A15" ]
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_66, undefined, trgFilter_66, arguments);
+IpcBuild.buildLibs(objList_m4, undefined, trgFilter_m4, arguments);
+IpcBuild.buildLibs(objList_arp32, undefined, trgFilter_arp32, arguments);
+IpcBuild.buildLibs(objList_host, undefined, trgFilter_host, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_66, undefined, trgFilter_66, ["profile=smp"]);
+IpcBuild.buildLibs(objList_m4, undefined, trgFilter_m4, ["profile=smp"]);
+IpcBuild.buildLibs(objList_arp32, undefined, trgFilter_arp32, ["profile=smp"]);
+IpcBuild.buildLibs(objList_host, undefined, trgFilter_host, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/family/vayu/package.xdc b/packages/ti/sdo/ipc/family/vayu/package.xdc
new file mode 100644 (file)
index 0000000..6c6adbb
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+requires ti.sdo.ipc;
+
+/*!
+ *  ======== ti.sdo.ipc.family.vayu ========
+ */
+package ti.sdo.ipc.family.vayu [1,0,0,0] {
+    module    TableInit;
+    module    NotifySetup;
+    module    InterruptArp32;
+    module    InterruptDsp;
+    module    InterruptIpu;
+    module    InterruptHost;
+}
diff --git a/packages/ti/sdo/ipc/family/vayu/package.xs b/packages/ti/sdo/ipc/family/vayu/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/gates/GateAAMonitor.c b/packages/ti/sdo/ipc/gates/GateAAMonitor.c
new file mode 100644 (file)
index 0000000..5b2a2eb
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateAAMonitor.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/Gate.h>
+#include <xdc/runtime/Log.h>
+#include <ti/sysbios/family/c64p/Cache.h>
+#include <ti/sysbios/family/c64p/Hwi.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include "package/internal/GateAAMonitor.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateAAMonitor_Instance_init ========
+ */
+Int GateAAMonitor_Instance_init(GateAAMonitor_Object *obj,
+                                IGateProvider_Handle localGate,
+                                const GateAAMonitor_Params *params,
+                                Error_Block *eb)
+{
+    /* Assert that params->sharedAddr is valid */
+    Assert_isTrue(
+        (UInt32)params->sharedAddr >= GateAAMonitor_SL2_RANGE_BASE &&
+        (UInt32)params->sharedAddr <  GateAAMonitor_SL2_RANGE_MAX,
+        GateAAMonitor_A_invSharedAddr);
+
+    obj->localGate  = localGate;
+    obj->sharedAddr = (Ptr)_Ipc_roundup(params->sharedAddr,
+            GateAAMonitor_CACHELINE_SIZE);
+    obj->nested = 0;
+
+    if (!params->openFlag) {
+        /*
+         *  The processor that inits the AAM initializes the value
+         *  to zero (e.g. no one is using it). The other processors
+         *  must invalidate the memory in case it is in cache.
+         */
+        *(obj->sharedAddr) = 0;
+        Cache_wbInv((Ptr)obj->sharedAddr, GateAAMonitor_CACHELINE_SIZE,
+                    Cache_Type_ALL, TRUE);
+    }
+    else {
+        /* Opening. */
+        Cache_inv((Ptr)obj->sharedAddr, GateAAMonitor_CACHELINE_SIZE,
+                  Cache_Type_ALL, TRUE);
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== GateAAMonitor_enter ========
+ */
+IArg GateAAMonitor_enter(GateAAMonitor_Object *obj)
+{
+    IArg key;
+
+    key = IGateProvider_enter(obj->localGate);
+
+    /* If the gate object has already been entered, return the nested value */
+    obj->nested++;
+    if (obj->nested > 1) {
+        return (key);
+    }
+
+    /* Enter the monitor */
+    GateAAMonitor_getLock((Ptr)obj->sharedAddr);
+
+    return (key);
+}
+
+/*
+ *  ======== GateAAMonitor_leave ========
+ *  The sharedAddr must come from SL2 (shared L2 memory) so we only
+ *  have to freeze L1D.
+ */
+Void GateAAMonitor_leave(GateAAMonitor_Object *obj, IArg key)
+{
+    Cache_Mode mode;
+    UInt hwiKey;
+
+    obj->nested--;
+
+    if (obj->nested == 0) {
+        /* disable interrupts before setting Cache to FREEZE */
+        hwiKey = Hwi_disable();
+
+        mode = Cache_setMode(Cache_Type_L1D, Cache_Mode_FREEZE);
+
+        /* Leave the critical region by setting address value to zero */
+        *(obj->sharedAddr) = 0;
+
+        Cache_setMode(Cache_Type_L1D, mode);
+
+        /* restore interrupts */
+        Hwi_restore(hwiKey);
+    }
+
+    IGateProvider_leave(obj->localGate, key);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateAAMonitor_getReservedMask ========
+ */
+Bits32 *GateAAMonitor_getReservedMask()
+{
+    /* This gate doesn't allow reserving resources */
+    return (NULL);
+}
+
+/*
+ *  ======== GatePeterson_sharedMemReq ========
+ */
+SizeT GateAAMonitor_sharedMemReq(const IGateMPSupport_Params *params)
+{
+    SizeT memReq;
+
+    memReq = (SizeT)(2 * GateAAMonitor_CACHELINE_SIZE);
+
+    return (memReq);
+}
+
+/*
+ *  ======== GateAAMonitor_query ========
+ */
+Bool GateAAMonitor_query(Int qual)
+{
+    Bool rc;
+
+    switch (qual) {
+        case IGateProvider_Q_BLOCKING:
+            /* Depends on gate proxy? */
+            rc = FALSE;
+            break;
+
+        case IGateProvider_Q_PREEMPTING:
+            /* Depends on gate proxy? */
+            rc = TRUE;
+            break;
+        default:
+            rc = FALSE;
+            break;
+    }
+
+    return (rc);
+}
diff --git a/packages/ti/sdo/ipc/gates/GateAAMonitor.xdc b/packages/ti/sdo/ipc/gates/GateAAMonitor.xdc
new file mode 100644 (file)
index 0000000..58e84cf
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateAAMonitor.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.gates;
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.IGateProvider;
+import xdc.runtime.Diags;
+import xdc.runtime.Log;
+
+import ti.sdo.ipc.Ipc;
+
+import ti.sdo.ipc.interfaces.IGateMPSupport;
+
+/*!
+ *  ======== GateAAMonitor ========
+ *  Multiprocessor gate that utilizes an atomic access monitor (AAM)
+ */
+@InstanceInitError
+
+module GateAAMonitor inherits IGateMPSupport
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        Ptr     sharedAddr;
+        UInt    nested;
+        String  enteredBy;     /* Entered or free */
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== A_invSharedAddr ========
+     *  Assert raised when supplied sharedAddr is invalid
+     *
+     *  C6472 requires that shared region 0 be placed in SL2 memory and that
+     *  all GateMP instances be allocated from region 0.  The gate itself may
+     *  be used to protect the contents of any shared region.
+     */
+    config Assert.Id A_invSharedAddr  = {
+        msg: "A_invSharedAddr: Address must be in shared L2 address space"
+    };
+
+    /*!
+     *  ======== numInstances ========
+     *  Maximum number of instances supported by the GateAAMonitor module
+     */
+    config UInt numInstances = 32;
+
+instance:
+
+
+internal:
+
+    /*! Get the lock */
+    @DirectCall
+    UInt getLock(Ptr sharedAddr);
+
+    /*! L1D cache line size is 64 */
+    const UInt CACHELINE_SIZE = 64;
+
+    /*!
+     *  Range of SL2 RAM on TMS320TCI6486. Used for ensuring sharedAddr is
+     *  valid
+     */
+    const Ptr SL2_RANGE_BASE = 0x00200000;
+    const Ptr SL2_RANGE_MAX  = 0x002bffff;
+
+    struct Instance_State {
+        volatile UInt32*    sharedAddr;
+        UInt                nested;    /* For nesting */
+        IGateProvider.Handle localGate;
+    };
+}
diff --git a/packages/ti/sdo/ipc/gates/GateAAMonitor.xs b/packages/ti/sdo/ipc/gates/GateAAMonitor.xs
new file mode 100644 (file)
index 0000000..70b5d9d
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateAAMonitor.xs ========
+ *
+ */
+
+var GateAAMonitor   = null;
+var Cache           = null;
+var Ipc             = null;
+var GateMP          = null;
+
+/*!
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    GateAAMonitor   = this;
+    Cache           = xdc.useModule('ti.sysbios.hal.Cache');
+    Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP          = xdc.useModule('ti.sdo.ipc.GateMP');
+}
+
+/*!
+ *  ======== instance$static$init ========
+ */
+function instance$static$init(obj, params)
+{
+    GateAAMonitor.$logError("Static instances not supported yet",
+            GateAAMonitor.common$, GateAAMonitor.common$.namedInstance);
+}
+
+/*!
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    var rc = false;
+    var IGateProvider = xdc.module('xdc.runtime.IGateProvider');
+
+    switch (qual) {
+        case IGateProvider.Q_BLOCKING:
+            rc = true;
+            break;
+        case IGateProvider.Q_PREEMPTING:
+            rc = true;
+            break;
+        default:
+           GateAAMonitor.$logWarning("Invalid quality.", this, qual);
+           break;
+    }
+
+    return (rc);
+}
+
+/*!
+ *  ======== sharedMemReqMeta ========
+ */
+function sharedMemReqMeta(params)
+{
+    GateAAMonitor.$logError("Static instances not supported yet",
+            GateAAMonitor.common$, GateAAMonitor.common$.namedInstance);
+}
+
+/*!
+ *  ======== getNumResources ========
+ */
+function getNumResources()
+{
+    return (this.numInstances);
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== getRemoteStatus$view ========
+ */
+function getRemoteStatus$view(handle)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+
+    try {
+        var view = Program.scanHandleView('ti.sdo.ipc.gates.GateAAMonitor',
+                                          $addr(handle), 'Basic');
+        return ("Entered by " + view.enteredBy);
+    }
+    catch(e) {
+        throw("ERROR: Couldn't scan GateAAMonitor handle view: " + e);
+    }
+}
+
+/*!
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    var GateAAMonitor   = xdc.useModule('ti.sdo.ipc.gates.GateAAMonitor');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    /* view.sharedAddr */
+    view.sharedAddr = "0x" + Number(obj.sharedAddr).toString(16);
+
+    /* view.nested */
+    view.nested = obj.nested;
+
+    /* view.enteredBy */
+    try {
+        var sstruct_status = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                 obj.sharedAddr.$addr, false);
+        var status = sstruct_status.elem;
+        if (status > 0) {
+            view.enteredBy = "CORE" + (status - 1);
+        }
+        else {
+            view.enteredBy = "[free]";
+        }
+    }
+    catch(e) {
+        view.$status["enteredBy"] =
+            "Error: could not fetch status data from shared memory: " + e;
+    }
+}
diff --git a/packages/ti/sdo/ipc/gates/GateAAMonitor_asm.s64P b/packages/ti/sdo/ipc/gates/GateAAMonitor_asm.s64P
new file mode 100644 (file)
index 0000000..39269e3
--- /dev/null
@@ -0,0 +1,109 @@
+;
+;  Copyright (c) 2012-2013, Texas Instruments Incorporated
+;  All rights reserved.
+;
+;  Redistribution and use in source and binary forms, with or without
+;  modification, are permitted provided that the following conditions
+;  are met:
+;
+;  *  Redistributions of source code must retain the above copyright
+;     notice, this list of conditions and the following disclaimer.
+;
+;  *  Redistributions in binary form must reproduce the above copyright
+;     notice, this list of conditions and the following disclaimer in the
+;     documentation and/or other materials provided with the distribution.
+;
+;  *  Neither the name of Texas Instruments Incorporated nor the names of
+;     its contributors may be used to endorse or promote products derived
+;     from this software without specific prior written permission.
+;
+;  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+;  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+;  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+;  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+;  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+;  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+;  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+;  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+;  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+;  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;
+;
+; ======== GateAAMonitor_asm.s64P ========
+;
+;! Revistion History
+;! =================
+;! 21-Jul-2009 skp      Pulled from tci6486 code in drivers tree.
+;!                  Interrupts are re-enabled before return
+
+        .cdecls     C,NOLIST,"package/internal/GateAAMonitor.xdc.h"
+
+        .if $isdefed("__TI_ELFABI__")
+          .if __TI_ELFABI__
+            .asg ti_sdo_ipc_gates_GateAAMonitor_getLock__I, _ti_sdo_ipc_gates_GateAAMonitor_getLock__I
+          .endif
+        .endif
+
+        .global _ti_sdo_ipc_gates_GateAAMonitor_getLock__I
+
+        .asg        0x01840044, L1DCC
+
+;
+;  ======== _ti_sdo_ipc_gates_GateAAMonitor_getLock ========
+;  This function is a spin loop to try to get the lock.
+;  Assuming all cores are trying to get the same lock,
+;  The first core to successfully execute LL-SL-CMTL before another core
+;  can execute LL will get the lock. To prevent deadlock situations
+;  from happening for a 6-core GEM device, we have inserted NOPs into the code.
+;
+;  We are doing the following to work around several GEM bugs. See GEM DATA
+;  MEMORY CONTROLLER rev 1.03 or later section 2.3.8 for more details:
+;      1. Disable interrupts before LL, re-enable after CMTL if we don't get
+;         the lock.
+;      2. Freeze L1D cache before LL and unfreeze L1D cache after CMTL
+;      3. No memory accesses are in the cycle before, after or in parallel
+;         with LL, SL, and CMTL.
+;      4. Doing an 'mvk' instruction on the D2 unit in the cycle before and
+;         after each of LL, SL, and CMTL to block EDI (Emulation) accesses
+;         on these cycles.
+;
+;
+    .sect ".text:_ti_sdo_ipc_gates_GateAAMonitor_getLock__I"
+    .clink
+_ti_sdo_ipc_gates_GateAAMonitor_getLock__I:
+        mvc     DNUM, b5    ; get the DNUM value
+||      mvkl    L1DCC, a5   ; L1D cache control register
+        add     b5, 1, b5   ; setup DNUM + 1 to be stored in lock address
+||      mvkh    L1DCC, a5
+        mv      a4, b2      ; copy address to B side
+||      mvk     1, a0       ; value to put into L1DCC.OPER to freeze
+        mvc     TSR, b4     ; save away current TSR value
+        mv      b4, a4      ; set return value to old TSR value
+||      mvk     1, b7
+spin_lock:
+        stw     a0, *a5     ; freeze L1D cache
+||      dint                ; disable interrupts
+        ldw     *a5, a2     ; get previous freeze
+  [!a0] mvk.d2  0, b6       ; never executed
+        ll.d2   *b2, b0     ; read and monitor address
+  [!a0] mvk.d2  0, b6       ; never executed
+        nop     2
+  [!a0] mvk.d2  0, b6       ; never executed
+  [!b0] sl.d2   b5, *b2     ; store DNUM + 1 into lock address
+        zero.d2 b1          ; set b1 = 0
+  [!b0] cmtl.d2 *b2, b1     ; commit the store, if successful, b1 = 1.
+  [!a0] mvk.d2  0, b6       ; never executed
+        shru    a2, 16, a2  ; shift L1DCC.POPER down to L1DCC.OPER
+        stw     a2, *a5     ; restore previous frozen/non-frozen state
+        rint                ; restore interrupts
+
+  [ b1] bnop    b3, 5       ; if successful, return with interrupts disabled
+                            ; note: return happens before 'rint'.
+
+        add     b5, b7, b0
+||      saddu4  b7, b7, b7
+wait:
+  [ b0] bdec    wait, b0
+        nop     5
+        bnop    spin_lock, 5 ; spin around if not successful
diff --git a/packages/ti/sdo/ipc/gates/GateHWSem.c b/packages/ti/sdo/ipc/gates/GateHWSem.c
new file mode 100644 (file)
index 0000000..6e7cd92
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateHWSem.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include "package/internal/GateHWSem.xdc.h"
+
+/*
+ *  ======== GateHWSem_Module_startup ========
+ *  release the HW semaphore if the core owns it.
+ */
+Int GateHWSem_Module_startup(Int phase)
+{
+    Int i;
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSem_baseAddr;
+    Bits32 *reservedMaskArr = (Bits32 *)GateHWSem_reservedMaskArr;
+
+    /* releases the HW semaphore if the core owns it otherwise its a nop */
+    for (i = 0; i < GateHWSem_numSems; i++) {
+        if (reservedMaskArr[i >> 5] & (1 << (i % 32))) {
+            /* Don't reset reserved HW semaphores */
+            continue;
+        }
+        baseAddr[i] = 1;
+    }
+
+    return (Startup_DONE);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateHWSem_Instance_init ========
+ */
+Void GateHWSem_Instance_init(GateHWSem_Object *obj,
+                            IGateProvider_Handle localGate,
+                            const GateHWSem_Params *params)
+{
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSem_baseAddr;
+
+    /* Assert that params->resourceId is valid */
+    Assert_isTrue(params->resourceId < GateHWSem_numSems,
+                  GateHWSem_A_invSemNum);
+
+   /* Create the local gate */
+    obj->localGate  = localGate;
+    obj->semNum     = params->resourceId;
+    obj->nested     = 0;
+
+    /* Check for dynamic open */
+    if (!params->openFlag) {
+        /* Reset the hardware semaphore */
+        baseAddr[obj->semNum] = 1;
+    }
+}
+
+/*
+ *  ======== GateHWSem_enter ========
+ */
+IArg GateHWSem_enter(GateHWSem_Object *obj)
+{
+    IArg key;
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSem_baseAddr;
+
+    key = IGateProvider_enter(obj->localGate);
+
+    /* If the gate object has already been entered, return the nested value */
+    obj->nested++;
+    if (obj->nested > 1) {
+        return (key);
+    }
+
+    /* Enter the hardware lock */
+    while (baseAddr[obj->semNum] != 1) {
+        obj->nested--; /* Restore state of delegate object */
+        IGateProvider_leave(obj->localGate, key);
+        key = IGateProvider_enter(obj->localGate);
+        obj->nested++; /* Re-nest the gate */
+    }
+
+    return (key);
+}
+
+/*
+ *  ======== GateHWSem_leave ========
+ */
+Void GateHWSem_leave(GateHWSem_Object *obj, IArg key)
+{
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSem_baseAddr;
+
+    obj->nested--;
+
+    if (obj->nested == 0) {
+        /* Leave the critical region by setting address value to 1 */
+        baseAddr[obj->semNum] = 1;
+    }
+
+    IGateProvider_leave(obj->localGate, key);
+}
+
+/*
+ *  ======== GateHWSem_getResourceId ========
+ */
+Bits32 GateHWSem_getResourceId(GateHWSem_Object *obj)
+{
+    return (obj->semNum);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateHWSem_getReservedMask ========
+ */
+Bits32 *GateHWSem_getReservedMask()
+{
+    return ((Bits32 *)GateHWSem_reservedMaskArr);
+}
+
+/*
+ *  ======== GateHWSem_query ========
+ */
+Bool GateHWSem_query(Int qual)
+{
+    Bool rc;
+
+    switch (qual) {
+        case IGateProvider_Q_BLOCKING:
+            /* Depends on gate proxy? */
+            rc = TRUE;
+            break;
+
+        case IGateProvider_Q_PREEMPTING:
+            /* Depends on gate proxy? */
+            rc = TRUE;
+            break;
+        default:
+            rc = FALSE;
+            break;
+    }
+    return (rc);
+}
+
+/*
+ *  ======== GateHWSem_sharedMemReq ========
+ */
+SizeT GateHWSem_sharedMemReq(const IGateMPSupport_Params *params)
+{
+    /* No shared memory needed */
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/gates/GateHWSem.xdc b/packages/ti/sdo/ipc/gates/GateHWSem.xdc
new file mode 100644 (file)
index 0000000..d300421
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateHWSem.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.gates;
+
+import xdc.runtime.Assert;
+import xdc.runtime.IGateProvider;
+
+import ti.sdo.ipc.interfaces.IGateMPSupport;
+
+/*!
+ *  ======== GateHWSem ========
+ *  Multiprocessor gate that utilizes hardware semaphores
+ */
+@ModuleStartup
+
+module GateHWSem inherits IGateMPSupport
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        Ptr     semNum;
+        UInt    nested;
+        String  enteredBy;      /* Which core has entered the hw sem */
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== A_invSemNum ========
+     *  Asserted when supplied semNum is invalid for the relevant device
+     */
+    config Assert.Id A_invSemNum  = {
+        msg: "A_invSemNum: Invalid hardware semaphore number"
+    };
+
+    /*!
+     *  ======== setReserved ========
+     *  Reserve a HW sempahore for use outside of IPC.
+     *
+     *  GateMP will, by default, manage all HW semaphores on the device unless
+     *  this API is used to set aside specific HW semaphores for use outside
+     *  of IPC.
+     *
+     *  @param(semNum)      HW semaphore number to reserve
+     */
+    metaonly Void setReserved(UInt semNum);
+
+instance:
+
+    /*!
+     *  @_nodoc
+     *  ======== enter ========
+     *  Enter this gate
+     */
+    @DirectCall
+    override IArg enter();
+
+    /*!
+     *  @_nodoc
+     *  ======== leave ========
+     *  Leave this gate
+     */
+    @DirectCall
+    override Void leave(IArg key);
+
+internal:
+
+    /*! Device-specific base address for HW Semaphore subsystem */
+    config Ptr baseAddr;
+
+    /*! Device-specific query offset for HW Semaphore subsystem (for ROV) */
+    config Ptr queryAddr;
+
+    /*! Device-specific number of semphores in the HW Semaphore subsystem */
+    config UInt numSems;
+
+    /*! Mask of reserved HW semaphores */
+    config Bits32 reservedMaskArr[];
+
+    struct Instance_State {
+        UInt                     semNum;    /* The sem number being used */
+        UInt                     nested;    /* For nesting */
+        IGateProvider.Handle     localGate;
+    };
+}
diff --git a/packages/ti/sdo/ipc/gates/GateHWSem.xs b/packages/ti/sdo/ipc/gates/GateHWSem.xs
new file mode 100644 (file)
index 0000000..4ff7352
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateHWSem.xs ========
+ *
+ */
+
+var GateHWSem   = null;
+var GateMP      = null;
+var Ipc         = null;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    GateHWSem = this
+
+    try {
+        var Settings = xdc.module("ti.sdo.ipc.family.Settings");
+        var devCfg = Settings.getGateHWSemSettings();
+        GateHWSem.baseAddr      = devCfg.baseAddr;
+        GateHWSem.queryAddr     = devCfg.queryAddr;
+        GateHWSem.numSems       = devCfg.numSems;
+
+        GateHWSem.reservedMaskArr.length =
+                Math.ceil(GateHWSem.numSems / 32);
+        for (var i = 0; i < GateHWSem.reservedMaskArr.length; i++) {
+            GateHWSem.reservedMaskArr[i] = 0;
+        }
+    }
+    catch(e) {
+    }
+}
+
+/*
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    var rc = false;
+    var IGateProvider = xdc.module('xdc.runtime.IGateProvider');
+
+    switch (qual) {
+        case IGateProvider.Q_BLOCKING:
+            rc = true;
+            break;
+        case IGateProvider.Q_PREEMPTING:
+            rc = true;
+            break;
+        default:
+           GateHWSem.$logWarning("Invalid quality.", this, qual);
+           break;
+    }
+
+    return (rc);
+}
+
+/*
+ *  ======== getNumResources ========
+ */
+function getNumResources()
+{
+    return (GateHWSem.numSems);
+}
+
+/*
+ *  ======== setReserved ========
+ */
+function setReserved(semNum)
+{
+    var GateHWSem = this;
+
+    if (semNum >= GateHWSem.numSems) {
+        GateHWSem.$logError("Invalid semaphore number: " + GateHWSem.numSems +
+                ". There are only " + GateHWSem.numSems + " on this device.",
+                this);
+    }
+
+    GateHWSem.reservedMaskArr[semNum >> 5] |= (1 << (semNum % 32));
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== getRemoteStatus$view ========
+ */
+function getRemoteStatus$view(handle)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+
+    try {
+        var view = Program.scanHandleView('ti.sdo.ipc.gates.GateHWSem',
+                                          $addr(handle), 'Basic');
+        return ("Entered by " + view.enteredBy);
+    }
+    catch(e) {
+        throw("ERROR: Couldn't scan GateHWSem handle view: " + e);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var GateHWSem       = xdc.useModule('ti.sdo.ipc.gates.GateHWSem');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    /* view.semNum */
+    view.semNum = obj.semNum;
+
+    /* view.nested */
+    view.nested = obj.nested;
+
+    /* view.enteredBy */
+    try {
+        var modCfg = Program.getModuleConfig('ti.sdo.ipc.gates.GateHWSem');
+        var semQueryAddr = $addr(Number(modCfg.queryAddr) + obj.semNum * 4);
+
+        var sstruct_status = Program.fetchStruct(
+                                ScalarStructs.S_Bits32$fetchDesc,
+                                semQueryAddr, false);
+        var status = sstruct_status.elem;
+        if (status & 0x1) {
+            view.enteredBy = "[free]";
+        }
+        else {
+            var coreId = (status & 0x0000ff00) >> 8;
+            view.enteredBy = "CORE" + coreId;
+        }
+    }
+    catch(e) {
+        view.$status["enteredBy"] =
+            "Error: could not fetch query data: " + e;
+    }
+}
diff --git a/packages/ti/sdo/ipc/gates/GateHWSpinlock.c b/packages/ti/sdo/ipc/gates/GateHWSpinlock.c
new file mode 100644 (file)
index 0000000..cc82492
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateHWSpinlock.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/Log.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/GateHWSpinlock.xdc.h"
+
+/*
+ *  ======== GateHWSpinlock_Module_startup ========
+ *  release the HW spinlock if the core owns it.
+ */
+Int GateHWSpinlock_Module_startup(Int phase)
+{
+    Int i;
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSpinlock_baseAddr;
+    SharedRegion_Entry entry;
+    Bits32 *reservedMaskArr = (Bits32 *)GateHWSpinlock_reservedMaskArr;
+
+    /* Wait for Startup to be done because a user fxn may set MultiProc id */
+    if (!Startup_Module_startupDone()) {
+        return (Startup_NOTDONE);
+    }
+
+    /* Don't initialize the spinlocks if not the owner of region 0 */
+    SharedRegion_getEntry(0, &entry);
+    if (MultiProc_self() != entry.ownerProcId || !(entry.isValid)) {
+        return (Startup_DONE);
+    }
+
+    /*
+     *  See OMAP4 TRM section 21.4.1.2.1
+     *  Spinlocks Clearing After a System Bug Recovery
+     */
+
+    for (i = 0; i < GateHWSpinlock_numLocks; i++) {
+        if (reservedMaskArr[i >> 5] & (1 << (i % 32))) {
+            /* Don't reset reserved spinlocks */
+            continue;
+        }
+        baseAddr[i] = 0;
+    }
+
+    return (Startup_DONE);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateHWSpinlock_Instance_init ========
+ */
+Void GateHWSpinlock_Instance_init(GateHWSpinlock_Object *obj,
+                            IGateProvider_Handle localGate,
+                            const GateHWSpinlock_Params *params)
+{
+    /* Assert that params->resourceId is valid */
+    Assert_isTrue(params->resourceId < GateHWSpinlock_numLocks,
+                  GateHWSpinlock_A_invSpinLockNum);
+
+    obj->localGate      = localGate;
+    obj->lockNum        = params->resourceId;
+    obj->nested         = 0;
+
+    /* Check for dynamic open */
+    if (params->openFlag) {
+        Log_write1(GateHWSpinlock_LM_open, (UArg)obj->lockNum);
+    }
+    else {
+        Log_write1(GateHWSpinlock_LM_create, (UArg)obj->lockNum);
+    }
+}
+
+/*
+ *  ======== GateHWSpinlock_enter ========
+ */
+IArg GateHWSpinlock_enter(GateHWSpinlock_Object *obj)
+{
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSpinlock_baseAddr;
+    IArg key;
+
+    key = IGateProvider_enter(obj->localGate);
+
+    /* If the gate object has already been entered, return the nested value */
+    obj->nested++;
+    if (obj->nested > 1) {
+        return (key);
+    }
+
+    /* Enter the spinlock */
+    while (1) {
+        if (baseAddr[obj->lockNum] == 0) {
+            break;
+        }
+
+        obj->nested--; /* Restore state of delegate object */
+        IGateProvider_leave(obj->localGate, key);
+        key = IGateProvider_enter(obj->localGate);
+        obj->nested++; /* Re-nest the gate */
+    }
+
+    Log_write2(GateHWSpinlock_LM_enter,(UArg)obj->lockNum, key);
+
+    return (key);
+}
+
+/*
+ *  ======== GateHWSpinlock_leave ========
+ */
+Void GateHWSpinlock_leave(GateHWSpinlock_Object *obj, IArg key)
+{
+    volatile UInt32 *baseAddr = (volatile UInt32 *)GateHWSpinlock_baseAddr;
+
+    obj->nested--;
+
+    /* Leave the spinlock if the leave() is not nested */
+    if (obj->nested == 0) {
+        baseAddr[obj->lockNum] = 0;
+    }
+
+    IGateProvider_leave(obj->localGate, key);
+
+    Log_write2(GateHWSpinlock_LM_leave, (UArg)obj->lockNum, key);
+}
+
+/*
+ *  ======== GateHWSpinlock_getResourceId ========
+ */
+Bits32 GateHWSpinlock_getResourceId(GateHWSpinlock_Object *obj)
+{
+    return (obj->lockNum);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateHWSpinlock_getReservedMask ========
+ */
+Bits32 *GateHWSpinlock_getReservedMask()
+{
+    return ((Bits32 *)GateHWSpinlock_reservedMaskArr);
+}
+
+/*
+ *  ======== GateHWSpinlock_sharedMemReq ========
+ */
+SizeT GateHWSpinlock_sharedMemReq(const IGateMPSupport_Params *params)
+{
+    return (0);
+}
+
+/*
+ *  ======== GateHWSpinlock_query ========
+ */
+Bool GateHWSpinlock_query(Int qual)
+{
+    Bool rc;
+
+    switch (qual) {
+        case IGateProvider_Q_BLOCKING:
+            /* Depends on gate proxy? */
+            rc = FALSE;
+            break;
+
+        case IGateProvider_Q_PREEMPTING:
+            /* Depends on gate proxy? */
+            rc = TRUE;
+            break;
+        default:
+            rc = FALSE;
+            break;
+    }
+    return (rc);
+}
diff --git a/packages/ti/sdo/ipc/gates/GateHWSpinlock.xdc b/packages/ti/sdo/ipc/gates/GateHWSpinlock.xdc
new file mode 100644 (file)
index 0000000..ac7d45c
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateHWSpinlock.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.gates;
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.IGateProvider;
+import xdc.runtime.Diags;
+import xdc.runtime.Log;
+
+import ti.sdo.ipc.interfaces.IGateMPSupport;
+
+/*!
+ *  ======== GateHWSpinlock ========
+ *  Multiprocessor gate that utilizes a hardware spinlock
+ */
+@ModuleStartup
+
+module GateHWSpinlock inherits IGateMPSupport
+{
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     */
+    metaonly struct BasicView {
+        UInt    lockNum;
+        UInt    nested;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== LM_enter ========
+     *  Logged on gate enter
+     */
+    config Log.Event LM_enter = {
+        mask: Diags.USER1,
+        msg: "LM_enter: Gate (lockNum = %d) entered, returning key = %d"
+    };
+
+    /*!
+     *  ======== LM_leave ========
+     *  Logged on gate leave
+     */
+    config Log.Event LM_leave = {
+        mask: Diags.USER1,
+        msg: "LM_leave: Gate (lockNum = %d) left using key = %d"
+    };
+
+    /*!
+     *  ======== LM_create ========
+     *  Logged on gate create
+     */
+    config Log.Event LM_create = {
+        mask: Diags.USER1,
+        msg: "LM_create: Gate (lockNum = %d) created"
+    };
+
+    /*!
+     *  ======== LM_open ========
+     *  Logged on gate open
+     */
+    config Log.Event LM_open = {
+        mask: Diags.USER1,
+        msg: "LM_open: Remote gate (lockNum = %d) opened"
+    };
+
+    /*!
+     *  ======== LM_delete ========
+     *  Logged on gate deletion
+     */
+    config Log.Event LM_delete = {
+        mask: Diags.USER1,
+        msg: "LM_delete: Gate (lockNum = %d) deleted"
+    };
+
+    /*!
+     *  ======== LM_close ========
+     *  Logged on gate close
+     */
+    config Log.Event LM_close = {
+        mask: Diags.USER1,
+        msg: "LM_close: Gate (lockNum = %d) closed"
+    };
+
+    /*!
+     *  ======== A_invSpinLockNum ========
+     *  Assert raised when provided lockNum is invalid for the relevant device
+     */
+    config Assert.Id A_invSpinLockNum  = {
+        msg: "A_invSpinLockNum: Invalid hardware spinlock number"
+    };
+
+    /*! Device-specific base address for HW Semaphore subsystem */
+    config Ptr baseAddr = null;
+
+    /*!
+     *  ======== setReserved ========
+     *  Reserve a HW spinlock for use outside of IPC.
+     *
+     *  GateMP will, by default, manage all HW spinlocks on the device unless
+     *  this API is used to set aside specific spinlocks for use outside
+     *  of IPC.
+     *
+     *  @param(lockNum)      HW spinlock number to reserve
+     */
+    metaonly Void setReserved(UInt lockNum);
+
+
+
+instance:
+
+    /*!
+     *  @_nodoc
+     *  ======== enter ========
+     *  Enter this gate
+     */
+    @DirectCall
+    override IArg enter();
+
+    /*!
+     *  @_nodoc
+     *  ======== leave ========
+     *  Leave this gate
+     */
+    @DirectCall
+    override Void leave(IArg key);
+
+internal:
+
+    /*! Device-specific number of semphores in the HW Semaphore subsystem */
+    config UInt numLocks;
+
+    /*! Mask of reserved HW spinlocks */
+    config Bits32 reservedMaskArr[];
+
+    struct Instance_State {
+        UInt            lockNum;   /* The lock number being used */
+        UInt            nested;    /* For nesting */
+        IGateProvider.Handle     localGate;
+    };
+}
diff --git a/packages/ti/sdo/ipc/gates/GateHWSpinlock.xs b/packages/ti/sdo/ipc/gates/GateHWSpinlock.xs
new file mode 100644 (file)
index 0000000..2fc6987
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateHWSpinlock.xs ========
+ *
+ */
+
+var GateHWSpinlock = null;
+var GateMP      = null;
+var Ipc         = null;
+
+var devCfg;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    GateHWSpinlock = this;
+
+    try {
+        var Settings = xdc.module("ti.sdo.ipc.family.Settings");
+        devCfg = Settings.getGateHWSpinlockSettings();
+        GateHWSpinlock.numLocks = devCfg.numLocks;
+
+        GateHWSpinlock.reservedMaskArr.length =
+                Math.ceil(GateHWSpinlock.numLocks / 32);
+        for (var i = 0; i < GateHWSpinlock.reservedMaskArr.length; i++) {
+            GateHWSpinlock.reservedMaskArr[i] = 0;
+        }
+    }
+    catch (e) {
+    }
+}
+
+
+/*!
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    if (GateHWSpinlock.baseAddr == null) {
+        GateHWSpinlock.baseAddr = devCfg.baseAddr;
+    }
+}
+
+
+/*
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    var rc = false;
+    var IGateProvider = xdc.module('xdc.runtime.IGateProvider');
+
+    switch (qual) {
+        case IGateProvider.Q_BLOCKING:
+            rc = true;
+            break;
+        case IGateProvider.Q_PREEMPTING:
+            rc = true;
+            break;
+        default:
+           GateHWSpinlock.$logWarning("Invalid quality.", this, qual);
+           break;
+    }
+
+    return (rc);
+}
+
+/*
+ *  ======== getNumResources ========
+ */
+function getNumResources()
+{
+    return (GateHWSpinlock.numLocks);
+}
+
+/*
+ *  ======== setReserved ========
+ */
+function setReserved(lockNum)
+{
+    if (lockNum >= GateHWSpinlock.numLocks) {
+        GateHWSpinlock.$logError("Invalid spinlock number: " + lockNum +
+                ". There are only " + GateHWSpinlock.numLocks +
+                " locks on this device.", GateHWSpinlock);
+    }
+
+    GateHWSpinlock.reservedMaskArr[lockNum >> 5] |= (1 << (lockNum % 32));
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== getRemoteStatus$view ========
+ */
+function getRemoteStatus$view(handle)
+{
+    /* HW Spinlocks don't offer status */
+    return("[no status]");
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    GateHWSpinlock = xdc.useModule('ti.sdo.ipc.gates.GateHWSpinlock');
+
+    /* view.lockNum */
+    view.lockNum = obj.lockNum;
+
+    /* view.nested */
+    view.nested = obj.nested;
+}
diff --git a/packages/ti/sdo/ipc/gates/GateMPSupportNull.c b/packages/ti/sdo/ipc/gates/GateMPSupportNull.c
new file mode 100644 (file)
index 0000000..d8e7b6b
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateMPSupportNull.c ========
+ *  Implementation of functions specified in GateMPSupportNull.xdc.
+ *
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/IGateProvider.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include "package/internal/GateMPSupportNull.xdc.h"
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateMPSupportNull_Instance_init ========
+ */
+Void GateMPSupportNull_Instance_init(GateMPSupportNull_Object *obj,
+        IGateProvider_Handle localGate, const GateMPSupportNull_Params *params)
+{
+    obj->resourceId = params->resourceId;
+}
+
+/*
+ *  ======== GateMPSupportNull_getResourceId ========
+ */
+Bits32 GateMPSupportNull_getResourceId(GateMPSupportNull_Object *obj)
+{
+    return (1);
+}
+
+/*
+ *  ======== GateMPSupportNull_enter ========
+ *  Returns FIRST_ENTER when it gets the gate, returns NESTED_ENTER
+ *  on nested calls.
+ */
+IArg GateMPSupportNull_enter(GateMPSupportNull_Object *obj)
+{
+    if (GateMPSupportNull_action == GateMPSupportNull_Action_ASSERT) {
+        Assert_isTrue(FALSE, GateMPSupportNull_A_invalidAction);
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== GateMPSupportNull_leave ========
+ *  Only releases the gate if key == FIRST_ENTER.
+ */
+Void GateMPSupportNull_leave(GateMPSupportNull_Object *obj, IArg key)
+{
+    if (GateMPSupportNull_action == GateMPSupportNull_Action_ASSERT) {
+        Assert_isTrue(FALSE, GateMPSupportNull_A_invalidAction);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GateMPSupportNull_getReservedMask ========
+ */
+Bits32 *GateMPSupportNull_getReservedMask()
+{
+    /* This gate doesn't allow reserving resources */
+    return (NULL);
+}
+
+/*
+ *  ======== GateSupportNull_query ========
+ *
+ */
+Bool GateMPSupportNull_query(Int qual)
+{
+    return (FALSE);
+}
+
+
+/*
+ *  ======== GateMPSupportNull_sharedMemReq ========
+ */
+SizeT GateMPSupportNull_sharedMemReq(const IGateMPSupport_Params *params)
+{
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/gates/GateMPSupportNull.xdc b/packages/ti/sdo/ipc/gates/GateMPSupportNull.xdc
new file mode 100644 (file)
index 0000000..5a2e452
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateMPSupportNull.xdc ========
+ *
+ */
+
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== GateMPSupportNull ========
+ *  Module to plug GateMP proxies
+ */
+module GateMPSupportNull inherits ti.sdo.ipc.interfaces.IGateMPSupport
+{
+
+    /*!
+     *  Assert raised when trying to use GateMPSupportNull's enter or leave
+     */
+    config Assert.Id A_invalidAction  = {
+        msg: "A_invalidAction: Cannot use ti.sdo.ipc.gates.GateMPSupportNull"
+    };
+
+    /*!
+     *  Error codes returned by certain calls in GateMP
+     */
+    enum Action {
+        Action_NONE   =  0,
+        Action_ASSERT =  1
+    };
+
+    /*!
+     *  ======== action ========
+     *  Assert if the enter and/or leave is called
+     */
+    config Action action = Action_ASSERT;
+
+instance:
+
+    /*!
+     *  @_nodoc
+     *  ======== enter ========
+     *  Enter this gate
+     */
+    @DirectCall
+    override IArg enter();
+
+    /*!
+     *  @_nodoc
+     *  ======== leave ========
+     *  Leave this gate
+     */
+    @DirectCall
+    override Void leave(IArg key);
+
+internal:
+
+    struct Instance_State {
+        UInt   resourceId;
+    };
+
+}
diff --git a/packages/ti/sdo/ipc/gates/GateMPSupportNull.xs b/packages/ti/sdo/ipc/gates/GateMPSupportNull.xs
new file mode 100644 (file)
index 0000000..3acb8d3
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GateMPSupportNull.xs ========
+ *
+ */
+
+/*
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    return (false);
+}
+
+/*
+ *  ======== getNumResources ========
+ */
+function getNumResources()
+{
+    return (1);
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== getRemoteStatus$view ========
+ */
+function getRemoteStatus$view(handle)
+{
+    /* A null gate has no status */
+    return ("N/A");
+}
diff --git a/packages/ti/sdo/ipc/gates/GatePeterson.c b/packages/ti/sdo/ipc/gates/GatePeterson.c
new file mode 100644 (file)
index 0000000..6f6e062
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GatePeterson.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/Gate.h>
+#include <xdc/runtime/Log.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include "package/internal/GatePeterson.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GatePeterson_Instance_init ========
+ */
+Int GatePeterson_Instance_init(GatePeterson_Object *obj,
+                               IGateProvider_Handle localGate,
+                               const GatePeterson_Params *params,
+                               Error_Block *eb)
+{
+    Assert_isTrue(params->sharedAddr != NULL, ti_sdo_ipc_Ipc_A_invParam);
+    Assert_isTrue(GatePeterson_numInstances != NULL, ti_sdo_ipc_Ipc_A_invParam);
+
+    obj->localGate      = localGate;
+    obj->cacheEnabled   = SharedRegion_isCacheEnabled(params->regionId);
+    obj->cacheLineSize  = SharedRegion_getCacheLineSize(params->regionId);
+
+    /* Settings for both the creator and opener */
+    if (obj->cacheLineSize > sizeof(GatePeterson_Attrs)) {
+        obj->attrs   = params->sharedAddr;
+        obj->flag[0] = (Bits16 *)((UArg)(obj->attrs) + obj->cacheLineSize);
+        obj->flag[1] = (Bits16 *)((UArg)(obj->flag[0]) + obj->cacheLineSize);
+        obj->turn    = (Bits16 *)((UArg)(obj->flag[1]) + obj->cacheLineSize);
+    }
+    else {
+        obj->attrs   = params->sharedAddr;
+        obj->flag[0] = (Bits16 *)((UArg)(obj->attrs) +
+                        sizeof(GatePeterson_Attrs));
+        obj->flag[1] = (Bits16 *)((UArg)(obj->flag[0]) + sizeof(Bits16));
+        obj->turn    = (Bits16 *)((UArg)(obj->flag[1]) + sizeof(Bits16));
+    }
+    obj->nested  = 0;
+
+    if (!params->openFlag) {
+        /* Creating. */
+        obj->selfId = 0;
+        obj->otherId = 1;
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+        GatePeterson_postInit(obj);
+    }
+    else {
+        /* Opening. */
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+
+        Cache_inv((Ptr)obj->attrs, sizeof(GatePeterson_Attrs), Cache_Type_ALL,
+                  TRUE);
+
+        if (obj->attrs->creatorProcId == MultiProc_self()) {
+            /* Opening locally */
+            obj->selfId         = 0;
+            obj->otherId        = 1;
+        }
+        else {
+            /* Trying to open a gate remotely */
+            obj->selfId         = 1;
+            obj->otherId        = 0;
+            if (obj->attrs->openerProcId == MultiProc_INVALIDID) {
+                /* Opening remotely for the first time */
+                obj->attrs->openerProcId    = MultiProc_self();
+            }
+            else if (obj->attrs->openerProcId != MultiProc_self()) {
+                Error_raise(eb, GatePeterson_E_gateRemotelyOpened,
+                            obj->attrs->creatorProcId,
+                            obj->attrs->openerProcId);
+            }
+
+            if (obj->cacheEnabled) {
+                Cache_wbInv((Ptr)obj->attrs, sizeof(GatePeterson_Attrs),
+                            Cache_Type_ALL, TRUE);
+            }
+        }
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== GatePeterson_Instance_finalize ========
+ */
+Void GatePeterson_Instance_finalize(GatePeterson_Object *obj, Int status)
+{
+    if (!status) {
+        /* Modify shared memory */
+        if (obj->objType == ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC) {
+            obj->attrs->openerProcId = MultiProc_INVALIDID;
+            Cache_wbInv(obj->attrs, sizeof(GatePeterson_Attrs), Cache_Type_ALL,
+                        TRUE);
+        }
+    }
+}
+
+/*
+ *  ======== GatePeterson_enter ========
+ */
+IArg GatePeterson_enter(GatePeterson_Object *obj)
+{
+    IArg key;
+
+    /* Enter local gate */
+    key = IGateProvider_enter(obj->localGate);
+
+    /* If the gate object has already been entered, return the key */
+    obj->nested++;
+    if (obj->nested > 1) {
+        return (key);
+    }
+
+    /* Indicate that we need to use the resource. */
+    *(obj->flag[obj->selfId]) = GatePeterson_BUSY ;
+    if (obj->cacheEnabled) {
+        Cache_wbInv((Ptr)obj->flag[obj->selfId], obj->cacheLineSize,
+            Cache_Type_ALL, TRUE);
+    }
+
+    /* Give away the turn. */
+    *(obj->turn) = obj->otherId;
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv((Ptr)obj->turn, obj->cacheLineSize, Cache_Type_ALL, TRUE);
+        Cache_inv((Ptr)obj->flag[obj->otherId], obj->cacheLineSize,
+            Cache_Type_ALL, TRUE);
+    }
+
+    /* Wait while other process is using the resource and has the turn. */
+    while ((*(obj->flag[obj->otherId]) == GatePeterson_BUSY) &&
+        (*(obj->turn) == obj->otherId)) {
+        if (obj->cacheEnabled) {
+            Cache_inv((Ptr)obj->flag[obj->otherId], obj->cacheLineSize,
+                Cache_Type_ALL, FALSE);
+            Cache_inv((Ptr)obj->turn, obj->cacheLineSize, Cache_Type_ALL, TRUE);
+        }
+    }
+
+    return (key);
+}
+
+/*
+ *  ======== GatePeterson_leave ========
+ */
+Void GatePeterson_leave(GatePeterson_Object *obj, IArg key)
+{
+    /* Release the resource and leave system gate. */
+    obj->nested--;
+    if (obj->nested == 0) {
+        *(obj->flag[obj->selfId]) = GatePeterson_FREE;
+        if (obj->cacheEnabled) {
+            Cache_wbInv((Ptr)obj->flag[obj->selfId], obj->cacheLineSize,
+                Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /* Leave local gate */
+    IGateProvider_leave(obj->localGate, key);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GatePeterson_getReservedMask ========
+ */
+Bits32 *GatePeterson_getReservedMask()
+{
+    /* This gate doesn't allow reserving resources */
+    return (NULL);
+}
+
+/*
+ *  ======== GatePeterson_sharedMemReq ========
+ */
+SizeT GatePeterson_sharedMemReq(const IGateMPSupport_Params *params)
+{
+    SizeT memReq;
+
+    if (SharedRegion_getCacheLineSize(params->regionId) >=
+        sizeof(GatePeterson_Attrs)) {
+        /*! 4 Because shared of shared memory usage (see GatePeterson.xdc) */
+        memReq = 4 * SharedRegion_getCacheLineSize(params->regionId);
+    }
+    else {
+        memReq = sizeof(GatePeterson_Attrs) + sizeof(Bits16) * 3;
+    }
+
+    return(memReq);
+}
+
+/*
+ *  ======== GatePeterson_query ========
+ */
+Bool GatePeterson_query(Int qual)
+{
+    Bool rc;
+
+    switch (qual) {
+        case IGateProvider_Q_BLOCKING:
+            /* GatePeterson is never blocking */
+            rc = FALSE;
+            break;
+        case IGateProvider_Q_PREEMPTING:
+            /* Depends on gate proxy? */
+            rc = TRUE;
+            break;
+        default:
+            rc = FALSE;
+            break;
+    }
+
+    return (rc);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+/*
+ *  ======== GatePeterson_postInit ========
+ *  Function to be called during
+ *  1. module startup to complete the initialization of all static instances
+ *  2. instance_init to complete the initialization of a dynamic instance
+ *
+ *  Main purpose is to set up shared memory
+ */
+Void GatePeterson_postInit(GatePeterson_Object *obj)
+{
+    /* Set up shared memory */
+    *(obj->turn)       = 0;
+    *(obj->flag[0])    = 0;
+    *(obj->flag[1])    = 0;
+    obj->attrs->creatorProcId  = MultiProc_self();
+    obj->attrs->openerProcId   = MultiProc_INVALIDID;
+
+    /*
+     * Write everything back to memory. This assumes that obj->attrs is equal
+     * to the shared memory base address
+     */
+    if (obj->cacheEnabled) {
+        Cache_wbInv((Ptr)obj->attrs, sizeof(GatePeterson_Attrs), Cache_Type_ALL,
+            FALSE);
+        Cache_wbInv((Ptr)(obj->flag[0]), obj->cacheLineSize * 3, Cache_Type_ALL,
+            TRUE);
+    }
+}
diff --git a/packages/ti/sdo/ipc/gates/GatePeterson.xdc b/packages/ti/sdo/ipc/gates/GatePeterson.xdc
new file mode 100644 (file)
index 0000000..71efb3a
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GatePeterson.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.gates;
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.IGateProvider;
+import xdc.runtime.Diags;
+import xdc.runtime.Log;
+import xdc.rov.ViewInfo;
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.Ipc;
+
+import ti.sdo.ipc.interfaces.IGateMPSupport;
+
+/*!
+ *  ======== GatePeterson ========
+ *  IGateMPSupport gate based on the Peterson algorithm
+ *
+ *  This module implements the {@link ti.sdo.ipc.interfaces.IGateMPSupport}
+ *  interface using the Peterson Algorithm in shared memory. This
+ *  implementation works for only 2 processors.
+ *
+ *  Each GatePeterson instance requires a small piece of
+ *  shared memory.  The base address of this shared memory is specified as
+ *  the 'sharedAddr' argument to the create. The amount of shared memory
+ *  consumed by a single instance can be obtained using the
+ *  {@link #sharedMemReq} call.
+ *
+ *  Shared memory has to conform to the following specification.  Padding is
+ *  added between certain elements in shared memory if cache alignment is
+ *  required for the region in which the instance is placed.
+ *
+ *  @p(code)
+ *
+ *              shmBaseAddr -> --------------------------- bytes
+ *                             |  version                | 4
+ *              (Attrs struct) |  creatorProcId          | 2
+ *                             |  openerProcId           | 2
+ *                             |  (PADDING if aligned)   |
+ *                             |-------------------------|
+ *                             |  flag[0]                | 2
+ *                             |  (PADDING if aligned)   |
+ *                             |-------------------------|
+ *                             |  flag[1]                | 2
+ *                             |  (PADDING if aligned)   |
+ *                             |-------------------------|
+ *                             |  turn                   | 2
+ *                             |  (PADDING if aligned)   |
+ *                             |-------------------------|
+ *  @p
+ */
+@InstanceInitError
+@InstanceFinalize
+
+module GatePeterson inherits IGateMPSupport
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String  objType;
+        Ptr     localGate;
+        UInt    nested;
+        UInt    creatorProcId;
+        UInt    openerProcId;
+        String  gateOwner;
+    }
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== E_gateRemotelyOpened ========
+     *  Error raised when gate cannot be opened because of the opener's ID
+     *
+     *  Error raised in {@link #open} when trying to remotely open a
+     *  GatePeterson instance whose configured opener processor Id does
+     *  not match that of the opener's MultiProc id. but it has already been
+     *  opened/created on two other processors.  GatePeterson only works with
+     *  two processors.
+     */
+    config Error.Id E_gateRemotelyOpened  = {
+        msg: "E_gateRemotelyOpened: Gate already in use by two other processors: creator: %d, opener: %d"
+    };
+
+    /*!
+     *  ======== numInstances ========
+     *  Maximum number of instances supported by the GatePeterson module
+     */
+    config UInt numInstances = 512;
+
+instance:
+
+    /*!
+     *  @_nodoc
+     *  ======== enter ========
+     *  Enter this gate
+     */
+    @DirectCall
+    override IArg enter();
+
+    /*!
+     *  @_nodoc
+     *  ======== leave ========
+     *  Leave this gate
+     */
+    @DirectCall
+    override Void leave(IArg key);
+
+internal:
+
+    /* Used for the 'flag' in shared memory */
+    const UInt32 FREE = 0;
+    const UInt32 BUSY = 1;
+
+    /* Stored in shared memory */
+    struct Attrs {
+        Bits16   creatorProcId;
+        Bits16   openerProcId;
+    };
+
+    /* initializes shared memory */
+    Void postInit(Object *obj);
+
+    struct Instance_State {
+        Attrs           *attrs;
+        volatile Bits16 *flag[2];
+        volatile Bits16 *turn;
+        UInt16          selfId;
+        UInt16          otherId;
+        UInt            nested;    /* For nesting */
+        IGateProvider.Handle localGate;
+        Ipc.ObjType     objType;
+        SizeT           cacheLineSize;
+        Bool            cacheEnabled;
+    };
+}
diff --git a/packages/ti/sdo/ipc/gates/GatePeterson.xs b/packages/ti/sdo/ipc/gates/GatePeterson.xs
new file mode 100644 (file)
index 0000000..690c848
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GatePeterson.xs ========
+ *
+ */
+
+var GatePeterson = null;
+var MultiProc    = null;
+var Cache        = null;
+var Ipc          = null;
+var GateMP       = null;
+
+/*!
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    GatePeterson = this;
+    MultiProc    = xdc.useModule('ti.sdo.utils.MultiProc');
+    Cache        = xdc.useModule('ti.sysbios.hal.Cache');
+    Ipc          = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP       = xdc.useModule('ti.sdo.ipc.GateMP');
+}
+
+/*!
+ *  ======== instance$static$init ========
+ */
+function instance$static$init(obj, params)
+{
+    GatePeterson.$logError("Static instances not supported yet",
+            GatePeterson.common$, GatePeterson.common$.namedInstance);
+}
+
+/*!
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    var rc = false;
+    var IGateProvider = xdc.module('xdc.runtime.IGateProvider');
+
+    switch (qual) {
+        case IGateProvider.Q_BLOCKING:
+            rc = false;
+            break;
+        case IGateProvider.Q_PREEMPTING:
+            rc = true;
+            break;
+        default:
+           GatePeterson.$logWarning("Invalid quality.", this, qual);
+           break;
+    }
+
+    return (rc);
+}
+
+/*
+ *  ======== getNumResources ========
+ */
+function getNumResources()
+{
+    return (this.numInstances);
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== getRemoteStatus$view ========
+ */
+function getRemoteStatus$view(handle)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    try {
+        var view = Program.scanHandleView('ti.sdo.ipc.gates.GatePeterson',
+                                          $addr(handle), 'Basic');
+        if (view.gateOwner == "free") {
+            return (view.gateOwner);
+        }
+        return ("Entered by " + view.gateOwner);
+    }
+    catch(e) {
+        throw("ERROR: Couldn't scan GatePeterson handle view: " + e);
+    }
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    var GatePeterson    = xdc.useModule('ti.sdo.ipc.gates.GatePeterson');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    /* view.objType */
+    view.objType = Ipc.getObjTypeStr$view(obj.objType);
+
+    /* view.nested */
+    view.nested = obj.nested;
+
+   try {
+        attrs = Program.fetchStruct(GatePeterson.Attrs$fetchDesc,
+                                    obj.attrs.$addr);
+
+        view.creatorProcId = attrs.creatorProcId;
+        view.openerProcId = attrs.openerProcId;
+    }
+    catch (e) {
+        view.$status["creatorProcId"] = view.$status["openerProcId"] =
+            "Error: could not fetch shared memory structure: " + e;
+        throw (e);
+    }
+
+    try {
+        var sstruct_flag0 = Program.fetchStruct(ScalarStructs.S_Bits16$fetchDesc,
+                                                obj.flag[0].$addr);
+        var sstruct_flag1 = Program.fetchStruct(ScalarStructs.S_Bits16$fetchDesc,
+                                                obj.flag[1].$addr);
+        var sstruct_turn  = Program.fetchStruct(ScalarStructs.S_Bits16$fetchDesc,
+                                                obj.turn.$addr);
+
+        var flag = [sstruct_flag0.elem, sstruct_flag1.elem];
+        var turn = sstruct_turn.elem;
+
+        if (flag[1] == 1 && (turn == 1 || flag[0] == 0)) {
+            /* Opener has the gate */
+            view.gateOwner = "opener";
+        }
+        else if (flag[0] == 1 && (turn == 0 || flag[1] == 0)) {
+            /* Creator has the gate */
+            view.gateOwner = "creator";
+        }
+        else {
+            view.gateOwner = "[free]";
+        }
+    }
+    catch(e) {
+        view.$status["gateOwner"] =
+            "Error: could not fetch turn/flag data from shared memory: " + e;
+    }
+
+}
diff --git a/packages/ti/sdo/ipc/gates/GatePetersonN.c b/packages/ti/sdo/ipc/gates/GatePetersonN.c
new file mode 100644 (file)
index 0000000..4c34058
--- /dev/null
@@ -0,0 +1,318 @@
+/* 
+ * Copyright (c) 2013 Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */ 
+/*
+ *  ======== GatePetersonN.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/IGateProvider.h>
+#include <xdc/runtime/Gate.h>
+#include <xdc/runtime/Log.h>
+
+#include <ti/sdo/ipc/interfaces/IGateMPSupport.h>
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include "package/internal/GatePetersonN.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+
+#define ROUND_UP(a, b) (SizeT)((((UInt32) a) + ((b) - 1)) & ~((b) - 1))
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== GatePetersonN_Instance_init ========
+ */
+Int GatePetersonN_Instance_init(GatePetersonN_Object *obj,
+                               IGateProvider_Handle localGate,
+                               const GatePetersonN_Params *params,
+                               Error_Block *eb)
+{
+    SizeT  offset;
+    SizeT  minAlign = Memory_getMaxDefaultTypeAlign();
+    SizeT  i;
+
+    if (SharedRegion_getCacheLineSize(params->regionId) > minAlign) {
+            minAlign = SharedRegion_getCacheLineSize(params->regionId);
+    }
+
+    Assert_isTrue(params->sharedAddr != NULL, ti_sdo_ipc_Ipc_A_invParam);
+    Assert_isTrue(GatePetersonN_numInstances != NULL,ti_sdo_ipc_Ipc_A_invParam);
+
+    obj->localGate      = localGate;
+    obj->cacheEnabled   = SharedRegion_isCacheEnabled(params->regionId);
+    obj->cacheLineSize  = SharedRegion_getCacheLineSize(params->regionId);
+    obj->nested  = 0;
+    
+    /* This is not cluster aware:
+     * obj->numProcessors  = MultiProc_getNumProcessors();
+     * obj->selfId         = MultiProc_self();
+     */
+
+    /* Cluster aware initialization */ 
+    obj->numProcessors  = MultiProc_getNumProcsInCluster();
+    
+    /* set selfId to 0-based offset within cluster. */
+    obj->selfId         = MultiProc_self() - MultiProc_getBaseIdOfCluster();
+    
+    /* Assign shared memory addresses for the protocol state variables */
+    
+    offset = 0;
+
+    for (i=0; i < obj->numProcessors; i++) {
+        obj->enteredStage[i] = (Int32 *)((UArg)(params->sharedAddr) + offset); 
+        offset += minAlign;
+    }
+
+    for (i=0; i < obj->numProcessors - 1; i++) {
+       obj->lastProcEnteringStage[i] = (Int32 *)((UArg)(params->sharedAddr) 
+                                                   + offset);
+        offset += minAlign;
+    }
+
+    if (!params->openFlag) {
+        /* Creating. */
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+        GatePetersonN_postInit(obj);
+    }
+    else {
+        /* Opening. */
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== GatePetersonN_Instance_finalize ========
+ */
+Void GatePetersonN_Instance_finalize(GatePetersonN_Object *obj, Int status)
+{
+}
+
+/*
+ *  ======== GatePetersonN_enter ========
+ */
+IArg GatePetersonN_enter(GatePetersonN_Object *obj)
+{
+    IArg key;
+    SizeT   numProcessors;
+    SizeT   myProcId;
+    Int32   curStage;
+    SizeT   proc;
+
+    /* Enter local gate */
+    key = IGateProvider_enter(obj->localGate);
+
+    /* If the gate object has already been entered, return the key */
+    obj->nested++;
+    if (obj->nested > 1) {
+        return (key);
+    }
+    numProcessors = obj->numProcessors;
+    myProcId      = obj->selfId;
+
+    for (curStage=0; curStage < (numProcessors - 1); curStage++) {
+
+        *(obj->enteredStage[myProcId]) = curStage;
+        *(obj->lastProcEnteringStage[curStage]) = myProcId;
+        
+       if (obj->cacheEnabled) {
+
+            Cache_wbInv((Ptr)obj->enteredStage[myProcId], obj->cacheLineSize,
+                    Cache_Type_ALL, FALSE);
+            Cache_wbInv((Ptr)obj->lastProcEnteringStage[curStage], 
+                    obj->cacheLineSize, Cache_Type_ALL, TRUE);
+        }
+
+        for (proc=0; proc < numProcessors; proc++) {
+
+            if (proc != myProcId) {
+
+               if (obj->cacheEnabled) {
+
+                    Cache_inv((Ptr)obj->enteredStage[proc], 
+                            obj->cacheLineSize, Cache_Type_ALL, FALSE);
+                    Cache_inv((Ptr)obj->lastProcEnteringStage[curStage], 
+                            obj->cacheLineSize, Cache_Type_ALL, TRUE);
+               }
+
+                while ((*(obj->enteredStage[proc]) >= curStage) &&
+                       (*(obj->lastProcEnteringStage[curStage]) == myProcId)) {
+
+                    /* wait till 'proc' leaves or another 'proc' enters stage */
+                   if (obj->cacheEnabled) {
+
+                        Cache_inv((Ptr)obj->enteredStage[proc], 
+                                obj->cacheLineSize, Cache_Type_ALL, FALSE);
+                        Cache_inv((Ptr)obj->lastProcEnteringStage[curStage], 
+                                obj->cacheLineSize, Cache_Type_ALL, TRUE);
+                    }
+                }
+            }
+        }
+
+    } /* stages */
+
+    return (key);
+}
+
+/*
+ *  ======== GatePetersonN_leave ========
+ */
+Void GatePetersonN_leave(GatePetersonN_Object *obj, IArg key)
+{
+    /* Release the resource and leave system gate. */
+    obj->nested--;
+    if (obj->nested == 0) {
+
+        *(obj->enteredStage[obj->selfId]) = GatePetersonN_NOT_INTERESTED;
+
+        if (obj->cacheEnabled) {
+            Cache_wbInv((Ptr)obj->enteredStage[obj->selfId], obj->cacheLineSize,
+                Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /* Leave local gate */
+    IGateProvider_leave(obj->localGate, key);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+/*
+ *  ======== GatePetersonN_getReservedMask ========
+ */
+Bits32 *GatePetersonN_getReservedMask()
+{
+    /* This gate doesn't allow reserving resources */
+    return (NULL);
+}
+
+/*
+ *  ======== GatePetersonN_sharedMemReq ========
+ */
+SizeT GatePetersonN_sharedMemReq(const IGateMPSupport_Params *params)
+{
+    SizeT  memReq;
+    UInt16 numProcessors = MultiProc_getNumProcsInCluster(); /* Cluster aware */
+    SizeT  minAlign = Memory_getMaxDefaultTypeAlign();
+
+    if (SharedRegion_getCacheLineSize(params->regionId) > minAlign) {
+            minAlign = SharedRegion_getCacheLineSize(params->regionId);
+    }
+    
+    /*  Allocate aligned memory for shared state variables used in protocol
+     *      enteredStage[NUM_PROCESSORS]
+     *     lastProcEnteringStage[NUM_STAGES] 
+     */
+    memReq = ((2 * numProcessors) - 1) * 
+              SharedRegion_getCacheLineSize(params->regionId);
+
+    return(memReq);
+}
+
+/*
+ *  ======== GatePetersonN_query ========
+ */
+Bool GatePetersonN_query(Int qual)
+{
+    Bool rc;
+
+    switch (qual) {
+        case IGateProvider_Q_BLOCKING:
+            /* GatePeterson is never blocking */
+            rc = FALSE;
+            break;
+        case IGateProvider_Q_PREEMPTING:
+            /* Depends on gate proxy? */
+            rc = TRUE;
+            break;
+        default:
+            rc = FALSE;
+            break;
+    }
+
+    return (rc);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+/*
+ *  ======== GatePetersonN_postInit ========
+ *  Function to be called during
+ *  1. module startup to complete the initialization of all static instances
+ *  2. instance_init to complete the initialization of a dynamic instance
+ *
+ *  Main purpose is to set up shared memory
+ */
+Void GatePetersonN_postInit(GatePetersonN_Object *obj)
+{
+    UInt16 i;
+
+    /* Set up shared memory */
+    for (i=0; i < obj->numProcessors; i++) {
+        *(obj->enteredStage[i]) = GatePetersonN_NOT_INTERESTED;
+    }
+
+    for (i=0; i < obj->numProcessors - 1; i++) {
+       *(obj->lastProcEnteringStage[i]) = 0;
+    }
+
+    /*
+     * Write everything back to shared memory. 
+     */
+    if (obj->cacheEnabled) {
+        Cache_wbInv((Ptr)(obj->enteredStage[0]), obj->cacheLineSize * 
+                obj->numProcessors, Cache_Type_ALL, FALSE);
+        Cache_wbInv((Ptr)(obj->lastProcEnteringStage[0]), obj->cacheLineSize * 
+                obj->numProcessors-1, Cache_Type_ALL, TRUE);
+    }
+}
+
diff --git a/packages/ti/sdo/ipc/gates/GatePetersonN.xdc b/packages/ti/sdo/ipc/gates/GatePetersonN.xdc
new file mode 100644 (file)
index 0000000..51c03a0
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GatePetersonN.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.gates;
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.IGateProvider;
+import xdc.runtime.Diags;
+import xdc.runtime.Log;
+import xdc.rov.ViewInfo;
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.Ipc;
+
+import ti.sdo.ipc.interfaces.IGateMPSupport;
+
+/*!
+ *  ======== GatePetersonN (for N processors) ========
+ *  IGateMPSupport gate based on the Peterson's algorithm
+ *
+ *  This module implements the {@link ti.sdo.ipc.interfaces.IGateMPSupport}
+ *  interface using the Peterson Algorithm in shared memory. This
+ *  implementation works for N processors.
+ *
+ *  Each GatePetersonN instance requires a small piece of
+ *  shared memory.  The base address of this shared memory is specified as
+ *  the 'sharedAddr' argument to the create. The amount of shared memory
+ *  consumed by a single instance can be obtained using the
+ *  {@link #sharedMemReq} call.
+ *
+ *  Shared memory has to conform to the following specification.  Padding is
+ *  added between certain elements in shared memory if cache alignment is
+ *  required for the region in which the instance is placed.
+ *
+ *  @p(code)
+ *
+ *              shmBaseAddr -> ------------------------------ bytes
+ *                             |  enteredStage[0]           | 4
+ *                             |  (PADDING if aligned)      |
+ *                             |----------------------------|
+ *                             |  enteredStage[1]           | 4
+ *                             |  (PADDING if aligned)      |
+ *                             |----------------------------|
+ *                                      . . . 
+ *                             |----------------------------|
+ *                             |  enteredStage[N-1]         | 4
+ *                             |  (PADDING if aligned)      |
+ *                             |----------------------------|
+ *                             |  lastProcEnteringStage[1]  | 4
+ *                             |  (PADDING if aligned)      |
+ *                             |----------------------------|
+ *                                      . . . 
+ *                             |----------------------------|
+ *                             |  lastProcEnteringStage[N-1]| 4
+ *                             |  (PADDING if aligned)      |
+ *                             |----------------------------|
+ *  @p
+ */
+@InstanceInitError
+@InstanceFinalize
+
+module GatePetersonN inherits IGateMPSupport
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String  objType;
+        Ptr     localGate;
+        UInt    nested;
+        String  gateOwner;
+    }
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  ======== numInstances ========
+     *  Maximum number of instances supported by the GatePetersonN module
+     */
+    config UInt numInstances = 512;
+    config UInt MAX_NUM_PROCS  =  8;
+
+instance:
+
+    /*!
+     *  @_nodoc
+     *  ======== enter ========
+     *  Enter this gate
+     */
+    @DirectCall
+    override IArg enter();
+
+    /*!
+     *  @_nodoc
+     *  ======== leave ========
+     *  Leave this gate
+     */
+    @DirectCall
+    override Void leave(IArg key);
+
+internal:
+
+    const Int32 NOT_INTERESTED = -1;
+
+    /* initializes shared memory */
+    Void postInit(Object *obj);
+
+    struct Instance_State {
+        volatile Int32 *enteredStage[MAX_NUM_PROCS];
+        volatile Int32 *lastProcEnteringStage[MAX_NUM_PROCS-1];
+        UInt16          selfId;
+        UInt16          numProcessors;
+        UInt            nested;    /* For nesting */
+        IGateProvider.Handle localGate;
+        Ipc.ObjType     objType;
+        SizeT           cacheLineSize;
+        Bool            cacheEnabled;
+    };
+}
diff --git a/packages/ti/sdo/ipc/gates/GatePetersonN.xs b/packages/ti/sdo/ipc/gates/GatePetersonN.xs
new file mode 100644 (file)
index 0000000..9432b6e
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== GatePetersonN.xs ========
+ *
+ */
+
+var GatePetersonN = null;
+var MultiProc    = null;
+var Cache        = null;
+var Ipc          = null;
+var GateMP       = null;
+
+/*!
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    GatePetersonN = this;
+    MultiProc    = xdc.useModule('ti.sdo.utils.MultiProc');
+    Cache        = xdc.useModule('ti.sysbios.hal.Cache');
+    Ipc          = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP       = xdc.useModule('ti.sdo.ipc.GateMP');
+}
+/* TODO: add function module$static$init() and set MAX_NUM_PROCS from MultiProc
+ */
+
+/*!
+ *  ======== instance$static$init ========
+ */
+function instance$static$init(obj, params)
+{
+    GatePetersonN.$logError("Static instances not supported yet",
+            GatePetersonN.common$, GatePetersonN.common$.namedInstance);
+}
+
+/*!
+ *  ======== queryMeta ========
+ */
+function queryMeta(qual)
+{
+    var rc = false;
+    var IGateProvider = xdc.module('xdc.runtime.IGateProvider');
+
+    switch (qual) {
+        case IGateProvider.Q_BLOCKING:
+            rc = false;
+            break;
+        case IGateProvider.Q_PREEMPTING:
+            rc = true;
+            break;
+        default:
+           GatePetersonN.$logWarning("Invalid quality.", this, qual);
+           break;
+    }
+
+    return (rc);
+}
+
+/*
+ *  ======== getNumResources ========
+ */
+function getNumResources()
+{
+    return (this.numInstances);
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== getRemoteStatus$view ========
+ */
+function getRemoteStatus$view(handle)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    try {
+        var view = Program.scanHandleView('ti.sdo.ipc.gates.GatePetersonN',
+                                          $addr(handle), 'Basic');
+        if (view.gateOwner == "free") {
+            return (view.gateOwner);
+        }
+        return ("Entered by " + view.gateOwner);
+    }
+    catch(e) {
+        throw("ERROR: Couldn't scan GatePetersonN handle view: " + e);
+    }
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    var GatePetersonN    = xdc.useModule('ti.sdo.ipc.gates.GatePetersonN');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    /* view.objType */
+    view.objType = Ipc.getObjTypeStr$view(obj.objType);
+
+    /* view.nested */
+    view.nested = obj.nested;
+    /*
+    try {
+        var sstruct_flag0 = Program.fetchStruct(ScalarStructs.S_Bits16$fetchDesc,
+                                                obj.flag[0].$addr);
+        var sstruct_flag1 = Program.fetchStruct(ScalarStructs.S_Bits16$fetchDesc,
+                                                obj.flag[1].$addr);
+        var sstruct_turn  = Program.fetchStruct(ScalarStructs.S_Bits16$fetchDesc,
+                                                obj.turn.$addr);
+
+        var flag = [sstruct_flag0.elem, sstruct_flag1.elem];
+        var turn = sstruct_turn.elem;
+
+        if (flag[1] == 1 && (turn == 1 || flag[0] == 0)) {
+            view.gateOwner = "opener";
+        }
+        else if (flag[0] == 1 && (turn == 0 || flag[1] == 0)) {
+            view.gateOwner = "creator";
+        }
+        else {
+            view.gateOwner = "[free]";
+        }
+    }
+    catch(e) {
+        view.$status["gateOwner"] =
+            "Error: could not fetch turn/flag data from shared memory: " + e;
+    }
+   */
+}
diff --git a/packages/ti/sdo/ipc/gates/package.bld b/packages/ti/sdo/ipc/gates/package.bld
new file mode 100644 (file)
index 0000000..623e581
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList_0 = [
+    "GateMPSupportNull",
+    "GatePeterson",
+    "GatePetersonN"
+];
+
+var objList_3 = [
+    "GateHWSem",
+    "GateHWSpinlock",
+].concat(objList_0);
+
+var objList_1 = [
+    "GateAAMonitor",
+    "GateAAMonitor_asm",
+].concat(objList_3);
+
+var objList_2 = [
+    "GateHWSpinlock",
+].concat(objList_0);
+
+var trgFilter_1 = {
+    field: "isa",
+    list: [ "64P" ]
+};
+
+var trgFilter_2 = {
+    field: "isa",
+    list: [ "674", "64T", "v7M", "v7M4", "v7A", "v7A8", "v7A15", "arp32" ]
+};
+
+var trgFilter_3 = {
+    field: "isa",
+    list: [ "66" ]
+};
+
+var trgFilter_0 = {
+    field: "noIsa",
+    list: trgFilter_1.list.concat(trgFilter_2.list).concat(trgFilter_3.list)
+};
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList_0, undefined, trgFilter_0, arguments);
+IpcBuild.buildLibs(objList_1, undefined, trgFilter_1, arguments);
+IpcBuild.buildLibs(objList_2, undefined, trgFilter_2, arguments);
+IpcBuild.buildLibs(objList_3, undefined, trgFilter_3, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList_0, undefined, trgFilter_0, ["profile=smp"]);
+IpcBuild.buildLibs(objList_1, undefined, trgFilter_1, ["profile=smp"]);
+IpcBuild.buildLibs(objList_2, undefined, trgFilter_2, ["profile=smp"]);
+IpcBuild.buildLibs(objList_3, undefined, trgFilter_3, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/gates/package.xdc b/packages/ti/sdo/ipc/gates/package.xdc
new file mode 100644 (file)
index 0000000..dbcfa8e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.sdo.ipc.gates ========
+ *  IPC-related gates
+ *
+ *  Contains modules that provide various implementations of multiprocessor
+ *  gates.
+ *
+ */
+package ti.sdo.ipc.gates [1,0,0,0] {
+    module    GateAAMonitor;
+    module    GateHWSem;
+    module    GateHWSpinlock;
+    module    GatePeterson;
+    module    GatePetersonN;
+    module    GateMPSupportNull;
+}
diff --git a/packages/ti/sdo/ipc/gates/package.xs b/packages/ti/sdo/ipc/gates/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapBufMP.c b/packages/ti/sdo/ipc/heaps/HeapBufMP.c
new file mode 100644 (file)
index 0000000..5ccdf0a
--- /dev/null
@@ -0,0 +1,866 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapBufMP.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/heaps/_HeapBufMP.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/ipc/_ListMP.h>
+
+#include "package/internal/HeapBufMP.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(HeapBufMP_Params_init);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_alloc);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_close);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_create);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_delete);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_free);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_getExtendedStats);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_getStats);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_open);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_openByAddr);
+    #pragma FUNC_EXT_CALLED(HeapBufMP_sharedMemReq);
+#endif
+
+/*
+ *  ======== HeapBufMP_getSharedParams ========
+ */
+static Void HeapBufMP_getSharedParams(HeapBufMP_Params *sparams,
+    const ti_sdo_ipc_heaps_HeapBufMP_Params *params)
+{
+    sparams->gate        = (GateMP_Handle)params->gate;
+    sparams->name        = params->name;
+    sparams->regionId    = params->regionId;
+    sparams->sharedAddr  = params->sharedAddr;
+    sparams->align       = params->align;
+    sparams->numBlocks   = params->numBlocks;
+    sparams->blockSize   = params->blockSize;
+    sparams->exact       = params->exact;
+}
+
+/*
+ *  ======== HeapBufMP_getRTSCParams ========
+ */
+static Void HeapBufMP_getRTSCParams(
+    ti_sdo_ipc_heaps_HeapBufMP_Params *params,
+    const HeapBufMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_Params_init(params);
+
+    params->gate        = (ti_sdo_ipc_GateMP_Handle)sparams->gate;
+    params->name        = sparams->name;
+    params->regionId    = sparams->regionId;
+    params->sharedAddr  = sparams->sharedAddr;
+    params->align       = sparams->align;
+    params->numBlocks   = sparams->numBlocks;
+    params->blockSize   = sparams->blockSize;
+    params->exact       = sparams->exact;
+}
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== HeapBufMP_Params_init ========
+ */
+Void HeapBufMP_Params_init(HeapBufMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_Params params;
+
+    ti_sdo_ipc_heaps_HeapBufMP_Params_init(&params);
+    HeapBufMP_getSharedParams(sparams, &params);
+}
+
+/*
+ *  ======== HeapBufMP_alloc ========
+ */
+Ptr HeapBufMP_alloc(HeapBufMP_Handle handle,
+                      SizeT size,
+                      SizeT align)
+{
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    return (ti_sdo_ipc_heaps_HeapBufMP_alloc(
+            (ti_sdo_ipc_heaps_HeapBufMP_Object *)handle, size, align, &eb));
+}
+
+/*
+ *  ======== HeapBufMP_close ========
+ */
+Int HeapBufMP_close(HeapBufMP_Handle *handlePtr)
+{
+    HeapBufMP_delete(handlePtr);
+
+    return (HeapBufMP_S_SUCCESS);
+}
+
+/*
+ *  ======== HeapBufMP_create ========
+ */
+HeapBufMP_Handle HeapBufMP_create(const HeapBufMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_Params params;
+    ti_sdo_ipc_heaps_HeapBufMP_Object *obj;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    if (sparams != NULL) {
+        HeapBufMP_getRTSCParams(&params, (Ptr)sparams);
+
+        /* call the module create */
+        obj = ti_sdo_ipc_heaps_HeapBufMP_create(&params, &eb);
+    }
+    else {
+        obj = ti_sdo_ipc_heaps_HeapBufMP_create(NULL, &eb);
+    }
+
+    return ((HeapBufMP_Handle)obj);
+}
+
+/*
+ *  ======== HeapBufMP_delete ========
+ */
+Int HeapBufMP_delete(HeapBufMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_delete(
+            (ti_sdo_ipc_heaps_HeapBufMP_Handle *)handlePtr);
+
+    return (HeapBufMP_S_SUCCESS);
+}
+
+/*
+ *  ======== HeapBufMP_free ========
+ */
+Void HeapBufMP_free(HeapBufMP_Handle handle, Ptr addr, SizeT size)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_free(
+        (ti_sdo_ipc_heaps_HeapBufMP_Object *)handle, addr, size);
+}
+/*
+ *  ======== HeapBufMP_getExtendedStats ========
+ */
+Void HeapBufMP_getExtendedStats(HeapBufMP_Handle handle,
+                                HeapBufMP_ExtendedStats *stats)
+{
+    IArg key;
+    ti_sdo_ipc_heaps_HeapBufMP_Object *obj =
+            (ti_sdo_ipc_heaps_HeapBufMP_Object *)handle;
+
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    /* Make sure the attrs are not in cache */
+    if (obj->cacheEnabled) {
+        Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  The maximum number of allocations for this HeapBufMP (for any given
+     *  instance of time during its liftime) is computed as follows:
+     *
+     *  maxAllocatedBlocks = obj->numBlocks - obj->minFreeBlocks
+     *
+     *  Note that maxAllocatedBlocks is *not* the maximum allocation count, but
+     *  rather the maximum allocations seen at any snapshot of time in the
+     *  HeapBufMP instance.
+     */
+
+    /* if nothing has been alloc'ed yet, return 0 */
+    if ((Int)(obj->attrs->minFreeBlocks) == -1) {
+        stats->maxAllocatedBlocks = 0;
+    }
+    else {
+        stats->maxAllocatedBlocks = obj->attrs->numBlocks -
+                              obj->attrs->minFreeBlocks;
+    }
+
+    /* current # of alloc'ed blocks is computed using curr # of free blocks */
+    stats->numAllocatedBlocks = obj->attrs->numBlocks -
+            obj->attrs->numFreeBlocks;
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+
+/*
+ *  ======== HeapBufMP_getStats ========
+ */
+Void HeapBufMP_getStats(HeapBufMP_Handle handle, Ptr stats)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_getStats(
+            (ti_sdo_ipc_heaps_HeapBufMP_Handle)handle,
+            (Memory_Stats *)stats);
+}
+/*
+ *  ======== HeapBufMP_open ========
+ */
+Int HeapBufMP_open(String name,
+                   HeapBufMP_Handle *handlePtr)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Int status;
+    Ptr sharedAddr;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* Assert that a pointer has been supplied */
+    Assert_isTrue(handlePtr != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /* Assert that a name has been supplied */
+    Assert_isTrue(name != NULL, ti_sdo_ipc_Ipc_A_invParam);
+
+    /* Open by name */
+    status = NameServer_getUInt32((NameServer_Handle)
+                 HeapBufMP_module->nameServer,
+                 name,
+                 &sharedShmBase,
+                 ti_sdo_utils_MultiProc_procIdList);
+
+    if (status < 0) {
+        /* Name not found. */
+        *handlePtr = NULL;
+        return (HeapBufMP_E_NOTFOUND);
+    }
+
+    sharedAddr = SharedRegion_getPtr(sharedShmBase);
+
+    status = HeapBufMP_openByAddr(sharedAddr, handlePtr);
+
+    return (status);
+}
+
+/*
+ *  ======== HeapBufMP_openByAddr ========
+ */
+Int HeapBufMP_openByAddr(Ptr sharedAddr,
+                         HeapBufMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_heaps_HeapBufMP_Params params;
+    ti_sdo_ipc_heaps_HeapBufMP_Attrs *attrs;
+    Int status;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    ti_sdo_ipc_heaps_HeapBufMP_Params_init(&params);
+
+    /* Tell Instance_init() that we're opening */
+    params.openFlag = TRUE;
+
+    params.sharedAddr = sharedAddr;
+    attrs = (ti_sdo_ipc_heaps_HeapBufMP_Attrs *)sharedAddr;
+
+    if (SharedRegion_isCacheEnabled(SharedRegion_getId(sharedAddr))) {
+        Cache_inv(attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                Cache_Type_ALL, TRUE);
+    }
+
+    if (attrs->status != ti_sdo_ipc_heaps_HeapBufMP_CREATED) {
+        *handlePtr = NULL;
+        status = HeapBufMP_E_NOTFOUND;
+    }
+    else {
+        *handlePtr = (HeapBufMP_Handle)
+            ti_sdo_ipc_heaps_HeapBufMP_create(&params, &eb);
+        if (*handlePtr == NULL) {
+            status = HeapBufMP_E_FAIL;
+        }
+        else {
+            status = HeapBufMP_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== HeapBufMP_sharedMemReq ========
+ */
+SizeT HeapBufMP_sharedMemReq(const HeapBufMP_Params *params)
+{
+    SizeT memReq, minAlign, bufAlign, blockSize;
+    ListMP_Params listMPParams;
+    UInt16 regionId;
+
+    /* Assert that the required params have been set */
+    Assert_isTrue(params->blockSize != 0, ti_sdo_ipc_Ipc_A_invParam);
+    Assert_isTrue(params->numBlocks != 0, ti_sdo_ipc_Ipc_A_invParam);
+
+    if (params->sharedAddr == NULL) {
+        regionId = params->regionId;
+    }
+    else {
+        regionId = SharedRegion_getId(params->sharedAddr);
+    }
+
+    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    /* Determine the actual buffer alignment */
+    bufAlign = params->align;
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    if (bufAlign < minAlign) {
+        bufAlign = minAlign;
+    }
+
+    /* Determine the actual block size */
+    blockSize = _Ipc_roundup(params->blockSize, bufAlign);
+
+    /* Add size of HeapBufMP Attrs */
+    memReq = _Ipc_roundup(sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs), minAlign);
+
+    /*
+     *  Add size of ListMP Attrs.  No need to init params since it's not used
+     *  to create.
+     */
+    ListMP_Params_init(&listMPParams);
+    listMPParams.regionId = regionId;
+    memReq += ListMP_sharedMemReq(&listMPParams);
+
+    /* Round by the buffer alignment */
+    memReq = _Ipc_roundup(memReq, bufAlign);
+
+    /*
+     *  Add the buffer size. No need to subsequently round because the product
+     *  should be a multiple of cacheLineSize if cache alignment is enabled
+     */
+    memReq += blockSize * params->numBlocks;
+
+    return(memReq);
+}
+
+/*
+ *************************************************************************
+ *                      Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_Instance_init ========
+ */
+Int ti_sdo_ipc_heaps_HeapBufMP_Instance_init(
+        ti_sdo_ipc_heaps_HeapBufMP_Object *obj,
+        const ti_sdo_ipc_heaps_HeapBufMP_Params *params,
+        Error_Block *eb)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Ptr localAddr;
+    SizeT minAlign;
+    Int status;
+
+    Assert_isTrue(params->openFlag ||
+                  params->blockSize != 0, ti_sdo_ipc_Ipc_A_invParam);
+
+    obj->nsKey          = NULL;
+    obj->allocSize      = 0;
+
+    if (params->openFlag) {
+        /* Opening the gate */
+        obj->attrs          =
+                (ti_sdo_ipc_heaps_HeapBufMP_Attrs *)params->sharedAddr;
+
+        /* No need to Cache_inv attrs- already done in openByAddr() */
+        obj->align          = obj->attrs->align;
+        obj->numBlocks      = obj->attrs->numBlocks;
+        obj->blockSize      = obj->attrs->blockSize;
+        obj->exact          = obj->attrs->exact;
+        obj->buf            = SharedRegion_getPtr(obj->attrs->bufPtr);
+        obj->regionId       = SharedRegion_getId(obj->buf);
+
+        minAlign = Memory_getMaxDefaultTypeAlign();
+        if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+            minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+        }
+
+        obj->cacheEnabled   = SharedRegion_isCacheEnabled(obj->regionId);
+        obj->objType        = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+
+        localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
+        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&(obj->gate));
+        if (status != GateMP_S_SUCCESS) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (1);
+        }
+
+        /* Open the ListMP */
+        localAddr = (Ptr)_Ipc_roundup(
+            (UInt32)obj->attrs + sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+            minAlign);
+        status = ListMP_openByAddr(localAddr,
+            (ListMP_Handle *)&(obj->freeList));
+
+        if (status != ListMP_S_SUCCESS) {
+            /* obj->freeList set to NULL */
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (2);
+        }
+
+        /* Done opening */
+        return (0);
+    }
+
+    /* Creating the gate */
+    if (params->gate != NULL) {
+        obj->gate       = params->gate;
+    }
+    else {
+        /* If no gate specified, get the default system gate */
+        obj->gate       = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+    }
+
+    obj->exact          = params->exact;
+    obj->align          = params->align;
+    obj->numBlocks      = params->numBlocks;
+
+    if (params->sharedAddr == NULL) {
+        /* Creating using a shared region ID */
+        obj->objType    = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
+        obj->attrs      = NULL; /* Will be alloc'ed in postInit */
+        obj->regionId   = params->regionId;
+    }
+    else {
+        /* Creating using sharedAddr */
+        obj->regionId   = SharedRegion_getId(params->sharedAddr);
+
+        /* Assert that the buffer is in a valid shared region */
+        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+        /* Assert that sharedAddr is cached aligned if region requires align. */
+        Assert_isTrue(((UInt32)params->sharedAddr %
+                      SharedRegion_getCacheLineSize(obj->regionId) == 0),
+                      ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+        obj->objType    = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+        obj->attrs      = (ti_sdo_ipc_heaps_HeapBufMP_Attrs *)
+                params->sharedAddr;
+    }
+
+    obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+
+    /* Fix the alignment (alignment may be needed even if cache is disabled) */
+    obj->align = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(obj->regionId) > obj->align) {
+        obj->align = SharedRegion_getCacheLineSize(obj->regionId);
+    }
+
+    /* Round the blockSize up by the adjusted alignment */
+    obj->blockSize = _Ipc_roundup(params->blockSize, obj->align);
+
+    HeapBufMP_postInit(obj, eb);
+    if (Error_check(eb)) {
+        return(2);
+    }
+
+    /* Add entry to NameServer */
+    if (params->name != NULL) {
+        /* We will store a shared pointer in the NameServer */
+        sharedShmBase = SharedRegion_getSRPtr(obj->attrs,
+                                              obj->regionId);
+        obj->nsKey = NameServer_addUInt32((NameServer_Handle)
+                HeapBufMP_module->nameServer, params->name,
+                (UInt32)sharedShmBase);
+
+        if (obj->nsKey == NULL) {
+            /* NameServer_addUInt32 failed */
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
+            return (3);
+        }
+    }
+
+    return(0);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_Instance_finalize ========
+ */
+Void ti_sdo_ipc_heaps_HeapBufMP_Instance_finalize(
+        ti_sdo_ipc_heaps_HeapBufMP_Object *obj, Int status)
+{
+    if (obj->objType & (ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC |
+                        ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION)) {
+        /* Heap is being deleted */
+        /* Remove entry from NameServer */
+        if (obj->nsKey != NULL) {
+            NameServer_removeEntry((NameServer_Handle)
+                    HeapBufMP_module->nameServer, obj->nsKey);
+        }
+
+        if (obj->attrs != NULL) {
+            /* Set status to 'not created' */
+            obj->attrs->status = 0;
+            if (obj->cacheEnabled) {
+                Cache_wbInv(obj->attrs,
+                            sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                            Cache_Type_ALL, TRUE);
+            }
+        }
+
+        /* Delete the freeList. If NULL, then ListMP_create failed. */
+        if (obj->freeList != NULL) {
+            ListMP_delete((ListMP_Handle *)&(obj->freeList));
+        }
+
+        /*
+         *  Free the shared memory back to the region heap. If NULL, then the
+         *  Memory_alloc failed.
+         */
+        if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION &&
+            obj->attrs != NULL) {
+            Memory_free(SharedRegion_getHeap(obj->regionId), obj->attrs,
+                    obj->allocSize);
+        }
+    }
+    else {
+        /* Heap is being closed */
+        /* Close the freeList. If NULL, then ListMP_openByAddr failed. */
+        if (obj->freeList != NULL) {
+            ListMP_close((ListMP_Handle *)&(obj->freeList));
+        }
+
+        /* Close the gate. If NULL, then GateMP_openByAddr failed. */
+        if (obj->gate != NULL) {
+            GateMP_close((GateMP_Handle *)&(obj->gate));
+        }
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_alloc ========
+ *  Allocate a block.
+ */
+Ptr ti_sdo_ipc_heaps_HeapBufMP_alloc(ti_sdo_ipc_heaps_HeapBufMP_Object *obj,
+        SizeT size, SizeT align, Error_Block *eb)
+{
+    Char *block;
+    IArg key;
+
+    /* Check for valid blockSize */
+    if (size > obj->blockSize) {
+        Error_raise(eb, ti_sdo_ipc_heaps_HeapBufMP_E_sizeTooLarge, (IArg)size,
+                (IArg)obj->blockSize);
+        return (NULL);
+    }
+
+    /* Check for exact matching */
+    if (obj->exact && size != obj->blockSize) {
+        Error_raise(eb, ti_sdo_ipc_heaps_HeapBufMP_E_exactFail, (IArg)size,
+                (IArg)obj->blockSize);
+        return (NULL);
+    }
+
+    /* Check for valid alignment */
+    if (align > obj->align) {
+        Error_raise(eb, ti_sdo_ipc_heaps_HeapBufMP_E_alignTooLarge, (IArg)align,
+                (IArg)obj->align);
+        return (NULL);
+    }
+
+    /* Enter the gate */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    /* Get the first block */
+    block = ListMP_getHead((ListMP_Handle)obj->freeList);
+
+    /* Make sure that a valid pointer was returned. */
+    if (block == NULL) {
+        GateMP_leave((GateMP_Handle)obj->gate, key);
+        Error_raise(eb, ti_sdo_ipc_heaps_HeapBufMP_E_noBlocksLeft, (IArg)obj,
+                (IArg)size);
+
+        return (NULL);
+    }
+
+    /*
+     *  Keep track of the min number of free for this HeapBufMP, if user
+     *  has set the config variable trackMaxAllocs to true. Also, keep track
+     *  of the number of free blocks.
+     *
+     *  The min number of free blocks, 'minFreeBlocks', will be used to compute
+     *  the "all time" maximum number of allocated blocks in getExtendedStats().
+     */
+    if (ti_sdo_ipc_heaps_HeapBufMP_trackAllocs) {
+        /* Make sure the attrs are not in cache */
+        if (obj->cacheEnabled) {
+            Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                    Cache_Type_ALL, TRUE);
+        }
+
+        obj->attrs->numFreeBlocks--;
+
+        if (obj->attrs->numFreeBlocks < (Int32)obj->attrs->minFreeBlocks) {
+            /* save the new minimum */
+            obj->attrs->minFreeBlocks = obj->attrs->numFreeBlocks;
+        }
+
+        /* Make sure the attrs are written out to memory */
+        if (obj->cacheEnabled) {
+            Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                    Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /* Leave the gate */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (block);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_free ========
+ *  Frees the block to this HeapBufMP. 'size' not check for optimization
+ */
+Void ti_sdo_ipc_heaps_HeapBufMP_free(ti_sdo_ipc_heaps_HeapBufMP_Object *obj,
+        Ptr block, SizeT size)
+{
+    IArg key;
+
+    Assert_isTrue(((UInt32)block >= (UInt32)obj->buf) &&
+        ((UInt32)block < ((UInt32)obj->buf + obj->blockSize * obj->numBlocks)),
+        ti_sdo_ipc_heaps_HeapBufMP_A_invBlockFreed);
+
+    /* Assert that 'addr' is block-aligned */
+    Assert_isTrue((UInt32)block % obj->align == 0,
+            ti_sdo_ipc_heaps_HeapBufMP_A_badAlignment);
+
+    /*
+     *  Invalidate entire block make sure stale cache data isn't
+     *  evicted later
+     */
+    if (obj->cacheEnabled) {
+        Cache_inv(block, obj->attrs->blockSize, Cache_Type_ALL, FALSE);
+    }
+
+    /* Enter the gate */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    ListMP_putTail((ListMP_Handle)obj->freeList, block);
+
+    if (ti_sdo_ipc_heaps_HeapBufMP_trackAllocs) {
+        /* Make sure the attrs are not in cache */
+        if (obj->cacheEnabled) {
+            Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                Cache_Type_ALL, FALSE);
+        }
+
+        obj->attrs->numFreeBlocks++;
+
+        /* Make sure the attrs are written out to memory */
+        if (obj->cacheEnabled) {
+            Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                Cache_Type_ALL, TRUE);
+        }
+    }
+
+    /* Leave the gate */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_getStats ========
+ */
+Void ti_sdo_ipc_heaps_HeapBufMP_getStats(ti_sdo_ipc_heaps_HeapBufMP_Object *obj,
+        Memory_Stats *stats)
+{
+    IArg key;
+    SizeT blockSize;
+
+    /* This is read-only, so do not need cache management */
+    blockSize = obj->attrs->blockSize;
+
+    /* Total size is constant */
+    stats->totalSize = blockSize * obj->attrs->numBlocks;
+
+    if (ti_sdo_ipc_heaps_HeapBufMP_trackAllocs) {
+        /*
+         * Protect this section so that numFreeBlocks doesn't change
+         * between totalFreeSize and largestFreeSize
+         */
+        key = GateMP_enter((GateMP_Handle)obj->gate);
+        /* Tracking enabled. Make sure the attrs are not in cache */
+        if (obj->cacheEnabled) {
+            Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                    Cache_Type_ALL, TRUE);
+        }
+
+        stats->totalFreeSize     = blockSize * obj->attrs->numFreeBlocks;
+        stats->largestFreeSize   = (obj->attrs->numFreeBlocks > 0) ?
+                                    blockSize : 0;
+
+        GateMP_leave((GateMP_Handle)obj->gate, key);
+    }
+    else {
+        /* Tracking disabled */
+        stats->totalFreeSize    = 0;
+        stats->largestFreeSize  = 0;
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_isBlocking ========
+ */
+Bool ti_sdo_ipc_heaps_HeapBufMP_isBlocking(
+        ti_sdo_ipc_heaps_HeapBufMP_Object *obj)
+{
+    Bool flag = FALSE;
+
+    // TODO figure out how to determine whether the gate is blocking...
+    return (flag);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *                          Shared memory Layout:
+ *
+ *          sharedAddr   -> ---------------------------
+ *                         |  HeapBufMP_Attrs        |
+ *                         |  (minAlign PADDING)     |
+ *                         |-------------------------|
+ *                         |  ListMP shared instance |
+ *                         |  (bufAlign PADDING)     |
+ *                         |-------------------------|
+ *                         |  HeapBufMP BUFFER       |
+ *                         |-------------------------|
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapBufMP_postInit ========
+ *  Slice and dice the buffer up into the correct size blocks and
+ *  add to the freelist.
+ */
+Void ti_sdo_ipc_heaps_HeapBufMP_postInit(ti_sdo_ipc_heaps_HeapBufMP_Object *obj,
+        Error_Block *eb)
+{
+    UInt i;
+    Char *buf;
+    SizeT minAlign;
+    HeapBufMP_Params heapParams;
+    ListMP_Params listMPParams;
+    IHeap_Handle regionHeap;
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+    }
+
+    if (obj->attrs == NULL) {
+        HeapBufMP_Params_init(&heapParams);
+        heapParams.regionId     = obj->regionId;
+        heapParams.numBlocks    = obj->numBlocks;
+        heapParams.align        = obj->align;
+        heapParams.blockSize    = obj->blockSize;
+        obj->allocSize  =  HeapBufMP_sharedMemReq(&heapParams);
+
+        regionHeap = SharedRegion_getHeap(obj->regionId);
+        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);
+        obj->attrs = Memory_alloc(regionHeap, obj->allocSize, minAlign, eb);
+        if (obj->attrs == NULL) {
+            return;
+        }
+    }
+
+    /* Store the GateMP sharedAddr in the HeapBuf Attrs */
+    obj->attrs->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
+
+    /* Create the freeList */
+    ListMP_Params_init(&listMPParams);
+    listMPParams.sharedAddr = (Ptr)_Ipc_roundup((UInt32)obj->attrs +
+            sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs), minAlign);
+    listMPParams.gate       = (GateMP_Handle)obj->gate;
+    obj->freeList   = (ti_sdo_ipc_ListMP_Handle)ListMP_create(&listMPParams);
+    if (obj->freeList == NULL) {
+        return;
+    }
+
+    obj->buf        = (Ptr)((SizeT)listMPParams.sharedAddr +
+                            ListMP_sharedMemReq(&listMPParams));
+
+    obj->attrs->numFreeBlocks = obj->numBlocks;
+    obj->attrs->minFreeBlocks = (UInt)-1;
+    obj->attrs->blockSize     = obj->blockSize;
+    obj->attrs->align         = obj->align;
+    obj->attrs->numBlocks     = obj->numBlocks;
+    obj->attrs->exact         = obj->exact ? 1 : 0;
+
+    /* Adjust obj->buf and put a SRPtr in attrs */
+    buf = obj->buf = (Ptr)_Ipc_roundup(obj->buf, obj->align);
+    obj->attrs->bufPtr = SharedRegion_getSRPtr(obj->buf, obj->regionId);
+
+    /*
+     * Split the buffer into blocks that are length "blockSize" and
+     * add into the freeList Queue.
+     */
+    for (i = 0; i < obj->numBlocks; i++) {
+        /* Add the block to the freeList */
+        ListMP_putTail((ListMP_Handle)obj->freeList, (ListMP_Elem *)buf);
+
+        buf += obj->blockSize;
+    }
+
+    /* Last thing, set the status */
+    obj->attrs->status = ti_sdo_ipc_heaps_HeapBufMP_CREATED;
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapBufMP_Attrs),
+                Cache_Type_ALL, TRUE);
+    }
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapBufMP.xdc b/packages/ti/sdo/ipc/heaps/HeapBufMP.xdc
new file mode 100644 (file)
index 0000000..ffed61b
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapBufMP.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.heaps;
+
+import ti.sdo.ipc.ListMP;
+import ti.sdo.ipc.SharedRegion;
+import ti.sdo.ipc.Ipc;
+import ti.sdo.ipc.GateMP;
+import ti.sdo.utils.NameServer;
+
+import xdc.rov.ViewInfo;
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== HeapBufMP ========
+ *  Multi-processor fixed-size buffer heap implementation
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/HeapBufMP.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>HeapBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ *  It is important to note that allocation tracking is disabled by default in
+ *  {@link #trackAllocs}.  Disabling allocation tracking improves alloc/free
+ *  performance especially when cache calls are required in shared memory.
+ */
+
+@InstanceInitError
+@InstanceFinalize
+
+module HeapBufMP inherits xdc.runtime.IHeap
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      name;
+        Ptr         buf;
+        String      objType;
+        Ptr         gate;
+        Bool        exact;
+        SizeT       align;
+        SizeT       blockSize;
+        UInt        numBlocks;
+        UInt        curAllocated;
+        UInt        maxAllocated;
+        Ptr         freeList;
+    }
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                [
+                    'Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ]
+            ]
+        });
+
+    /*!
+     *  Assert raised when freeing a block that is not in the buffer's range
+     */
+    config Assert.Id A_invBlockFreed =
+        {msg: "A_invBlockFreed: Invalid block being freed"};
+
+    /*!
+     *  Assert raised when freeing a block that isn't aligned properly
+     */
+    config Assert.Id A_badAlignment =
+        {msg: "A_badAlignment: Block being freed is not aligned properly "};
+
+    /*!
+     *  Error raised when a requested alloc size is too large
+     */
+    config Error.Id E_sizeTooLarge =
+        {msg: "E_sizeTooLarge: Requested alloc size of %u is greater than %u"};
+
+    /*!
+     *  Error raised when a requested alignment is too large
+     */
+    config Error.Id E_alignTooLarge =
+        {msg: "E_alignTooLarge: Requested alignment size of %u is greater than %u"};
+
+    /*!
+     *  Error raised when exact matching failed
+     */
+    config Error.Id E_exactFail =
+        {msg: "E_exactFail: Exact allocation failed (requested size = %u and buffer size = %u)"};
+
+    /*!
+     *  Error raised when there are no more blocks left in the buffer
+     */
+    config Error.Id E_noBlocksLeft =
+        {msg: "E_noBlocksLeft: No more blocks left in buffer (handle = 0x%x, requested size = %u)"};
+
+    /*!
+     *  Maximum runtime entries
+     *
+     *  Maximum number of HeapBufMP's that can be dynamically created and
+     *  added to the NameServer.
+     *
+     *  To minimize the amount of runtime allocation, this parameter allows
+     *  the pre-allocation of memory for the HeapBufMP's NameServer table.
+     *  The default is to allow growth (i.e. memory allocation when
+     *  creating a new instance).
+     */
+    metaonly config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+
+    /*!
+     *  Maximum length for heap names
+     */
+    config UInt maxNameLen = 32;
+
+    /*!
+     *  Section name is used to place the names table
+     *
+     *  The default value of NULL implies that no explicit placement is
+     *  performed.
+     */
+    metaonly config String tableSection = null;
+
+    /*!
+     *  Track the number of allocated blocks
+     *
+     *  This will enable/disable the tracking of the current and maximum number
+     *  of allocations for a HeapBufMP instance.  This maximum refers to the
+     *  "all time" maximum number of allocations for the history of a HeapBufMP
+     *  instance.
+     *
+     *  Tracking allocations might adversely affect performance when allocating
+     *  and/or freeing.  This is especially true if cache is enabled for the
+     *  shared region.  If this feature is not needed, setting this to false
+     *  avoids the performance penalty.
+     */
+    config Bool trackAllocs = false;
+
+instance:
+
+    /*!
+     *  GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+    config GateMP.Handle gate = null;
+
+    /*! @_nodoc
+     *  Set to TRUE by the open() call. No one else should touch this!
+     */
+    config Bool openFlag = false;
+
+    /*!
+     *  Use exact matching
+     *
+     *  Setting this flag will allow allocation only if the requested size
+     *  is equal to (rather than less than or equal to) the buffer's block
+     *  size.
+     */
+    config Bool exact = false;
+
+    /*!
+     *  Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all HeapBufMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     */
+    config String name = null;
+
+    /*!
+     *  Alignment (in MAUs) of each block.
+     *
+     *  The alignment must be a power of 2. If the value 0 is specified,
+     *  the value will be changed to meet the minimum structure alignment
+     *  requirements (refer to
+     *  {@link xdc.runtime.Memory#getMaxDefaultTypeAlign} and
+     *  {@link xdc.runtime.Memory#getMaxDefaultTypeAlignMeta} and
+     *  the cache alignment size of the region in which the heap will
+     *  be placed.  Therefore, the actual alignment may be larger.
+     *
+     *  The default alignment is 0.
+     */
+    config SizeT align = 0;
+
+    /*!
+     *  Number of fixed-size blocks.
+     *
+     *  This is a required parameter for all new HeapBufMP instances.
+     */
+    config UInt numBlocks = 0;
+
+    /*!
+     *  Size (in MAUs) of each block.
+     *
+     *  HeapBufMP will round the blockSize up to the nearest multiple of the
+     *  alignment, so the actual blockSize may be larger. When creating a
+     *  HeapBufMP dynamically, this needs to be taken into account to determine
+     *  the proper buffer size to pass in.
+     *
+     *  Required parameter.
+     *
+     *  The default size of the blocks is 0 MAUs.
+     */
+    config SizeT blockSize = 0;
+
+    /*!
+     *  Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  will be allocated.
+     */
+    config UInt16 regionId = 0;
+
+    /*! @_nodoc
+     *  Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  heap at a specific location in shared memory.  If sharedAddr is null,
+     *  then shared memory for a new instance will be allocated from the
+     *  heap belonging to the region identified by {@link #regionId}.
+     */
+    config Ptr sharedAddr = null;
+
+    @DirectCall
+    override Ptr alloc(SizeT size, SizeT align, xdc.runtime.Error.Block *eb);
+
+    @DirectCall
+    override Void free(Ptr block, SizeT size);
+
+internal:
+
+    /*! Used in the attrs->status field */
+    const UInt32 CREATED = 0x05251995;
+
+    /*!
+     *  This Params object is used for temporary storage of the
+     *  module wide parameters that are for setting the NameServer instance.
+     */
+    metaonly config NameServer.Params nameSrvPrms;
+
+    /*! slice and dice the buffer */
+    Void postInit(Object *obj, Error.Block *eb);
+
+    /*! Structure of attributes in shared memory */
+    struct Attrs {
+        Bits32              status;
+        SharedRegion.SRPtr  gateMPAddr;     /* GateMP SRPtr (shm safe)       */
+        SharedRegion.SRPtr  bufPtr;         /* Memory managed by instance    */
+        Bits32              numFreeBlocks;  /* Number of free blocks         */
+        Bits32              minFreeBlocks;  /* Min number of free blocks     */
+        Bits32              blockSize;      /* True size of each block       */
+        Bits32              align;          /* Alignment of each block       */
+        Bits32              numBlocks;      /* Number of individual blocks.  */
+        Bits16              exact;          /* For 'exact' allocation        */
+    }
+
+    struct Instance_State {
+        Attrs               *attrs;
+        GateMP.Handle       gate;           /* Gate for critical regions     */
+        Ipc.ObjType         objType;        /* See enum ObjType              */
+        Ptr                 nsKey;          /* Used to remove NS entry       */
+        Bool                cacheEnabled;   /* Whether to do cache calls     */
+        UInt16              regionId;       /* SharedRegion index            */
+        SizeT               allocSize;      /* Shared memory allocated       */
+        Char                *buf;           /* Local pointer to buf          */
+        ListMP.Handle       freeList;       /* List of free buffers          */
+        SizeT               blockSize;      /* Adjusted blockSize            */
+        SizeT               align;          /* Adjusted alignment            */
+        UInt                numBlocks;      /* Number of blocks in buffer    */
+        Bool                exact;          /* Exact match flag              */
+    };
+
+    struct Module_State {
+        NameServer.Handle   nameServer;     /* NameServer for this module    */
+    };
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapBufMP.xs b/packages/ti/sdo/ipc/heaps/HeapBufMP.xs
new file mode 100644 (file)
index 0000000..aee3850
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapBufMP.xs ========
+ *
+ */
+
+var HeapBufMP       = null;
+var SharedRegion    = null;
+var NameServer      = null;
+var ListMP          = null;
+var Ipc             = null;
+var Cache           = null;
+var GateMP          = null;
+var Memory          = null;
+
+var instCount = 0;  /* use to determine if processing last instance */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    HeapBufMP       = this;
+    NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    ListMP          = xdc.useModule("ti.sdo.ipc.ListMP");
+    SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP          = xdc.useModule('ti.sdo.ipc.GateMP');
+    Cache           = xdc.useModule('ti.sysbios.hal.Cache');
+    Memory          = xdc.useModule('xdc.runtime.Memory');
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    mod.nameServer  = null;
+
+    /* initialize the NameServer param to be used now or later */
+    HeapBufMP.nameSrvPrms.maxRuntimeEntries = params.maxRuntimeEntries;
+    HeapBufMP.nameSrvPrms.tableSection      = params.tableSection;
+    HeapBufMP.nameSrvPrms.maxNameLen        = params.maxNameLen;
+
+    /*
+     *  Get the current number of created static instances of this module.
+     *  Note: if user creates a static instance after this point and
+     *        expects to use NameServer, this is a problem.
+     */
+    var instCount = this.$instances.length;
+
+    /* create NameServer here only if no static instances are created */
+    if (instCount == 0) {
+        mod.nameServer = NameServer.create("HeapBufMP",
+                                            HeapBufMP.nameSrvPrms);
+    }
+}
+
+
+/*
+ *  ======== viewInitBasic ========
+ *  Initialize the 'Basic' HeapBufMP instance view.
+ */
+function viewInitBasic(view, obj)
+{
+    var NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    var HeapBufMP       = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+    view.name       = NameServer.getName$view("HeapBufMP",
+                      SharedRegion.getSRPtrMeta$view(obj.attrs));
+    view.buf        = $addr(obj.buf);
+    view.objType    = Ipc.getObjTypeStr$view(obj.objType);
+    view.gate       = obj.gate;
+    view.exact      = obj.exact;
+    view.align      = obj.align;
+    view.blockSize  = obj.blockSize;
+    view.numBlocks  = obj.numBlocks;
+
+    var modCfg = Program.getModuleConfig('ti.sdo.ipc.heaps.HeapBufMP');
+
+    try {
+        var attrs = Program.fetchStruct(HeapBufMP.Attrs$fetchDesc,
+                                        obj.attrs.$addr, false);
+
+        var dataViews = Program.scanInstanceDataView('ti.sdo.ipc.ListMP',
+            'Lists');
+
+        /*
+         *  Compute 'numFreeBlocks' by counting the number of elements
+         *  on the freeList
+         */
+        for each (var dataView in dataViews) {
+            if (dataView.label.match(Number(obj.freeList).toString(16))) {
+                var numFreeBlocks = dataView.elements.length;
+            }
+        }
+
+        view.curAllocated  = obj.numBlocks - numFreeBlocks;
+
+        if (modCfg.trackAllocs) {
+            /* Compute only if trackMaxAllocs. Otherwise leave blank */
+            if (attrs.minFreeBlocks != 0xFFFFFFFF) {
+                var minFreeBlocks = attrs.minFreeBlocks;
+            }
+            else {
+                var minFreeBlocks = obj.numBlocks;
+
+            }
+            view.maxAllocated = obj.numBlocks - minFreeBlocks;
+        }
+
+        if (view.curAllocated < 0) {
+            view.$status["curAllocated"] = "Error: curAllocated" +
+                    " < 0! (possibly caused by an invalid free)";
+        }
+    }
+    catch (e) {
+        view.$status["curAllocated"] = view.$status["maxAllocated"] =
+            "Error:  could not access shared memory to retreive stats: " + e;
+    }
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapMemMP.c b/packages/ti/sdo/ipc/heaps/HeapMemMP.c
new file mode 100644 (file)
index 0000000..c5f79b7
--- /dev/null
@@ -0,0 +1,988 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapMemMP.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/heaps/_HeapMemMP.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/_GateMP.h>
+
+#include "package/internal/HeapMemMP.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(HeapMemMP_Params_init);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_alloc);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_close);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_create);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_delete);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_free);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_getExtendedStats);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_getStats);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_open);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_openByAddr);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_restore);
+    #pragma FUNC_EXT_CALLED(HeapMemMP_sharedMemReq);
+#endif
+
+/*
+ *  ======== HeapMemMP_getSharedParams ========
+ */
+static Void HeapMemMP_getSharedParams(HeapMemMP_Params *sparams,
+        const ti_sdo_ipc_heaps_HeapMemMP_Params *params)
+{
+    sparams->gate        = (GateMP_Handle)params->gate;
+    sparams->name        = params->name;
+    sparams->regionId    =  params->regionId;
+    sparams->sharedAddr  =  params->sharedAddr;
+    sparams->sharedBufSize = params->sharedBufSize;
+}
+
+/*
+ *  ======== HeapMemMP_getRTSCParams ========
+ */
+static Void HeapMemMP_getRTSCParams(
+        ti_sdo_ipc_heaps_HeapMemMP_Params *params,
+        const HeapMemMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_Params_init(params);
+
+    params->gate = (ti_sdo_ipc_GateMP_Handle)sparams->gate;
+    params->name = sparams->name;
+    params->regionId = sparams->regionId;
+    params->sharedAddr  =  sparams->sharedAddr;
+    params->sharedBufSize = sparams->sharedBufSize;
+}
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== HeapMemMP_Params_init ========
+ */
+Void HeapMemMP_Params_init(HeapMemMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_Params params;
+
+    ti_sdo_ipc_heaps_HeapMemMP_Params_init(&params);
+    HeapMemMP_getSharedParams(sparams, &params);
+}
+
+/*
+ *  ======== HeapMemMP_alloc ========
+ */
+Ptr HeapMemMP_alloc(HeapMemMP_Handle handle, SizeT size, SizeT align)
+{
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    return (ti_sdo_ipc_heaps_HeapMemMP_alloc(
+            (ti_sdo_ipc_heaps_HeapMemMP_Handle)handle, size, align, &eb));
+}
+
+/*
+ *  ======== HeapMemMP_create ========
+ */
+HeapMemMP_Handle HeapMemMP_create(const HeapMemMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_Params params;
+    ti_sdo_ipc_heaps_HeapMemMP_Object *obj;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    if (sparams != NULL) {
+        HeapMemMP_getRTSCParams(&params, (Ptr)sparams);
+
+        /* call the module create */
+        obj = ti_sdo_ipc_heaps_HeapMemMP_create(&params, &eb);
+    }
+    else {
+        obj = ti_sdo_ipc_heaps_HeapMemMP_create(NULL, &eb);
+    }
+
+    return ((HeapMemMP_Handle)obj);
+}
+
+/*
+ *  ======== HeapMemMP_close ========
+ */
+Int HeapMemMP_close(HeapMemMP_Handle *handlePtr)
+{
+    HeapMemMP_delete(handlePtr);
+
+    return (HeapMemMP_S_SUCCESS);
+}
+
+/*
+ *  ======== HeapMemMP_delete ========
+ */
+Int HeapMemMP_delete(HeapMemMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_delete(
+            (ti_sdo_ipc_heaps_HeapMemMP_Handle *)handlePtr);
+
+    return (HeapMemMP_S_SUCCESS);
+}
+
+/*
+ *  ======== HeapMemMP_free ========
+ */
+Void HeapMemMP_free(HeapMemMP_Handle handle, Ptr addr, SizeT size)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_free(
+            (ti_sdo_ipc_heaps_HeapMemMP_Handle)handle, addr, size);
+}
+
+/*
+ *  ======== HeapMemMP_getExtendedStats ========
+ */
+Void HeapMemMP_getExtendedStats(HeapMemMP_Handle handle,
+        HeapMemMP_ExtendedStats *stats)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_Object *obj =
+            (ti_sdo_ipc_heaps_HeapMemMP_Object *)handle;
+
+    stats->buf   = obj->buf;
+    stats->size  = obj->bufSize;
+}
+
+/*
+ *  ======== HeapMemMP_getStats ========
+ */
+Void HeapMemMP_getStats(HeapMemMP_Handle handle, Ptr stats)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_getStats(
+        (ti_sdo_ipc_heaps_HeapMemMP_Handle)handle, (Memory_Stats *)stats);
+}
+
+/*
+ *  ======== HeapMemMP_open ========
+ */
+Int HeapMemMP_open(String name, HeapMemMP_Handle *handlePtr)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Int status;
+    Ptr sharedAddr;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* Assert that a pointer has been supplied */
+    Assert_isTrue(handlePtr != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /* Assert that a name has been supplied */
+    Assert_isTrue(name != NULL, ti_sdo_ipc_Ipc_A_invParam);
+
+    /* Open by name */
+    status = NameServer_getUInt32(
+            (NameServer_Handle)HeapMemMP_module->nameServer, name,
+            &sharedShmBase, ti_sdo_utils_MultiProc_procIdList);
+
+    if (status < 0) {
+        /* Name not found. */
+        *handlePtr = NULL;
+        return (HeapMemMP_E_NOTFOUND);
+    }
+
+    sharedAddr = SharedRegion_getPtr(sharedShmBase);
+
+    status = HeapMemMP_openByAddr(sharedAddr, handlePtr);
+
+    return (status);
+}
+
+/*
+ *  ======== HeapMemMP_openByAddr ========
+ */
+Int HeapMemMP_openByAddr(Ptr sharedAddr,
+                         HeapMemMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_Params params;
+    ti_sdo_ipc_heaps_HeapMemMP_Attrs *attrs;
+    Int status;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    ti_sdo_ipc_heaps_HeapMemMP_Params_init(&params);
+
+    /* Tell Instance_init() that we're opening */
+    params.openFlag = TRUE;
+
+    params.sharedAddr = sharedAddr;
+    attrs = (ti_sdo_ipc_heaps_HeapMemMP_Attrs *)sharedAddr;
+
+    if (SharedRegion_isCacheEnabled(SharedRegion_getId(sharedAddr))) {
+        Cache_inv(attrs, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Attrs),
+                Cache_Type_ALL, TRUE);
+    }
+
+    if (attrs->status != ti_sdo_ipc_heaps_HeapMemMP_CREATED) {
+        *handlePtr = NULL;
+        status = HeapMemMP_E_NOTFOUND;
+    }
+    else {
+        *handlePtr = (HeapMemMP_Handle)ti_sdo_ipc_heaps_HeapMemMP_create(
+                &params, &eb);
+        if (*handlePtr == NULL) {
+            status = HeapMemMP_E_FAIL;
+        }
+        else {
+            status = HeapMemMP_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== HeapMemMP_restore ========
+ *  The buffer should have the properly alignment at this
+ *  point (either from instance$static$init in HeapMemMP.xs or
+ *  from the above HeapMemMP_Instance_init).
+ */
+Void HeapMemMP_restore(HeapMemMP_Handle handle)
+{
+    ti_sdo_ipc_heaps_HeapMemMP_Object *obj =
+            (ti_sdo_ipc_heaps_HeapMemMP_Object *)handle;
+
+    ti_sdo_ipc_heaps_HeapMemMP_Header *begHeader;
+
+    /*
+     *  Fill in the top of the memory block
+     *  next: pointer will be NULL (end of the list)
+     *  size: size of this block
+     *  NOTE: no need to Cache_inv because obj->attrs->bufPtr should be const
+     */
+    begHeader = (ti_sdo_ipc_heaps_HeapMemMP_Header *)obj->buf;
+    begHeader->next = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+    begHeader->size = obj->bufSize;
+
+    obj->attrs->head.next = obj->attrs->bufPtr;
+    if (obj->cacheEnabled) {
+        Cache_wbInv(&(obj->attrs->head),
+                sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header), Cache_Type_ALL,
+                FALSE);
+        Cache_wbInv(begHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                Cache_Type_ALL, TRUE);
+    }
+}
+
+/*
+ *  ======== HeapMemMP_sharedMemReq ========
+ */
+SizeT HeapMemMP_sharedMemReq(const HeapMemMP_Params *params)
+{
+    SizeT memReq, minAlign;
+    UInt16 regionId;
+
+    /* Ensure that the sharedBufSize param has been set */
+    Assert_isTrue(params->sharedBufSize != 0, ti_sdo_ipc_Ipc_A_invParam);
+
+    if (params->sharedAddr == NULL) {
+        regionId = params->regionId;
+    }
+    else {
+        regionId = SharedRegion_getId(params->sharedAddr);
+    }
+
+    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    minAlign = sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header);
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    /* Add size of HeapBufMP Attrs */
+    memReq = _Ipc_roundup(sizeof(ti_sdo_ipc_heaps_HeapMemMP_Attrs), minAlign);
+
+    /* Add the buffer size */
+    memReq += params->sharedBufSize;
+
+    /* Make sure the size is a multiple of minAlign (round down) */
+    memReq = (memReq / minAlign) * minAlign;
+
+    return((SizeT)memReq);
+}
+
+/*
+ *************************************************************************
+ *                      Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMemMP_Instance_init ========
+ */
+Int ti_sdo_ipc_heaps_HeapMemMP_Instance_init(
+        ti_sdo_ipc_heaps_HeapMemMP_Object *obj,
+        const ti_sdo_ipc_heaps_HeapMemMP_Params *params,
+        Error_Block *eb)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Ptr localAddr;
+    Int status;
+
+    /* Assert that sharedBufSize is sufficient */
+    Assert_isTrue(params->openFlag == TRUE ||
+                  params->sharedBufSize != 0,
+                  ti_sdo_ipc_Ipc_A_invParam);
+
+    obj->nsKey          = NULL;
+    obj->allocSize      = 0;
+
+    if (params->openFlag == TRUE) {
+        /* Opening the gate */
+        obj->attrs      = (ti_sdo_ipc_heaps_HeapMemMP_Attrs *)
+            params->sharedAddr;
+
+        /* No need to Cache_inv- already done in openByAddr() */
+        obj->buf            = (Char *)SharedRegion_getPtr(
+                                    obj->attrs->bufPtr);
+        obj->bufSize        = obj->attrs->head.size;
+        obj->objType        = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+        obj->regionId       = SharedRegion_getId(obj->buf);
+        obj->cacheEnabled   = SharedRegion_isCacheEnabled(obj->regionId);
+
+        /* Set minAlign */
+        obj->minAlign = sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header);
+        if (SharedRegion_getCacheLineSize(obj->regionId) > obj->minAlign) {
+            obj->minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+        }
+
+        localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
+
+        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&(obj->gate));
+        if (status != GateMP_S_SUCCESS) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return(1);
+        }
+
+        return(0);
+    }
+
+    /* Creating the heap */
+    if (params->gate != NULL) {
+        obj->gate       = params->gate;
+    }
+    else {
+        /* If no gate specified, get the default system gate */
+        obj->gate       = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+    }
+
+    obj->bufSize        = params->sharedBufSize;
+
+    if (params->sharedAddr == NULL) {
+        /* Creating using a shared region ID */
+        obj->objType    = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
+        obj->attrs      = NULL; /* Will be alloc'ed in postInit */
+        obj->regionId   = params->regionId;
+    }
+    else {
+        /* Creating using sharedAddr */
+        obj->regionId   = SharedRegion_getId(params->sharedAddr);
+
+        /* Assert that the buffer is in a valid shared region */
+        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+        /* Assert that sharedAddr is cache aligned */
+        Assert_isTrue(((UInt32)params->sharedAddr %
+                      SharedRegion_getCacheLineSize(obj->regionId) == 0),
+                      ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+        obj->objType    = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+
+        /* obj->buf will get alignment-adjusted in postInit */
+        obj->buf        = (Ptr)((UInt32)params->sharedAddr +
+                          sizeof(ti_sdo_ipc_heaps_HeapMemMP_Attrs));
+        obj->attrs     = (ti_sdo_ipc_heaps_HeapMemMP_Attrs *)params->sharedAddr;
+    }
+
+    obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+
+    /* Set minAlign */
+    obj->minAlign = sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header);
+    if (SharedRegion_getCacheLineSize(obj->regionId) > obj->minAlign) {
+        obj->minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+    }
+
+    HeapMemMP_postInit(obj, eb);
+    if (Error_check(eb)) {
+        return(2);
+    }
+
+    /* Add entry to NameServer */
+    if (params->name != NULL) {
+        /* We will store a shared pointer in the NameServer */
+        sharedShmBase = SharedRegion_getSRPtr(obj->attrs,
+                                              obj->regionId);
+        obj->nsKey = NameServer_addUInt32((NameServer_Handle)
+                HeapMemMP_module->nameServer, params->name,
+                (UInt32)sharedShmBase);
+
+        if (obj->nsKey == NULL) {
+            /* NameServer_addUInt32 failed */
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
+            return (3);
+        }
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMemMP_Instance_finalize ========
+ */
+Void ti_sdo_ipc_heaps_HeapMemMP_Instance_finalize(
+        ti_sdo_ipc_heaps_HeapMemMP_Object *obj, Int status)
+{
+    if (obj->objType & (ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC |
+                        ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION)) {
+        /* Remove entry from NameServer */
+        if (obj->nsKey != NULL) {
+            NameServer_removeEntry((NameServer_Handle)
+                    HeapMemMP_module->nameServer, obj->nsKey);
+        }
+
+        if (obj->attrs != NULL) {
+            /* Set status to 'not created' */
+            obj->attrs->status = 0;
+            if (obj->cacheEnabled) {
+                Cache_wbInv(obj->attrs,
+                            sizeof(ti_sdo_ipc_heaps_HeapMemMP_Attrs),
+                            Cache_Type_ALL, TRUE);
+            }
+        }
+
+        /*
+         *  Free the shared memory back to the region heap. If NULL, then the
+         *  Memory_alloc failed.
+         */
+        if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION
+            && obj->attrs != NULL) {
+            Memory_free(SharedRegion_getHeap(obj->regionId), obj->attrs,
+                        obj->allocSize);
+        }
+    }
+    else {
+        /* Heap is being closed */
+        /* Close the gate. If NULL, then GateMP_openByAddr failed. */
+        if (obj->gate != NULL) {
+            GateMP_close((GateMP_Handle *)&(obj->gate));
+        }
+    }
+}
+
+/*
+ * NOTE:
+ * Embedded within the code for HeapMemMP_alloc and HeapMemMP_free are comments
+ * that can be used to match a shared memory reference with its required
+ * cache call.  This is done because the code for alloc and free is complex.
+ * These two-character comments indicate
+ * 1) The type of cache operation that is being performed {A, B}
+ *    A = Cache_inv
+ *    B = Cache_wbInv
+ * 2) A numerical id of the specific cache call that is performed.
+ *    1, 2, 3
+ *    For example, the comment 'A2' indicates that the corresponding cache call
+ *    is a Cache_inv operation identified by the number '2'
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMemMP_alloc ========
+ *  HeapMemMP is implemented such that all of the memory and blocks it works
+ *  with have an alignment that is a multiple of the minimum alignment and have
+ *  a size which is a multiple of the minAlign. Maintaining this requirement
+ *  throughout the implementation ensures that there are never any odd
+ *  alignments or odd block sizes to deal with.
+ *
+ *  Specifically:
+ *  The buffer managed by HeapMemMP:
+ *    1. Is aligned on a multiple of obj->minAlign
+ *    2. Has an adjusted size that is a multiple of obj->minAlign
+ *  All blocks on the freelist:
+ *    1. Are aligned on a multiple of obj->minAlign
+ *    2. Have a size that is a multiple of obj->minAlign
+ *  All allocated blocks:
+ *    1. Are aligned on a multiple of obj->minAlign
+ *    2. Have a size that is a multiple of obj->minAlign
+ *
+ */
+Ptr ti_sdo_ipc_heaps_HeapMemMP_alloc(ti_sdo_ipc_heaps_HeapMemMP_Object *obj,
+    SizeT reqSize, SizeT reqAlign, Error_Block *eb)
+{
+    IArg key;
+    ti_sdo_ipc_heaps_HeapMemMP_Header *prevHeader, *newHeader, *curHeader;
+    Char *allocAddr;
+    Memory_Size curSize, adjSize;
+    SizeT remainSize; /* free memory after allocated memory */
+    SizeT adjAlign, offset;
+
+    /* Assert that requested align is a power of 2 */
+    Assert_isTrue((reqAlign & (reqAlign - 1)) == 0,
+        ti_sdo_ipc_heaps_HeapMemMP_A_align);
+
+    /* Assert that requested block size is non-zero */
+    Assert_isTrue(reqSize != 0, ti_sdo_ipc_heaps_HeapMemMP_A_zeroBlock);
+
+    adjSize = (Memory_Size)reqSize;
+
+    /* Make size requested a multiple of obj->minAlign */
+    if ((offset = (adjSize & (obj->minAlign - 1))) != 0) {
+        adjSize = adjSize + (obj->minAlign - offset);
+    }
+
+    /*
+     *  Make sure the alignment is at least as large as obj->minAlign
+     *  Note: adjAlign must be a power of 2 (by function constraint) and
+     *  obj->minAlign is also a power of 2,
+     */
+    adjAlign = reqAlign;
+    if (adjAlign & (obj->minAlign - 1)) {
+        /* adjAlign is less than obj->minAlign */
+        adjAlign = obj->minAlign;
+    }
+
+    /* No need to Cache_inv Attrs- 'head' should be constant */
+    prevHeader = &(obj->attrs->head);
+
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    /*
+     *  The block will be allocated from curHeader. Maintain a pointer to
+     *  prevHeader so prevHeader->next can be updated after the alloc.
+     */
+    if (obj->cacheEnabled) {
+        Cache_inv(prevHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                  Cache_Type_ALL, TRUE); /* A1 */
+    }
+    curHeader = (ti_sdo_ipc_heaps_HeapMemMP_Header *)
+        SharedRegion_getPtr(prevHeader->next); /* A1 */
+
+    /* Loop over the free list. */
+    while (curHeader != NULL) {
+        /* Invalidate curHeader */
+        if (obj->cacheEnabled) {
+            Cache_inv(curHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                      Cache_Type_ALL, TRUE); /* A2 */
+        }
+        curSize = curHeader->size;
+
+        /*
+         *  Determine the offset from the beginning to make sure
+         *  the alignment request is honored.
+         */
+        offset = (Memory_Size)curHeader & (adjAlign - 1);
+        if (offset) {
+            offset = adjAlign - offset;
+        }
+
+        /* Internal Assert that offset is a multiple of obj->minAlign */
+        Assert_isTrue(((offset & (obj->minAlign - 1)) == 0),
+                ti_sdo_ipc_Ipc_A_internal);
+
+        /* big enough? */
+        if (curSize >= (adjSize + offset)) {
+
+            /* Set the pointer that will be returned. Alloc from front */
+            allocAddr = (Char *)((Memory_Size)curHeader + offset);
+
+            /*
+             *  Determine the remaining memory after the allocated block.
+             *  Note: this cannot be negative because of above comparison.
+             */
+            remainSize = curSize - adjSize - offset;
+
+            /* Internal Assert that remainSize is a multiple of obj->minAlign */
+            Assert_isTrue(((remainSize & (obj->minAlign - 1)) == 0),
+                           ti_sdo_ipc_Ipc_A_internal);
+
+            /*
+             *  If there is memory at the beginning (due to alignment
+             *  requirements), maintain it in the list.
+             *
+             *  offset and remainSize must be multiples of
+             *  sizeof(HeapMemMP_Header). Therefore the address of the newHeader
+             *  below must be a multiple of the sizeof(HeapMemMP_Header), thus
+             *  maintaining the requirement.
+             */
+            if (offset) {
+
+                /* Adjust the curHeader size accordingly */
+                curHeader->size = offset; /* B2 */
+                /* Cache wb at end of this if block */
+
+                /*
+                 *  If there is remaining memory, add into the free list.
+                 *  Note: no need to coalesce and we have HeapMemMP locked so
+                 *        it is safe.
+                 */
+                if (remainSize) {
+                    newHeader = (ti_sdo_ipc_heaps_HeapMemMP_Header *)
+                        ((Memory_Size)allocAddr + adjSize);
+
+                    /* curHeader has been inv at top of 'while' loop */
+                    newHeader->next = curHeader->next;  /* B1 */
+                    newHeader->size = remainSize;       /* B1 */
+                    if (obj->cacheEnabled) {
+                        /* Writing back curHeader will cache-wait */
+                        Cache_wbInv(newHeader,
+                                sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                                Cache_Type_ALL, FALSE); /* B1 */
+                    }
+
+                    curHeader->next = SharedRegion_getSRPtr(newHeader,
+                                                            obj->regionId);
+                }
+                /* Write back (and invalidate) newHeader and curHeader */
+                if (obj->cacheEnabled) {
+                    /* B2 */
+                    Cache_wbInv(curHeader,
+                            sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                            Cache_Type_ALL, TRUE);
+                }
+            }
+            else {
+                /*
+                 *  If there is any remaining, link it in,
+                 *  else point to the next free block.
+                 *  Note: no need to coalesce and we have HeapMemMP locked so
+                 *        it is safe.
+                 */
+                if (remainSize) {
+                    newHeader = (ti_sdo_ipc_heaps_HeapMemMP_Header *)
+                        ((Memory_Size)allocAddr + adjSize);
+
+                    newHeader->next  = curHeader->next; /* A2, B3  */
+                    newHeader->size  = remainSize;      /* B3      */
+
+                    if (obj->cacheEnabled) {
+                        /* Writing back prevHeader will cache-wait */
+                        Cache_wbInv(newHeader,
+                                sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                                Cache_Type_ALL, FALSE); /* B3 */
+                    }
+
+                    /* B4 */
+                    prevHeader->next = SharedRegion_getSRPtr(newHeader,
+                                                             obj->regionId);
+                }
+                else {
+                    /* curHeader has been inv at top of 'while' loop */
+                    prevHeader->next = curHeader->next; /* A2, B4 */
+                }
+
+                if (obj->cacheEnabled) {
+                    /* B4 */
+                    Cache_wbInv(prevHeader,
+                            sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                            Cache_Type_ALL, TRUE);
+                }
+            }
+
+            GateMP_leave((GateMP_Handle)obj->gate, key);
+
+            /* Success, return the allocated memory */
+            return ((Ptr)allocAddr);
+        }
+        else {
+            prevHeader = curHeader;
+            curHeader = SharedRegion_getPtr(curHeader->next);
+        }
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    Error_raise(eb, ti_sdo_ipc_heaps_HeapMemMP_E_memory, (IArg)obj,
+            (IArg)reqSize);
+
+    return (NULL);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMemMP_free ========
+ */
+Void ti_sdo_ipc_heaps_HeapMemMP_free(ti_sdo_ipc_heaps_HeapMemMP_Object *obj,
+        Ptr addr, SizeT size)
+{
+    IArg key;
+    ti_sdo_ipc_heaps_HeapMemMP_Header *curHeader, *newHeader, *nextHeader;
+    SizeT offset;
+
+    /* Assert that 'addr' is cache aligned  */
+    Assert_isTrue(((UInt32)addr % obj->minAlign == 0),
+            ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+    /* Restore size to actual allocated size */
+    offset = size & (obj->minAlign - 1);
+    if (offset != 0) {
+        size += obj->minAlign - offset;
+    }
+
+    newHeader = (ti_sdo_ipc_heaps_HeapMemMP_Header *)addr;
+
+    /*
+     *  Invalidate entire buffer being freed to ensure that stale cache
+     *  data in block isn't evicted later
+     */
+    if (obj->cacheEnabled) {
+        Cache_inv(newHeader, size, Cache_Type_ALL, FALSE);
+    }
+
+    /*
+     * obj->attrs never changes, doesn't need Gate protection
+     * and Cache invalidate
+     */
+    curHeader = &(obj->attrs->head);
+
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (obj->cacheEnabled) {
+        /* A1 */
+        Cache_inv(curHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                Cache_Type_ALL, TRUE);
+    }
+
+    nextHeader = SharedRegion_getPtr(curHeader->next);
+
+    /* Make sure the entire buffer is in the range of the heap. */
+    Assert_isTrue((((SizeT)newHeader >= (SizeT)obj->buf) &&
+                   ((SizeT)newHeader + size <=
+                    (SizeT)obj->buf + obj->bufSize)),
+                   ti_sdo_ipc_heaps_HeapMemMP_A_invalidFree);
+
+    /* Go down freelist and find right place for buf */
+    while (nextHeader != NULL && nextHeader < newHeader) {
+        if (obj->cacheEnabled) {
+            Cache_inv(nextHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                      Cache_Type_ALL, FALSE); /* A2 */
+        }
+
+        /* Make sure the addr is not in this free block */
+        Assert_isTrue((SizeT)newHeader >= (SizeT)nextHeader + nextHeader->size,
+                       ti_sdo_ipc_heaps_HeapMemMP_A_invalidFree); /* A2 */
+        curHeader = nextHeader;
+        /* A2 */
+        nextHeader = SharedRegion_getPtr(nextHeader->next);
+    }
+
+    /* B2 */
+    newHeader->next = SharedRegion_getSRPtr(nextHeader, obj->regionId);
+    newHeader->size = size;
+
+    /* B1, A1 */
+    curHeader->next = SharedRegion_getSRPtr(newHeader, obj->regionId);
+
+    /* Join contiguous free blocks */
+    if (nextHeader != NULL) {
+        /*
+         *  Verify the free size is not overlapping. Not all cases are
+         *  detectable, but it is worth a shot. Note: only do this
+         *  assert if nextHeader is non-NULL.
+         */
+        Assert_isTrue(((SizeT)newHeader + size) <= (SizeT)nextHeader,
+                      ti_sdo_ipc_heaps_HeapMemMP_A_invalidFree);
+
+        /* Join with upper block */
+        if (((Memory_Size)newHeader + size) == (Memory_Size)nextHeader) {
+            if (obj->cacheEnabled) {
+                Cache_inv(nextHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                          Cache_Type_ALL, TRUE);
+            }
+            newHeader->next = nextHeader->next; /* A2, B2 */
+            newHeader->size += nextHeader->size; /* A2, B2 */
+            size += obj->minAlign;
+
+            /* Don't Cache_wbInv, this will be done later */
+        }
+    }
+
+    /*
+     *  Join with lower block. Make sure to check to see if not the
+     *  first block. No need to invalidate attrs since head shouldn't change.
+     */
+    if ((curHeader != &obj->attrs->head) &&
+        ((Memory_Size)curHeader + curHeader->size == (Memory_Size)newHeader)) {
+        /*
+         * Don't Cache_inv newHeader since newHeader has data that
+         * hasn't been written back yet (B2)
+         */
+        curHeader->next = newHeader->next; /* B1, B2 */
+        curHeader->size += newHeader->size; /* B1, B2 */
+    }
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(curHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+             Cache_Type_ALL, FALSE); /* B1 */
+        /*
+         *  writeback invalidate the new header
+         */
+        Cache_wbInv(newHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+             Cache_Type_ALL, TRUE);  /* B2 */
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+
+/*
+ *  ======== HeapMemMP_isBlocking ========
+ */
+Bool ti_sdo_ipc_heaps_HeapMemMP_isBlocking(
+        ti_sdo_ipc_heaps_HeapMemMP_Object *obj)
+{
+    Bool flag = FALSE;
+
+    // TODO figure out how to determine whether the gate is blocking...
+    return (flag);
+}
+
+/*
+ *  ======== HeapMemMP_getStats ========
+ */
+Void ti_sdo_ipc_heaps_HeapMemMP_getStats(ti_sdo_ipc_heaps_HeapMemMP_Object *obj,
+        Memory_Stats *stats)
+{
+    IArg key;
+    ti_sdo_ipc_heaps_HeapMemMP_Header *curHeader;
+
+    stats->totalSize         = obj->bufSize;
+    stats->totalFreeSize     = 0;  /* determined later */
+    stats->largestFreeSize   = 0;  /* determined later */
+
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (obj->cacheEnabled) {
+        Cache_inv(&(obj->attrs->head),
+                sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header), Cache_Type_ALL,
+                TRUE);
+    }
+
+    curHeader = SharedRegion_getPtr(obj->attrs->head.next);
+
+    while (curHeader != NULL) {
+        /* Invalidate curHeader */
+        if (obj->cacheEnabled) {
+            Cache_inv(curHeader, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Header),
+                      Cache_Type_ALL, TRUE);
+        }
+        stats->totalFreeSize += curHeader->size;
+        if (stats->largestFreeSize < curHeader->size) {
+            stats->largestFreeSize = curHeader->size;
+        }
+        curHeader = SharedRegion_getPtr(curHeader->next);
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMemMP_postInit ========
+ */
+Void ti_sdo_ipc_heaps_HeapMemMP_postInit(ti_sdo_ipc_heaps_HeapMemMP_Object *obj,
+        Error_Block *eb)
+{
+    HeapMemMP_Params params;
+    IHeap_Handle regionHeap;
+
+    if (obj->attrs == NULL) {
+        /* Need to allocate from the heap */
+        HeapMemMP_Params_init(&params);
+        params.regionId = obj->regionId;
+        params.sharedBufSize = obj->bufSize;
+        obj->allocSize = HeapMemMP_sharedMemReq(&params);
+
+        regionHeap = SharedRegion_getHeap(obj->regionId);
+        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);
+        obj->attrs = Memory_alloc(regionHeap,
+                                  obj->allocSize,
+                                  obj->minAlign, eb);
+        if (obj->attrs == NULL) {
+            return;
+        }
+
+        obj->buf = (Ptr)((UInt32)obj->attrs +
+                sizeof(ti_sdo_ipc_heaps_HeapMemMP_Attrs));
+    }
+
+    /* Round obj->buf up by obj->minAlign */
+    obj->buf = (Ptr)_Ipc_roundup(obj->buf, obj->minAlign);
+
+    /* Verify the buffer is large enough */
+    Assert_isTrue((obj->bufSize >=
+            SharedRegion_getCacheLineSize(obj->regionId)),
+            ti_sdo_ipc_heaps_HeapMemMP_A_heapSize);
+
+    /* Make sure the size is a multiple of obj->minAlign */
+    obj->bufSize = (obj->bufSize / obj->minAlign) * obj->minAlign;
+
+    obj->attrs->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
+    obj->attrs->bufPtr = SharedRegion_getSRPtr(obj->buf, obj->regionId);
+
+    /* Store computed obj->bufSize in shared mem */
+    obj->attrs->head.size = obj->bufSize;
+
+    /* Place the initial header */
+    HeapMemMP_restore((HeapMemMP_Handle)obj);
+
+    /* Last thing, set the status */
+    obj->attrs->status = ti_sdo_ipc_heaps_HeapMemMP_CREATED;
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapMemMP_Attrs),
+                Cache_Type_ALL, TRUE);
+    }
+
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapMemMP.xdc b/packages/ti/sdo/ipc/heaps/HeapMemMP.xdc
new file mode 100644 (file)
index 0000000..a6a5760
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapMemMP.xdc ========
+ *
+ */
+
+package ti.sdo.ipc.heaps;
+
+import ti.sdo.ipc.SharedRegion;
+import ti.sdo.ipc.Ipc;
+import ti.sdo.ipc.GateMP;
+import ti.sdo.utils.NameServer;
+
+import xdc.rov.ViewInfo;    /* Display local/shared state + FreeBlockView */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.Memory;
+import xdc.runtime.Startup;
+
+/*!
+ *  ======== HeapMemMP ========
+ *  Multi-processor variable size buffer heap implementation.
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/HeapMemMP.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>HeapMemMP = xdc.useModule('ti.sdo.ipc.heaps.HeapMemMP');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ */
+@InstanceInitError   /* For NameServer_addUInt32                            */
+@InstanceFinalize    /* For finalizing shared memory and removing NS entry  */
+
+module HeapMemMP inherits xdc.runtime.IHeap {
+
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String          name;
+        Ptr             buf;
+        Memory.Size     totalSize;
+        String          objType;
+        Ptr             gate;
+    }
+
+    /*! @_nodoc */
+    metaonly struct DetailedView {
+        String          name;
+        Ptr             buf;
+        Memory.Size     totalSize;
+        String          objType;
+        Ptr             gate;
+        Ptr             attrs;
+        Bool            cacheEnabled;
+        Memory.Size     totalFreeSize;
+        Memory.Size     largestFreeSize;
+    }
+
+    /*! @_nodoc */
+    metaonly struct FreeBlockView {
+        String          address;
+        String          label;
+        String          size;
+    }
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+            [
+                'Basic',
+                {
+                    type: ViewInfo.INSTANCE,
+                    viewInitFxn: 'viewInitBasic',
+                    structName: 'BasicView'
+                }
+            ],
+            [
+                'Detailed',
+                {
+                    type: ViewInfo.INSTANCE,
+                    viewInitFxn: 'viewInitDetailed',
+                    structName: 'DetailedView'
+                }
+            ],
+            [
+                'FreeList',
+                {
+                    type: ViewInfo.INSTANCE_DATA,
+                    viewInitFxn: 'viewInitData',
+                    structName: 'FreeBlockView'
+                }
+            ]
+            ]
+        });
+
+    /*!
+     *  ======== ExtendedStats ========
+     *  Stats structure for the getExtendedStats API.
+     *
+     *  @field(buf)           Local address of the shared buffer
+     *                        This may be different from the original buf
+     *                        parameter due to alignment requirements.
+     *  @field(size)          Size of the shared buffer.
+     *                        This may be different from the original size
+     *                        parameter due to alignment requirements.
+     */
+    struct ExtendedStats {
+        Ptr   buf;
+        SizeT size;
+    }
+
+    /*!
+     *  Assert raised when a block of size 0 is requested.
+     */
+    config Assert.Id A_zeroBlock =
+        {msg: "A_zeroBlock: Cannot allocate size 0"};
+
+    /*!
+     *  Assert raised when the requested heap size is too small.
+     */
+    config Assert.Id A_heapSize =
+        {msg: "A_heapSize: Requested heap size is too small"};
+
+    /*!
+     *  Assert raised when the requested alignment is not a power of 2.
+     */
+    config Assert.Id A_align =
+        {msg: "A_align: Requested align is not a power of 2"};
+
+    /*!
+     *  Assert raised when the free detects that an invalid addr or size.
+     *
+     *  This could arise when multiple frees are done on the same buffer or
+     *  if corruption occurred.
+     *
+     *  This also could occur when an alloc is made with size N and the
+     *  free for this buffer specifies size M where M > N. Note: not every
+     *  case is detectable.
+     *
+     *  This assert can also be caused when passing an invalid addr to free
+     *  or if the size is causing the end of the buffer to be
+     *  out of the expected range.
+     */
+    config Assert.Id A_invalidFree =
+        {msg: "A_invalidFree: Invalid free"};
+
+    /*!
+     *  Raised when requested size exceeds largest free block.
+     */
+    config Error.Id E_memory =
+        {msg: "E_memory: Out of memory: handle=0x%x, size=%u"};
+
+    /*!
+     *  Maximum runtime entries
+     *
+     *  Maximum number of HeapMemMP's that can be dynamically created and
+     *  added to the NameServer.
+     *
+     *  To minimize the amount of runtime allocation, this parameter allows
+     *  the pre-allocation of memory for the HeapMemMP's NameServer table.
+     *  The default is to allow growth (i.e. memory allocation when
+     *  creating a new instance).
+     */
+    metaonly config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+
+    /*!
+     *  Maximum length for heap names
+     */
+    config UInt maxNameLen = 32;
+
+    /*!
+     *  Section name is used to place the names table
+     *
+     *  The default value of NULL implies that no explicit placement is
+     *  performed.
+     */
+    metaonly config String tableSection = null;
+
+instance:
+
+    /*!
+     *  GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+    config GateMP.Handle gate = null;
+
+    /*! @_nodoc
+     *  Set to TRUE by the open() call. No one else should touch this!
+     */
+    config Bool openFlag = false;
+
+    /*!
+     *  Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all HeapMemMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     */
+    config String name = null;
+
+    /*!
+     *  Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  will be allocated.
+     */
+    config UInt16 regionId = 0;
+
+    /*! @_nodoc
+     *  Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  heap at a specific location in shared memory.  If sharedAddr is null,
+     *  then shared memory for a new instance will be allocated from the
+     *  heap belonging to the region identified by {@link #regionId}.
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  Size of {@link #sharedBuf}
+     *
+     *  This is the size of the buffer to be used in the HeapMemMP instance.
+     *  The actual buffer size in the created instance might actually be less
+     *  than the value supplied in 'sharedBufSize' because of alignment
+     *  constraints.
+     *
+     *  It is important to note that the total amount of shared memory required
+     *  for a HeapMemMP instance will be greater than the size supplied here.
+     *  Additional space will be consumed by shared instance attributes and
+     *  alignment-related padding.  Use the {@link #sharedMemReq} or the
+     *  {@link #sharedMemReqMeta} call to determine the exact amount of shared
+     *  memory required for an instance for a given sharedBufSize and cache
+     *  settings.
+     */
+    config SizeT sharedBufSize = 0;
+
+    /*!
+     *  ======== getStats ========
+     *  @a(HeapMemMP)
+     *  getStats() will lock the heap using the HeapMemMP Gate while it retrieves
+     *  the HeapMemMP's statistics.
+     *
+     *  The returned totalSize reflects the usable size of the buffer, not
+     *  necessarily the size specified during create.
+     */
+    @DirectCall
+    override Void getStats(xdc.runtime.Memory.Stats *stats);
+
+    @DirectCall
+    override Ptr alloc(SizeT size, SizeT align, xdc.runtime.Error.Block *eb);
+
+    @DirectCall
+    override Void free(Ptr block, SizeT size);
+
+internal:
+
+    /*! Used in the attrs->status field */
+    const UInt32 CREATED    = 0x07041776;
+
+    /*!
+     *  This Params object is used for temporary storage of the
+     *  module wide parameters that are for setting the NameServer instance.
+     */
+    metaonly config NameServer.Params nameSrvPrms;
+
+    /*! Initialize shared memory, adjust alignment, allocate memory for buf */
+    Void postInit(Object *obj, Error.Block *eb);
+
+    /*!
+     * Header maintained at the lower address of every free block. The size of
+     * this struct must be a power of 2
+     */
+    struct Header {
+        SharedRegion.SRPtr  next;  /* SRPtr to next header (Header *)    */
+        Bits32              size;  /* Size of this segment (Memory.size) */
+    };
+
+    /*! Structure of attributes in shared memory */
+    struct Attrs {
+        Bits32                  status;     /* Version number                */
+        SharedRegion.SRPtr      bufPtr;     /* SRPtr to buf                  */
+        Header                  head;       /* First free block pointer.     */
+                                            /* The size field will be used   */
+                                            /* to store original heap size.  */
+        SharedRegion.SRPtr      gateMPAddr; /* GateMP SRPtr                  */
+    }
+
+    struct Instance_State {
+        Attrs               *attrs;         /* Local pointer to attrs        */
+        GateMP.Handle       gate;           /* Gate for critical regions     */
+        Ipc.ObjType         objType;        /* Static/Dynamic? open/creator? */
+        Ptr                 nsKey;          /* Used to remove NS entry       */
+        Bool                cacheEnabled;   /* Whether to do cache calls     */
+        UInt16              regionId;       /* SharedRegion index            */
+        SizeT               allocSize;      /* Shared memory allocated       */
+        Char                *buf;           /* Local pointer to buf          */
+        SizeT               minAlign;       /* Minimum alignment required    */
+        SizeT               bufSize;        /* Size of usable buffer         */
+    };
+
+    struct Module_State {
+        NameServer.Handle       nameServer;
+    };
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapMemMP.xs b/packages/ti/sdo/ipc/heaps/HeapMemMP.xs
new file mode 100644 (file)
index 0000000..ea932be
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapMemMP.xs ========
+ *
+ */
+
+var HeapMemMP       = null;
+var SharedRegion    = null;
+var NameServer      = null;
+var Ipc             = null;
+var Cache           = null;
+var GateMP          = null;
+
+var instCount = 0;  /* use to determine if processing last instance */
+
+/*
+ *  ======== module$use ========
+ *  Initialize module values.
+ */
+function module$use(mod, params)
+{
+    HeapMemMP       = this;
+    NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP          = xdc.useModule('ti.sdo.ipc.GateMP');
+    Cache           = xdc.useModule('ti.sysbios.hal.Cache');
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    mod.nameServer  = null;
+
+    /* initialize the NameServer param to be used now or later */
+    HeapMemMP.nameSrvPrms.maxRuntimeEntries = params.maxRuntimeEntries;
+    HeapMemMP.nameSrvPrms.tableSection      = params.tableSection;
+    HeapMemMP.nameSrvPrms.maxNameLen        = params.maxNameLen;
+
+    /*
+     *  Get the current number of created static instances of this module.
+     *  Note: if user creates a static instance after this point and
+     *        expects to use NameServer, this is a problem.
+     */
+    var instCount = this.$instances.length;
+
+    /* create NameServer here only if no static instances are created */
+    if (instCount == 0) {
+        mod.nameServer = NameServer.create("HeapMemMP",
+                                            HeapMemMP.nameSrvPrms);
+    }
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+
+    view.name = NameServer.getName$view("HeapMemMP",
+        SharedRegion.getSRPtrMeta$view(obj.attrs));
+
+    view.buf = $addr(obj.buf);
+    view.totalSize = "0x" + obj.bufSize.toString(16);
+
+    view.objType = Ipc.getObjTypeStr$view(obj.objType);
+    if (view.objType == null) {
+        Program.displayError(view, "objType",
+            "Corrupted state: The value of 'objType' is not " +
+            "one of known types");
+    }
+
+    view.gate = obj.gate;
+}
+
+/*
+ *  ======== viewInitDetailed ========
+ *  Initialize the 'Detailed' HeapMemMP instance view.
+ */
+function viewInitDetailed(view, obj)
+{
+    var HeapMemMP       = xdc.useModule('ti.sdo.ipc.heaps.HeapMemMP');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+    // first get the Basic view:
+    viewInitBasic(view, obj);
+
+    /* view.attrs */
+    view.attrs = "0x" + Number(obj.attrs.$addr).toString(16);
+
+    /* view.cacheEnabled */
+    view.cacheEnabled = obj.cacheEnabled;
+
+    /* view.totalFreeSize */
+
+    var totalFreeSize = 0;
+    var largestFreeSize = 0;
+
+    /* get the free list head; it should always exist even if list is empty */
+    var currElem;
+    var attrs;
+
+    try {
+        attrs = Program.fetchStruct(HeapMemMP.Attrs$fetchDesc,
+                                    obj.attrs.$addr, false);
+
+        currElem = Program.fetchStruct(HeapMemMP.Header$fetchDesc,
+                                       attrs.head.$addr, false);
+    }
+    catch (e) {
+        view.$status["totalFreeSize"] =
+                "Error: could not access head element of free list: " + e;
+
+        throw (e);
+    }
+
+    /*
+     * Traverse free list and add up all of the sizes.  This loop condition
+     * ensures that we don't try to access a null element (i.e. it avoids trav-
+     * ersing past the header on an empty list and it ends once the end of a non
+     * empty list is reached).
+     */
+    while (currElem.next != SharedRegion.getSRPtrMeta$view(0)) {
+        // Fetch the next free block (next linked list element)
+        try {
+            var currElem = Program.fetchStruct(
+                    HeapMemMP.Header$fetchDesc,
+                    SharedRegion.getPtrMeta$view(currElem.next),
+                    false);
+        }
+        catch (e) {
+            view.$status["totalFreeSize"] = "Error: could not access" +
+                    " next element linked list: " + e;
+            throw (e);
+        }
+
+        // add up the total free space
+        totalFreeSize += currElem.size;
+
+        // check for a new max free size
+        if (currElem.size > largestFreeSize) {
+            largestFreeSize = currElem.size;
+        }
+    }
+
+    view.totalFreeSize = "0x" + Number(totalFreeSize).toString(16);
+    view.largestFreeSize = "0x" + Number(largestFreeSize).toString(16);
+
+    if (totalFreeSize > obj.bufSize) {
+        view.$status["totalFreeSize"] = "Error: totalFreeSize (" +
+                view.totalFreeSize + ") > totalSize (" + view.totalSize +
+                ")!";
+    }
+
+    if (totalFreeSize < 0) {
+        view.$status["totalFreeSize"] = "Error: totalFreeSize (" +
+                view.totalFreeSize + ") is negative!";
+    }
+
+    if (largestFreeSize > obj.bufSize) {
+        view.$status["largestFreeSize"] = "Error: largestFreeSize (" +
+                view.largestFreeSize + ") > totalSize (" + view.totalSize +
+                ")!";
+    }
+
+    if (largestFreeSize < 0) {
+        view.$status["largestFreeSize"] = "Error: largestFreeSize (" +
+                view.largestFreeSize + ") is negative!";
+    }
+}
+
+/*
+ *  ======== viewInitData ========
+ */
+function viewInitData(view, obj)
+{
+    var NameServer = xdc.useModule('ti.sdo.utils.NameServer');
+
+    view.label = Program.getShortName(obj.$label);
+    if (view.label == "") {
+        // split the label to rid of the long full package name that precedes
+        // format will be: "HeapMemMP@0x12345678"
+        var splitStr = String(obj.$label).split(".");
+
+        view.label = splitStr[splitStr.length - 1];
+    }
+    view.label += "-freeList";
+
+    if (obj.attrs != 0) {
+        view.elements = getFreeList(obj);
+    }
+
+    return(view);
+}
+
+/*
+ *  ======== getFreeList ========
+ */
+function getFreeList(obj)
+{
+    var HeapMemMP       = xdc.useModule('ti.sdo.ipc.heaps.HeapMemMP');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+    try {
+        var attrs = Program.fetchStruct(HeapMemMP.Attrs$fetchDesc,
+                                        obj.attrs.$addr, false);
+        var header = Program.fetchStruct(HeapMemMP.Header$fetchDesc,
+                                         attrs.head.$addr, false);
+    }
+    catch (e) {
+        print("Error: Caught exception from fetchStruct: " +
+            e.toString());
+        throw (e);
+    }
+
+
+    var freeList = new Array();
+
+    /* For each block on the free list... */
+    while (true) {
+        /* Break if this is the last block */
+        if (header.next == SharedRegion.getSRPtrMeta$view(0)) {
+            break;
+        }
+
+        /* Fetch the next block */
+        try {
+            var header = Program.fetchStruct(
+                    HeapMemMP.Header$fetchDesc,
+                    SharedRegion.getPtrMeta$view(header.next),
+                    false);
+        }
+        catch (e) {
+            print("Error: Caught exception from fetchStruct: " +
+                e.toString());
+            throw (e);
+        }
+
+        /* Add this block to the list */
+        var memBlock = Program.newViewStruct('ti.sdo.ipc.heaps.HeapMemMP',
+                                             'FreeList');
+        memBlock.size = "0x" + Number(header.size).toString(16);
+        memBlock.address = "0x" + Number(header.$addr).toString(16);
+
+        freeList[freeList.length] = memBlock;
+    }
+
+    return (freeList);
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapMultiBufMP.c b/packages/ti/sdo/ipc/heaps/HeapMultiBufMP.c
new file mode 100644 (file)
index 0000000..a0c5f5a
--- /dev/null
@@ -0,0 +1,1059 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapMultiBufMP.c ========
+ */
+
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+
+#include <string.h> /* for memcpy */
+#include <stdlib.h> /* for qsort */
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_NameServer.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/heaps/_HeapMultiBufMP.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/_GateMP.h>
+
+#include "package/internal/HeapMultiBufMP.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_Params_init);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_alloc);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_close);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_create);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_delete);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_free);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_getExtendedStats);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_getStats);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_open);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_openByAddr);
+    #pragma FUNC_EXT_CALLED(HeapMultiBufMP_sharedMemReq);
+#endif
+
+/*
+ *  ======== HeapMultiBufMP_getSharedParams ========
+ */
+static Void HeapMultiBufMP_getSharedParams(HeapMultiBufMP_Params *sparams,
+        const ti_sdo_ipc_heaps_HeapMultiBufMP_Params *params)
+{
+    sparams->gate        = (GateMP_Handle)params->gate;
+    sparams->exact       = params->exact;
+    sparams->name        = params->name;
+    sparams->numBuckets  = params->numBuckets;
+    sparams->bucketEntries =
+        (HeapMultiBufMP_Bucket *)params->bucketEntries;
+    sparams->regionId    =  params->regionId;
+    sparams->sharedAddr  =  params->sharedAddr;
+}
+
+/*
+ *  ======== HeapMultiBufMP_getRTSCParams ========
+ */
+static Void HeapMultiBufMP_getRTSCParams(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Params *params,
+        const HeapMultiBufMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params_init(params);
+
+    params->gate = (ti_sdo_ipc_GateMP_Handle)sparams->gate;
+    params->exact = sparams->exact;
+    params->name = sparams->name;
+    params->numBuckets = sparams->numBuckets;
+    params->bucketEntries = (ti_sdo_ipc_heaps_HeapMultiBufMP_Bucket *)
+        sparams->bucketEntries;
+    params->regionId = sparams->regionId;
+    params->sharedAddr = sparams->sharedAddr;
+}
+
+/*
+ *  ======== HeapMultiBufMP_sizeAlignCompare ========
+ *  Comparison function for qsort. Compares Buckets first by blockSize, then
+ *  by align, in ascending order.
+ */
+static int HeapMultiBufMP_sizeAlignCompare(const void *a, const void *b)
+{
+    int diff;
+    HeapMultiBufMP_Bucket *bucketA, *bucketB;
+
+    bucketA = (HeapMultiBufMP_Bucket *)a;
+    bucketB = (HeapMultiBufMP_Bucket *)b;
+
+    diff = bucketA->blockSize - bucketB->blockSize;
+
+    /* If the blockSizes match, sort them by ascending align */
+    if (diff == 0) {
+        diff = bucketA->align - bucketB->align;
+    }
+
+    return (diff);
+}
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== HeapMultiBufMP_Params_init ========
+ */
+Void HeapMultiBufMP_Params_init(HeapMultiBufMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params params;
+
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params_init(&params);
+    HeapMultiBufMP_getSharedParams(sparams, &params);
+}
+
+/*
+ *  ======== HeapMultiBufMP_alloc ========
+ */
+Ptr HeapMultiBufMP_alloc(HeapMultiBufMP_Handle handle,
+        SizeT size, SizeT align)
+{
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    return (ti_sdo_ipc_heaps_HeapMultiBufMP_alloc(
+        (ti_sdo_ipc_heaps_HeapMultiBufMP_Object *)handle, size, align, &eb));
+}
+
+/*
+ *  ======== HeapMultiBufMP_close ========
+ */
+Int HeapMultiBufMP_close(HeapMultiBufMP_Handle *handlePtr)
+{
+    HeapMultiBufMP_delete(handlePtr);
+
+    return (HeapMultiBufMP_S_SUCCESS);
+}
+
+/*
+ *  ======== HeapMultiBufMP_create ========
+ */
+HeapMultiBufMP_Handle HeapMultiBufMP_create(
+        const HeapMultiBufMP_Params *sparams)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params params;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    if (sparams != NULL) {
+        HeapMultiBufMP_getRTSCParams(&params, (Ptr)sparams);
+        /* call the module create */
+        obj = ti_sdo_ipc_heaps_HeapMultiBufMP_create(&params, &eb);
+    }
+    else {
+        obj = ti_sdo_ipc_heaps_HeapMultiBufMP_create(NULL, &eb);
+    }
+
+    return ((HeapMultiBufMP_Handle)obj);
+}
+
+/*
+ *  ======== HeapMultiBufMP_delete ========
+ */
+Int HeapMultiBufMP_delete(HeapMultiBufMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_delete(
+        (ti_sdo_ipc_heaps_HeapMultiBufMP_Handle *)handlePtr);
+
+    return (HeapMultiBufMP_S_SUCCESS);
+}
+
+/*
+ *  ======== HeapMultiBufMP_free ========
+ */
+Void HeapMultiBufMP_free(HeapMultiBufMP_Handle handle, Ptr addr, SizeT size)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_free(
+        (ti_sdo_ipc_heaps_HeapMultiBufMP_Object *)handle, addr, size);
+}
+
+/*
+ *  ======== HeapMultiBufMP_getExtendedStats ========
+ */
+Void HeapMultiBufMP_getExtendedStats(HeapMultiBufMP_Handle handle,
+        HeapMultiBufMP_ExtendedStats *stats)
+{
+    IArg key;
+    UInt i;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj =
+        (ti_sdo_ipc_heaps_HeapMultiBufMP_Object *)handle;
+
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    stats->numBuckets = obj->numBuckets;
+
+    /* Make sure the attrs are not in cache */
+    if (obj->cacheEnabled) {
+        Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs),
+            Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  The maximum number of allocations for this HeapMultiBufMP (for any given
+     *  instance of time during its liftime) is computed as follows:
+     *
+     *  maxAllocatedBlocks = obj->numBlocks - obj->minFreeBlocks
+     *
+     *  Note that maxAllocatedBlocks is *not* the maximum allocation count, but
+     *  rather the maximum allocations seen at any snapshot of time in the
+     *  HeapMultiBufMP instance.
+     */
+
+    /* if nothing has been alloc'ed yet, return 0 */
+    for (i = 0; i < stats->numBuckets; i++) {
+        /* Get the blockSize and align for the buffer */
+        stats->numBlocks[i] = obj->attrs->buckets[i].numBlocks;
+        stats->blockSize[i] = obj->attrs->buckets[i].blockSize;
+        stats->align[i]     = obj->attrs->buckets[i].align;
+
+        /* if nothing has been alloc'ed yet, return 0 */
+        if ((Int)(obj->attrs->buckets[i].minFreeBlocks) == -1) {
+            stats->maxAllocatedBlocks[i] = 0;
+        }
+        else {
+            stats->maxAllocatedBlocks[i] = obj->attrs->buckets[i].numBlocks
+                                         - obj->attrs->buckets[i].minFreeBlocks;
+        }
+        /*
+         * current number of alloc'ed blocks is computed using curr # free
+         * blocks
+         */
+        stats->numAllocatedBlocks[i] = obj->attrs->buckets[i].numBlocks
+                                     - obj->attrs->buckets[i].numFreeBlocks;
+    }
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+/*
+ *  ======== HeapMultiBufMP_getStats ========
+ */
+Void HeapMultiBufMP_getStats(HeapMultiBufMP_Handle handle, Ptr stats)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_getStats(
+        (ti_sdo_ipc_heaps_HeapMultiBufMP_Handle)handle,
+        (Memory_Stats *)stats);
+}
+/*
+ *  ======== HeapMultiBufMP_open ========
+ */
+Int HeapMultiBufMP_open(String name,
+        HeapMultiBufMP_Handle *handlePtr)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Int status;
+    Ptr sharedAddr;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* Assert that a pointer has been supplied */
+    Assert_isTrue(handlePtr != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /* Assert that a name has been supplied */
+    Assert_isTrue(name != NULL, ti_sdo_ipc_Ipc_A_invParam);
+
+    /* Open by name */
+    status = NameServer_getUInt32(
+            (NameServer_Handle)HeapMultiBufMP_module->nameServer, name,
+            &sharedShmBase, ti_sdo_utils_MultiProc_procIdList);
+
+    if (status < 0) {
+        /* Name not found. */
+        *handlePtr = NULL;
+        return (HeapMultiBufMP_E_NOTFOUND);
+    }
+
+    sharedAddr = SharedRegion_getPtr(sharedShmBase);
+
+    status = HeapMultiBufMP_openByAddr(sharedAddr, handlePtr);
+
+    return (status);
+}
+
+/*
+ *  ======== HeapMultiBufMP_openByAddr ========
+ */
+Int HeapMultiBufMP_openByAddr(Ptr sharedAddr,
+        HeapMultiBufMP_Handle *handlePtr)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params params;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs *attrs;
+    Int status;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params_init(&params);
+
+    /* Tell Instance_init() that we're opening */
+    params.openFlag = TRUE;
+
+    params.sharedAddr = sharedAddr;
+    attrs = (ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs *)sharedAddr;
+
+    if (SharedRegion_isCacheEnabled(SharedRegion_getId(sharedAddr))) {
+        Cache_inv(attrs, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs),
+            Cache_Type_ALL, TRUE);
+    }
+
+    if (attrs->status != ti_sdo_ipc_heaps_HeapMultiBufMP_CREATED) {
+        *handlePtr = NULL;
+        status = HeapMultiBufMP_E_NOTFOUND;
+    }
+    else {
+        *handlePtr = (HeapMultiBufMP_Handle)
+            ti_sdo_ipc_heaps_HeapMultiBufMP_create(&params, &eb);
+        if (*handlePtr == NULL) {
+            status = HeapMultiBufMP_E_FAIL;
+        }
+        else {
+            status = HeapMultiBufMP_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== HeapMultiBufMP_sharedMemReq ========
+ */
+SizeT HeapMultiBufMP_sharedMemReq(const HeapMultiBufMP_Params *sparams)
+{
+    SizeT   memReq, minAlign;
+    UInt    i;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Bucket
+        bucketEntries[HeapMultiBufMP_MAXBUCKETS];
+    UInt    numBuckets;
+    UInt16  regionId;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Params params;
+
+    /* Assert that the required params have been set */
+    Assert_isTrue(sparams->bucketEntries != NULL, ti_sdo_ipc_Ipc_A_invParam);
+    Assert_isTrue(sparams->numBuckets != 0, ti_sdo_ipc_Ipc_A_invParam);
+
+    if (sparams->sharedAddr == NULL) {
+        regionId = sparams->regionId;
+    }
+    else {
+        regionId = SharedRegion_getId(sparams->sharedAddr);
+    }
+
+    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID,
+            ti_sdo_ipc_Ipc_A_internal);
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    memReq = _Ipc_roundup(sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs),
+        minAlign);
+
+    HeapMultiBufMP_getRTSCParams(&params, (Ptr)sparams);
+
+    /* Optimize the bucketEntries array */
+    numBuckets = HeapMultiBufMP_processBuckets(bucketEntries, &params,
+        regionId);
+
+    for (i = 0; i < numBuckets; i++) {
+        memReq = _Ipc_roundup(memReq, bucketEntries[i].align);
+
+        memReq += bucketEntries[i].blockSize * bucketEntries[i].numBlocks;
+    }
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                      Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_Instance_init ========
+ */
+Int ti_sdo_ipc_heaps_HeapMultiBufMP_Instance_init(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj,
+        const ti_sdo_ipc_heaps_HeapMultiBufMP_Params *params, Error_Block *eb)
+{
+    SharedRegion_SRPtr sharedShmBase;
+    Ptr localAddr;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Bucket
+        optBucketEntries[HeapMultiBufMP_MAXBUCKETS];
+    Int status;
+
+    /* Ensure that bucketEntries has been supplied */
+    Assert_isTrue(params->openFlag ||
+                  params->bucketEntries != NULL, ti_sdo_ipc_Ipc_A_invParam);
+
+
+    /* Check numBuckets */
+    Assert_isTrue(params->openFlag ||
+                  params->numBuckets <= HeapMultiBufMP_MAXBUCKETS,
+                  ti_sdo_ipc_Ipc_A_invParam);
+
+    obj->nsKey          = NULL;
+    obj->allocSize      = 0;
+
+    if (params->openFlag) {
+        /* Opening the heap */
+        obj->attrs          = (ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs *)
+            params->sharedAddr;
+        obj->objType        = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+        obj->bucketEntries  = NULL; /* Never used in open */
+
+        /* No need to Cache_inv attrs- already done in openByAddr() */
+        obj->numBuckets     = obj->attrs->numBuckets;
+        obj->exact          = obj->attrs->exact == 1;
+        obj->buf            = SharedRegion_getPtr(
+                              obj->attrs->buckets[0].baseAddr);
+        obj->regionId       = SharedRegion_getId(obj->buf);
+        obj->cacheEnabled   = SharedRegion_isCacheEnabled(obj->regionId);
+
+        localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
+
+        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&(obj->gate));
+        if (status != GateMP_S_SUCCESS) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (1);
+        }
+
+        /* Done opening */
+        return (0);
+    }
+
+    /* Creating the heap */
+    if (params->gate != NULL) {
+        obj->gate       = params->gate;
+    }
+    else {
+        /* If no gate specified, get the default system gate */
+        obj->gate       = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+    }
+
+    if (params->sharedAddr == NULL) {
+        /* Creating using a shared region ID */
+        obj->objType    = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
+        obj->attrs      = NULL; /* Will be alloc'ed in postInit */
+        obj->regionId   = params->regionId;
+    }
+    else {
+        /* Creating using sharedAddr */
+        obj->regionId   = SharedRegion_getId(params->sharedAddr);
+
+        /* Assert that the buffer is in a valid shared region */
+        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+        /* Assert that sharedAddr is cached aligned if region cache aligned */
+        Assert_isTrue(((UInt32)params->sharedAddr %
+                      SharedRegion_getCacheLineSize(obj->regionId) == 0),
+                      ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+        obj->objType    = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+
+        /* obj->buf will get alignment-adjusted in postInit */
+        obj->buf        = (Ptr)((UInt32)params->sharedAddr +
+                                sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs));
+        obj->attrs      = (ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs *)
+            params->sharedAddr;
+    }
+
+    obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+    obj->exact        = params->exact;
+    /* Adjust & sort the copied bucket entries by blockSize & align */
+    obj->numBuckets = HeapMultiBufMP_processBuckets(optBucketEntries,
+        (ti_sdo_ipc_heaps_HeapMultiBufMP_Params *)params, obj->regionId);
+    obj->bucketEntries = optBucketEntries;
+
+    HeapMultiBufMP_postInit(obj, eb);
+    if (Error_check(eb)) {
+        return (1);
+    }
+
+    /* Set to NULL since optBucketEntries is on the stack */
+    obj->bucketEntries = NULL;
+
+    /* Add entry to NameServer */
+    if (params->name != NULL) {
+        /* We will store a shared pointer in the NameServer */
+        sharedShmBase = SharedRegion_getSRPtr(obj->attrs,
+                                              obj->regionId);
+        obj->nsKey = NameServer_addUInt32(
+                (NameServer_Handle)HeapMultiBufMP_module->nameServer,
+                params->name, (UInt32)sharedShmBase);
+
+        if (obj->nsKey == NULL) {
+            /* NameServer_addUInt32 failed */
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
+            return (2);
+        }
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== HeapMultiBufMP_Instance_finalize ========
+ */
+Void ti_sdo_ipc_heaps_HeapMultiBufMP_Instance_finalize(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, Int status)
+{
+    /* First remove the NameServer entry */
+    if (obj->objType & (ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC |
+        ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION)) {
+        if (obj->nsKey != NULL) {
+            NameServer_removeEntry((NameServer_Handle)
+                    HeapMultiBufMP_module->nameServer, obj->nsKey);
+        }
+
+        if (obj->attrs != NULL) {
+            obj->attrs->status = 0;
+
+            if (obj->cacheEnabled) {
+                Cache_wbInv(obj->attrs,
+                            sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs),
+                            Cache_Type_ALL, TRUE);
+            }
+        }
+
+        /*
+         *  Free the shared memory back to the region heap. If NULL, then the
+         *  Memory_alloc failed.
+         */
+        if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION &&
+            obj->attrs != NULL) {
+            Memory_free(SharedRegion_getHeap(obj->regionId), obj->attrs,
+                        obj->allocSize);
+        }
+    }
+    else {
+        /* Heap is being closed */
+        /* Close the gate. If NULL, then GateMP_openByAddr failed. */
+        if (obj->gate != NULL) {
+            GateMP_close((GateMP_Handle *)&(obj->gate));
+        }
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_alloc ========
+ *  Allocate a block.
+ */
+Ptr ti_sdo_ipc_heaps_HeapMultiBufMP_alloc(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, SizeT size, SizeT align,
+        Error_Block *eb)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *block;
+    UInt index;
+    IArg key;
+    Bool alignMatches, sizeMatches;
+
+    /* Read-only field, so no cache/gate concerns */
+    for (index = 0; index < obj->numBuckets; index++) {
+        sizeMatches = (size <= obj->attrs->buckets[index].blockSize);
+        alignMatches = (align <= obj->attrs->buckets[index].align);
+
+        if (sizeMatches && alignMatches) {
+            if (obj->exact && size != obj->attrs->buckets[index].blockSize) {
+                Error_raise(eb, ti_sdo_ipc_heaps_HeapMultiBufMP_E_exactFail,
+                            size, obj->attrs->buckets[index].blockSize);
+                return (NULL);
+            }
+            break;
+        }
+    }
+
+    if (index == obj->attrs->numBuckets) {
+        /* Couldn't find a buffer with suitable size/align */
+        Error_raise(eb, ti_sdo_ipc_heaps_HeapMultiBufMP_E_size,
+                size, align);
+
+        return (NULL);
+    }
+
+    /* At this point, we know the bucket number. Enter the gate */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (obj->cacheEnabled) {
+        Cache_inv(&(obj->attrs->buckets[index]),
+                  sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_BucketAttrs),
+                  Cache_Type_ALL, TRUE);
+    }
+
+    /* Get the first block */
+    block = HeapMultiBufMP_getHead(obj, index);
+
+    /* Make sure that a valid pointer was returned. */
+    if (block == NULL) {
+        /* No more blocks left in the buffer */
+        GateMP_leave((GateMP_Handle)obj->gate, key);
+        Error_raise(eb, ti_sdo_ipc_heaps_HeapMultiBufMP_E_noBlocksLeft,
+                    obj->attrs->buckets[index].blockSize,
+                    obj->attrs->buckets[index].align);
+
+        return (NULL);
+    }
+
+    obj->attrs->buckets[index].numFreeBlocks--;
+
+    /*
+     *  Keep track of the [min] number of free for this HeapMultiBufMP, if user
+     *  has set the config variable trackMaxAllocs to true.
+     *
+     *  The min number of free blocks, 'minFreeBlocks', will be used to compute
+     *  the "all time" maximum number of allocated blocks in getExtendedStats()
+     */
+    if (ti_sdo_ipc_heaps_HeapMultiBufMP_trackMaxAllocs) {
+        if (obj->attrs->buckets[index].numFreeBlocks <
+                obj->attrs->buckets[index].minFreeBlocks) {
+            /* save the new minimum */
+            obj->attrs->buckets[index].minFreeBlocks =
+            obj->attrs->buckets[index].numFreeBlocks;
+        }
+    }
+
+    /* Results of getHead and trackMaxAllocs written out to memory */
+    if (obj->cacheEnabled) {
+        Cache_wbInv(&(obj->attrs->buckets[index]),
+            sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_BucketAttrs), Cache_Type_ALL,
+            TRUE);
+    }
+
+    /* Leave the gate */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (block);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_free ========
+ *  Frees the block to this HeapMultiBufMP.
+ */
+Void ti_sdo_ipc_heaps_HeapMultiBufMP_free(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, Ptr block, SizeT size)
+{
+    Int  index;
+    IArg key;
+    SharedRegion_SRPtr blockSRPtr;
+
+    /* Check for invalid arguments */
+    Assert_isTrue(size != 0, ti_sdo_ipc_Ipc_A_nullArgument);
+
+    /*
+     *  invaliate the block here so that stale data isn't evicted from cache
+     *  at some later point
+     */
+    if (obj->cacheEnabled) {
+        Cache_inv(block, size, Cache_Type_ALL, FALSE);
+    }
+
+    /* First search by block */
+    blockSRPtr = SharedRegion_getSRPtr(block, obj->regionId);
+
+    Assert_isTrue(blockSRPtr >= obj->attrs->buckets[0].baseAddr &&
+                  blockSRPtr <
+                  (obj->attrs->buckets[obj->attrs->numBuckets - 1].baseAddr +
+                   obj->attrs->buckets[obj->attrs->numBuckets - 1].numBlocks *
+                   obj->attrs->buckets[obj->attrs->numBuckets - 1].blockSize),
+                   ti_sdo_ipc_heaps_HeapMultiBufMP_A_addrNotFound);
+
+    for (index = obj->numBuckets - 1; index >= 0; index--) {
+        /* We can compare SRPtrs because they are both in the same region */
+        if (obj->attrs->buckets[index].baseAddr <= blockSRPtr) {
+            break;
+        }
+    }
+
+    /* Assert if the size does not match the found bucket */
+    Assert_isTrue((size <= obj->attrs->buckets[index].blockSize) &&
+                  (obj->attrs->exact == 0) ||
+                  (size == obj->attrs->buckets[index].blockSize) &&
+                  (obj->attrs->exact == 1),
+                    ti_sdo_ipc_heaps_HeapMultiBufMP_A_sizeNotFound);
+
+    /* Enter the gate */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    if (obj->cacheEnabled) {
+        Cache_inv(block, obj->attrs->buckets[index].blockSize, Cache_Type_ALL,
+                  FALSE);
+        Cache_inv(&(obj->attrs->buckets[index]),
+                  sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_BucketAttrs),
+                  Cache_Type_ALL, TRUE);
+    }
+
+    HeapMultiBufMP_putTail(obj, index, block);
+
+    /*
+     *  Only need to write back the HeapMultiBufMP_Elem (top) part of the the
+     *  block being freed.  The rest of the block must also be invalidated
+     *  to ensure that stale data isn't evicted from cache at some later point
+     */
+    if (obj->cacheEnabled) {
+        Cache_wb(block, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Elem),
+                 Cache_Type_ALL, FALSE);
+    }
+
+    obj->attrs->buckets[index].numFreeBlocks++;
+    if (obj->cacheEnabled) {
+        Cache_wbInv(&(obj->attrs->buckets[index]),
+                 sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_BucketAttrs),
+                 Cache_Type_ALL, TRUE);
+    }
+
+    /* Leave the gate */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_getHead ========
+ */
+ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *ti_sdo_ipc_heaps_HeapMultiBufMP_getHead(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, Int index)
+{
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *block;
+    SharedRegion_SRPtr sharedBlock;
+
+    /* obj->attrs->buckets[index] should have already been invalidated */
+    if (obj->attrs->buckets[index].head !=
+            ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
+        sharedBlock = obj->attrs->buckets[index].head;
+        block = SharedRegion_getPtr(sharedBlock);
+
+        if (obj->cacheEnabled) {
+            /*
+             *  Only need to invalidate the elem, not the entire block.
+             */
+            Cache_inv(block, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Elem),
+                      Cache_Type_ALL, FALSE);
+        }
+        obj->attrs->buckets[index].head = block->next;
+        if (obj->attrs->buckets[index].head ==
+                ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
+            /* We've removed the last block from the bucket */
+            obj->attrs->buckets[index].tail =
+                ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+        }
+
+        /*
+         *  No need to write back here since obj->attrs->buckets[index]
+         *  written back in HeapMultiBufMP_alloc
+         */
+    }
+    else {
+        block = NULL;
+    }
+
+    return (block);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_getStats ========
+ */
+Void ti_sdo_ipc_heaps_HeapMultiBufMP_getStats(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, Memory_Stats *stats)
+{
+    IArg key;
+    SizeT totalSize = 0;
+    SizeT totalFreeSize = 0;
+    SizeT largestFreeSize = 0;
+    UInt i;
+
+    if (obj->cacheEnabled) {
+        Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs),
+            Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     * Protect this section so that numFreeBlocks doesn't change between
+     * totalFreeSize and largestFreeSize
+     */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    for (i = 0; i < obj->attrs->numBuckets; i++) {
+        /* Check largest free block. */
+        if (obj->attrs->buckets[i].blockSize > largestFreeSize
+            && obj->attrs->buckets[i].numFreeBlocks > 0) {
+            largestFreeSize = obj->attrs->buckets[i].blockSize;
+        }
+        totalSize += obj->attrs->buckets[i].blockSize *
+                     obj->attrs->buckets[i].numBlocks;
+        totalFreeSize += obj->attrs->buckets[i].blockSize *
+                         obj->attrs->buckets[i].numFreeBlocks;
+    }
+
+    stats->totalSize = totalSize;
+    stats->totalFreeSize = totalFreeSize;
+    stats->largestFreeSize = largestFreeSize;
+
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_isBlocking ========
+ */
+Bool ti_sdo_ipc_heaps_HeapMultiBufMP_isBlocking(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj)
+{
+    Bool flag = FALSE;
+
+    // TODO figure out how to determine whether the gate is blocking...
+    return (flag);
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_putTail ========
+ */
+Void ti_sdo_ipc_heaps_HeapMultiBufMP_putTail(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, Int index,
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *block)
+{
+    SharedRegion_SRPtr sharedBlock;
+    ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *temp;
+
+    sharedBlock = SharedRegion_getSRPtr(block, obj->regionId);
+
+    /* obj->attrs->buckets[index] should have already been invalidated */
+    if (obj->attrs->buckets[index].tail == ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
+        obj->attrs->buckets[index].head = sharedBlock;
+    }
+    else {
+        temp = (ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *)
+                SharedRegion_getPtr(obj->attrs->buckets[index].tail);
+        temp->next = sharedBlock;
+
+        /*
+         *  No need to wait here because cache operation after putTail() will
+         *  wait
+         */
+        Cache_wbInv(temp, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Elem),
+                 Cache_Type_ALL, FALSE);
+    }
+    obj->attrs->buckets[index].tail = sharedBlock;
+    block->next = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+
+    /*
+     *  No need to write back here since obj->attrs->buckets[index]
+     *  and 'block' written back in HeapMultiBufMP_alloc
+     */
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_postInit ========
+ *  Slice and dice the buffer up into the correct size blocks and
+ *  add to the freelist.
+ */
+Void ti_sdo_ipc_heaps_HeapMultiBufMP_postInit(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Object *obj, Error_Block *eb)
+{
+    UInt i;
+    UInt j;
+    Char *buf;
+    SizeT minAlign;
+    HeapMultiBufMP_Params sparams;
+    IHeap_Handle regionHeap;
+
+    if (obj->attrs == NULL) {
+        /* Need to allocate from the heap */
+        HeapMultiBufMP_Params_init(&sparams);
+        sparams.regionId      = obj->regionId;
+        sparams.bucketEntries = (HeapMultiBufMP_Bucket *)obj->bucketEntries;
+        sparams.numBuckets    = obj->numBuckets;
+        obj->allocSize =  HeapMultiBufMP_sharedMemReq(&sparams);
+
+        minAlign = Memory_getMaxDefaultTypeAlign();
+        if (minAlign < SharedRegion_getCacheLineSize(obj->regionId)) {
+            minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+        }
+
+        regionHeap = SharedRegion_getHeap(obj->regionId);
+        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);
+        obj->attrs = Memory_alloc(regionHeap, obj->allocSize, minAlign, eb);
+        if (obj->attrs == NULL) {
+            return;
+        }
+
+        obj->buf = (Ptr)((UInt32)obj->attrs +
+            sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs));
+    }
+
+    obj->attrs->numBuckets  = obj->numBuckets;
+    obj->attrs->exact       = obj->exact ? 1 : 0;
+    obj->attrs->gateMPAddr  = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
+
+    for (i = 0; i < obj->numBuckets; i++) {
+        obj->attrs->buckets[i].head = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+        obj->attrs->buckets[i].tail = ti_sdo_ipc_SharedRegion_INVALIDSRPTR;
+        obj->attrs->buckets[i].minFreeBlocks = (UInt)-1;
+        obj->attrs->buckets[i].blockSize     = obj->bucketEntries[i].blockSize;
+        obj->attrs->buckets[i].numBlocks     = obj->bucketEntries[i].numBlocks;
+        obj->attrs->buckets[i].numFreeBlocks = obj->bucketEntries[i].numBlocks;
+        obj->attrs->buckets[i].align         = obj->bucketEntries[i].align;
+    }
+
+    /* obj->buf should point to base of first buffer */
+    obj->buf = buf = (Ptr)_Ipc_roundup(obj->buf, obj->attrs->buckets[0].align);
+    for (i = 0; i < obj->numBuckets; i++) {
+
+        /* Make sure buffer is buffer-aligned (not just min-Align'ed) */
+        buf = (Ptr)_Ipc_roundup(buf, obj->attrs->buckets[i].align);
+
+        /* Put a shared pointer to the buf in attrs */
+        obj->attrs->buckets[i].baseAddr =
+                SharedRegion_getSRPtr(buf, obj->regionId);
+
+        /*
+         * Split the buffer into blocks that are length "blockSize" and
+         * add into the freeList Queue.
+         */
+        for (j = 0; j < obj->attrs->buckets[i].numBlocks; j++) {
+            /* Put the free block on the end of the linked list */
+            HeapMultiBufMP_putTail(obj, i,
+                (ti_sdo_ipc_heaps_HeapMultiBufMP_Elem *)buf);
+
+            buf += obj->attrs->buckets[i].blockSize;
+        }
+    }
+
+    /* At the end of the loop, buf points to the end of shared memory */
+    if (obj->cacheEnabled) {
+        /*
+         *  Write back the entire buffer. Don't cache-wait since the
+         *  Cache_wbInv below will.
+         */
+        Cache_wbInv(obj->buf, buf - obj->buf, Cache_Type_ALL, FALSE);
+    }
+
+    /* Last thing, set the status */
+    obj->attrs->status = ti_sdo_ipc_heaps_HeapMultiBufMP_CREATED;
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_heaps_HeapMultiBufMP_Attrs),
+            Cache_Type_ALL, TRUE);
+    }
+}
+
+/*
+ *  ======== ti_sdo_ipc_heaps_HeapMultiBufMP_processBuckets ========
+ *  1) Adjust the blockSize and alignments for each buffer
+ *      - Alignment adjusted for cacheLineSize, cacheAlign
+ *      - blockSize adjusted for alignment
+ *  2) Sort buckets by blockSize and then by alignment
+ *  3) Merge buckets with same blockSize and same alignment
+ */
+UInt ti_sdo_ipc_heaps_HeapMultiBufMP_processBuckets(
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Bucket *optBucketEntries,
+        ti_sdo_ipc_heaps_HeapMultiBufMP_Params *params,
+        UInt16 regionId)
+{
+    UInt i, j;
+    Int optNumBuckets;
+
+    /* Copy the supplied buckets to a modifiable area */
+    memcpy(optBucketEntries,
+           params->bucketEntries,
+           sizeof(HeapMultiBufMP_Bucket) * params->numBuckets);
+
+    /* Combine if blockSizes (and alignments) are equal and shrink the array */
+    for (i = 0; i < params->numBuckets; i++) {
+        /* Ensure that align is a power of two */
+        Assert_isTrue((optBucketEntries[i].align &
+                      (optBucketEntries[i].align - 1)) == 0,
+                      ti_sdo_ipc_heaps_HeapMultiBufMP_A_invalidAlign);
+
+        /* First fix the alignment */
+        if (optBucketEntries[i].align <
+            SharedRegion_getCacheLineSize(regionId)) {
+            optBucketEntries[i].align = SharedRegion_getCacheLineSize(regionId);
+        }
+        else if (optBucketEntries[i].align <
+                 Memory_getMaxDefaultTypeAlign()) {
+            /* Cache is disabled, use the default alignment */
+            optBucketEntries[i].align = Memory_getMaxDefaultTypeAlign();
+        }
+
+        /* Fix the blockSize if blockSize isn't a multiple of alignment */
+        optBucketEntries[i].blockSize =
+            (optBucketEntries[i].blockSize + (optBucketEntries[i].align - 1))
+             & ~(optBucketEntries[i].align - 1);
+    }
+
+    /* Sort optBucketEntries by blockSize and then alignment */
+    qsort(optBucketEntries, params->numBuckets, sizeof(HeapMultiBufMP_Bucket),
+          HeapMultiBufMP_sizeAlignCompare);
+
+    optNumBuckets = 0;
+
+    /* Combine if blockSizes (and alignments) are equal and shrink the array */
+    for (i = 0; i < params->numBuckets; i++) {
+        if (optBucketEntries[i].numBlocks != 0) {
+            memcpy(&(optBucketEntries[optNumBuckets]), &(optBucketEntries[i]),
+                   sizeof(HeapMultiBufMP_Bucket));
+            for (j = i + 1 ; j < params->numBuckets; j++) {
+                if (optBucketEntries[optNumBuckets].blockSize ==
+                        optBucketEntries[j].blockSize &&
+                    optBucketEntries[optNumBuckets].align ==
+                        optBucketEntries[j].align) {
+                    /* Combine the buckets */
+                    optBucketEntries[optNumBuckets].numBlocks +=
+                                  optBucketEntries[j].numBlocks;
+                    optBucketEntries[j].numBlocks = 0;
+                }
+            }
+            optNumBuckets++ ;
+        }
+    }
+
+    return (optNumBuckets);
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapMultiBufMP.xdc b/packages/ti/sdo/ipc/heaps/HeapMultiBufMP.xdc
new file mode 100644 (file)
index 0000000..d9f9bf1
--- /dev/null
@@ -0,0 +1,416 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapMultiBufMP.xdc ========
+ *
+ *
+ */
+
+package ti.sdo.ipc.heaps;
+
+import ti.sdo.ipc.SharedRegion;
+import ti.sdo.ipc.Ipc;
+import ti.sdo.ipc.GateMP;
+import ti.sdo.utils.NameServer;
+
+import xdc.rov.ViewInfo;    /* Display local/shared state + FreeBlockView */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.Memory;
+import xdc.runtime.Startup;
+
+/*!
+ *  ======== HeapMultiBufMP ========
+ *  Multi-processor fixed-size buffer heap implementation
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/HeapMultiBufMP.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>HeapMultiBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapMultiBufMP');
+ *  </PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ *  It is important to note that max allocation tracking is disabled by default
+ *  in {@link #trackMaxAllocs}.  Disabling allocation tracking improves alloc/
+ *  free performance especially when cache calls are required in shared memory.
+ */
+@InstanceInitError
+@InstanceFinalize
+
+module HeapMultiBufMP inherits xdc.runtime.IHeap
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String          name;
+        Ptr             buf;
+        Memory.Size     totalSize;
+        String          objType;
+        Ptr             gate;
+        Bool            exact;
+    }
+
+    /*! @_nodoc */
+    metaonly struct BucketsView {
+        Ptr             baseAddr;
+        UInt            blockSize;
+        UInt            align;
+        UInt            numBlocks;
+        UInt            numFreeBlocks;
+        UInt            minFreeBlocks;
+    }
+
+    /*! @_nodoc */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+            [
+                'Basic',
+                {
+                    type: ViewInfo.INSTANCE,
+                    viewInitFxn: 'viewInitBasic',
+                    structName: 'BasicView'
+                }
+            ],
+            [
+                'Buffer Information',
+                {
+                    type: ViewInfo.INSTANCE_DATA,
+                    viewInitFxn: 'viewInitData',
+                    structName: 'BucketsView'
+                }
+            ],
+            ]
+        });
+
+    /*!
+     *  Structure for bucket configuration
+     *
+     *  An array of buckets is a required parameter to create any
+     *  HeapMultiBufMP instance.  The fields of each bucket correspond
+     *  to the attributes of each buffer in the HeapMultiBufMP.  The actual
+     *  block sizes and alignments may be adjusted per the process described
+     *  at {@link #bucketEntries}.
+     *
+     *  @field(blockSize)       Size of each block (in MADUs)
+     *  @field(numBlocks)       Number of blocks
+     *  @field(align)           Alignment of each block (in MADUs)
+     */
+    struct Bucket {
+        SizeT       blockSize;
+        UInt        numBlocks;
+        SizeT       align;
+    }
+
+    /*!
+     *  ======== ExtendedStats ========
+     *  Stats structure for the getExtendedStats API.
+     *
+     *  @field(numBuckets)         Number of buckets
+     *  @field(numBlocks)          Number of blocks in each buffer
+     *  @field(blockSize)          Block size of each buffer
+     *  @field(align)              Alignment of each buffer
+     *  @field(maxAllocatedBlocks) The maximum number of blocks allocated from
+     *                             this heap at any single point in time during
+     *                             the lifetime of this HeapMultiBufMP instance
+     *
+     *  @field(numAllocatedBlocks) The total number of blocks currently
+     *                             allocated in this HeapMultiBufMP instance
+     */
+    struct ExtendedStats {
+        UInt numBuckets;
+        UInt numBlocks          [8];
+        UInt blockSize          [8];
+        UInt align              [8];
+        UInt maxAllocatedBlocks [8];
+        UInt numAllocatedBlocks [8];
+    }
+
+    /*!
+     *  Assert raised when the align parameter is not a power of 2.
+     */
+    config Assert.Id A_invalidAlign =
+        {msg: "align parameter must be a power of 2"};
+
+    /*!
+     *  Assert raised when an invalid buffer size was passed to free()
+     */
+    config Assert.Id A_sizeNotFound =
+        {msg: "an invalid buffer size was passed to free"};
+
+    /*!
+     *  Assert raised when an invalid block address was passed to free()
+     */
+    config Assert.Id A_addrNotFound =
+        {msg: "an invalid buffer address was passed to free"};
+
+    /*!
+     *  Error raised when exact matching failed
+     */
+    config Error.Id E_exactFail =
+        {msg: "E_exactFail: Exact allocation failed (requested size = %u and buffer size = %u)"};
+
+    /*!
+     *  Error raised when requested size exceeds all blockSizes.
+     */
+    config Error.Id E_size =
+        {msg: "E_size: requested size/alignment is too big (requested size = %u and requested align = %u)"};
+
+    /*!
+     *  Error raised when there are no blocks left in the buffer corresponding to the requested size/alignment
+     */
+    config Error.Id E_noBlocksLeft =
+        {msg: "E_noBlocksLeft: No more blocks left in buffer (buffer size = %u and buffer align = %u)"};
+
+    /*!
+     *  Maximum runtime entries
+     *
+     *  Maximum number of HeapMultiBufMP's that can be dynamically created and
+     *  added to the NameServer.
+     *
+     *  To minimize the amount of runtime allocation, this parameter allows
+     *  the pre-allocation of memory for the HeapMultiBufMP's NameServer table.
+     *  The default is to allow growth (i.e. memory allocation when
+     *  creating a new instance).
+     */
+    metaonly config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+
+    /*!
+     *  Maximum length for heap names
+     */
+    config UInt maxNameLen = 32;
+
+    /*!
+     *  Section name is used to place the names table
+     *
+     *  The default value of NULL implies that no explicit placement is
+     *  performed.
+     */
+    metaonly config String tableSection = null;
+
+    /*!
+     *  Track the maximum number of allocated blocks
+     *
+     *  This will enable/disable the tracking of the maximum number of
+     *  allocations for a HeapMultiBufMP instance.  This maximum refers to the
+     *  "all time" maximum number of allocations for the history of a
+     *  HeapMultiBufMP instance, not the current number of allocations.
+     *
+     *  Tracking the maximum might adversely affect performance when allocating
+     *  and/or freeing. If this feature is not needed, setting this to false
+     *  avoids the performance penalty.
+     */
+    config Bool trackMaxAllocs = false;
+
+instance:
+
+    /*!
+     *  GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in use of the GateMP
+     *  system gate for context protection.
+     */
+    config GateMP.Handle gate = null;
+
+    /*! @_nodoc
+     *   by the open() call. No one else should touch this!
+     */
+    config Bool openFlag = false;
+
+    /*!
+     *  Use exact matching
+     *
+     *  Setting this flag will allow allocation only if the requested size
+     *  is equal to (rather than less than or equal to) a buffer's block size.
+     */
+    config Bool exact = false;
+
+    /*!
+     *  Name of this instance.
+     *
+     *  The name (if not NULL) must be unique among all HeapMultiBufMP
+     *  instances in the entire system.  When creating a new
+     *  heap, it is necessary to supply an instance name.
+     */
+    config String name = null;
+
+    /*!
+     *  Number of buckets in {@link #bucketEntries}
+     *
+     *  This parameter is required to create any instance.
+     */
+    config Int numBuckets = 0;
+
+    /*!
+     *  Bucket Entries
+     *
+     *  The bucket entries are an array of {@link #Bucket}s whose values
+     *  correspond to the desired alignment, block size and length for each
+     *  buffer.  It is important to note that the alignments and sizes for each
+     *  buffer may be adjusted due to cache and alignment related constraints.
+     *  Buffer sizes are rounded up by their corresponding alignments.  Buffer
+     *  alignments themselves will assume the value of region cache alignment
+     *  size when the cache size is greater than the requested buffer alignment.
+     *
+     *  For example, specifying a bucket with {blockSize: 192, align: 256} will
+     *  result in a buffer of blockSize = 256 and alignment = 256.  If cache
+     *  alignment is required, then a bucket of {blockSize: 96, align: 64} will
+     *  result in a buffer of blockSize = 128 and alignment = 128 (assuming
+     *  cacheSize = 128).
+     */
+    config Bucket bucketEntries[];
+
+    /*!
+     *  Shared region ID
+     *
+     *  The index corresponding to the shared region from which shared memory
+     *  will be allocated.
+     */
+    config UInt16 regionId = 0;
+
+    /*! @_nodoc
+     *  Physical address of the shared memory
+     *
+     *  This value can be left as 'null' unless it is required to place the
+     *  heap at a specific location in shared memory.  If sharedAddr is null,
+     *  then shared memory for a new instance will be allocated from the
+     *  heap belonging to the region identified by {@link #regionId}.
+     */
+    config Ptr sharedAddr = null;
+
+    @DirectCall
+    override Ptr alloc(SizeT size, SizeT align, xdc.runtime.Error.Block *eb);
+
+    @DirectCall
+    override Void free(Ptr block, SizeT size);
+
+internal:
+
+    /*! Used in the attrs->status field */
+    const UInt32 CREATED = 0x05101920;
+
+    /*!
+     *  This Params object is used for temporary storage of the
+     *  module wide parameters that are for setting the NameServer instance.
+     */
+    metaonly config NameServer.Params nameSrvPrms;
+
+    /*! slice and dice the buffer */
+    Void postInit(Object *obj, Error.Block *eb);
+
+    /*!
+     * Takes in modifiable array of bucket entries, performs an in-place sort
+     * of the bucket entries, combines the entries as necessary, and returns
+     * the new number of buckets in the combined entries
+     */
+    UInt processBuckets(Bucket *bucketEntries, Params *params,
+                        UInt16 regionId);
+
+    /*!
+     * Add the block to the tail; index specifies the buffer number
+     *
+     * Precondition: inv obj->attrs->bucket[index]
+     * Postcondition: wb obj->attrs->bucket[index] and wb the block
+     */
+    Void putTail(Object *obj, Int index, Elem *block);
+
+    /*!
+     * Removes a block from the head and returns it; index specifies
+     * the buffer number. The block is invalidated before returned
+     *
+     * Precondition: inv obj->attrs->bucket[index]
+     * Postcondition: wb obj->attrs->bucket[index]
+     */
+    Elem *getHead(Object *obj, Int index);
+
+    /*! Needed for freelist */
+    @Opaque struct Elem {
+        /* must be volatile for whole_program */
+        volatile SharedRegion.SRPtr next;
+    };
+
+    /*! Shared memory state for a single buffer. */
+    struct BucketAttrs {
+        SharedRegion.SRPtr  head;
+        SharedRegion.SRPtr  tail;
+        SharedRegion.SRPtr  baseAddr;
+        Bits32              numFreeBlocks;
+        Bits32              minFreeBlocks;
+        Bits32              blockSize;
+        Bits32              align;
+        Bits32              numBlocks;
+    }
+
+    /*! Shared memory state for a HeapMultiBufMP instance */
+    struct Attrs {
+        Bits32              status;         /* Created stamp                 */
+        SharedRegion.SRPtr  gateMPAddr;     /* GateMP SRPtr                  */
+        Bits32              numBuckets;     /* Number of buffers             */
+        BucketAttrs         buckets[8]; /* Buffer attributes        */
+        Bits16              exact;          /* 1 = exact matching, 0 = no    */
+    }
+
+    struct Instance_State {
+        Attrs               *attrs;         /* Shared state                  */
+        GateMP.Handle       gate;           /* Gate for critical regions     */
+        Ipc.ObjType         objType;        /* See enum ObjType              */
+        Ptr                 nsKey;          /* Used to remove NS entry       */
+        Bool                cacheEnabled;   /* Whether to do cache calls     */
+        UInt16              regionId;       /* SharedRegion index            */
+        SizeT               allocSize;      /* Shared memory allocated       */
+        Char                *buf;           /* Local pointer to buf          */
+        Bucket              bucketEntries[];/* Optimized bucketEntries       */
+                                            /* NULL for dynamic instance     */
+        UInt                numBuckets;     /* # of optimized entries        */
+        Bool                exact;          /* Exact match flag              */
+    };
+
+    struct Module_State {
+        NameServer.Handle   nameServer;
+    };
+}
diff --git a/packages/ti/sdo/ipc/heaps/HeapMultiBufMP.xs b/packages/ti/sdo/ipc/heaps/HeapMultiBufMP.xs
new file mode 100644 (file)
index 0000000..8fc8e46
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== HeapMultiBufMP.xs ========
+ *
+ */
+
+var HeapMultiBufMP  = null;
+var SharedRegion    = null;
+var NameServer      = null;
+var Ipc             = null;
+var Cache           = null;
+var GateMP          = null;
+
+var instCount = 0;  /* use to determine if processing last instance */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    HeapMultiBufMP  = this;
+    Memory          = xdc.useModule('xdc.runtime.Memory');
+    NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    GateMP          = xdc.useModule('ti.sdo.ipc.GateMP');
+    Cache           = xdc.useModule('ti.sysbios.hal.Cache');
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    mod.nameServer  = null;
+
+    /* Setup nameserver */
+    /* initialize the NameServer param to be used now or later */
+    HeapMultiBufMP.nameSrvPrms.maxRuntimeEntries
+            = params.maxRuntimeEntries;
+    HeapMultiBufMP.nameSrvPrms.tableSection = params.tableSection;
+    HeapMultiBufMP.nameSrvPrms.maxNameLen   = params.maxNameLen;
+
+    /*
+     *  Get the current number of created static instances of this module.
+     *  Note: if user creates a static instance after this point and
+     *        expects to use NameServer, this is a problem.
+     */
+    var instCount = this.$instances.length;
+
+    /* create NameServer here only if no static instances are created */
+    if (instCount == 0) {
+        mod.nameServer = NameServer.create("HeapMultiBufMP",
+                                            HeapMultiBufMP.nameSrvPrms);
+    }
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    var HeapMultiBufMP  = xdc.useModule('ti.sdo.ipc.heaps.HeapMultiBufMP');
+    var Ipc             = xdc.useModule('ti.sdo.ipc.Ipc');
+    var SharedRegion    = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+    /* view.name */
+    view.name = NameServer.getName$view("HeapMultiBufMP",
+        SharedRegion.getSRPtrMeta$view(obj.attrs));
+
+    /* view.objType */
+    view.objType = Ipc.getObjTypeStr$view(obj.objType);
+
+    /* view.gate */
+    view.gate = obj.gate;
+
+    try {
+        var attrs = Program.fetchStruct(HeapMultiBufMP.Attrs$fetchDesc,
+                                        obj.attrs.$addr);
+        var totalSize = 0;
+        for (var i = 0; i < attrs.numBuckets; i++) {
+            totalSize += attrs.buckets[i].blockSize *
+                         attrs.buckets[i].numBlocks;
+        }
+
+        /* view.totalSize */
+        view.totalSize = "0x" + Number(totalSize).toString(16);
+
+        /* view.exact */
+        view.exact = attrs.exact == 1 ? true : false;
+
+        /* view.buf */
+        view.buf = $addr(obj.buf);
+    }
+    catch (e) {
+        throw("Error: could not access shared memory: " + e);
+    }
+
+}
+
+/*
+ *  ======== viewInitData ========
+ */
+function viewInitData(view, obj)
+{
+    var HeapMultiBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapMultiBufMP');
+    var SharedRegion   = xdc.useModule('ti.sdo.ipc.SharedRegion');
+    var NameServer     = xdc.useModule('ti.sdo.utils.NameServer');
+
+    /* Display the instance label in the tree */
+    view.label = NameServer.getName$view("HeapMultiBufMP",
+        SharedRegion.getSRPtrMeta$view(obj.attrs.$addr));
+    if (view.label == null) {
+        view.label = "0x" + Number(obj.attrs.$addr).toString(16);
+    }
+
+    /* Fetch attrs struct */
+    try {
+        var attrs = Program.fetchStruct(HeapMultiBufMP.Attrs$fetchDesc,
+                                        obj.attrs.$addr);
+
+        for (i = 0; i < Number(attrs.numBuckets); i++) {
+            var elem = Program.newViewStruct('ti.sdo.ipc.heaps.HeapMultiBufMP',
+                                             'Buffer Information');
+            elem.baseAddr       = "0x" + Number(SharedRegion.getPtrMeta$view(
+                attrs.buckets[i].baseAddr)).toString(16);
+            elem.blockSize      = attrs.buckets[i].blockSize;
+            elem.align          = attrs.buckets[i].align;
+            elem.numBlocks      = attrs.buckets[i].numBlocks;
+            elem.numFreeBlocks  = attrs.buckets[i].numFreeBlocks;
+
+            elem.minFreeBlocks  = attrs.buckets[i].minFreeBlocks == 0xffffffff
+                                  ? -1 : attrs.buckets[i].minFreeBlocks;
+
+            /* Add the element to the list. */
+            view.elements.$add(elem);
+        }
+    }
+    catch (e) {
+        throw("Error: could not access shared memory: " + e);
+    }
+}
diff --git a/packages/ti/sdo/ipc/heaps/_HeapBufMP.h b/packages/ti/sdo/ipc/heaps/_HeapBufMP.h
new file mode 100644 (file)
index 0000000..1c7310d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _HeapBufMP.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_heaps_HeapBufMP__nolocalnames
+
+#include <ti/sdo/ipc/heaps/HeapBufMP.h>
+
+#include <ti/ipc/HeapBufMP.h>
diff --git a/packages/ti/sdo/ipc/heaps/_HeapMemMP.h b/packages/ti/sdo/ipc/heaps/_HeapMemMP.h
new file mode 100644 (file)
index 0000000..4841020
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _HeapMemMP.h ========
+ *  This file should only be used by Ipc modules
+ */
+#define ti_sdo_ipc_heaps_HeapMemMP__nolocalnames
+
+#include <ti/sdo/ipc/heaps/HeapMemMP.h>
+
+#include <ti/ipc/HeapMemMP.h>
diff --git a/packages/ti/sdo/ipc/heaps/_HeapMultiBufMP.h b/packages/ti/sdo/ipc/heaps/_HeapMultiBufMP.h
new file mode 100644 (file)
index 0000000..78b7b1d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _HeapMultiBufMP.h ========
+ *  This file should only be used by Ipc modules
+ */
+
+#define ti_sdo_ipc_heaps_HeapMultiBufMP__nolocalnames
+
+#include <ti/sdo/ipc/heaps/HeapMultiBufMP.h>
+
+#include <ti/ipc/HeapMultiBufMP.h>
diff --git a/packages/ti/sdo/ipc/heaps/package.bld b/packages/ti/sdo/ipc/heaps/package.bld
new file mode 100644 (file)
index 0000000..08803ac
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var commonObjList = [
+    "HeapMemMP",
+    "HeapBufMP",
+    "HeapMultiBufMP",
+];
+
+var objList0 = [
+].concat(commonObjList);
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList0, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList0, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [
+        "package.bld",
+        "_HeapBufMP.h",
+        "_HeapMemMP.h",
+        "_HeapMultiBufMP.h",
+];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/heaps/package.xdc b/packages/ti/sdo/ipc/heaps/package.xdc
new file mode 100644 (file)
index 0000000..d614630
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+requires ti.sdo.ipc;
+requires ti.sdo.ipc.interfaces;
+requires ti.sdo.utils;
+
+/*!
+ *  ======== ti.sdo.ipc.heaps ========
+ *  IPC-related memory heaps
+ *
+ *  Contains modules that support managing memory heaps by multiple
+ *  processors.
+ */
+package ti.sdo.ipc.heaps [1,0,0,0] {
+    module HeapBufMP;
+    module HeapMultiBufMP;
+    module HeapMemMP;
+}
diff --git a/packages/ti/sdo/ipc/heaps/package.xs b/packages/ti/sdo/ipc/heaps/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/instrumented.cfg b/packages/ti/sdo/ipc/instrumented.cfg
new file mode 100644 (file)
index 0000000..14d8b26
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/ipc/instrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = false;
+
+BIOS.libDir = "lib/sysbios/instrumented/";
+
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libDir = "lib/ipc/instrumented/";
+
+var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
+MessageQ.traceFlag = true;
diff --git a/packages/ti/sdo/ipc/instrumented.cfg.xs b/packages/ti/sdo/ipc/instrumented.cfg.xs
new file mode 100644 (file)
index 0000000..9f58c42
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== instrumented.cfg.xs ========
+ *
+ */
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.libType = BIOS.LibType_Custom;
+BIOS.buildingAppLib = false;
+BIOS.assertsEnabled = true;
+BIOS.logsEnabled = true;
+
+var SourceDir = xdc.module("xdc.cfg.SourceDir");
+SourceDir.verbose = 1;
+
+/* suppress un-placed sections warning from m3 Hwi.meta$init() */
+if (Program.sectMap[".vecs"] !== undefined) {
+    Program.sectMap[".vecs"].type = "DSECT";
+}
+if (Program.sectMap[".resetVecs"] !== undefined) {
+    Program.sectMap[".resetVecs"].type= "DSECT";
+}
diff --git a/packages/ti/sdo/ipc/interfaces/IGateMPSupport.xdc b/packages/ti/sdo/ipc/interfaces/IGateMPSupport.xdc
new file mode 100644 (file)
index 0000000..7fc865f
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IGateMPSupport.xdc ========
+ *
+ */
+
+import xdc.runtime.IGateProvider;
+
+/*!
+ *  ======== IGateMPSupport ========
+ */
+interface IGateMPSupport inherits IGateProvider
+{
+    /*!
+     *  ======== getNumResources ========
+     *  Returns the number of resources offered by the GateMP delegate
+     */
+    metaonly UInt getNumResources();
+
+    /*!
+     *  ======== getReservedMask ========
+     *  @_nodoc
+     *  Used by GateMP to query which HW resources are reserved
+     */
+    @DirectCall
+    Bits32 *getReservedMask();
+
+    /*!
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  The value returned by this function may depend on the cache alignment
+     *  requirements for the shared region from which memory will be used.
+     *
+     *  @param(params)      Pointer to the parameters that will be used in
+     *                      the create.
+     *
+     *  @a(returns)         Number of MAUs needed to create the instance.
+     */
+    @DirectCall
+    SizeT sharedMemReq(const Params *params);
+
+    /*!
+     *  ======== getRemoteStatus$view ========
+     *  @_nodoc
+     *  ROV helper function that returns the status of the remote gate
+     *
+     *  @b(returns)     Gate status
+     */
+    metaonly String getRemoteStatus$view(IGateProvider.Handle handle);
+
+instance:
+
+    /*!
+     *  Logical resource id
+     */
+    config UInt resourceId = 0;
+
+    /*! @_nodoc
+     *  ======== openFlag ========
+     */
+    config Bool openFlag = false;
+
+    /*!
+     *  ======== regionId ========
+     *  @_nodoc
+     *  Shared Region Id
+     *
+     *  The ID corresponding to the shared region in which this shared instance
+     *  is to be placed.
+     */
+    config UInt16 regionId = 0;
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Physical address of the shared memory
+     *
+     *  This parameter is only used by GateMP delegates that use shared memory
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== create ========
+     *  Create a remote gate instance.
+     *
+     *  A Non-NULL gate for local protection must be passed to the create
+     *  call.  If no local protection is desired, a
+     *  {@link xdc.runtime.GateNull} handle must be passed in.
+     *
+     *  @param(localGate)       Gate to use for local protection.
+     */
+    create(IGateProvider.Handle localGate);
+}
diff --git a/packages/ti/sdo/ipc/interfaces/IMessageQTransport.xdc b/packages/ti/sdo/ipc/interfaces/IMessageQTransport.xdc
new file mode 100644 (file)
index 0000000..2d2ef14
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IMessageQTransport.xdc ========
+ *
+ */
+
+/*!
+ *  ======== IMessageQTransport ========
+ *  Interface for the transports used by MessageQ
+ *
+ *  The transport implementations have to register with
+ *  {@link ti.sdo.ipc.MessageQ}. This is done via the
+ *  {@link ti.sdo.ipc.MessageQ#registerTransport} function.
+ *
+ *  If transports need additional processing during startup,
+ *  there are multiple hook points to run start-up code that
+ *  the transport implementation can use.
+ */
+
+interface IMessageQTransport
+{
+    /*!
+     *  Transport return values
+     *
+     *  @p(blist)
+     *  -{@link #S_SUCCESS}: Operation was successful
+     *  -{@link #E_FAIL}: Operation resulted in a failure
+     *  -{@link #E_ERROR}: Operation resulted in an error.
+     *  @p
+     */
+    enum Status {
+        S_SUCCESS = 0,
+        E_FAIL = -1,
+        E_ERROR = -2
+    };
+
+    /*!
+     *  Reason for error function being called
+     *
+     *  First field in the {@link #errFxn}
+     */
+    enum Reason {
+        Reason_FAILEDPUT,
+        Reason_INTERNALERR,
+        Reason_PHYSICALERR,
+        Reason_FAILEDALLOC
+    };
+
+    /*!
+     *  Asynchronous error function for the transport module
+     */
+    config ErrFxn errFxn = null;
+
+    /*!
+     *  Typedef for transport error callback function.
+     *
+     *  First parameter: Why the error function is being called.
+     *
+     *  Second parameter: Handle of transport that had the error. NULL denotes
+     *  that it is a system error, not a specific transport.
+     *
+     *  Third parameter: Pointer to the message. This is only valid for
+     *  {@link #Reason_FAILEDPUT}.
+     *
+     *  Fourth parameter: Transport specific information. Refer to individual
+     *  transports for more details.
+     */
+    typedef Void (*ErrFxn)(Reason, Handle, Ptr, UArg);
+
+    /*!
+     *  ======== setErrFxn ========
+     *  Sets the asynchronous error function for the transport module
+     *
+     *  This API allows the user to set the function that will be called in
+     *  case of an asynchronous error by the transport.
+     *
+     *  @param(errFxn)        Function that is called when an asynchronous
+     *                        error occurs.
+     */
+    Void setErrFxn(ErrFxn errFxn);
+
+instance:
+
+    /*!
+     *  Which priority messages should this transport manage.
+     */
+    config UInt priority = 0;
+
+    /*!
+     *  ======== create ========
+     *  Create a Transport instance
+     *
+     *  This function creates a transport instance. The transport is
+     *  responsible for registering with MessageQ via the
+     *  {@link ti.sdo.ipc.MessageQ#registerTransport} API.
+     *
+     *  @param(procId)        Remote processor id that this instance
+     *                        will communicate with.
+     */
+    create(UInt16 procId);
+
+    /*!
+     *  ======== getStatus ========
+     *  Status of a Transport instance
+     *
+     *  This function returns the status of the transport instance.
+     *
+     *  @b(returns)             Returns status of Transport instance
+     */
+    @DirectCall
+    Int getStatus();
+
+    /*!
+     *  ======== put ========
+     *  Put the message to the remote processor
+     *
+     *  If the transport can accept the message, it returns TRUE. Accepting
+     *  a message does not mean that it is transmitted. It simply means that
+     *  the transport should be able to send the message. If the actual transfer
+     *  fails, the transport calls the {@#ErrFxn} (assuming it is set up via the
+     *  {@#setErrFxn} API. If the {@#ErrFxn} is not set, the message is dropped.
+     *  (also...should an error be raised or just System_printf?).
+     *
+     *  If the transport cannot send the message, it returns FALSE and a
+     *  filled in Error_Block. The caller still owns the message.
+     *
+     *  @param(msg)             Pointer the message to be sent
+     *
+     *  @b(returns)             TRUE denotes acceptance of the message to
+     *                          be sent. FALSE denotes the message could not be
+     *                          sent.
+     */
+    @DirectCall
+    Bool put(Ptr msg);
+
+    /*!
+     *  ======== Control ========
+     *  Send a control command to the transport instance
+     *
+     *  This is function allows transport to specify control commands. Refer
+     *  to individual transport implementions for more details.
+     *
+     *  @param(cmd)             Requested command
+     *  @param(cmdArgs)         Accompanying field for the command. This is
+     *                          command specific.
+     *
+     *  @b(returns)             TRUE denotes acceptance of the command. FALSE
+     *                          denotes failure of the command.
+     */
+    @DirectCall
+    Bool control(UInt cmd, UArg cmdArg);
+}
diff --git a/packages/ti/sdo/ipc/interfaces/INotifyDriver.xdc b/packages/ti/sdo/ipc/interfaces/INotifyDriver.xdc
new file mode 100644 (file)
index 0000000..f7f9f1e
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== INotifyDriver.xdc ========
+ *
+ */
+
+/*!
+ *  ======== INotifyDriver ========
+ *  Notify driver interface
+ *
+ *  Interface implemented by all drivers for the notify module.  Modules that
+ *  implement this interface expect the eventId arguments to be valid.
+ */
+
+interface INotifyDriver {
+
+instance:
+
+    /*!
+     *  ======== registerEvent ========
+     *  Register a callback to an event
+     *
+     *  This driver function is called by the Notify_registerEvent function
+     *  within the Notify module gate. Refer to its documentation for more
+     *  details.
+     *
+     *  @param(eventId)      Number of event that is being registered
+     */
+    @DirectCall
+    Void registerEvent(UInt32 eventId);
+
+    /*!
+     *  ======== unregisterEvent ========
+     *  Remove an event listener from an event
+     *
+     *  This driver function is called by the Notify_unregisterEvent function
+     *  within the Notify module gate. Refer to it for more details.
+     *
+     *  @param(eventId)      Number of event that is being unregistered
+     */
+    @DirectCall
+    Void unregisterEvent(UInt32 eventId);
+
+    /*!
+     *  ======== sendEvent ========
+     *  Send a signal to an event
+     *
+     *  This interface function is called by the Notify_sendEvent function.
+     *  Notify_sendEvent does not provide any context protection for
+     *  INotifyDriver_sendEvent, so appropriate measures must be taken within
+     *  the driver itself.
+     *
+     *  @param(eventId)      Number of event to signal
+     *  @param(payload)      Payload (optional) to pass to callback function
+     *  @param(waitClear)    If TRUE, have the NotifyDriver wait for
+     *                       acknowledgement back from the destination
+     *                       processor.
+     *
+     *  @b(returns)          Notify status
+     */
+    @DirectCall
+    Int sendEvent(UInt32 eventId, UInt32 payload, Bool waitClear);
+
+    /*!
+     *  ======== disable ========
+     *  Disable a NotifyDriver instance
+     *
+     *  Disables the ability of a Notify driver to receive events for a given
+     *  processor. This interface function is called by the Notify_disable
+     *  function. Refer to its documentation for more details.
+     */
+    @DirectCall
+    Void disable();
+
+    /*!
+     *  ======== enable ========
+     *  Enable a NotifyDriver instance
+     *
+     *  Enables the ability of a Notify driver to receive events for a given
+     *  processor. This interface function is called by the Notify_restore
+     *  function. Refer to its documentation for more details.
+     */
+    @DirectCall
+    Void enable();
+
+    /*!
+     *  ======== disableEvent ========
+     *  Disable an event
+     *
+     *  This interface function is called by the Notify_disableEvent function.
+     *  Refer to its documentation for more details.
+     *
+     *  The Notify module does validation of the eventId.  The Notify module
+     *  enters calls this function within the Notify module gate.
+     *
+     *  @param(eventId)      Number of event to disable
+     */
+    @DirectCall
+    Void disableEvent(UInt32 eventId);
+
+    /*!
+     *  ======== enableEvent ========
+     *  Enable an event
+     *
+     *  This interface function is called by the Notify_disableEvent function.
+     *  Refer to its documentation for more details.
+     *
+     *  The Notify module does validation of the eventId.  The Notify module
+     *  enters calls this function within the Notify module gate.
+     *
+     *  @param(eventId)      Number of event to enable
+     */
+    @DirectCall
+    Void enableEvent(UInt32 eventId);
+
+    /*! @_nodoc
+     *  ======== setNotifyHandle ========
+     *  Called during Notify instance creation to 'send' its handle to its
+     *  corresponding notify driver instance
+     */
+    @DirectCall
+    Void setNotifyHandle(Ptr driverHandle);
+
+}
diff --git a/packages/ti/sdo/ipc/interfaces/INotifySetup.xdc b/packages/ti/sdo/ipc/interfaces/INotifySetup.xdc
new file mode 100644 (file)
index 0000000..ed4f3bf
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== INotifySetup.xdc ========
+ *
+ */
+/*
+ *  ======== Revision History ========
+ *
+ */
+
+interface INotifySetup {
+
+    /*! Function that will be called in Notify_attach */
+    @DirectCall
+    Int attach(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*! Shared Memory Required for a single notification line */
+    @DirectCall
+    SizeT sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*! Returns number of interrupt lines to the processor */
+    @DirectCall
+    UInt16 numIntLines(UInt16 remoteProcId);
+}
diff --git a/packages/ti/sdo/ipc/interfaces/ITransportSetup.xdc b/packages/ti/sdo/ipc/interfaces/ITransportSetup.xdc
new file mode 100644 (file)
index 0000000..be84887
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== ITransportSetup.xdc ========
+ *
+ */
+
+/*
+ *  ======== Revision History ========
+ *
+ */
+
+interface ITransportSetup
+{
+    /*! priority of the transport */
+    config UInt priority = 0;
+
+    /*! Function that will be called in MessageQ_attach */
+    @DirectCall
+    Int attach(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*! Function that will be called in MessageQ_detach */
+    @DirectCall
+    Int detach(UInt16 remoteProcId);
+
+    /*! Determines if a transport has been registered to a remote processor */
+    @DirectCall
+    Bool isRegistered(UInt16 remoteProcId);
+
+    /*! Shared memory required */
+    @DirectCall
+    SizeT sharedMemReq(Ptr sharedAddr);
+}
diff --git a/packages/ti/sdo/ipc/interfaces/package.bld b/packages/ti/sdo/ipc/interfaces/package.bld
new file mode 100644 (file)
index 0000000..3ee9f84
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList = [
+];
+
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/interfaces/package.xdc b/packages/ti/sdo/ipc/interfaces/package.xdc
new file mode 100644 (file)
index 0000000..aa0238a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.sdo.ipc.interfaces ========
+ *  IPC-related interfaces
+ *
+ *  Contains interfaces for communication between processors.
+ */
+
+package ti.sdo.ipc.interfaces [1,0,0,0] {
+    interface INotifyDriver;
+    interface INotifySetup;
+    interface IGateMPSupport;
+    interface IMessageQTransport;
+    interface ITransportSetup;
+}
diff --git a/packages/ti/sdo/ipc/interfaces/package.xs b/packages/ti/sdo/ipc/interfaces/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/linkcmd.xdt b/packages/ti/sdo/ipc/linkcmd.xdt
new file mode 100644 (file)
index 0000000..624ac6f
--- /dev/null
@@ -0,0 +1,77 @@
+%%{
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%%{
+/*
+ *  Add SharedRegions to the linker map when heaps are created.
+ *  This is to prevent the user from placing other code/data
+ *  in the same memory location where heaps will be created.
+ */
+%%}
+%var SharedRegion = xdc.module("ti.sdo.ipc.SharedRegion");
+%var Ipc = xdc.module("ti.sdo.ipc.Ipc");
+%
+%var regions = SharedRegion.$object.regions;
+%
+
+% if (Program.build.target.$name.match(/ti/)) {
+SECTIONS
+{
+%    for (var i=0; i < regions.length; i++) {
+%        if ((regions[i].entry.isValid) &&
+%            (regions[i].entry.ownerProcId != SharedRegion.DEFAULTOWNERID) &&
+%            (SharedRegion.genSectionInLinkCmd[i])) {
+%            var sectName = "ti.sdo.ipc.SharedRegion_" + i;
+%            var len  = utils.toHex(regions[i].entry.len);
+%            var base = utils.toHex(Number(regions[i].entry.base));
+%            if (Program.build.target.$name.match(/ARP32/)) {
+    `sectName`:  { . += `len`;} run > `base` PAGE 1, type = NOLOAD
+%            }
+%            else {
+    `sectName`:  { . += `len`;} run > `base`, type = NOLOAD
+%            }
+%        }
+%    }
+%
+%    if (Ipc.generateSlaveDataForHost &&
+%       (Program.sectMap["ti_sdo_ipc_init"] == undefined)) {
+
+%            if (Program.build.target.$name.match(/ARP32/)) {
+    ti_sdo_ipc_init: load > `Program.platform.dataMemory` PAGE 1, type = NOINIT
+%            }
+%            else {
+    ti_sdo_ipc_init: load > `Program.platform.dataMemory`, type = NOINIT
+%            }
+%    }
+}
+% }
diff --git a/packages/ti/sdo/ipc/makefile.xdt b/packages/ti/sdo/ipc/makefile.xdt
new file mode 100644 (file)
index 0000000..8b31571
--- /dev/null
@@ -0,0 +1,156 @@
+%%{
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%%{
+    var File = xdc.module("xdc.services.io.File");
+
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    var TARGET = $args[0];
+
+    var XDCROOT = String(environment['xdc.rootDir'] + '/packages/').replace(/\\/g, "/");
+
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+
+    var CGEN = TARGET.rootDir.replace(/\\/g, "/");
+
+    function baseName(path) {
+       return path.substr(path.lastIndexOf('/') + 1).replace(/\.[^\.]+$/, "");
+    }
+
+    function packageName(path) {
+       var dirpath = path.substring(0, path.lastIndexOf('/'));
+       return dirpath.substr(dirpath.lastIndexOf('/') + 1);
+    }
+    var OBJS = [];
+%%}
+vpath % `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
+vpath %.c `XDCROOT`
+
+XOPTS = `'-I"' + XDCROOT + '"' + " -Dxdc_target_types__=" + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude + " -Dxdc_target_name__=" + TARGET.name`
+
+CCOPTS ?= `BIOS.getCCOpts(TARGET.name)`
+
+XDC_ROOT  = `XDCROOT`
+
+IPC_ROOT = `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
+
+BUILD_DEFS = `Build.getDefs()`
+
+BIOS_INC  = -I"`xdc.getPackageRepository("ti.sysbios")`"
+
+IPC_INC    = -I"`xdc.getPackageRepository("ti.sdo.ipc")`"
+
+UTILS_INC    = -I"`xdc.getPackageRepository("ti.sdo.utils")`"
+
+CC = `CGEN`/bin/`TARGET.cc.cmd` $(CCOPTS) -I `CGEN`/include
+
+ASM = `CGEN`/bin/`TARGET.asm.cmd` $(CCOPTS) -I `CGEN`/include
+
+AR = `CGEN`/bin/`TARGET.ar.cmd` `TARGET.ar.opts`
+
+%if (environment["os.name"].match(/Windows.*/i)) {
+%if (BIOS.buildingAppLib == false) {
+%    Build.$private.libDir = Build.$private.libDir.replace(/\//g,'\\');
+%}
+DEL = cmd.exe /q /c del /f
+CP = cmd.exe /q /c copy /Y
+%}
+%else {
+DEL = rm -f
+CP = cp -f
+%}
+
+define RM
+       $(if $(wildcard $1),$(DEL) $1,:)
+endef
+
+define ASSEMBLE
+       @echo asm`TARGET.suffix` $< ...
+       @$(ASM) $(BUILD_DEFS) $(XOPTS) $(IPC_INC) $<
+endef
+
+%var LIB = "ipc.a" + TARGET.suffix;
+
+%if (BIOS.buildingAppLib == false) {
+all: `Build.$private.libDir``LIB`
+%}
+%else {
+all: `LIB`
+%}
+
+%var sources = Build.getAsmFiles(TARGET.$name);
+%for each (var s in sources) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".obj";
+%    OBJS.push(obj)
+`obj`: `s` makefile
+       @-$(call RM, $@)
+       $(ASSEMBLE) --output_file=`obj`
+
+%}
+
+Ipc.obj: `Build.getCFiles(TARGET.$name)` makefile
+       @-$(call RM, $@)
+       @echo cl`TARGET.suffix` $< ...
+       @$(CC) $(BUILD_DEFS) $(XOPTS) $(BIOS_INC) \
+       $(IPC_INC) $(UTILS_INC) \
+%var sources = Build.getCFiles(TARGET.$name).split(' ');
+%for each (var s in sources) {
+%    if (s.substring(0,4) == "xdc/") {
+       $(XDC_ROOT)`s` \
+%    } else {
+       $(IPC_ROOT)`s` \
+%    }
+%}
+
+`LIB`: Ipc.obj `OBJS.join(" ")`
+       @echo ar`TARGET.suffix` $^ ...
+       @-$(call RM, $@)
+       @$(AR) $@ $^
+
+%if (BIOS.buildingAppLib == false) {
+`Build.$private.libDir``LIB`: `LIB`
+       @echo cp `LIB`
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+       @$(CP) `LIB` "`Build.$private.libDir``LIB`"
+%}
+
+clean:
+       @-$(call RM, `LIB`)
+%if (BIOS.buildingAppLib == false) {
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+%}
+       @-$(call RM, Ipc.obj)
+%for (var i = 0; i < OBJS.length; i++) {
+       @-$(call RM, `OBJS[i]`)
+%}
diff --git a/packages/ti/sdo/ipc/makefile_gccArmLto.xdt b/packages/ti/sdo/ipc/makefile_gccArmLto.xdt
new file mode 100644 (file)
index 0000000..1390dec
--- /dev/null
@@ -0,0 +1,152 @@
+%%{
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%%{
+    var File = xdc.module("xdc.services.io.File");
+
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    var TARGET = $args[0];
+
+    var XDCROOT = String(environment['xdc.rootDir'] + '/packages/').replace(/\\/g, "/");
+
+    var XOPTS = '-I "' + XDCROOT + '"'
+       + " -Dxdc_target_types__=" + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude
+       + " -Dxdc_target_name__=" + TARGET.name;
+
+    var CGEN = TARGET.rootDir.replace(/\\/g, "/");
+
+    function baseName(path) {
+       return path.substr(path.lastIndexOf('/') + 1).replace(/\.[^\.]+$/, "");
+    }
+
+    function packageName(path) {
+       var dirpath = path.substring(0, path.lastIndexOf('/'));
+       return dirpath.substr(dirpath.lastIndexOf('/') + 1);
+    }
+    var OBJS = [];
+%%}
+vpath % `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
+vpath %.c `XDCROOT`
+
+CCOPTS    = `BIOS.getCCOpts(TARGET.$name)`
+
+XDC_ROOT  = `XDCROOT`
+
+BUILD_DEFS = `Build.getDefs()`
+
+BIOS_INC  = -I"`xdc.getPackageRepository("ti.sysbios")`"
+
+IPC_INC    = -I"`xdc.getPackageRepository("ti.sdo.ipc")`"
+
+UTILS_INC    = -I"`xdc.getPackageRepository("ti.sdo.utils")`"
+
+
+CC = `CGEN`/`TARGET.ccBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
+ASM = `CGEN`/`TARGET.asmBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
+AR = `CGEN`/`TARGET.arBin.cmd` `TARGET.ar.opts`
+
+%if (environment["os.name"].match(/Windows.*/i)) {
+%if (BIOS.buildingAppLib == false) {
+%    Build.$private.libDir = Build.$private.libDir.replace(/\//g,'\\');
+%}
+DEL = cmd.exe /q /c del /f
+CP = cmd.exe /q /c copy /Y
+%}
+%else {
+DEL = rm -f
+CP = cp -f
+%}
+
+define RM
+       $(if $(wildcard $1),$(DEL) $1,:)
+endef
+
+define ASSEMBLE
+       @echo asm`TARGET.suffix` $< ...
+       @$(ASM) $(BUILD_DEFS) `XOPTS` $(BIOS_INC) $<
+endef
+
+define COMPILE
+       @echo cl`TARGET.suffix` $< ...
+       @$(CC) $(BUILD_DEFS) `XOPTS` $(BIOS_INC) $(IPC_INC) $(UTILS_INC) $<
+endef
+
+%var LIB = "ipc.a" + TARGET.suffix;
+
+all: `LIB`
+
+%var sources = Build.getAsmFiles(TARGET.$name);
+%for each (var s in sources) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".o";
+%    OBJS.push(obj)
+`obj`: `s` makefile
+       @-$(call RM, $@)
+       $(ASSEMBLE) -o `obj`
+
+%}
+
+%var sources = Build.getCFiles(TARGET.$name).split(' ');
+%for each (var s in sources) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".o";
+%    OBJS.push(obj)
+`obj`: `s` makefile
+       @-$(call RM, `obj`)
+       $(COMPILE) -o `obj`
+%}
+
+`LIB`: `OBJS.join(" ")`
+       @echo ar`TARGET.suffix` $^ ...
+       @-$(call RM, $@)
+       @$(AR) $@ $^
+%if (BIOS.buildingAppLib == false) {
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+       $(CP) `LIB` "`Build.$private.libDir``LIB`"
+%}
+
+clean:
+       @-$(call RM, `LIB`)
+%if (BIOS.buildingAppLib == false) {
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+%}
+%if (TARGET.$name.match(/gnu/)) {
+       @-$(call RM, BIOS.o)
+%}
+%else {
+       @-$(call RM, BIOS.obj)
+%}
+%for (var i = 0; i < OBJS.length; i++) {
+       @-$(call RM, `OBJS[i]`)
+%}
diff --git a/packages/ti/sdo/ipc/nonInstrumented.cfg b/packages/ti/sdo/ipc/nonInstrumented.cfg
new file mode 100644 (file)
index 0000000..7e1ed26
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/ipc/nonInstrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = false;
+
+BIOS.libDir = "lib/sysbios/nonInstrumented/";
+
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libDir = "lib/ipc/nonInstrumented/";
+
+var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
+MessageQ.traceFlag = false;
diff --git a/packages/ti/sdo/ipc/nonInstrumented.cfg.xs b/packages/ti/sdo/ipc/nonInstrumented.cfg.xs
new file mode 100644 (file)
index 0000000..8087ff7
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== nonInstrumented.cfg.xs ========
+ *
+ */
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.libType = BIOS.LibType_Custom;
+BIOS.buildingAppLib = false;
+BIOS.assertsEnabled = false;
+BIOS.logsEnabled = false;
+
+var SourceDir = xdc.module("xdc.cfg.SourceDir");
+SourceDir.verbose = 1;
+
+/* suppress un-placed sections warning from m3 Hwi.meta$init() */
+if (Program.sectMap[".vecs"] !== undefined) {
+    Program.sectMap[".vecs"].type = "DSECT";
+}
+if (Program.sectMap[".resetVecs"] !== undefined) {
+    Program.sectMap[".resetVecs"].type= "DSECT";
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/IInterrupt.xdc b/packages/ti/sdo/ipc/notifyDrivers/IInterrupt.xdc
new file mode 100644 (file)
index 0000000..1b72cb1
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== IInterrupt.xdc ========
+ *
+ */
+
+/*!
+ *  ======== IInterrupt ========
+ *  Interface for the inter-processor interrupts
+ */
+interface IInterrupt {
+
+    struct IntInfo {
+        UInt  localIntId;
+        UInt  remoteIntId;
+        UInt  intVectorId;
+    }
+
+    /*!
+     *  ======== intEnable ========
+     *  Enables the interrupt corresponding to intId
+     *
+     *  @param(remoteProcId)  Remote MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     */
+    @DirectCall
+    Void intEnable(UInt16 remoteProcId, IntInfo *intInfo);
+
+    /*!
+     *  ======== intDisable ========
+     *  Disables the interrupt corresponding to intId
+     *
+     *  @param(remoteProcId)  Remote MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     */
+    @DirectCall
+    Void intDisable(UInt16 remoteProcId, IntInfo *intInfo);
+
+    /*!
+     *  ======== intRegister ========
+     *  Register an interrupt line to a remote processor
+     *
+     *  @param(remoteProcId)  Remote MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     *  @param(func)          Function to register.
+     *  @param(arg)           Argument that will be passed to func
+     */
+    @DirectCall
+    Void intRegister(UInt16 remoteProcId, IntInfo *intInfo, Fxn func, UArg arg);
+
+    /*!
+     *  ======== intUnregister ========
+     *  Unregister an interrupt line to a remote processor
+     *
+     *  @param(remoteProcId)  Remote MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     */
+    @DirectCall
+    Void intUnregister(UInt16 remoteProcId, IntInfo *intInfo);
+
+    /*!
+     *  ======== intSend ========
+     *  Send interrupt to the remote processor
+     *
+     *  @param(remoteProcId)  Remote MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     *  @param(arg)           Argument for sending interrupt.
+     */
+    @DirectCall
+    Void intSend(UInt16 remoteProcId, IntInfo *intInfo, UArg arg);
+
+    /*!
+     *  @_nodoc
+     *  Post an interrupt locally.
+     *
+     *  Used to simulate receiving an interrupt from a remote (source)
+     *  processor
+     *
+     *  @param(remoteProcId)  Source MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     *  @param(arg)           Argument for sending interrupt.
+     */
+    @DirectCall
+    Void intPost(UInt16 srcProcId, IntInfo *intInfo, UArg arg);
+
+    /*!
+     *  ======== intClear ========
+     *  Clear interrupt
+     *
+     *  @param(remoteProcId)  Remote MultiProc Id
+     *  @param(intInfo)       Information needed to configure interrupt line
+     *
+     *  @b(returns)           Value (if any) of the interrupt before
+     *                        it was cleared
+     */
+    @DirectCall
+    UInt intClear(UInt16 remoteProcId, IntInfo *intInfo);
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.c b/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.c
new file mode 100644 (file)
index 0000000..980ce50
--- /dev/null
@@ -0,0 +1,600 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverCirc.c ========
+ */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Timestamp.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/hal/Cache.h>
+
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+
+#include "package/internal/NotifyDriverCirc.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+
+/*
+ **************************************************************
+ *                       Instance functions
+ **************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverCirc_Instance_init ========
+ */
+Void NotifyDriverCirc_Instance_init(NotifyDriverCirc_Object *obj,
+                                  const NotifyDriverCirc_Params *params)
+{
+    UInt16 regionId;
+    UInt16 localIndex, remoteIndex;
+    SizeT  regionCacheSize, minAlign;
+    SizeT  ctrlSize, circBufSize, totalSelfSize;
+
+   /*
+    * Check whether remote proc ID has been set and isn't the same as the
+    * local proc ID
+    */
+    Assert_isTrue ((params->remoteProcId != MultiProc_INVALIDID) &&
+                   (params->remoteProcId != MultiProc_self()),
+                   ti_sdo_ipc_Ipc_A_invParam);
+
+    /*
+     *  Determine obj->cacheEnabled using params->cacheEnabled and SharedRegion
+     *  cache flag setting, if applicable.
+     */
+    obj->cacheEnabled = params->cacheEnabled;
+    minAlign = params->cacheLineSize;
+    if (minAlign == 0) {
+        /* Fix alignment of zero */
+        minAlign = sizeof(Ptr);
+    }
+
+    regionId = SharedRegion_getId(params->sharedAddr);
+    if (regionId != SharedRegion_INVALIDREGIONID) {
+        /*
+         *  Override the user cacheEnabled setting if the region
+         *  cacheEnabled is FALSE.
+         */
+        if (!SharedRegion_isCacheEnabled(regionId)) {
+            obj->cacheEnabled = FALSE;
+        }
+
+        regionCacheSize = SharedRegion_getCacheLineSize(regionId);
+
+        /*
+         *  Override the user cache line size setting if the region
+         *  cache line size is smaller.
+         */
+        if (regionCacheSize < minAlign) {
+            minAlign = regionCacheSize;
+        }
+    }
+
+    /* Check if shared memory base addr is aligned to cache line boundary.*/
+    Assert_isTrue ((UInt32)params->sharedAddr % minAlign == 0,
+        ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+    /*
+     *  Store all interrupt information so it may be used (if neccessary) by
+     *  the IInterrupt delegates
+     */
+    obj->intInfo.remoteIntId = params->remoteIntId;
+    obj->intInfo.localIntId  = params->localIntId;
+    obj->intInfo.intVectorId = params->intVectorId;
+
+    /* determine which slot to use */
+    if (params->remoteProcId > MultiProc_self()) {
+        localIndex  = 0;
+        remoteIndex = 1;
+    }
+    else {
+        localIndex  = 1;
+        remoteIndex = 0;
+    }
+
+    /* set the remote processor's id */
+    obj->remoteProcId = params->remoteProcId;
+
+    /* counters for capturing spin wait statistics */
+    obj->spinCount = 0;
+    obj->spinWaitTime = 0;
+
+    /* calculate the circular buffer size one-way */
+    circBufSize = _Ipc_roundup(
+        sizeof(NotifyDriverCirc_EventEntry) * NotifyDriverCirc_numMsgs,
+               minAlign);
+
+    /* calculate the control size one-way */
+    ctrlSize = _Ipc_roundup(sizeof(Bits32), minAlign);
+
+    /* calculate the total size one-way */
+    totalSelfSize =  circBufSize + (2 * ctrlSize);
+
+    /*
+     *  Init put/get buffer and index pointers.
+     *  These are all on different cache lines.
+     */
+    obj->putBuffer = (NotifyDriverCirc_EventEntry *)
+        ((UInt32)params->sharedAddr + (localIndex * totalSelfSize));
+
+    obj->putWriteIndex = (Bits32 *)((UInt32)obj->putBuffer + circBufSize);
+
+    obj->putReadIndex = (Bits32 *)((UInt32)obj->putWriteIndex + ctrlSize);
+
+    obj->getBuffer = (NotifyDriverCirc_EventEntry *)
+        ((UInt32)params->sharedAddr + (remoteIndex * totalSelfSize));
+
+    obj->getWriteIndex = (Bits32 *)((UInt32)obj->getBuffer + circBufSize);
+
+    obj->getReadIndex = (Bits32 *)((UInt32)obj->getWriteIndex + ctrlSize);
+
+    /*
+     *  Calculate the size for cache wb/inv in sendEvent and isr.
+     *  This size is the circular buffer + putWriteIndex.
+     *  [sizeof(EventEntry) * numMsgs] + [the sizeof(Ptr)]
+     *  aligned to a cache line.
+     */
+    obj->opCacheSize = ((UInt32)obj->putReadIndex - (UInt32)obj->putBuffer);
+
+    /* init the putWrite and putRead Index to 0 */
+    obj->putWriteIndex[0] = 0;
+    obj->putReadIndex[0] = 0;
+
+    /* cache wb the putWrite/Read Index but no need to inv them */
+    if (obj->cacheEnabled) {
+        Cache_wb(obj->putWriteIndex,
+                 sizeof(Bits32),
+                 Cache_Type_ALL, TRUE);
+
+        Cache_wb(obj->putReadIndex,
+                 sizeof(Bits32),
+                 Cache_Type_ALL, TRUE);
+
+        /* invalidate any stale data of the get buffer and indexes */
+        Cache_inv(obj->getBuffer,
+                  totalSelfSize,
+                  Cache_Type_ALL, TRUE);
+    }
+
+    /* Register the incoming interrupt */
+    NotifyDriverCirc_InterruptProxy_intRegister(obj->remoteProcId,
+        &(obj->intInfo), (Fxn)NotifyDriverCirc_isr, (UArg)obj);
+}
+
+/*
+ *  ======== NotifyDriverCirc_Instance_finalize ========
+ */
+Void NotifyDriverCirc_Instance_finalize(NotifyDriverCirc_Object *obj)
+{
+    SizeT  sizeToInv;
+
+    /* Unregister interrupt */
+    NotifyDriverCirc_InterruptProxy_intUnregister(obj->remoteProcId,
+        &(obj->intInfo));
+
+    /* cache inv the shared memory that is used for instance */
+    if (obj->cacheEnabled) {
+        if (obj->remoteProcId > MultiProc_self()) {
+            /* calculate the size of the buffer and indexes for one side */
+            sizeToInv = ((UInt32)obj->getBuffer - (UInt32)obj->putBuffer);
+
+            /* invalidate the shared memory for this instance */
+            Cache_inv(obj->putBuffer,
+                     (sizeToInv * 2),
+                      Cache_Type_ALL, TRUE);
+        }
+        else {
+            /* calculate the size of the buffer and indexes for one side */
+            sizeToInv = ((UInt32)obj->putBuffer - (UInt32)obj->getBuffer);
+
+            /* invalidate the shared memory for this instance */
+            Cache_inv(obj->getBuffer,
+                     (sizeToInv * 2),
+                      Cache_Type_ALL, TRUE);
+        }
+    }
+}
+
+/*
+ *  ======== NotifyDriverCirc_registerEvent ========
+ */
+Void NotifyDriverCirc_registerEvent(NotifyDriverCirc_Object *obj,
+                                   UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Set the 'registered' bit */
+    SET_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverCirc_unregisterEvent ========
+ */
+Void NotifyDriverCirc_unregisterEvent(NotifyDriverCirc_Object *obj,
+                                     UInt32 eventId)
+{
+    UInt hwiKey;
+
+    /*
+     *  Disable interrupt line to ensure that isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    hwiKey = Hwi_disable();
+
+    /* Clear the registered bit */
+    CLEAR_BIT(obj->evtRegMask, eventId);
+
+    /* Restore the interrupt line */
+    Hwi_restore(hwiKey);
+}
+
+/*
+ *  ======== NotifyDriverCirc_sendEvent ========
+ */
+Int NotifyDriverCirc_sendEvent(NotifyDriverCirc_Object *obj,
+                              UInt32                 eventId,
+                              UInt32                 payload,
+                              Bool                   waitClear)
+{
+    Bool loop = FALSE;
+    Bool spinWait = FALSE;
+    UInt hwiKey;
+    UInt32 startWaitTime, spinWaitTime;
+    UInt32 writeIndex, readIndex;
+    NotifyDriverCirc_EventEntry *eventEntry;
+
+    /*
+     *  Retrieve the get Index. No need to cache inv the
+     *  readIndex until out writeIndex wraps. Only need to invalidate
+     *  once every N times [N = number of slots in buffer].
+     */
+    readIndex = obj->putReadIndex[0];
+
+    do {
+        /* disable interrupts */
+        hwiKey = Hwi_disable();
+
+        /* retrieve the put index */
+        writeIndex = obj->putWriteIndex[0];
+
+        /* if slot available 'break' out of loop */
+        if (((writeIndex + 1) & NotifyDriverCirc_maxIndex) != readIndex) {
+            break;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(hwiKey);
+
+        /* check to make sure code has looped */
+        if (loop && !waitClear) {
+            /* if no slot available and waitClear is 'FALSE' */
+            return (Notify_E_FAIL);
+        }
+
+        /* start timestamp for spin wait statistics */
+        if (NotifyDriverCirc_enableStats) {
+            if (loop && !spinWait) {
+                startWaitTime = Timestamp_get32();
+                spinWait = TRUE;
+            }
+        }
+
+        /* cache invalidate the putReadIndex */
+        if (obj->cacheEnabled) {
+            Cache_inv(obj->putReadIndex,
+                      sizeof(Bits32),
+                      Cache_Type_ALL,
+                      TRUE);
+        }
+
+        /* re-read the get count */
+        readIndex = obj->putReadIndex[0];
+
+        /* convey that the code has looped around */
+        loop = TRUE;
+    } while (1);
+
+    /* interrupts are disabled at this point */
+
+    /* increment spinCount and determine the spin wait time */
+    if (NotifyDriverCirc_enableStats) {
+        if (spinWait) {
+            obj->spinCount++;
+            spinWaitTime = Timestamp_get32() - startWaitTime;
+            if (spinWaitTime > obj->spinWaitTime) {
+                obj->spinWaitTime = spinWaitTime;
+            }
+        }
+    }
+
+    /* calculate the next available entry */
+    eventEntry = (NotifyDriverCirc_EventEntry *)((UInt32)obj->putBuffer +
+                 (writeIndex * sizeof(NotifyDriverCirc_EventEntry)));
+
+    /* Set the eventId field and payload for the entry */
+    eventEntry->eventid = eventId;
+    eventEntry->payload = payload;
+
+    /*
+     *  Writeback the event entry. No need to invalidate since
+     *  only one processor ever writes here. No need to wait for
+     *  cache operation since another cache operation is done below.
+     */
+    if (obj->cacheEnabled) {
+        Cache_wb(eventEntry,
+                 sizeof(NotifyDriverCirc_EventEntry),
+                 Cache_Type_ALL,
+                 FALSE);
+    }
+
+    /* update the putWriteIndex */
+    obj->putWriteIndex[0] = (writeIndex + 1) & NotifyDriverCirc_maxIndex;
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    /*
+     *  Writeback the putWriteIndex.
+     *  No need to invalidate since only one processor
+     *  ever writes here.
+     */
+    if (obj->cacheEnabled) {
+        Cache_wb(obj->putWriteIndex,
+                 sizeof(Bits32),
+                 Cache_Type_ALL,
+                 TRUE);
+    }
+
+    /* Send an interrupt to the Remote Processor */
+    NotifyDriverCirc_InterruptProxy_intSend(obj->remoteProcId, &(obj->intInfo),
+                                            eventId);
+
+    return (Notify_S_SUCCESS);
+}
+
+/*
+ *  ======== NotifyDriverCirc_disable ========
+ */
+Void NotifyDriverCirc_disable(NotifyDriverCirc_Object *obj)
+{
+    /* Disable the incoming interrupt line */
+    NotifyDriverCirc_InterruptProxy_intDisable(obj->remoteProcId,
+                                              &(obj->intInfo));
+}
+
+/*
+ *  ======== NotifyDriverCirc_enable ========
+ */
+Void NotifyDriverCirc_enable(NotifyDriverCirc_Object *obj)
+{
+    /* NotifyDriverCirc_enableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverCirc_A_notSupported);
+}
+
+/*
+ *  ======== NotifyDriverCirc_disableEvent ========
+ */
+Void NotifyDriverCirc_disableEvent(NotifyDriverCirc_Object *obj, UInt32 eventId)
+{
+    /* NotifyDriverCirc_disableEvent not supported by this driver */
+    Assert_isTrue(FALSE, NotifyDriverCirc_A_notSupported);
+}
+
+/*
+ *  ======== NotifyDriverCirc_enableEvent ========
+ */
+Void NotifyDriverCirc_enableEvent(NotifyDriverCirc_Object *obj, UInt32 eventId)
+{
+    /* Enable the incoming interrupt line */
+    NotifyDriverCirc_InterruptProxy_intEnable(obj->remoteProcId,
+                                             &(obj->intInfo));
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverCirc_sharedMemReq ========
+ */
+SizeT NotifyDriverCirc_sharedMemReq(const NotifyDriverCirc_Params *params)
+{
+    UInt16 regionId;
+    SizeT regionCacheSize;
+    SizeT minAlign, memReq;
+
+    /* Ensure that params is non-NULL */
+    Assert_isTrue(params != NULL, ti_sdo_ipc_Ipc_A_internal);
+
+    /*
+     *  Determine obj->cacheEnabled using params->cacheEnabled and SharedRegion
+     *  cache flag setting, if applicable.
+     */
+    minAlign = params->cacheLineSize;
+    if (minAlign == 0) {
+        /* Fix alignment of zero */
+        minAlign = sizeof(Ptr);
+    }
+
+    regionId = SharedRegion_getId(params->sharedAddr);
+    if (regionId != SharedRegion_INVALIDREGIONID) {
+        regionCacheSize = SharedRegion_getCacheLineSize(regionId);
+        /* Override minAlign if the region cache line size is smaller */
+        if (regionCacheSize < minAlign) {
+            minAlign = regionCacheSize;
+        }
+    }
+
+    /*
+     *  Amount of shared memory:
+     *  1 putBuffer with numMsgs (rounded to CLS) +
+     *  1 putWriteIndex ptr (rounded to CLS) +
+     *  1 putReadIndex put (rounded to CLS) +
+     *  1 getBuffer with numMsgs (rounded to CLS) +
+     *  1 getWriteIndex ptr (rounded to CLS) +
+     *  1 getReadIndex put (rounded to CLS) +
+     *
+     *  For CLS of 128b it is:
+     *      256b + 128b + 128b + 256b+ 128b + 128b = 1KB
+     *
+     *  Note: CLS means Cache Line Size
+     */
+    memReq = 2 *
+        ((_Ipc_roundup(sizeof(NotifyDriverCirc_EventEntry) *
+                       NotifyDriverCirc_numMsgs, minAlign))
+        + ( 2 * _Ipc_roundup(sizeof(Bits32), minAlign)));
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverCirc_isr ========
+ */
+Void NotifyDriverCirc_isr(UArg arg)
+{
+    NotifyDriverCirc_EventEntry *eventEntry;
+    NotifyDriverCirc_Object     *obj;
+    UInt32 writeIndex, readIndex;
+
+    obj = (NotifyDriverCirc_Object *)arg;
+
+    /* Make sure the NotifyDriverCirc_Object is not NULL */
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_internal);
+
+    /*
+     *  Invalidate both getBuffer getWriteIndex from cache.
+     *  Do the Cache_wait() below.
+     */
+    if (obj->cacheEnabled) {
+        Cache_inv(obj->getBuffer,
+                  obj->opCacheSize,
+                  Cache_Type_ALL,
+                  FALSE);
+    }
+
+    /* Clear the remote interrupt */
+    NotifyDriverCirc_InterruptProxy_intClear(obj->remoteProcId,
+                                            &(obj->intInfo));
+
+    /* wait here to make sure inv is completely done */
+    if (obj->cacheEnabled) {
+        Cache_wait();
+    }
+
+    /* get the writeIndex and readIndex */
+    writeIndex = obj->getWriteIndex[0];
+    readIndex = obj->getReadIndex[0];
+
+    /* get the event */
+    eventEntry = &(obj->getBuffer[readIndex]);
+
+    /* if writeIndex != readIndex then there is an event to process */
+    while (writeIndex != readIndex) {
+        /*
+         *  Check to make sure event is registered. If the event
+         *  is not registered, the event is not processed and is lost.
+         */
+        if (TEST_BIT(obj->evtRegMask, eventEntry->eventid)) {
+            /* Execute the callback function */
+            ti_sdo_ipc_Notify_exec(obj->notifyHandle,
+                                   eventEntry->eventid,
+                                   eventEntry->payload);
+        }
+
+        /* update the readIndex. */
+        readIndex = ((readIndex + 1) & NotifyDriverCirc_maxIndex);
+
+        /* set the getReadIndex */
+        obj->getReadIndex[0] = readIndex;
+
+        /*
+         *  Write back the getReadIndex once every N / 4 messages.
+         *  No need to invalidate since only one processor ever
+         *  writes this. No need to wait for operation to complete
+         *  since remote core updates its readIndex at least once
+         *  every N messages and the remote core will not use a slot
+         *  until it sees that the event has been processed with this
+         *  cache wb.
+         */
+        if ((obj->cacheEnabled) &&
+            ((readIndex % NotifyDriverCirc_modIndex) == 0)) {
+            Cache_wb(obj->getReadIndex,
+                     sizeof(Bits32),
+                     Cache_Type_ALL,
+                     FALSE);
+        }
+
+        /* get the next event */
+        eventEntry = &(obj->getBuffer[readIndex]);
+    }
+}
+
+/*
+ *  ======== NotifyDriverCirc_setNotifyHandle ========
+ */
+Void NotifyDriverCirc_setNotifyHandle(NotifyDriverCirc_Object *obj,
+                                     Ptr notifyHandle)
+{
+    /* Internally used, so no Assert needed */
+    obj->notifyHandle = (ti_sdo_ipc_Notify_Handle)notifyHandle;
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.xdc b/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.xdc
new file mode 100644 (file)
index 0000000..be9d8a6
--- /dev/null
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverCirc.xdc ================
+ */
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.interfaces.INotifyDriver;
+import ti.sdo.ipc.notifyDrivers.IInterrupt;
+import ti.sdo.ipc.Notify;
+
+import xdc.rov.ViewInfo;
+
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== NotifyDriverCirc ========
+ *  A shared memory driver using circular buffer for the Notify Module.
+ *
+ *  This is a {@link ti.sdo.ipc.Notify} driver that utilizes shared memory
+ *  and inter-processor hardware interrupts for notification between cores.
+ *  This driver supports caching.
+ *
+ *  This driver is designed to work with a variety of devices, each with
+ *  distinct interrupt mechanisms.  Therefore, this module needs to be plugged
+ *  with an appropriate module that implements the {@link IInterrupt} interface
+ *  for a given device.
+ *
+ *  The Notify_[enable/disable]Event APIs are not supported by this driver.
+ *
+ *  The driver utilizes shared memory in the manner indicated by the following
+ *  diagram.
+ *
+ *  @p(code)
+ *
+ *  NOTE: Processors '0' and '1' correspond to the processors with lower and
+ *        higher MultiProc ids, respectively
+ *
+ * sharedAddr -> --------------------------- bytes
+ *               |  eventEntry0  (0)       | 8
+ *               |  eventEntry1  (0)       | 8
+ *               |  ...                    |
+ *               |  eventEntry15 (0)       | 8
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  eventEntry16 (0)       | 8
+ *               |  eventEntry17 (0)       | 8
+ *               |  ...                    |
+ *               |  eventEntry31 (0)       | 8
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  putWriteIndex (0)      | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  putReadIndex (0)       | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  eventEntry0  (1)       | 8
+ *               |  eventEntry1  (1)       | 8
+ *               |  ...                    |
+ *               |  eventEntry15 (1)       | 8
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  eventEntry16 (1)       | 8
+ *               |  eventEntry17 (1)       | 8
+ *               |  ...                    |
+ *               |  eventEntry31 (1)       | 8
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  getWriteIndex (1)      | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  getReadIndex (1)       | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *
+ *
+ *  Legend:
+ *  (0), (1) : Memory that belongs to the proc with lower and higher
+ *             MultiProc.id, respectively
+ *   |----|  : Cache line boundary
+ *
+ *  @p
+ */
+
+@InstanceFinalize
+
+module NotifyDriverCirc inherits ti.sdo.ipc.interfaces.INotifyDriver
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+        Bool        cacheEnabled;
+        UInt        bufSize;
+        UInt        spinCount;
+        UInt        maxSpinWait;
+    }
+
+    /*! @_nodoc */
+    metaonly struct EventDataView {
+        UInt        index;
+        String      buffer;
+        Ptr         addr;
+        UInt        eventId;
+        Ptr         payload;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Events',
+                    {
+                        type: ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'EventDataView'
+                    }
+                ],
+            ]
+        });
+
+    /*!
+     *  Assert raised when trying to use Notify_[enable/disable]Event with
+     *  NotifyDriverCirc
+     */
+    config Assert.Id A_notSupported =
+        {msg: "A_notSupported: [enable/disable]Event not supported by NotifyDriverCirc"};
+
+
+    /*! @_nodoc
+     *  IInterrupt proxy that handles interrupts between multiple CPU cores
+     */
+    proxy InterruptProxy inherits IInterrupt;
+
+    /*!
+     *  ======== enableStats ========
+     *  Enable statistics for sending an event
+     *
+     *  If this parameter is to 'TRUE' and 'waitClear' is also set to
+     *  TRUE when calling (@link #sendEvent(), then the module keeps
+     *  track of the number of times the processor spins waiting for
+     *  an empty slot and the max amount of time it waits.
+     */
+    config Bool enableStats = false;
+
+    /*!
+     *  ======== numMsgs ========
+     *  The number of messages or slots in the circular buffer
+     *
+     *  This is use to determine the size of the put and get buffers.
+     *  Each eventEntry is two 32bits wide, therefore the total size
+     *  of each circular buffer is [numMsgs * sizeof(eventEntry)].
+     *  The total size of each buffer must be a multiple of the
+     *  the cache line size. For example, if the cacheLineSize = 128
+     *  then numMsgs could be 16, 32, etc...
+     */
+    config UInt numMsgs = 32;
+
+    /*!
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to parameters that will be used in the
+     *                      create
+     *
+     *  @a(returns)         Number of MAUs in shared memory needed to create
+     *                      the instance.
+     */
+    SizeT sharedMemReq(const Params *params);
+
+instance:
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Address in shared memory where this instance will be placed
+     *
+     *  Use {@link #sharedMemReq} to determine the amount of shared memory
+     *  required.
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== cacheEnabled ========
+     *  Whether cache operations will be performed
+     *
+     *  If it is known that no cache operations are needed for this instance
+     *  set this flag to FALSE.  If {@link #sharedAddr} lies within a shared
+     *  region and the cache enabled setting for the region is FALSE,
+     *  then the value specified here will be overriden to FALSE.
+     */
+    config Bool cacheEnabled = true;
+
+    /*!
+     *  ======== cacheLineSize ========
+     *  The cache line size of the shared memory
+     *
+     *  This value should be configured
+     */
+    config SizeT cacheLineSize = 128;
+
+    /*!
+     *  ======== remoteProcId ========
+     *  The MultiProc ID corresponding to the remote processor
+     *
+     *  This parameter must be set for every device.  The
+     *  MultiProc_getId call can be used to obtain
+     *  a MultiProc id given the remote processor's name.
+     */
+    config UInt16 remoteProcId = MultiProc.INVALIDID;
+
+    /*!
+     *  ======== intVectorId ========
+     *  Interrupt vector ID to be used by the driver.
+     *
+     *  This parameter is only used by C64x+ targets
+     */
+    config UInt intVectorId = ~1u;
+
+    /*!
+     *  ======== localIntId ========
+     *  Local interrupt ID for interrupt line
+     *
+     *  For devices that support multiple inter-processor interrupt lines, this
+     *  configuration parameter allows selecting a specific line to use for
+     *  receiving an interrupt.  The value specified here corresponds to the
+     *  incoming interrupt line on the local processor.
+     *
+     *  If this configuration is not set, a default interrupt id is
+     *  typically chosen.
+     */
+    config UInt localIntId = -1u;
+
+    /*!
+     *  ======== remoteIntId ========
+     *  Remote interrupt ID for interrupt line
+     *
+     *  For devices that support multiple inter-processor interrupt lines, this
+     *  configuration parameter allows selecting a specific line to use for
+     *  receiving an interrupt.  The value specified here corresponds to the
+     *  incoming interrupt line on the remote processor.
+     *
+     *  If this configuration is not set, a default interrupt id is
+     *  typically chosen.
+     */
+    config UInt remoteIntId = -1u;
+
+internal:
+
+    /*! The max index set to (numMsgs - 1) */
+    config UInt maxIndex;
+
+    /*!
+     *  The modulo index value. Set to (numMsgs / 4).
+     *  Used in the isr for doing cache_wb of readIndex.
+     */
+    config UInt modIndex;
+
+    /*!
+     *  Plugs the interrupt and executes the callback functions according
+     *  to event priority
+     */
+    Void isr(UArg arg);
+
+    /*!
+     *  Structure for each event. This struct is placed in shared memory.
+     */
+    struct EventEntry {
+        volatile Bits32 eventid;
+        volatile Bits32 payload;
+    }
+
+    /*! Instance state structure */
+    struct Instance_State {
+        EventEntry       *putBuffer;     /* buffer used to put events        */
+        Bits32           *putReadIndex;  /* ptr to readIndex for put buffer  */
+        Bits32           *putWriteIndex; /* ptr to writeIndex for put buffer */
+        EventEntry       *getBuffer;     /* buffer used to get events        */
+        Bits32           *getReadIndex;  /* ptr to readIndex for get buffer  */
+        Bits32           *getWriteIndex; /* ptr to writeIndex for put buffer */
+        Bits32           evtRegMask;     /* local event register mask        */
+        SizeT            opCacheSize;    /* optimized cache size for wb/inv  */
+        UInt32           spinCount;      /* number of times sender waits     */
+        UInt32           spinWaitTime;   /* largest wait time for sender     */
+        Notify.Handle    notifyHandle;   /* Handle to front-end object       */
+        IInterrupt.IntInfo intInfo;      /* Intr info passed to Interr mod   */
+        UInt16           remoteProcId;   /* Remote MultiProc id              */
+        Bool             cacheEnabled;   /* set by param or SharedRegion     */
+    }
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.xs b/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.xs
new file mode 100644 (file)
index 0000000..27e9198
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverCirc.xs ================
+ */
+
+var NotifyDriverCirc = null;
+var MultiProc        = null;
+var Notify           = null;
+var Ipc              = null;
+var Cache            = null;
+var Memory           = null;
+var SharedRegion     = null;
+var Timestamp        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverCirc = this;
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Cache           = xdc.useModule("ti.sysbios.hal.Cache");
+    Timestamp = xdc.useModule("xdc.runtime.Timestamp");
+
+    if (NotifyDriverCirc.InterruptProxy == null) {
+        var Settings = xdc.module("ti.sdo.ipc.family.Settings");
+        var interruptDelegate = Settings.getDefaultInterruptDelegate();
+        NotifyDriverCirc.InterruptProxy = xdc.useModule(interruptDelegate);
+    }
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    NotifyDriverCirc.maxIndex = NotifyDriverCirc.numMsgs - 1;
+    NotifyDriverCirc.modIndex = NotifyDriverCirc.numMsgs / 4;
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    /* view obj information */
+    view.cacheEnabled = obj.cacheEnabled;
+    view.bufSize      = modCfg.numMsgs;
+    view.spinCount    = obj.spinCount;
+    view.maxSpinWait  = obj.spinWaitTime;;
+}
+
+/*
+ *  ======== getEventData ========
+ *  Helper function for use within viewInitData
+ */
+function getEventData(view, obj, bufferPtr, putIndex, getIndex)
+{
+    var NotifyDriverCirc =
+        xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+
+    if (bufferPtr == obj.putBuffer) {
+        var bufferName = "put";
+    }
+    else {
+        var bufferName = "get";
+    }
+
+    try {
+        var putBuffer = Program.fetchArray(obj.putBuffer$fetchDesc,
+                                           bufferPtr,
+                                           modCfg.numMsgs);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putBuffer struct from shared memory"));
+    }
+
+    var i = getIndex;
+
+    while (i != putIndex) {
+        /* The event is registered */
+        var elem = Program.newViewStruct(
+                'ti.sdo.ipc.notifyDrivers.NotifyDriverCirc',
+                'Events');
+
+        elem.index = i;
+        elem.buffer = bufferName;
+        elem.addr = utils.toHex(putBuffer[i].$addr);
+        elem.eventId = putBuffer[i].eventid;
+        elem.payload = utils.toHex(putBuffer[i].payload);
+
+        /* Create a new row in the instance data view */
+        view.elements.$add(elem);
+
+        i++;
+    }
+}
+
+
+/*
+ *  ======== viewInitData ========
+ *  Instance data view.
+ */
+function viewInitData(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    try {
+        var notifyObj = Program.scanHandleView('ti.sdo.ipc.Notify',
+            obj.notifyHandle, 'Basic');
+    }
+    catch (e) {
+        throw (new Error("Error fetching Notify instance view"));
+    }
+
+    /* Display the instance label in the tree */
+    view.label = "remoteProcId = " + obj.remoteProcId + " lineId = " +
+        notifyObj.lineId;
+
+    /* Fetch put/get index's */
+    try {
+        var putWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.putWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putWriteIndex struct from shared memory"));
+    }
+
+    try {
+        var putReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.putReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putReadIndex struct from shared memory"));
+    }
+
+    try {
+        var getWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.getWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getWriteIndex struct from shared memory"));
+    }
+
+    try {
+        var getReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.getReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getReadIndex struct from shared memory"));
+    }
+
+    /* Get event data for the put buffer */
+    getEventData(view, obj, obj.putBuffer, putWriteIndex.elem, putReadIndex.elem);
+
+    /* Get event data for the get buffer */
+    getEventData(view, obj, obj.getBuffer, getWriteIndex.elem, getReadIndex.elem);
+
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.c b/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.c
new file mode 100644 (file)
index 0000000..f63d5d7
--- /dev/null
@@ -0,0 +1,715 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverShm.c ========
+ */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/hal/Hwi.h>
+
+#include <ti/sdo/utils/List.h>
+
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+
+#include "package/internal/NotifyDriverShm.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+#define EVENTENTRY(eventChart, entrySize, eventId) \
+            ((NotifyDriverShm_EventEntry *) \
+             ((UInt32)(eventChart) + ((entrySize) * (eventId))));
+
+/*
+ **************************************************************
+ *                       Instance functions
+ **************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverShm_Instance_init ========
+ */
+Int NotifyDriverShm_Instance_init(NotifyDriverShm_Object *obj,
+                                  const NotifyDriverShm_Params *params,
+                                  Error_Block *eb)
+{
+    UInt16 regionId;
+    SizeT regionCacheSize, minAlign, procCtrlSize;
+
+   /*
+    * Check whether remote proc ID has been set and isn't the same as the
+    * local proc ID
+    */
+    Assert_isTrue ((params->remoteProcId != MultiProc_INVALIDID) &&
+                   (params->remoteProcId != MultiProc_self()),
+                   ti_sdo_ipc_Ipc_A_invParam);
+
+    /*
+     *  Determine obj->cacheEnabled using params->cacheEnabled and SharedRegion
+     *  cache flag setting, if applicable.
+     */
+    obj->cacheEnabled = params->cacheEnabled;
+    minAlign = params->cacheLineSize;
+    if (minAlign == 0) {
+        /* Fix alignment of zero */
+        minAlign = sizeof(Ptr);
+    }
+    regionId = SharedRegion_getId(params->sharedAddr);
+    if (regionId != SharedRegion_INVALIDREGIONID) {
+        /*
+         *  Override the user cacheEnabled setting if the region
+         *  cacheEnabled is FALSE.
+         */
+        if (!SharedRegion_isCacheEnabled(regionId)) {
+            obj->cacheEnabled = FALSE;
+        }
+
+        regionCacheSize = SharedRegion_getCacheLineSize(regionId);
+
+        /*
+         *  Override the user cache line size setting if the region
+         *  cache line size is smaller.
+         */
+        if (regionCacheSize < minAlign) {
+            minAlign = regionCacheSize;
+        }
+    }
+
+    /* Check if shared memory base addr is aligned to cache line boundary.*/
+    Assert_isTrue ((UInt32)params->sharedAddr % minAlign == 0,
+        ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+    obj->remoteProcId           = params->remoteProcId;
+
+    /*
+     *  Store all interrupt information so it may be used (if neccessary) by
+     *  the IInterrupt delegates
+     */
+    obj->intInfo.remoteIntId    = params->remoteIntId;
+    obj->intInfo.localIntId     = params->localIntId;
+    obj->intInfo.intVectorId    = params->intVectorId;
+
+    obj->nesting            = 0;
+
+    if (params->remoteProcId > MultiProc_self()) {
+        obj->selfId  = 0;
+        obj->otherId = 1;
+    }
+    else {
+        obj->selfId  = 1;
+        obj->otherId = 0;
+    }
+
+    /* Initialize pointers to shared memory regions */
+    procCtrlSize = _Ipc_roundup(sizeof(NotifyDriverShm_ProcCtrl), minAlign);
+
+    /*
+     *  Save the eventEntrySize in obj since we will need it at runtime to
+     *  index the event charts
+     */
+    obj->eventEntrySize = _Ipc_roundup(sizeof(NotifyDriverShm_EventEntry),
+        minAlign);
+
+    obj->selfProcCtrl = (NotifyDriverShm_ProcCtrl *)
+        ((UInt32)params->sharedAddr + (obj->selfId * procCtrlSize));
+    obj->otherProcCtrl = (NotifyDriverShm_ProcCtrl *)
+        ((UInt32)params->sharedAddr + (obj->otherId * procCtrlSize));
+    obj->selfEventChart  = (NotifyDriverShm_EventEntry *)
+        ((UInt32)params->sharedAddr
+         + (2 * procCtrlSize)
+         + (obj->eventEntrySize * ti_sdo_ipc_Notify_numEvents * obj->selfId));
+    obj->otherEventChart  = (NotifyDriverShm_EventEntry *)
+         ((UInt32)params->sharedAddr
+         + (2 * procCtrlSize)
+         + (obj->eventEntrySize * ti_sdo_ipc_Notify_numEvents * obj->otherId));
+
+    /* Allocate memory for regChart and init to (UInt32)-1 (unregistered) */
+    obj->regChart = Memory_valloc(
+            NotifyDriverShm_Object_heap(),
+            (sizeof(UInt32) * ti_sdo_ipc_Notify_numEvents),
+            NULL,
+            ~0,
+            eb);
+    if (obj->regChart == NULL) {
+        return (1);
+    }
+
+    /* Enable all events initially.*/
+    obj->selfProcCtrl->eventEnableMask = 0xFFFFFFFF;
+
+    /* Write back our own ProcCtrl */
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+            Cache_Type_ALL, TRUE);
+    }
+
+    /* Register the incoming interrupt */
+    NotifyDriverShm_InterruptProxy_intRegister(obj->remoteProcId,
+        &(obj->intInfo), (Fxn)NotifyDriverShm_isr, (UArg)obj);
+
+    return (0);
+}
+
+/*
+ *  ======== NotifyDriverShm_Instance_finalize ========
+ */
+Void NotifyDriverShm_Instance_finalize(NotifyDriverShm_Object *obj, int status)
+{
+    if (status == 0) {
+        /* Indicate that driver is no longer ready to send/receive events */
+        obj->selfProcCtrl->recvInitStatus = 0;
+        obj->selfProcCtrl->sendInitStatus = 0;
+
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+            Cache_Type_ALL, TRUE);
+
+        /* Unregister interrupt */
+        NotifyDriverShm_InterruptProxy_intUnregister(obj->remoteProcId,
+            &(obj->intInfo));
+
+        /* Free memory alloc'ed for regChart */
+        Memory_free(NotifyDriverShm_Object_heap(), obj->regChart,
+            sizeof(UInt32) * ti_sdo_ipc_Notify_numEvents);
+    }
+}
+
+/*
+ *  ======== NotifyDriverShm_registerEvent ========
+ */
+Void NotifyDriverShm_registerEvent(NotifyDriverShm_Object *obj,
+                                   UInt32 eventId)
+{
+    NotifyDriverShm_EventEntry *eventEntry;
+    Int i, j;
+
+    /*
+     *  Disable interrupt line to ensure that NotifyDriverShm_isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    NotifyDriverShm_disable(obj);
+
+    /*
+     *  Add an entry for the registered event into the Event Registration
+     *  Chart, in ascending order of event numbers (and decreasing
+     *  priorities).
+     */
+    for (i = 0; i < ti_sdo_ipc_Notify_numEvents; i++) {
+        /* Find the correct slot in the registration array.*/
+        if (obj->regChart[i] == (UInt32)-1) {
+            for (j = i - 1; j >= 0; j--) {
+                if (eventId < obj->regChart[j]) {
+                    obj->regChart[j + 1] = obj->regChart[j];
+                    i = j;
+                }
+                else {
+                    /* End the loop, slot found.*/
+                    j = -1;
+                }
+            }
+            obj->regChart[i] = eventId;
+            break;
+        }
+    }
+
+    /*
+     *  Clear any pending unserviced event as there are no listeners
+     *  for the pending event
+     */
+    eventEntry = EVENTENTRY(obj->selfEventChart, obj->eventEntrySize, eventId)
+    eventEntry->flag = NotifyDriverShm_DOWN;
+    if (obj->cacheEnabled) {
+        Cache_wbInv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    /* Set the 'registered' bit in shared memory and write back */
+    SET_BIT(obj->selfProcCtrl->eventRegMask, eventId);
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    /* Restore the interrupt line */
+    NotifyDriverShm_enable(obj);
+}
+
+/*
+ *  ======== NotifyDriverShm_unregisterEvent ========
+ */
+Void NotifyDriverShm_unregisterEvent(NotifyDriverShm_Object *obj,
+                                     UInt32 eventId)
+{
+    NotifyDriverShm_EventEntry *eventEntry;
+    Int i, j;
+
+    /*
+     *  Disable interrupt line to ensure that NotifyDriverShm_isr doesn't
+     *  preempt registerEvent and encounter corrupt state
+     */
+    NotifyDriverShm_disable(obj);
+
+    /*
+     *  First unset the registered bit in shared memory so no notifications
+     *  arrive after this point
+     */
+    CLEAR_BIT(obj->selfProcCtrl->eventRegMask, eventId);
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  Clear any pending unserviced event as there are no listeners
+     *  for the pending event.  This should be done only after the event
+     *  is unregistered from shared memory so the other processor doesn't
+     *  successfully send an event our way immediately after unflagging this
+     *  event.
+     */
+    eventEntry = EVENTENTRY(obj->selfEventChart, obj->eventEntrySize, eventId);
+    eventEntry->flag = NotifyDriverShm_DOWN;
+
+    /* Write back both the flag and the reg mask */
+    if (obj->cacheEnabled) {
+        Cache_wbInv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  Re-arrange eventIds in the Event Registration Chart so there is
+     *  no gap caused by the removal of this eventId
+     *
+     *  There is no need to make this atomic since Notify_exec cannot preempt:
+     *  the event has already been disabled in shared memory (see above)
+     */
+    for (i = 0; i < ti_sdo_ipc_Notify_numEvents; i++) {
+        if (eventId == obj->regChart[i]) {
+            obj->regChart[i] = (UInt32)-1;
+            for (j = i + 1; (j != ti_sdo_ipc_Notify_numEvents) &&
+                    (obj->regChart[j] != (UInt32)-1); j++) {
+                obj->regChart[j - 1] = obj->regChart[j];
+                obj->regChart[j] = (UInt32)-1;
+            }
+            break;
+        }
+    }
+
+    /* Restore the interrupt line */
+    NotifyDriverShm_enable(obj);
+}
+
+/*
+ *  ======== NotifyDriverShm_sendEvent ========
+ */
+Int NotifyDriverShm_sendEvent(NotifyDriverShm_Object *obj,
+                              UInt32                 eventId,
+                              UInt32                 payload,
+                              Bool                   waitClear)
+{
+    NotifyDriverShm_EventEntry *eventEntry;
+    UInt32 i;
+    UInt sysKey;
+
+    eventEntry = EVENTENTRY(obj->otherEventChart, obj->eventEntrySize, eventId);
+
+    /* Check whether driver on other processor is initialized */
+    if (obj->cacheEnabled) {
+        Cache_inv(obj->otherProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+                  Cache_Type_ALL, TRUE);
+    }
+
+    if (obj->otherProcCtrl->recvInitStatus != NotifyDriverShm_INIT_STAMP) {
+        /*
+         * This may be used for polling till the other driver is ready, so
+         * do not assert or error
+         */
+        return (Notify_E_NOTINITIALIZED);
+    }
+
+    /* Check to see if the remote event is enabled */
+    if (!TEST_BIT(obj->otherProcCtrl->eventEnableMask, eventId)) {
+        return (Notify_E_EVTDISABLED);
+    }
+
+    /* Check to see if the remote event is registered */
+    if (!TEST_BIT(obj->otherProcCtrl->eventRegMask, eventId)) {
+        return (Notify_E_EVTNOTREGISTERED);
+    }
+
+
+    if (waitClear) {
+        i = 0;
+
+        if (obj->cacheEnabled) {
+            Cache_inv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+                Cache_Type_ALL, TRUE);
+        }
+
+        /*
+         *  The system gate is needed to ensure that checking eventEntry->flag
+         *  is atomic with the eventEntry modifications (flag/payload).
+         */
+        sysKey = Hwi_disable();
+
+        /* Wait for completion of previous event from other side. */
+        while ((eventEntry->flag != NotifyDriverShm_DOWN)) {
+            /*
+             * Leave critical section protection. Create a window
+             * of opportunity for other interrupts to be handled.
+             */
+            Hwi_restore(sysKey);
+            i++;
+            if ((i != (UInt32)-1) &&
+                (i == ti_sdo_ipc_Notify_sendEventPollCount)) {
+                return (Notify_E_TIMEOUT);
+            }
+
+            if (obj->cacheEnabled) {
+                Cache_inv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+                    Cache_Type_ALL, TRUE);
+            }
+
+            /* Re-enter the system gate */
+            sysKey = Hwi_disable();
+        }
+    }
+    else {
+        /*
+         *  The system gate is needed to ensure that checking eventEntry->flag
+         *  is atomic with the eventEntry modifications (flag/payload).
+         */
+        sysKey = Hwi_disable();
+    }
+
+    /* Set the event bit field and payload.*/
+    eventEntry->payload = payload;
+    eventEntry->flag    = NotifyDriverShm_UP;
+    if (obj->cacheEnabled) {
+        Cache_wbInv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+            Cache_Type_ALL, TRUE);
+    }
+
+    /* Send an interrupt to the Remote Processor */
+    NotifyDriverShm_InterruptProxy_intSend(obj->remoteProcId, &(obj->intInfo),
+                                           eventId);
+
+    /* must not restore interrupts before sending the interrupt */
+    Hwi_restore(sysKey);
+
+    return (Notify_S_SUCCESS);
+}
+
+/*
+ *  ======== NotifyDriverShm_disable ========
+ */
+Void NotifyDriverShm_disable(NotifyDriverShm_Object *obj)
+{
+    /* Disable the incoming interrupt line */
+    NotifyDriverShm_InterruptProxy_intDisable(obj->remoteProcId,
+                                              &(obj->intInfo));
+}
+
+/*
+ *  ======== NotifyDriverShm_enable ========
+ */
+Void NotifyDriverShm_enable(NotifyDriverShm_Object *obj)
+{
+    /* Enable the incoming interrupt line */
+    NotifyDriverShm_InterruptProxy_intEnable(obj->remoteProcId,
+                                             &(obj->intInfo));
+}
+
+/*
+ *  ======== NotifyDriverShm_disableEvent ========
+ */
+Void NotifyDriverShm_disableEvent(NotifyDriverShm_Object *obj, UInt32 eventId)
+{
+    UInt sysKey;
+    NotifyDriverShm_EventEntry *eventEntry;
+
+    Assert_isTrue(eventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Ipc_A_invArgument);
+
+    /*
+     *  Atomically unset the corresponding bit in the processor's
+     *  eventEnableMask
+     */
+    sysKey = Hwi_disable();
+    CLEAR_BIT(obj->selfProcCtrl->eventEnableMask, eventId);
+    Hwi_restore(sysKey);
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+            Cache_Type_ALL, TRUE);
+    }
+
+    eventEntry = EVENTENTRY(obj->selfEventChart, obj->eventEntrySize,
+            eventId);
+    if (obj->cacheEnabled) {
+        Cache_inv(eventEntry,
+                  sizeof(NotifyDriverShm_EventEntry),
+                  Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  Disable incoming Notify interrupts.  This is done to ensure that the
+     *  eventEntry->flag is read atomically with any write back to shared
+     *  memory
+     */
+    NotifyDriverShm_disable(obj);
+
+    /*
+     *  Is the local NotifyDriverShm_disableEvent happening between the
+     *  following two NotifyDriverShm_sendEvent operations on the remote
+     *  processor?
+     *  1. Writing NotifyDriverShm_UP to shared memory
+     *  2. Sending the interrupt across
+     *  If so, we should handle this event so the other core isn't left spinning
+     *  until the event is re-enabled and the next NotifyDriverShm_isr executes
+     *  This race condition is very rare but we need to account for it:
+     */
+    if (eventEntry->flag == NotifyDriverShm_UP) {
+        /*
+         *  Acknowledge the event. No need to store the payload. The other side
+         *  will not send this event again even though flag is down, because the
+         *  event is now disabled. So the payload within the eventChart will not
+         *  get overwritten.
+         */
+        eventEntry->flag = NotifyDriverShm_DOWN;
+
+        /* Write back acknowledgement */
+        if (obj->cacheEnabled) {
+            Cache_wbInv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+                Cache_Type_ALL, TRUE);
+        }
+
+        /*
+         *  Execute the callback function. This will execute in a Task
+         *  or Swi context (not Hwi!)
+         */
+        ti_sdo_ipc_Notify_exec(obj->notifyHandle, eventId, eventEntry->payload);
+    }
+
+    /* Re-enable incoming Notify interrupts */
+    NotifyDriverShm_enable(obj);
+}
+
+/*
+ *  ======== NotifyDriverShm_enableEvent ========
+ */
+Void NotifyDriverShm_enableEvent(NotifyDriverShm_Object *obj, UInt32 eventId)
+{
+    UInt sysKey;
+
+    Assert_isTrue(eventId < ti_sdo_ipc_Notify_numEvents,
+            ti_sdo_ipc_Ipc_A_invArgument);
+
+    /*
+     * Atomically set the corresponding bit in the processor's
+     * eventEnableMask
+     */
+    sysKey = Hwi_disable();
+    SET_BIT(obj->selfProcCtrl->eventEnableMask, eventId);
+    Hwi_restore(sysKey);
+
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+            Cache_Type_ALL, TRUE);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverShm_sharedMemReq ========
+ */
+SizeT NotifyDriverShm_sharedMemReq(const NotifyDriverShm_Params *params)
+{
+    UInt16 regionId;
+    SizeT regionCacheSize;
+    SizeT minAlign, memReq;
+
+    /* Ensure that params is non-NULL */
+    Assert_isTrue(params != NULL, ti_sdo_ipc_Ipc_A_internal);
+
+    /*
+     *  Determine obj->cacheEnabled using params->cacheEnabled and SharedRegion
+     *  cache flag setting, if applicable.
+     */
+    minAlign = params->cacheLineSize;
+    if (minAlign == 0) {
+        /* Fix alignment of zero */
+        minAlign = sizeof(Ptr);
+    }
+    regionId = SharedRegion_getId(params->sharedAddr);
+    if (regionId != SharedRegion_INVALIDREGIONID) {
+        regionCacheSize = SharedRegion_getCacheLineSize(regionId);
+        /* Override minAlign if the region cache line size is smaller */
+        if (regionCacheSize < minAlign) {
+            minAlign = regionCacheSize;
+        }
+    }
+
+    /* Determine obj->align which will be used to _Ipc_roundup addresses */
+    memReq = ((_Ipc_roundup(sizeof(NotifyDriverShm_ProcCtrl), minAlign)) * 2)
+           + ((_Ipc_roundup(sizeof(NotifyDriverShm_EventEntry), minAlign) * 2
+              * ti_sdo_ipc_Notify_numEvents));
+
+    return (memReq);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NotifyDriverShm_isr ========
+ */
+Void NotifyDriverShm_isr(UArg arg)
+{
+    UInt                            i;
+    NotifyDriverShm_EventEntry      *eventEntry;
+    NotifyDriverShm_Object          *obj;
+    UInt32                          eventId;
+    UInt32                          payload;
+
+    obj = (NotifyDriverShm_Object *)arg;
+
+    /* Make sure the NotifyDriverShm_Object is not NULL */
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_internal);
+
+    /* Clear the remote interrupt */
+    NotifyDriverShm_InterruptProxy_intClear(obj->remoteProcId,
+                                            &(obj->intInfo));
+
+    /*
+     * Iterate till no asserted event is found for one complete loop
+     * through all registered events.
+     */
+    i = 0;
+    do {
+        eventId = obj->regChart[i];
+
+        /* Check if the entry is a valid registered event. */
+        if (eventId != (UInt32)-1) {
+            /*
+             *  Check whether the event is disabled. If so, avoid the
+             *  unnecessary Cache invalidate. NOTE: selfProcCtrl does not have
+             *  to be cache-invalidated because:
+             *  1) Whenever self is written to by the local processor its memory
+             *     is also invalidated
+             *  2) 'selfProcCtrl' is never written to by the remote processor
+             */
+            if (!TEST_BIT(obj->selfProcCtrl->eventEnableMask,
+                (UInt32)eventId)) {
+                i++;
+                continue;
+            }
+
+            eventEntry = EVENTENTRY(obj->selfEventChart, obj->eventEntrySize,
+                eventId);
+
+            if (obj->cacheEnabled) {
+                Cache_inv(eventEntry,
+                          sizeof(NotifyDriverShm_EventEntry),
+                          Cache_Type_ALL, TRUE);
+            }
+
+            /* Check if the event is set */
+            if (eventEntry->flag == NotifyDriverShm_UP) {
+                /*
+                 *  Save the payload since it may be overwritten before
+                 *  Notify_exec is called
+                 */
+                payload = eventEntry->payload;
+
+                /* Acknowledge the event. */
+                eventEntry->flag = NotifyDriverShm_DOWN;
+
+                /* Write back acknowledgement */
+                if (obj->cacheEnabled) {
+                    Cache_wbInv(eventEntry, sizeof(NotifyDriverShm_EventEntry),
+                        Cache_Type_ALL, TRUE);
+                }
+
+                /* Execute the callback function */
+                ti_sdo_ipc_Notify_exec(obj->notifyHandle, eventId, payload);
+
+                /* reinitialize the event check counter. */
+                i = 0;
+            }
+            else {
+                /* check for next event. */
+                i++;
+            }
+        }
+    }
+    while ((eventId != (UInt32)-1) && (i < ti_sdo_ipc_Notify_numEvents));
+}
+
+/*
+ *  ======== NotifyDriverShm_setNotifyHandle ========
+ */
+Void NotifyDriverShm_setNotifyHandle(NotifyDriverShm_Object *obj,
+                                     Ptr notifyHandle)
+{
+    /* Internally used, so no Assert needed */
+    obj->notifyHandle = (ti_sdo_ipc_Notify_Handle)notifyHandle;
+
+    /* Indicate that the driver is initialized for this processor */
+    obj->selfProcCtrl->recvInitStatus = NotifyDriverShm_INIT_STAMP;
+    obj->selfProcCtrl->sendInitStatus = NotifyDriverShm_INIT_STAMP;
+
+    /* Write back our own ProcCtrl */
+    if (obj->cacheEnabled) {
+        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
+            Cache_Type_ALL, TRUE);
+    }
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.xdc b/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.xdc
new file mode 100644 (file)
index 0000000..c9076ca
--- /dev/null
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverShm.xdc ================
+ *
+ */
+
+import xdc.runtime.Error;
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.interfaces.INotifyDriver;
+import ti.sdo.ipc.notifyDrivers.IInterrupt;
+import ti.sdo.ipc.Notify;
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== NotifyDriverShm ========
+ *  A shared memory driver for the Notify Module.
+ *
+ *  This is a {@link ti.sdo.ipc.Notify} driver that utilizes shared memory
+ *  and inter-processor hardware interrupts for notification between cores.
+ *  This driver supports caching and currently expects a cache line size of 128
+ *  Bytes. Event priorities are supported and correspond to event numbers used
+ *  to register the events.
+ *
+ *  This driver is designed to work with a variety of devices, each with
+ *  distinct interrupt mechanisms.  Therefore, this module needs to be plugged
+ *  with an appropriate module that implements the {@link IInterrupt} interface
+ *  for a given device.
+ *
+ *  The driver utilizes shared memory in the manner indicated by the following
+ *  diagram.
+ *
+ *  @p(code)
+ *
+ *  NOTE: Processors '0' and '1' correspond to the processors with lower and
+ *        higher MultiProc ids, respectively
+ *
+ * sharedAddr -> --------------------------- bytes
+ *               |  recvInitStatus (0)     | 4  -\
+ *               |  sendInitStatus (0)     | 4   |= sizeof(ProcCtrl)
+ *               |  eventRegMask (0)       | 4   |
+ *               |  eventEnableMask (0)    | 4  -/
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *               |  recvInitStatus (1)     | 4
+ *               |  sendInitStatus (1)     | 4
+ *               |  eventRegMask (1)       | 4
+ *               |  eventEnableMask (1)    | 4
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *               |  eventEntry_0 (0)       | 12 -> sizeof(EventEntry)
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *               |  eventEntry_1 (0)       | 12
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *                       ... ...
+ *               |-------------------------|
+ *               |  eventEntry_N (0)       | 12
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *               |  eventEntry_0 (1)       | 12
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *               |  eventEntry_1 (1)       | 12
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *                       ... ...
+ *               |-------------------------|
+ *               |  eventEntry_N (1)       | 12
+ *               |  [PADDING] (if needed)  |
+ *               |-------------------------|
+ *
+ *
+ *  Legend:
+ *  (0), (1) : Memory that belongs to the proc with lower and higher
+ *             MultiProc.id, respectively
+ *   |----|  : Cache line boundary
+ *   N       : Notify_numEvents - 1
+ *
+ *  @p
+ */
+
+@InstanceInitError
+@InstanceFinalize
+
+module NotifyDriverShm inherits ti.sdo.ipc.interfaces.INotifyDriver
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+        Bool        cacheEnabled;
+    }
+
+    /*! @_nodoc */
+    metaonly struct EventDataView {
+        UInt        eventId;
+        String      procName;
+        Bool        enabled;
+        Bool        flagged;
+        Ptr         payload;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Events',
+                    {
+                        type: ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'EventDataView'
+                    }
+                ],
+            ]
+        });
+
+
+    /*! @_nodoc
+     *  IInterrupt proxy that handles interrupts between multiple CPU cores
+     */
+    proxy InterruptProxy inherits IInterrupt;
+
+    /*!
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to parameters that will be used in the
+     *                      create
+     *
+     *  @a(returns)         Number of MAUs in shared memory needed to create
+     *                      the instance.
+     */
+    SizeT sharedMemReq(const Params *params);
+
+instance:
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Address in shared memory where this instance will be placed
+     *
+     *  Use {@link #sharedMemReq} to determine the amount of shared memory
+     *  required.
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== cacheEnabled ========
+     *  Whether cache operations will be performed
+     *
+     *  If it is known that no cache operations are needed for this instance
+     *  set this flag to FALSE.  If {@link #sharedAddr} lies within a shared
+     *  region and the cache enabled setting for the region is FALSE,
+     *  then the value specified here will be overriden to FALSE.
+     */
+    config Bool cacheEnabled = true;
+
+    /*!
+     *  ======== cacheLineSize ========
+     *  The cache line size of the shared memory
+     *
+     *  This value should be configured
+     */
+    config SizeT cacheLineSize = 128;
+
+    /*!
+     *  ======== remoteProcId ========
+     *  The MultiProc ID corresponding to the remote processor
+     *
+     *  This parameter must be set for every device.  The
+     *  {@link ti.sdo.utils.MultiProc#getId} call can be used to obtain
+     *  a MultiProc id given the remote processor's name.
+     */
+    config UInt16 remoteProcId = MultiProc.INVALIDID;
+
+    /*!
+     *  ======== intVectorId ========
+     *  Interrupt vector ID to be used by the driver.
+     *
+     *  This parameter is only used by C64x+ targets
+     */
+    config UInt intVectorId = ~1u;
+
+    /*!
+     *  ======== localIntId ========
+     *  Local interrupt ID for interrupt line
+     *
+     *  For devices that support multiple inter-processor interrupt lines, this
+     *  configuration parameter allows selecting a specific line to use for
+     *  receiving an interrupt.  The value specified here corresponds to the
+     *  incoming interrupt line on the local processor.
+     *
+     *  If this configuration is not set, a default interrupt id is
+     *  typically chosen.
+     */
+    config UInt localIntId = -1u;
+
+    /*!
+     *  ======== remoteIntId ========
+     *  Remote interrupt ID for interrupt line
+     *
+     *  For devices that support multiple inter-processor interrupt lines, this
+     *  configuration parameter allows selecting a specific line to use for
+     *  receiving an interrupt.  The value specified here corresponds to the
+     *  incoming interrupt line on the remote processor.
+     *
+     *  If this configuration is not set, a default interrupt id is
+     *  typically chosen.
+     */
+    config UInt remoteIntId = -1u;
+
+internal:
+
+    /*! Flag an event up/down in shared memory */
+    const UInt16 DOWN = 0;
+    const UInt16 UP   = 1;
+
+    /*! Initialization stamp */
+    const UInt32 INIT_STAMP = 0xA9C8B7D6;
+
+    /*!
+     *  Plugs the interrupt and executes the callback functions according
+     *  to event priority
+     */
+    Void isr(UArg arg);
+
+    /*!
+     *  Used to flag a remote event and determine if a local event has been
+     *  flagged. This struct is placed in shared memory.
+     */
+    struct EventEntry {
+        volatile Bits32 flag;
+        volatile Bits32 payload;
+        volatile Bits32 reserved;
+        /* Padding if necessary */
+    }
+
+    /*!
+     *  NotifyDriverShm state for a single processor in shared memory.
+     *  Only the processor that owns this memory may write to it.
+     *  However, the contents may be read by both processors.
+     *
+     *  Two of these structs are place at the base of shared memory. Slots
+     *  [0] and [1] are respectively assigned to the processors with the
+     *  lower and higher MultiProc ids.
+     *
+     *  Constraints: sizeof(NotifyDriverShm_ProcCtrl) must be a power of two
+     *               and must be greater than sizeof(NotifyDriverShm_EventEntry)
+     */
+    struct ProcCtrl {
+        volatile Bits32 recvInitStatus;   /* Whether ready to receive events  */
+        volatile Bits32 sendInitStatus;   /* Whether ready to send events     */
+        volatile Bits32 eventRegMask;     /* Event Registered mask            */
+        volatile Bits32 eventEnableMask;  /* Event Enabled mask               */
+    }
+
+    struct Instance_State {
+        ProcCtrl         *selfProcCtrl;    /* Control struct for local proc   */
+        ProcCtrl         *otherProcCtrl;   /* Control struct for remote proc  */
+        EventEntry       *selfEventChart;  /* flags, payload (local)          */
+        EventEntry       *otherEventChart; /* flags, payload (remote)         */
+        Notify.Handle    notifyHandle;     /* Handle to front-end object      */
+        UInt32           regChart[];       /* Locally track registered events */
+        UInt             selfId;           /* Which procCtrl to use           */
+        UInt             otherId;          /* Which procCtrl to use           */
+        IInterrupt.IntInfo intInfo;        /* Intr info passed to Interr mod  */
+        UInt16           remoteProcId;     /* Remote MultiProc id             */
+        UInt             nesting;          /* For disable/restore nesting     */
+        Bool             cacheEnabled;     /* Whether to perform cache calls  */
+        SizeT            eventEntrySize;   /* Spacing between event entries   */
+    }
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.xs b/packages/ti/sdo/ipc/notifyDrivers/NotifyDriverShm.xs
new file mode 100644 (file)
index 0000000..5536c6e
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifyDriverShm.xs ================
+ *
+ */
+
+var NotifyDriverShm  = null;
+var List             = null;
+var MultiProc        = null;
+var Notify           = null;
+var Ipc              = null;
+var Cache            = null;
+var Memory           = null;
+var SharedRegion     = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NotifyDriverShm = this;
+    List            = xdc.useModule("ti.sdo.utils.List");
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Cache           = xdc.useModule("ti.sysbios.hal.Cache");
+    Memory          = xdc.useModule("xdc.runtime.Memory");
+
+    if (NotifyDriverShm.InterruptProxy == null) {
+        var Settings = xdc.module("ti.sdo.ipc.family.Settings");
+        var interruptDelegate = Settings.getDefaultInterruptDelegate();
+        NotifyDriverShm.InterruptProxy = xdc.useModule(interruptDelegate);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+
+    /* view.cacheEnabled */
+    view.cacheEnabled = obj.cacheEnabled;
+}
+
+/*
+ *  ======== getEventData ========
+ *  Helper function for use within viewInitData
+ */
+function getEventData(view, obj, procCtrlPtr, eventChartPtr)
+{
+    var NotifyDriverShm =
+        xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
+    var modCfg = Program.getModuleConfig('ti.sdo.ipc.Notify');
+
+    if (procCtrlPtr == obj.selfProcCtrl) {
+        var procName = "[local]";
+    }
+    else {
+        var procName = "[remote]";
+    }
+
+    try {
+        var procCtrl = Program.fetchStruct(NotifyDriverShm.ProcCtrl$fetchDesc,
+                                           procCtrlPtr, false);
+    }
+    catch(e) {
+        throw (new Error("Error fetching procCtrl struct from shared memory"));
+    }
+
+    /* For each possible eventId... */
+    for (var eventId = 0; eventId < modCfg.numEvents; eventId++) {
+        if (procCtrl.eventRegMask & (1 << eventId)) {
+            /* The event is registered */
+            var elem = Program.newViewStruct(
+                'ti.sdo.ipc.notifyDrivers.NotifyDriverShm',
+                'Events');
+
+            elem.eventId = eventId;
+            elem.procName = procName;
+            elem.enabled = procCtrl.eventEnableMask & (1 << eventId);
+
+            try {
+                var eventEntry = Program.fetchStruct(
+                    NotifyDriverShm.EventEntry$fetchDesc,
+                    $addr(Number(eventChartPtr) + obj.eventEntrySize *
+                          eventId), false);
+
+            }
+            catch (e) {
+                throw (new Error("Error fetching eventEntry from shared memory"));
+            }
+
+            elem.flagged = (eventEntry.flag == NotifyDriverShm.UP);
+            elem.payload = eventEntry.payload;
+
+            /* Create a new row in the instance data view */
+            view.elements.$add(elem);
+        }
+    }
+}
+
+
+/*
+ *  ======== viewInitData ========
+ *  Instance data view.
+ */
+function viewInitData(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    try {
+        var notifyObj = Program.scanHandleView('ti.sdo.ipc.Notify',
+            obj.notifyHandle, 'Basic');
+    }
+    catch (e) {
+        throw (new Error("Error fetching Notify instance view"));
+    }
+
+    /* Display the instance label in the tree */
+    view.label = "procId = " + obj.remoteProcId + " lineId = " +
+        notifyObj.lineId;
+
+    /* Fetch self/other procCtrl's */
+    try {
+        var procCtrl = Program.fetchStruct(obj.selfProcCtrl$fetchDesc,
+                                           obj.selfProcCtrl, false);
+    }
+    catch(e) {
+        throw (new Error("Error fetching procCtrl struct from shared memory"));
+    }
+
+    /* Get event data for the local processor */
+    getEventData(view, obj, obj.selfProcCtrl, obj.selfEventChart);
+
+    /* Get event data for the remote processor */
+    getEventData(view, obj, obj.otherProcCtrl, obj.otherEventChart);
+
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.c b/packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.c
new file mode 100644 (file)
index 0000000..801f5a4
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetupNull.c ========
+ */
+#include <xdc/std.h>
+#include <ti/sdo/ipc/_Notify.h>
+
+#include "package/internal/NotifySetupNull.xdc.h"
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*!
+ *  ======== NotifySetupNull_attach ========
+ *  Initialize interrupt
+ */
+Int NotifySetupNull_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    /* Should never attach */
+    return (Notify_E_FAIL);
+}
+
+
+/*!
+ *  ======== NotifySetupNull_sharedMemReq ========
+ */
+SizeT NotifySetupNull_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    return(0);
+}
+
+/*!
+ * ======== NotifySetupNull_numIntLines ========
+ */
+UInt16 NotifySetupNull_numIntLines(UInt16 remoteProcId)
+{
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.xdc b/packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.xdc
new file mode 100644 (file)
index 0000000..939dd57
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NotifySetupNull.xdc ========
+ *
+ */
+
+import ti.sdo.utils.MultiProc;
+
+/*!
+ *  ======== NotifySetupNull ========
+ */
+
+module NotifySetupNull inherits ti.sdo.ipc.interfaces.INotifySetup
+{
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.xs b/packages/ti/sdo/ipc/notifyDrivers/NotifySetupNull.xs
new file mode 100644 (file)
index 0000000..4a67820
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Interrupt.xs ========
+ *
+ */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/package.bld b/packages/ti/sdo/ipc/notifyDrivers/package.bld
new file mode 100644 (file)
index 0000000..8bf2948
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList = [
+      "NotifyDriverShm",
+      "NotifyDriverCirc",
+      "NotifySetupNull",
+];
+
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/notifyDrivers/package.xdc b/packages/ti/sdo/ipc/notifyDrivers/package.xdc
new file mode 100644 (file)
index 0000000..62d77b9
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+requires ti.sdo.ipc;
+requires ti.sdo.ipc.interfaces;
+requires ti.sdo.utils;
+
+/*!
+ *  ======== ti.sdo.ipc.notifyDrivers ========
+ *  Notify interface backend drivers
+ *
+ *  Contains modules that support the Notify API.
+ */
+package ti.sdo.ipc.notifyDrivers [1,0,0,0] {
+    interface IInterrupt;
+    module NotifyDriverShm;
+    module NotifyDriverCirc;
+    module NotifySetupNull;
+}
diff --git a/packages/ti/sdo/ipc/notifyDrivers/package.xs b/packages/ti/sdo/ipc/notifyDrivers/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c b/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c
new file mode 100644 (file)
index 0000000..156310b
--- /dev/null
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerMessageQ.c ========
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Startup.h>
+#include <xdc/runtime/knl/ISync.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Swi.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/syncs/SyncSwi.h>
+#include <ti/sysbios/gates/GateMutex.h>
+
+#include "package/internal/NameServerMessageQ.xdc.h"
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+
+/*
+ *  Determine name array size:
+ *    maxNameLen / ((bits per char) / (bits per byte) * (sizeof(Bits32)))
+ */
+#define MAXNAMEINCHAR   (NameServerMessageQ_maxNameLen / \
+                        (xdc_target__bitsPerChar / 8))
+#define NAMEARRAYSZIE   (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+
+/* message sent to remote procId */
+typedef struct NameServerMsg {
+    MessageQ_MsgHeader header;  /* message header                   */
+    Bits32  value;              /* holds value                      */
+    Bits32  request;            /* whether its a request/response   */
+    Bits32  requestStatus;      /* status of request                */
+    Bits32  reserved;           /* reserved field                   */
+                                /* name of NameServer instance      */
+    Bits32  instanceName[NAMEARRAYSZIE];
+                                /* name of NameServer entry         */
+    Bits32  name[NAMEARRAYSZIE];
+} NameServerMsg;
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+Void NameServerMessageQ_Instance_init(NameServerMessageQ_Object *obj,
+        UInt16 remoteProcId,
+        const NameServerMessageQ_Params *params)
+{
+    /* Assert that remoteProcId is valid */
+    Assert_isTrue(remoteProcId != MultiProc_self() &&
+                  remoteProcId != MultiProc_INVALIDID,
+                  Ipc_A_invParam);
+
+    obj->remoteProcId = remoteProcId;
+
+    /* register the remote driver with NameServer */
+    ti_sdo_utils_NameServer_registerRemoteDriver(
+            NameServerMessageQ_Handle_upCast(obj), remoteProcId);
+}
+
+/*
+ *  ======== NameServerMessageQ_Instance_finalize ========
+ */
+Void NameServerMessageQ_Instance_finalize(NameServerMessageQ_Object *obj)
+{
+    /* unregister remote driver from NameServer module */
+    ti_sdo_utils_NameServer_unregisterRemoteDriver(obj->remoteProcId);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NameServerMessageQ_Module_startup ========
+ */
+Int NameServerMessageQ_Module_startup(Int phase)
+{
+    MessageQ_Params  messageQParams;
+
+    /* Ensure MessageQ and SyncSwi Module_startup() have completed */
+    if ((ti_sdo_ipc_MessageQ_Module_startupDone() == FALSE) ||
+        (ti_sysbios_syncs_SyncSwi_Module_startupDone() == FALSE)) {
+        return (Startup_NOTDONE);
+    }
+
+    /* Create the message queue for NameServer using SyncSwi */
+    MessageQ_Params_init(&messageQParams);
+    messageQParams.synchronizer = NameServerMessageQ_module->syncSwiHandle;
+    NameServerMessageQ_module->msgHandle =
+        (ti_sdo_ipc_MessageQ_Handle)MessageQ_create(NULL, &messageQParams);
+
+    /* assert msgHandle is not null */
+    Assert_isTrue(NameServerMessageQ_module->msgHandle != NULL,
+        Ipc_A_nullPointer);
+
+    /* assert this is the first MessageQ created */
+    Assert_isTrue((MessageQ_getQueueId((MessageQ_Handle)
+        NameServerMessageQ_module->msgHandle) & 0xffff) == 0,
+        NameServerMessageQ_A_reservedMsgQueueId);
+
+    return (Startup_DONE);
+}
+
+/*
+ *  ======== NameServerMessageQ_attach ========
+ */
+Int NameServerMessageQ_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NameServerMessageQ_Params params;
+    NameServerMessageQ_Handle handle;
+    Int status = NameServerMessageQ_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* init params */
+    NameServerMessageQ_Params_init(&params);
+
+    /* create driver to remote proc */
+    handle = NameServerMessageQ_create(remoteProcId,
+                                       &params,
+                                       &eb);
+
+    if (handle != NULL) {
+        status = NameServerMessageQ_S_SUCCESS;
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== NameServerMessageQ_detach ========
+ */
+Int NameServerMessageQ_detach(UInt16 remoteProcId)
+{
+    NameServerMessageQ_Handle handle;
+    Int status = NameServerMessageQ_S_SUCCESS;
+
+    /* return handle based upon procId */
+    for (handle = NameServerMessageQ_Object_first(); handle != NULL;
+        handle = NameServerMessageQ_Object_next(handle)) {
+        if (handle->remoteProcId == remoteProcId) {
+            break;
+        }
+    }
+
+    if (handle == NULL) {
+        status = NameServerMessageQ_E_FAIL;
+    }
+    else {
+        NameServerMessageQ_delete(&handle);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== NameServerMessageQ_get ========
+ */
+Int NameServerMessageQ_get(NameServerMessageQ_Object *obj,
+                           String instanceName,
+                           String name,
+                           Ptr value,
+                           UInt32 *valueLen,
+                           ISync_Handle syncHandle,
+                           Error_Block *eb)
+{
+    Int len;
+    Int status;
+    IArg key;
+    MessageQ_QueueId queueId;
+    NameServerMsg    *msg;
+    Semaphore_Handle semRemoteWait = NameServerMessageQ_module->semRemoteWait;
+    GateMutex_Handle gateMutex = NameServerMessageQ_module->gateMutex;
+
+    /* enter gate - prevent multiple threads from entering */
+    key = GateMutex_enter(gateMutex);
+
+    /* alloc a message from specified heap */
+    msg = (NameServerMsg *)MessageQ_alloc(NameServerMessageQ_heapId,
+                                          sizeof(NameServerMsg));
+
+    /* make sure message is not NULL */
+    if (msg == NULL) {
+        Error_raise(eb, NameServerMessageQ_E_outOfMemory,
+                    NameServerMessageQ_heapId, 0);
+        return (NameServer_E_OSFAILURE);
+    }
+
+    /* make sure this is a request message */
+    msg->request = NameServerMessageQ_REQUEST;
+    msg->requestStatus = 0;
+
+    /* get the length of instanceName */
+    len = strlen(instanceName);
+
+    /* assert length is smaller than max (must have room for null character) */
+    Assert_isTrue(len < MAXNAMEINCHAR, NameServerMessageQ_A_nameIsTooLong);
+
+    /* copy the name of instance into putMsg */
+    strncpy((Char *)msg->instanceName, instanceName, len);
+
+    /* get the length of name */
+    len = strlen(name);
+
+    /* assert length is smaller than max (must have room for null character) */
+    Assert_isTrue(len < MAXNAMEINCHAR, NameServerMessageQ_A_nameIsTooLong);
+
+    /* copy the name of nameserver entry into putMsg */
+    strncpy((Char *)msg->name, name, len);
+
+    /* determine the queueId based upon the processor */
+    queueId = (UInt32)obj->remoteProcId << 16;
+
+    /* set the reply procId */
+    MessageQ_setReplyQueue(
+        (MessageQ_Handle)NameServerMessageQ_module->msgHandle,
+        (MessageQ_Msg)msg);
+
+    /* send message to remote processor. */
+    status = MessageQ_put(queueId, (MessageQ_Msg)msg);
+
+    /* make sure message sent successfully */
+    if (status < 0) {
+        /* free the message */
+        MessageQ_free((MessageQ_Msg)msg);
+
+        return (NameServer_E_FAIL);
+    }
+
+    /* pend here until we get a response back from remote processor */
+    status = Semaphore_pend(semRemoteWait, NameServerMessageQ_timeout);
+
+    if (status == FALSE) {
+        /* return timeout failure */
+        return (NameServer_E_OSFAILURE);
+    }
+
+    /* get the message */
+    msg = NameServerMessageQ_module->msg;
+
+    if (msg->requestStatus) {
+        /* name is found */
+
+        /* set length to amount of data that was copied */
+        *valueLen = sizeof(Bits32);
+
+        /* set the contents of value */
+        memcpy(value, &(msg->value), sizeof(Bits32));
+
+        /* set the status to success */
+        status = NameServer_S_SUCCESS;
+    }
+    else {
+        /* name is not found */
+
+        /* set status to not found */
+        status = NameServer_E_NOTFOUND;
+    }
+
+    /* free the message */
+    MessageQ_free((MessageQ_Msg)msg);
+
+    /* leave the gate */
+    GateMutex_leave(gateMutex, key);
+
+    /* return success status */
+    return (status);
+}
+
+/*
+ *  ======== NameServerMessageQ_sharedMemReq ========
+ */
+SizeT NameServerMessageQ_sharedMemReq(Ptr sharedAddr)
+{
+    return (0);
+}
+
+/*
+ *  ======== NameServerMessageQ_swiFxn ========
+ */
+Void NameServerMessageQ_swiFxn(UArg arg0, UArg arg1)
+{
+    NameServerMsg     *msg;
+    NameServer_Handle handle;
+    MessageQ_QueueId  queueId;
+    Int               status = NameServer_E_FAIL;
+    Semaphore_Handle  semRemoteWait = NameServerMessageQ_module->semRemoteWait;
+
+    /* drain all messages in the messageQ */
+    while (1) {
+        /* get a message, this never waits */
+        status = MessageQ_get(
+                    (MessageQ_Handle)NameServerMessageQ_module->msgHandle,
+                    (MessageQ_Msg *)&msg, 0);
+
+        /* if no message then return */
+        if (status != MessageQ_S_SUCCESS) {
+            break;
+        }
+
+        if (msg->request == NameServerMessageQ_REQUEST) {
+            /* reset value of status */
+            status = NameServer_E_FAIL;
+
+            /*
+             *  Message is a request. Lookup name in NameServer table.
+             *  Send a response message back to source processor.
+             */
+            handle = NameServer_getHandle((String)msg->instanceName);
+
+            if (handle != NULL) {
+                /* Search for the NameServer entry */
+                status = NameServer_getLocalUInt32(handle,
+                         (String)msg->name, &msg->value);
+            }
+
+            /* set the request status */
+            if (status < 0) {
+                msg->requestStatus = 0;
+            }
+            else {
+                msg->requestStatus = 1;
+            }
+
+            /* specify message as a response */
+            msg->request = NameServerMessageQ_RESPONSE;
+
+            /* get the remote processor from the msg header */
+            queueId = (UInt32)(msg->header.replyProc) << 16;
+
+            /* send response message to remote processor */
+            MessageQ_put(queueId, (MessageQ_Msg)msg);
+        }
+        else {
+            /*
+             *  This is a response message. At any given time, there is
+             *  only one of these outstanding because of semMultiBlock.
+             *  This allows us to safely set the Module state's msg pointer
+             *  and post semaphore.
+             */
+            NameServerMessageQ_module->msg = msg;
+            Semaphore_post(semRemoteWait);
+        }
+
+    }
+}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xdc b/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xdc
new file mode 100644 (file)
index 0000000..3a05952
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerMessageQ.xdc ========
+ */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+
+import xdc.rov.ViewInfo;
+
+import ti.sysbios.knl.Swi;
+import ti.sysbios.syncs.SyncSwi;
+import ti.sysbios.knl.Semaphore;
+import ti.sysbios.gates.GateMutex;
+import ti.sdo.ipc.MessageQ;
+import ti.sdo.utils.INameServerRemote;
+
+/*!
+ *  ======== NameServerMessageQ ========
+ *  Used by NameServer to communicate to remote processors.
+ *
+ *  This module is used by {@link ti.sdo.utils.NameServer} to communicate
+ *  to remote processors using {@link ti.sdo.ipc.MessageQ}.
+ *  There needs to be one instance between each two cores in the system.
+ *  Interrupts must be enabled before using this module.
+ *  This module does not require any share memory.
+ */
+@ModuleStartup
+@InstanceFinalize
+
+module NameServerMessageQ inherits INameServerRemote
+{
+    /*! maximum number of characters for name in bytes */
+    const UInt maxNameLen = 32;
+
+    /*!
+     *  Assert raised if first MessageQ created already
+     */
+    config Assert.Id A_reservedMsgQueueId = {
+        msg: "MessageQ Id 0 is reserved for NameServer"
+    };
+
+    /*!
+     *  Assert raised if too many characters in the name
+     */
+    config Assert.Id A_nameIsTooLong = {
+        msg: "Too many characters in name"
+    };
+
+    /*!
+     *  Error raised if all the message queue objects are taken
+     */
+    config Error.Id E_outOfMemory  = {
+        msg: "E_outOfMemory: MessageQ_alloc faild from heap: %d"
+    };
+
+    /*!
+     *  ======== heapId ========
+     *  The heap from which to alloc a message.
+     */
+    config UInt16 heapId = 0;
+
+    /*!
+     *  ======== timeoutInMicroSecs ========
+     *  The timeout value in terms of microseconds
+     *
+     *  A NameServer request will return after this amout of time
+     *  without a response. The default timeout value is 1 s.
+     *  To not wait, use the value of '0'.  To wait forever, use '~(0)'.
+     */
+    config UInt timeoutInMicroSecs = 1000000;
+
+internal:
+
+    /*
+     *  ======== timeout ========
+     *  The timeout value to pass into Semaphore_pend
+     *
+     *  This value is calculated based on timeoutInMicroSecs and the
+     *  SYSBIOS clock.tickPeriod.
+     */
+    config UInt timeout;
+
+    /*!
+     *  ======== Type ========
+     *  The type of the message
+     */
+    enum Type {
+        REQUEST =  0,
+        RESPONSE = 1
+    };
+
+    /*!
+     *  ======== swiFxn ========
+     *  The swi function that will be executed during the call back.
+     *
+     *  @param(arg0)    argument 0 to swi function
+     *  @param(arg1)    argument 1 to swi function
+     */
+    Void swiFxn(UArg arg0, UArg arg1);
+
+    /* Instance state */
+    struct Instance_State {
+        UInt16              remoteProcId;   /* remote MultiProc id           */
+    };
+
+    /* Module state */
+    struct Module_State {
+        MessageQ.Handle     msgHandle;      /* messageQ for NameServer       */
+        Swi.Handle          swiHandle;      /* instance swi object           */
+        SyncSwi.Handle      syncSwiHandle;  /* syncSwi handle                */
+        Semaphore.Handle    semRemoteWait;  /* sem to wait on remote proc    */
+        GateMutex.Handle    gateMutex;      /* gate to protect critical code */
+        Ptr                 msg;            /* pointer to response message   */
+    };
+}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xs b/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xs
new file mode 100644 (file)
index 0000000..f05e66a
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerMessageQ.xs ========
+ */
+
+var NameServerMessageQ = null;
+var NameServer = null;
+var Semaphore  = null;
+var Swi = null;
+var Clock = null;
+var Ipc = null;
+var SyncSwi = null;
+var GateMutex = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NameServerMessageQ = this;
+    NameServer      = xdc.useModule("ti.sdo.utils.NameServer");
+    Semaphore       = xdc.useModule("ti.sysbios.knl.Semaphore");
+    Swi             = xdc.useModule("ti.sysbios.knl.Swi");
+    Clock           = xdc.useModule("ti.sysbios.knl.Clock");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    SyncSwi         = xdc.useModule("ti.sysbios.syncs.SyncSwi");
+    GateMutex       = xdc.useModule("ti.sysbios.gates.GateMutex");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    mod.msgHandle = null;
+    mod.msg       = null;
+
+    /* calculate the timeout value */
+    if (NameServerMessageQ.timeoutInMicroSecs != ~(0)) {
+        NameServerMessageQ.timeout =
+            NameServerMessageQ.timeoutInMicroSecs / Clock.tickPeriod;
+    }
+    else {
+        NameServerMessageQ.timeout = NameServerMessageQ.timeoutInMicroSecs;
+    }
+
+    /* create Swi with lowest priority */
+    var swiParams = new Swi.Params();
+    swiParams.priority = 0;
+    mod.swiHandle  = Swi.create(NameServerMessageQ.swiFxn, swiParams);
+
+    /* create SyncSwi as the synchronizer */
+    var syncSwiParams = new SyncSwi.Params();
+    syncSwiParams.swi = mod.swiHandle;
+    mod.syncSwiHandle = SyncSwi.create(syncSwiParams);
+
+    /* create the semaphore to wait for a response message */
+    mod.semRemoteWait = Semaphore.create(0);
+
+    /* create GateMutex */
+    mod.gateMutex = GateMutex.create();
+}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.c b/packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.c
new file mode 100644 (file)
index 0000000..609c824
--- /dev/null
@@ -0,0 +1,562 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteNotify.c ========
+ */
+
+/* Remove Windows strncpy warning */
+#define _CRT_SECURE_NO_DEPRECATE 1
+
+#include <xdc/std.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/knl/ISync.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/knl/Swi.h>
+#include <ti/sysbios/knl/Semaphore.h>
+
+#include "package/internal/NameServerRemoteNotify.xdc.h"
+
+#include <ti/sdo/ipc/Ipc.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+
+/* Need to use reserved notify events */
+#undef NameServerRemoteNotify_notifyEventId
+#define NameServerRemoteNotify_notifyEventId \
+        ti_sdo_ipc_nsremote_NameServerRemoteNotify_notifyEventId + \
+                    (UInt32)((UInt32)Notify_SYSTEMKEY << 16)
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+Int NameServerRemoteNotify_Instance_init(NameServerRemoteNotify_Object *obj,
+        UInt16 remoteProcId,
+        const NameServerRemoteNotify_Params *params,
+        Error_Block *eb)
+{
+    Int               offset = 0;
+    Int               status;
+    Semaphore_Params  semParams;
+    Semaphore_Handle  semRemoteWait;
+    Semaphore_Handle  semMultiBlock;
+    Swi_Handle        swiHandle;
+    Swi_Params        swiParams;
+
+    /* Assert that a NameServerRemoteNotify_Params has been supplied */
+    Assert_isTrue(params != NULL, Ipc_A_nullArgument);
+
+    /* Assert that remoteProcId is valid */
+    Assert_isTrue(remoteProcId != MultiProc_self() &&
+                  remoteProcId != MultiProc_INVALIDID,
+                  Ipc_A_invParam);
+
+    /* determine the offset based upon own id and remote's id */
+    if (MultiProc_self() > remoteProcId) {
+        offset = 1;
+    }
+
+    obj->regionId = SharedRegion_getId(params->sharedAddr);
+
+    /* Assert that sharedAddr is cache aligned */
+    Assert_isTrue(((UInt32)params->sharedAddr %
+                  SharedRegion_getCacheLineSize(obj->regionId) == 0),
+                  Ipc_A_addrNotCacheAligned);
+
+    semRemoteWait = NameServerRemoteNotify_Instance_State_semRemoteWait(obj);
+    semMultiBlock = NameServerRemoteNotify_Instance_State_semMultiBlock(obj);
+    swiHandle = NameServerRemoteNotify_Instance_State_swiObj(obj);
+
+    obj->msg[0] = (NameServerRemoteNotify_Message *)(params->sharedAddr);
+    obj->msg[1] = (NameServerRemoteNotify_Message *)((UInt32)obj->msg[0] +
+                          sizeof(NameServerRemoteNotify_Message));
+    obj->gate = params->gate;
+    obj->remoteProcId = remoteProcId;
+
+    /* construct the semaphore */
+    Semaphore_Params_init(&semParams);
+    Semaphore_construct(Semaphore_struct(semRemoteWait), 0, &semParams);
+
+    /* construct the semaphore */
+    Semaphore_construct(Semaphore_struct(semMultiBlock), 1, &semParams);
+
+    /* swi created with lowest priority and fxn = swiFxn */
+    Swi_Params_init(&swiParams);
+    swiParams.arg0 = (UArg)obj;
+    swiParams.priority = 0;
+    Swi_construct(Swi_struct(swiHandle),
+                 (ti_sysbios_knl_Swi_FuncPtr)NameServerRemoteNotify_swiFxn,
+                 &swiParams, eb);
+
+    /* initialize own side of message struct only */
+    obj->msg[offset]->request = 0;
+    obj->msg[offset]->response = 0;
+    obj->msg[offset]->requestStatus = 0;
+    obj->msg[offset]->value = 0;
+    obj->msg[offset]->valueLen = 0;
+
+    memset(obj->msg[offset]->instanceName, 0,
+               sizeof(obj->msg[offset]->instanceName));
+    memset(obj->msg[offset]->name, 0,
+               sizeof(obj->msg[offset]->name));
+
+    /* determine cacheability of the object from the regionId */
+    obj->cacheEnable = SharedRegion_isCacheEnabled(obj->regionId);
+    if (obj->cacheEnable) {
+        /* write back shared memory that was modified */
+        Cache_wbInv(obj->msg[offset], sizeof(NameServerRemoteNotify_Message),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    /* register the call back function and event Id with notify */
+    status = Notify_registerEventSingle(
+                remoteProcId,
+                0,
+                NameServerRemoteNotify_notifyEventId,
+                (Notify_FnNotifyCbck)NameServerRemoteNotify_cbFxn,
+                (UArg)swiHandle);
+
+    /* if not successful return */
+    if (status < 0) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (1);
+    }
+
+    /* register the remote driver with NameServer */
+    ti_sdo_utils_NameServer_registerRemoteDriver(
+            NameServerRemoteNotify_Handle_upCast(obj), remoteProcId);
+
+    return (0);
+}
+
+/*
+ *  ======== NameServerRemoteNotify_Instance_finalize ========
+ */
+Void NameServerRemoteNotify_Instance_finalize(NameServerRemoteNotify_Object *obj,
+    Int status)
+{
+    Semaphore_Handle  semRemoteWait;
+    Semaphore_Handle  semMultiBlock;
+    Swi_Handle        swiHandle;
+
+    if (status == 0) {
+        /* unregister remote driver from NameServer module */
+        ti_sdo_utils_NameServer_unregisterRemoteDriver(obj->remoteProcId);
+
+        /* unregister event from Notify module */
+        Notify_unregisterEventSingle(
+                       obj->remoteProcId,
+                       0,
+                       NameServerRemoteNotify_notifyEventId);
+    }
+
+    semRemoteWait = NameServerRemoteNotify_Instance_State_semRemoteWait(obj);
+    if (semRemoteWait != NULL) {
+        Semaphore_destruct(Semaphore_struct(semRemoteWait));
+    }
+
+    semMultiBlock = NameServerRemoteNotify_Instance_State_semMultiBlock(obj);
+    if (semMultiBlock != NULL) {
+        Semaphore_destruct(Semaphore_struct(semMultiBlock));
+    }
+
+    swiHandle = NameServerRemoteNotify_Instance_State_swiObj(obj);
+    if (swiHandle != NULL) {
+        Swi_destruct(Swi_struct(swiHandle));
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NameServerRemoteNotify_attach ========
+ */
+Int NameServerRemoteNotify_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    NameServerRemoteNotify_Params nsrParams;
+    NameServerRemoteNotify_Handle handle;
+    Int status = NameServerRemoteNotify_E_FAIL;
+    Error_Block eb;
+
+    /* Assert that the default GateMP is not NULL */
+    Assert_isTrue(GateMP_getDefaultRemote() != NULL, Ipc_A_internal);
+
+    Error_init(&eb);
+
+    /* Use default GateMP */
+    NameServerRemoteNotify_Params_init(&nsrParams);
+    nsrParams.gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+
+    /* determine the address */
+    nsrParams.sharedAddr = sharedAddr;
+
+    /* create only if notify driver has been created to remote proc */
+    if (Notify_intLineRegistered(remoteProcId, 0)) {
+        handle = NameServerRemoteNotify_create(remoteProcId,
+                                               &nsrParams,
+                                               &eb);
+        if (handle != NULL) {
+            status = NameServerRemoteNotify_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== NameServerRemoteNotify_cbFxn ========
+ */
+Void NameServerRemoteNotify_cbFxn(UInt16 procId,
+                                  UInt16 lineId,
+                                  UInt32 eventId,
+                                  UArg arg,
+                                  UInt32 payload)
+{
+    Swi_Handle swiHandle;
+
+    /* Swi_Handle was passed as arg in register */
+    swiHandle = (Swi_Handle)arg;
+
+    /* post the Swi */
+    Swi_post(swiHandle);
+}
+
+/*
+ *  ======== NameServerRemoteNotify_detach ========
+ */
+Int NameServerRemoteNotify_detach(UInt16 remoteProcId)
+{
+    NameServerRemoteNotify_Handle handle;
+    Int status = NameServerRemoteNotify_S_SUCCESS;
+
+    for (handle = NameServerRemoteNotify_Object_first(); handle != NULL;
+        handle = NameServerRemoteNotify_Object_next(handle)) {
+        if (handle->remoteProcId == remoteProcId) {
+            break;
+        }
+    }
+
+    if (handle == NULL) {
+        status = NameServerRemoteNotify_E_FAIL;
+    }
+    else {
+        NameServerRemoteNotify_delete(&handle);
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== NameServerRemoteNotify_get ========
+ */
+Int NameServerRemoteNotify_get(NameServerRemoteNotify_Object *obj,
+                               String instanceName,
+                               String name,
+                               Ptr value,
+                               UInt32 *valueLen,
+                               ISync_Handle syncHandle,
+                               Error_Block *eb)
+{
+    Int len;
+    Int retval = NameServer_E_NOTFOUND;
+    Int offset = 0;
+    Int status;
+    Int notifyStatus;
+    IArg key;
+    Semaphore_Handle semRemoteWait;
+    Semaphore_Handle semMultiBlock;
+
+    Assert_isTrue(*valueLen <= 300,
+                      NameServerRemoteNotify_A_invalidValueLen);
+
+    semRemoteWait = NameServerRemoteNotify_Instance_State_semRemoteWait(obj);
+    semMultiBlock = NameServerRemoteNotify_Instance_State_semMultiBlock(obj);
+
+    /* prevent multiple threads from entering */
+    Semaphore_pend(semMultiBlock, BIOS_WAIT_FOREVER);
+
+    if (MultiProc_self() > obj->remoteProcId) {
+            offset = 1;
+    }
+
+    if (obj->cacheEnable) {
+        /* Make sure there's no outstanding message */
+        Cache_inv(obj->msg[offset], sizeof(NameServerRemoteNotify_Message),
+                  Cache_Type_ALL, TRUE);
+    }
+
+    /* enter gate so nobody can be modifying message in shared memory */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    /* this is a request message */
+    obj->msg[offset]->request = 1;
+    obj->msg[offset]->response = 0;
+    obj->msg[offset]->requestStatus = 0;
+    obj->msg[offset]->valueLen = *valueLen;
+
+    /* copy the name of instance into shared memory */
+    len = strlen(instanceName);
+    strncpy((Char *)obj->msg[offset]->instanceName, instanceName, len + 1);
+
+    /* copy the name of nameserver entry into shared memory */
+    len = strlen(name);
+    strncpy((Char *)obj->msg[offset]->name, name, len + 1);
+
+    if (obj->cacheEnable) {
+        Cache_wbInv(obj->msg[offset], sizeof(NameServerRemoteNotify_Message),
+                    Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  Send the notification to remote processor. Do not wait here since
+     *  we hold the GateMP.
+     */
+    notifyStatus = Notify_sendEvent(
+                       obj->remoteProcId,
+                       0,
+                       NameServerRemoteNotify_notifyEventId,
+                       0,
+                       FALSE);
+
+    /* now we can leave the gate after we send the notification */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    if (notifyStatus < 0) {
+        /* undo previous options */
+        obj->msg[offset]->request = 0;
+        obj->msg[offset]->valueLen = 0;
+
+        /* post the semaphore to make sure it doesn't block */
+        Semaphore_post(semMultiBlock);
+
+        return (retval);
+    }
+
+    /* pend here until we get a notification back from remote processor */
+    status = Semaphore_pend(semRemoteWait, NameServerRemoteNotify_timeout);
+
+    if (status == FALSE) {
+        retval = NameServer_E_OSFAILURE;
+    }
+    else {
+        /* getting here means we got the notification back */
+        /* enter gate so nobody can be modifying message in shared memory */
+        key = GateMP_enter((GateMP_Handle)obj->gate);
+
+        if (obj->cacheEnable) {
+            Cache_inv(obj->msg[offset], sizeof(NameServerRemoteNotify_Message),
+                      Cache_Type_ALL, TRUE);
+        }
+
+        /* if successful request then copy to value */
+        if (obj->msg[offset]->requestStatus == TRUE) {
+            /* clear out requestStatus */
+            obj->msg[offset]->requestStatus = FALSE;
+
+            /* copy to value */
+            if (obj->msg[offset]->valueLen == sizeof(UInt32)) {
+                memcpy(value, &(obj->msg[offset]->value), sizeof(UInt32));
+            }
+            else {
+                memcpy(value, &(obj->msg[offset]->valueBuf),
+                       obj->msg[offset]->valueLen);
+            }
+
+            /* set length to amount of data that was copied */
+            *valueLen = obj->msg[offset]->valueLen;
+
+            /* set the status */
+            retval = NameServer_S_SUCCESS;
+        }
+
+        /* clear out the request and response flags */
+        obj->msg[offset]->request  = 0;
+        obj->msg[offset]->response = 0;
+
+        if (obj->cacheEnable) {
+            Cache_wbInv(obj->msg[offset],
+                        sizeof(NameServerRemoteNotify_Message),
+                        Cache_Type_ALL, TRUE);
+        }
+
+        /*  Now we can leave the gate after we send the notification */
+        GateMP_leave((GateMP_Handle)obj->gate, key);
+    }
+
+    Semaphore_post(semMultiBlock);
+
+    return (retval);
+}
+
+/*
+ *  ======== NameServerRemoteNotify_sharedMemReq ========
+ */
+SizeT NameServerRemoteNotify_sharedMemReq(Ptr sharedAddr)
+{
+    /*
+     *  Two Message structs are required.
+     *  One for sending request and one for sending response.
+     */
+    if (ti_sdo_utils_MultiProc_numProcessors > 1) {
+        return (2 * sizeof(NameServerRemoteNotify_Message));
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== NameServerRemoteNotify_swiFxn ========
+ */
+Void NameServerRemoteNotify_swiFxn(UArg arg)
+{
+    Int count = NameServer_E_FAIL;
+    Int offset = 0;
+    UInt32 valueLen;
+    IArg key;
+    NameServer_Handle handle;
+    NameServerRemoteNotify_Object *obj;
+#ifndef xdc_runtime_Assert_DISABLE_ALL
+    Int status;
+#endif
+
+    obj = (NameServerRemoteNotify_Object *)arg;
+
+    if (MultiProc_self() > obj->remoteProcId) {
+        offset = 1;
+    }
+
+    if (obj->cacheEnable) {
+        /* invalidate both request and response messages */
+        Cache_inv(obj->msg[0],
+                  sizeof(NameServerRemoteNotify_Message) << 1,
+                  Cache_Type_ALL, TRUE);
+    }
+
+    /* in case of request */
+    if (obj->msg[1 - offset]->request == TRUE) {
+        /* get the NameServer handle */
+        handle = NameServer_getHandle(
+                     (String)obj->msg[1 - offset]->instanceName);
+        valueLen = obj->msg[1 - offset]->valueLen;
+
+        if (handle != NULL) {
+            /* Search for the NameServer entry */
+            if (valueLen == sizeof(UInt32)) {
+                count = NameServer_getLocalUInt32(handle,
+                    (String)obj->msg[1 - offset]->name,
+                    &obj->msg[1 - offset]->value);
+            }
+            else {
+                count = NameServer_getLocal(handle,
+                    (String)obj->msg[1 - offset]->name,
+                    &obj->msg[1 - offset]->valueBuf, &valueLen);
+            }
+        }
+
+        /* enter gate so nobody can be modifying message in shared memory */
+        key = GateMP_enter((GateMP_Handle)obj->gate);
+
+        /*
+         *  If an entry was found, set requestStatus to TRUE
+         *  and valueLen to the size of data that was copied.
+         */
+        if (count == NameServer_S_SUCCESS) {
+            obj->msg[1 - offset]->requestStatus = TRUE;
+            obj->msg[1 - offset]->valueLen = valueLen;
+        }
+
+        /* Send a response back */
+        obj->msg[1 - offset]->response = TRUE;
+        obj->msg[1 - offset]->request = FALSE;
+
+        if (obj->cacheEnable) {
+            Cache_wbInv(obj->msg[1 - offset],
+                        sizeof(NameServerRemoteNotify_Message),
+                        Cache_Type_ALL, TRUE);
+        }
+
+        /* now we can leave the gate */
+        GateMP_leave((GateMP_Handle)obj->gate, key);
+
+        /*
+         *  The Notify line must be active at this point for this processor to
+         *  have received a request.  Do not wait here since we are in a Swi.
+         */
+#ifndef xdc_runtime_Assert_DISABLE_ALL
+        status =
+#endif
+        Notify_sendEvent(obj->remoteProcId,
+                0, NameServerRemoteNotify_notifyEventId, 0, FALSE);
+        /* The NS query could fail, but the reply should never fail */
+        Assert_isTrue(status >= 0, Ipc_A_internal);
+
+    }
+
+    /* in case of response */
+    if (obj->msg[offset]->response == TRUE) {
+        /* post the Semaphore */
+        Semaphore_post(
+            NameServerRemoteNotify_Instance_State_semRemoteWait(obj));
+    }
+}
+
+/*
+ *  ======== NameServerRemoteNotify_getHandle ========
+ */
+NameServerRemoteNotify_Handle NameServerRemoteNotify_getHandle(
+    UInt16 remoteProcId)
+{
+    NameServerRemoteNotify_Handle obj;
+
+    for (obj = NameServerRemoteNotify_Object_first(); obj != NULL;
+        obj = NameServerRemoteNotify_Object_next(obj)) {
+        if (obj->remoteProcId == remoteProcId) {
+            break;
+        }
+    }
+
+    return (obj);
+}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.xdc b/packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.xdc
new file mode 100644 (file)
index 0000000..5e44939
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteNotify.xdc ========
+ */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+
+import xdc.rov.ViewInfo;
+
+import ti.sysbios.knl.Swi;
+import ti.sysbios.knl.Semaphore;
+import ti.sdo.ipc.GateMP;
+import ti.sdo.utils.INameServerRemote;
+
+/*!
+ *  ======== NameServerRemoteNotify ========
+ *  Used by NameServer to communicate to remote processors.
+ *
+ *  This module is used by {@link #ti.sdo.utils.NameServer} to communicate
+ *  to remote processors using {@link ti.sdo.ipc.Notify} and shared memory.
+ *  There needs to be one instance between each two cores in the system.
+ *  Interrupts must be enabled before using this module.  For critical
+ *  memory management, a GateMP {@link #gate} can be specified.  Currently
+ *  supports transferring up to 300-bytes between two cores.
+ */
+@InstanceInitError
+@InstanceFinalize
+
+module NameServerRemoteNotify inherits INameServerRemote
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        UInt        remoteProcId;
+        String      remoteProcName;
+        String      localRequestStatus;
+        String      localInstanceName;
+        String      localName;
+        String      localValue;
+        String      remoteRequestStatus;
+        String      remoteInstanceName;
+        String      remoteName;
+        String      remoteValue;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+            ]
+        });
+
+    /* structure in shared memory for retrieving value */
+    struct Message {
+        Bits32  request;            /* if this is a request set to 1    */
+        Bits32  response;           /* if this is a response set to 1   */
+        Bits32  requestStatus;      /* if request sucessful set to 1    */
+        Bits32  value;              /* holds value if len <= 4          */
+        Bits32  valueLen;           /* len of value                     */
+        Bits32  instanceName[8];    /* name of NameServer instance      */
+        Bits32  name[8];            /* name of NameServer entry         */
+        Bits32  valueBuf[75];       /* supports up to 300-byte value    */
+    };
+
+    /*!
+     *  Assert raised when length of value larger then 300 bytes.
+     */
+    config xdc.runtime.Assert.Id A_invalidValueLen =
+        {msg: "A_invalidValueLen: Invalid valueLen (too large)"};
+
+    /*!
+     *  ======== notifyEventId ========
+     *  The Notify event ID.
+     */
+    config UInt notifyEventId = 4;
+
+    /*!
+     *  ======== timeoutInMicroSecs ========
+     *  The timeout value in terms of microseconds
+     *
+     *  A NameServer request will return after this amout of time
+     *  without a response. The default timeout value is to wait forever.
+     *  To not wait, use the value of '0'.
+     */
+    config UInt timeoutInMicroSecs = ~(0);
+
+instance:
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Physical address of the shared memory
+     *
+     *  The shared memory that will be used for maintaining shared state
+     *  information.  This value must be the same for both processors when
+     *  creating the instance between a pair of processors.
+     */
+    config Ptr sharedAddr = null;
+
+    /*!
+     *  ======== gate ========
+     *  GateMP used for critical region management of the shared memory
+     *
+     *  Using the default value of NULL will result in the default GateMP
+     *  being used for context protection.
+     */
+    config GateMP.Handle gate = null;
+
+internal:
+
+    /*
+     *  ======== timeout ========
+     *  The timeout value to pass into Semaphore_pend
+     *
+     *  This value is calculated based on timeoutInMicroSecs and the
+     *  SYSBIOS clock.tickPeriod.
+     */
+    config UInt timeout;
+
+    /*!
+     *  ======== cbFxn ========
+     *  The call back function registered with Notify.
+     *
+     *  This function is registered with Notify as a call back function
+     *  when the specified event is triggered.  This function simply posts
+     *  a Swi which will process the event.
+     *
+     *  @param(procId)          Source proc id
+     *  @param(lineId)          Interrupt line id
+     *  @param(eventId)         the Notify event id.
+     *  @param(arg)             the argument for the function.
+     *  @param(payload)         a 32-bit payload value.
+     */
+    Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+               UInt32 payload);
+
+    /*!
+     *  ======== swiFxn ========
+     *  The swi function that will be executed during the call back.
+     *
+     *  @param(arg)     argument to swi function
+     */
+    Void swiFxn(UArg arg);
+
+    /* instance state */
+    struct Instance_State {
+        Message             *msg[2];        /* Ptrs to messages in shared mem */
+        UInt16              regionId;       /* SharedRegion ID                */
+        GateMP.Handle       gate;           /* remote and local gate protect  */
+        Semaphore.Object    semRemoteWait;  /* sem to wait on remote proc     */
+        Semaphore.Object    semMultiBlock;  /* sem to block multiple threads  */
+        Swi.Object          swiObj;         /* instance swi object            */
+        UInt16              remoteProcId;   /* remote MultiProc id            */
+        Bool                cacheEnable;    /* cacheability                   */
+    };
+}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.xs b/packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.xs
new file mode 100644 (file)
index 0000000..fdf7f9b
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteNotify.xs ========
+ */
+
+var NameServerRemoteNotify;
+var NameServer;
+var MultiProc;
+var Notify;
+var Ipc;
+var GateMP;
+var SharedRegion;
+var Semaphore;
+var Swi;
+var Clock = null;
+var Cache;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    NameServerRemoteNotify = this;
+    NameServer      = xdc.useModule("ti.sdo.utils.NameServer");
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    GateMP          = xdc.useModule("ti.sdo.ipc.GateMP");
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Semaphore       = xdc.useModule("ti.sysbios.knl.Semaphore");
+    Swi             = xdc.useModule("ti.sysbios.knl.Swi");
+    Clock           = xdc.useModule("ti.sysbios.knl.Clock");
+    Cache           = xdc.useModule("ti.sysbios.hal.Cache");
+}
+
+/*
+ *  ======== module$static$init ========
+ *  Initialize module values.
+ */
+function module$static$init(mod, params)
+{
+    /* calculate the timeout value */
+    if (NameServerRemoteNotify.timeoutInMicroSecs != ~(0)) {
+        NameServerRemoteNotify.timeout =
+            NameServerRemoteNotify.timeoutInMicroSecs / Clock.tickPeriod;
+    }
+    else {
+        NameServerRemoteNotify.timeout =
+            NameServerRemoteNotify.timeoutInMicroSecs;
+    }
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (Notify.numEvents <= NameServerRemoteNotify.notifyEventId) {
+        NameServerRemoteNotify.$logFatal(
+                "NameServerRemoteNotify.notifyEventId (" +
+                NameServerRemoteNotify.notifyEventId +
+                ") is too big: Notify.numEvents = " + Notify.numEvents,
+                NameServerRemoteNotify);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== fetchString ========
+ *  Returns a string contained in one of the Bits32 array fields in 'msg'
+ */
+function fetchString(msg, field)
+{
+    var NSRN = xdc.useModule('ti.sdo.ipc.nsremote.NameServerRemoteNotify');
+
+    var ptrToString = $addr(Number(msg) + NSRN.Message.$offsetof(field));
+
+    return (Program.fetchString(ptrToString));
+}
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    var NSRN = xdc.useModule('ti.sdo.ipc.nsremote.NameServerRemoteNotify');
+
+    /* view.remoteProcId */
+    view.remoteProcId = obj.remoteProcId;
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    if (MultiProc.self$view() > obj.remoteProcId) {
+        var offset = 1;
+    }
+    else {
+        var offset = 0;
+    }
+    var localId = offset;
+    var remoteId = 1 - offset;
+
+    try {
+        var localMsg = Program.fetchStruct(
+                NSRN.Message$fetchDesc,
+                $addr(obj.msg[localId])); /* msg[0] belongs to local core */
+    }
+    catch(e) {
+        Program.displayError(view, "localRequestStatus", "Problem " +
+            "retrieving local request status ");
+        return;
+    }
+
+    if (localMsg.request == 1 || localMsg.response == 1) {
+        if (localMsg.request == 1) {
+            /* Request */
+            view.localRequestStatus = "Receiving a request";
+        }
+        else {
+            /* Response */
+            view.localRequestStatus = "Sending a response ";
+            if (localMsg.requestStatus == 1) {
+                view.localRequestStatus += "(found)";
+                if (localMsg.valueLen <= 4) {
+                    view.localValue = "0x" +
+                        Number(localMsg.value).toString(16);
+                }
+                else {
+                    view.localValue = "Value at 0x" +
+                        Number(Number(obj.msg[localId]) +
+                        NSRN.Message.$offsetof("valueBuf")).toString(16);
+                }
+            }
+            else {
+                view.localRequestStatus += "(not found)";
+            }
+        }
+
+        view.localInstanceName = fetchString(obj.msg[localId], "instanceName");
+        view.localName = fetchString(obj.msg[localId], "name");
+    }
+    else {
+        view.localRequestStatus = "Idle";
+    }
+
+    try {
+        var remoteMsg = Program.fetchStruct(
+                NSRN.Message$fetchDesc,
+                $addr(obj.msg[remoteId]));
+    }
+    catch(e) {
+        Program.displayError(view, "localRequestStatus", "Problem " +
+            "retrieving remote request status ");
+        return;
+    }
+
+    if (remoteMsg.request == 1 || remoteMsg.response == 1) {
+        if (remoteMsg.request == 1) {
+            /* Request */
+            view.remoteRequestStatus = "Receiving a request";
+        }
+        else {
+            /* Response */
+            view.remoteRequestStatus = "Sending a response ";
+            if (remoteMsg.requestStatus == 1) {
+                view.remoteRequestStatus += "(found)";
+
+                if (remoteMsg.valueLen <= 4) {
+                    view.remoteValue = "0x" +
+                        Number(remoteMsg.value).toString(16);
+                }
+                else {
+                    view.remoteValue = "Value at 0x" +
+                        Number(Number(obj.msg[remoteId]) +
+                        NSRN.Message.$offsetof("valueBuf")).toString(16);
+                }
+            }
+            else {
+                view.remoteRequestStatus += "(not found)";
+            }
+        }
+
+        view.remoteInstanceName = fetchString(obj.msg[remoteId], "instanceName");
+        view.remoteName = fetchString(obj.msg[remoteId], "name");
+    }
+    else {
+        view.remoteRequestStatus = "Idle";
+    }
+}
diff --git a/packages/ti/sdo/ipc/nsremote/package.bld b/packages/ti/sdo/ipc/nsremote/package.bld
new file mode 100644 (file)
index 0000000..d2da811
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList = [
+      "NameServerRemoteNotify",
+      "NameServerMessageQ",
+];
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/nsremote/package.xdc b/packages/ti/sdo/ipc/nsremote/package.xdc
new file mode 100644 (file)
index 0000000..6f33d57
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ */
+
+/*!
+ *  ======== ti.sdo.ipc.nsremote ========
+ */
+
+package ti.sdo.ipc.nsremote [1,0,0,0] {
+    module    NameServerRemoteNotify;
+    module    NameServerMessageQ;
+}
diff --git a/packages/ti/sdo/ipc/nsremote/package.xs b/packages/ti/sdo/ipc/nsremote/package.xs
new file mode 100644 (file)
index 0000000..b728685
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/ipc/package.bld b/packages/ti/sdo/ipc/package.bld
new file mode 100644 (file)
index 0000000..8ce61a6
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2010-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== package.bld ========
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList = [
+      "Notify",
+      "GateMP",
+      "Ipc",
+      "MessageQ",
+      "SharedRegion",
+      "ListMP",
+];
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [
+    "package.bld",
+    "linkcmd.xdt",
+    "_GateMP.h",
+    "_ListMP.h",
+    "_Notify.h",
+    "_MessageQ.h",
+    "_SharedRegion.h",
+    "_Ipc.h",
+    "Ipc.c",
+    "makefile.xdt",
+    "makefile_gccArmLto.xdt",
+    "instrumented.cfg.xs", "nonInstrumented.cfg.xs",
+    "instrumented.cfg", "nonInstrumented.cfg",
+    "smpInstrumented.cfg", "smpNonInstrumented.cfg",
+];
+
+var testArray = [
+    {   name: 'instrumented',
+        config: "instrumented",
+        libdir: "instrumented",
+    },
+    {   name: 'nonInstrumented',
+        config: "nonInstrumented",
+        libdir: "nonInstrumented",
+    },
+];
+
+/* Build non-SMP pre-built libs */
+for each (var targ in Build.targets) {
+
+    /* For each test... */
+    for each (var test in testArray) {
+
+        var platform = test.platform ? test.platform : targ.platform;
+
+        var cfg = Pkg.addConfiguration(test.name,
+                                        targ, platform, {
+                                        cfgScript: test.config,
+                                        prelink: false,
+                                        profile: "release",
+                                        exportCfg: false,
+                                        exportSrc: false,
+                                     });
+
+        var myLib = "lib/ipc/"
+                + test.libdir + "/ipc.a" + targ.suffix;
+
+        Pkg.otherFiles[Pkg.otherFiles.length++] = myLib;
+    }
+}
+
+var smpTestArray = [
+    {   name: 'smpInstrumented',
+        config: "smpInstrumented",
+        libdir: "instrumented",
+    },
+    {   name: 'smpNonInstrumented',
+        config: "smpNonInstrumented",
+        libdir: "nonInstrumented",
+    },
+];
+
+/* Build SMP pre-built libs */
+for each (var targ in Build.targets) {
+
+    if (targ.profiles["smp"] === undefined) continue;
+
+    /* For each test... */
+    for each (var test in smpTestArray) {
+        var platform = test.platform ? test.platform : targ.platform;
+
+        var cfg = Pkg.addConfiguration(test.name,
+                                        targ, platform, {
+                                        cfgScript: test.config,
+                                        prelink: false,
+                                        profile: "release",
+                                        exportCfg: false,
+                                        exportSrc: false,
+                                     });
+
+        var myLib = "lib/smpipc/"
+                + test.libdir + "/ipc.a" + targ.suffix;
+
+        Pkg.otherFiles[Pkg.otherFiles.length++] = myLib;
+    }
+}
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
+Pkg.generatedFiles.$add("custom/");
diff --git a/packages/ti/sdo/ipc/package.xdc b/packages/ti/sdo/ipc/package.xdc
new file mode 100644 (file)
index 0000000..2f34213
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.sdo.ipc ========
+ *  Inter processor communication.
+ *
+ *  Contains modules are that OS independent and support
+ *  streaming messaging between threads and/or processors.
+ *
+ */
+
+package ti.sdo.ipc [1,0,0,0] {
+    module    Build;
+    module    GateMP;
+    module    MessageQ;
+    module    SharedRegion;
+    module    ListMP;
+    module    Ipc;
+    module    Notify;
+}
diff --git a/packages/ti/sdo/ipc/package.xs b/packages/ti/sdo/ipc/package.xs
new file mode 100644 (file)
index 0000000..b6c1493
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var name = this.$name + ".a" + prog.build.target.suffix;
+    var lib = "";
+    var libdir = "";
+
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    if (BIOS.smpEnabled == true) {
+        libdir = "lib/smpipc/";
+    }
+    else {
+        libdir = "lib/ipc/";
+    }
+
+    switch (BIOS.libType) {
+        case BIOS.LibType_Instrumented:
+        case BIOS.LibType_NonInstrumented:
+        case BIOS.LibType_Custom:
+            if (Build.$used == false) return (null);
+            lib = Build.$private.outputDir + Build.$private.libraryName;
+            return ("!" + String(java.io.File(lib).getCanonicalPath()));
+            break;
+
+        case BIOS.LibType_Debug:
+            lib = libdir + "debug/" + name;
+            if (java.io.File(this.packageBase + lib).exists()) {
+                return lib;
+            }
+            break;
+    }
+
+    /* could not find any library, throw exception */
+    throw Error("Library not found: " + name);
+}
+
+/*
+ *  ======== Package.getSects ========
+ */
+function getSects()
+{
+    return "ti/sdo/ipc/linkcmd.xdt";
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+
+    /*
+     * Force the Build module to get used if any module
+     * in this package is used
+     */
+    for (var mod in this.$modules) {
+        if (this.$modules[mod].$used == true) {
+            xdc.useModule('ti.sdo.ipc.Build');
+            break;
+        }
+    }
+}
diff --git a/packages/ti/sdo/ipc/smpInstrumented.cfg b/packages/ti/sdo/ipc/smpInstrumented.cfg
new file mode 100644 (file)
index 0000000..57de8c9
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/ipc/instrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = true;
+
+BIOS.libDir = "lib/smpbios/instrumented/";
+
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libDir = "lib/smpipc/instrumented/";
+
+var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
+MessageQ.traceFlag = true;
diff --git a/packages/ti/sdo/ipc/smpNonInstrumented.cfg b/packages/ti/sdo/ipc/smpNonInstrumented.cfg
new file mode 100644 (file)
index 0000000..3cf288c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/ipc/nonInstrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = true;
+
+BIOS.libDir = "lib/sysbios/nonInstrumented/";
+
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libDir = "lib/smpipc/nonInstrumented/";
+
+var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
+MessageQ.traceFlag = false;
diff --git a/packages/ti/sdo/ipc/transports/TransportNullSetup.c b/packages/ti/sdo/ipc/transports/TransportNullSetup.c
new file mode 100644 (file)
index 0000000..43264f8
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportNullSetup.c ========
+ */
+
+#include <xdc/std.h>
+
+#include "package/internal/TransportNullSetup.xdc.h"
+
+#include <ti/sdo/ipc/_MessageQ.h>
+
+/*
+ *  ======== TransportNullSetup_attach ========
+ */
+Int TransportNullSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    return (MessageQ_E_FAIL);
+}
+
+/*
+ *  ======== TransportNullSetup_detach ========
+ */
+Int TransportNullSetup_detach(UInt16 remoteProcId)
+{
+    return (MessageQ_E_FAIL);
+}
+
+/*
+ *  ======== TransportNullSetup_isRegistered ========
+ */
+Bool TransportNullSetup_isRegistered(UInt16 remoteProcId)
+{
+    return (FALSE);
+}
+
+/*
+ *  ======== TransportNullSetup_sharedMemReq ========
+ */
+SizeT TransportNullSetup_sharedMemReq(Ptr sharedAddr)
+{
+    return(0);
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportNullSetup.xdc b/packages/ti/sdo/ipc/transports/TransportNullSetup.xdc
new file mode 100644 (file)
index 0000000..e666968
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportNullSetup.xdc ========
+ */
+
+/*!
+ *  ======== TransportNullSetup ========
+ */
+
+module TransportNullSetup inherits ti.sdo.ipc.interfaces.ITransportSetup
+{
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportNullSetup.xs b/packages/ti/sdo/ipc/transports/TransportNullSetup.xs
new file mode 100644 (file)
index 0000000..455246d
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ======== TransportNullSetup.xs ========
+ */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShm.c b/packages/ti/sdo/ipc/transports/TransportShm.c
new file mode 100644 (file)
index 0000000..fa9c4b4
--- /dev/null
@@ -0,0 +1,546 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShm.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Gate.h>
+#include <xdc/runtime/Memory.h>
+
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/knl/Swi.h>
+
+#include "package/internal/TransportShm.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/ipc/_ListMP.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+
+/* Need to use reserved notify events */
+#undef TransportShm_notifyEventId
+#define TransportShm_notifyEventId \
+        ti_sdo_ipc_transports_TransportShm_notifyEventId + \
+                    (UInt32)((UInt32)Notify_SYSTEMKEY << 16)
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+
+/*
+ *  ======== TransportShm_notifyFxn ========
+ */
+Void TransportShm_notifyFxn(UInt16 procId,
+                            UInt16 lineId,
+                            UInt32 eventId,
+                            UArg arg,
+                            UInt32 payload)
+{
+    Swi_Handle swiHandle;
+
+    /* Swi_Handle was passed as arg in register */
+    swiHandle = (Swi_Handle)arg;
+
+    /* post the Swi */
+    Swi_post(swiHandle);
+}
+
+/*
+ *  ======== TransportShm_swiFxn ========
+ */
+Void TransportShm_swiFxn(UArg arg)
+{
+    UInt32 queueId;
+    TransportShm_Object *obj = (TransportShm_Object *)arg;
+    MessageQ_Msg msg = NULL;
+
+    /*
+     *  While there are messages, get them out and send them to
+     *  their final destination.
+     */
+    msg = (MessageQ_Msg)ListMP_getHead((ListMP_Handle)obj->localList);
+    while (msg != NULL) {
+        /* Get the destination message queue Id */
+        queueId = MessageQ_getDstQueue(msg);
+
+        /* put the message to the destination queue */
+        MessageQ_put(queueId, msg);
+
+        /* check to see if there are more messages */
+        msg = (MessageQ_Msg)ListMP_getHead((ListMP_Handle)obj->localList);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportShm_Instance_init ========
+ */
+Int TransportShm_Instance_init(TransportShm_Object *obj,
+        UInt16 procId, const TransportShm_Params *params,
+        Error_Block *eb)
+{
+    Int            localIndex;
+    Int            remoteIndex;
+    Int            status;
+    Bool           flag;
+    UInt32         minAlign;
+    ListMP_Params  listMPParams[2];
+    Swi_Handle     swiHandle;
+    Swi_Params     swiParams;
+    Ptr            localAddr;
+
+    swiHandle = TransportShm_Instance_State_swiObj(obj);
+
+    /*
+     *  Determine who gets the '0' slot in shared memory and who gets
+     *  the '1' slot. The '0' slot is given to the lower MultiProc id.
+     */
+    if (MultiProc_self() < procId) {
+        localIndex  = 0;
+        remoteIndex = 1;
+    }
+    else {
+        localIndex  = 1;
+        remoteIndex = 0;
+    }
+
+    if (params->openFlag) {
+        /* Open by sharedAddr */
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
+        obj->self = (TransportShm_Attrs *)params->sharedAddr;
+        obj->regionId = SharedRegion_getId(params->sharedAddr);
+        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+
+        localAddr = SharedRegion_getPtr(obj->self->gateMPAddr);
+        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&obj->gate);
+        if (status < 0) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return(1);
+        }
+    }
+    else {
+        /* init the gate for ListMP create below */
+        if (params->gate != NULL) {
+            obj->gate = params->gate;
+        }
+        else {
+            obj->gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+        }
+
+        /* Creating using sharedAddr */
+        obj->regionId = SharedRegion_getId(params->sharedAddr);
+
+        /* Assert that the buffer is in a valid shared region */
+        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+                ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+        /* Assert that sharedAddr is cache aligned */
+        Assert_isTrue(((UInt32)params->sharedAddr %
+                SharedRegion_getCacheLineSize(obj->regionId) == 0),
+                ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+        /* set object's cacheEnabled, type, self */
+        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+        obj->self = (TransportShm_Attrs *)params->sharedAddr;
+    }
+
+    /* determine the minimum alignment to align to */
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+    }
+
+    /*
+     *  Carve up the shared memory.
+     *  If cache is enabled, these need to be on separate cache lines.
+     *  This is done with minAlign and _Ipc_roundup function.
+     */
+    obj->other = (TransportShm_Attrs *)((UInt32)(obj->self) +
+        (_Ipc_roundup(sizeof(TransportShm_Attrs), minAlign)));
+
+    ListMP_Params_init(&(listMPParams[0]));
+    listMPParams[0].gate = (GateMP_Handle)obj->gate;
+    listMPParams[0].sharedAddr = (UInt32 *)((UInt32)(obj->other) +
+        (_Ipc_roundup(sizeof(TransportShm_Attrs), minAlign)));
+
+    ListMP_Params_init(&listMPParams[1]);
+    listMPParams[1].gate = (GateMP_Handle)obj->gate;
+    listMPParams[1].sharedAddr = (UInt32 *)((UInt32)(listMPParams[0].sharedAddr)
+        + ListMP_sharedMemReq(&listMPParams[0]));
+
+    obj->priority      = params->priority;
+    obj->remoteProcId  = procId;
+
+    Swi_Params_init(&swiParams);
+    swiParams.arg0 = (UArg)obj;
+    Swi_construct(Swi_struct(swiHandle),
+                 (Swi_FuncPtr)TransportShm_swiFxn,
+                 &swiParams, eb);
+
+    if (params->openFlag == FALSE) {
+        obj->localList = (ti_sdo_ipc_ListMP_Handle)
+                ListMP_create(&(listMPParams[localIndex]));
+        if (obj->localList == NULL) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (2);
+        }
+
+        obj->remoteList = (ti_sdo_ipc_ListMP_Handle)
+                ListMP_create(&(listMPParams[remoteIndex]));
+        if (obj->localList == NULL) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (2);
+        }
+    }
+    else {
+        /* Open the local ListMP instance */
+        status = ListMP_openByAddr(listMPParams[localIndex].sharedAddr,
+                                   (ListMP_Handle *)&(obj->localList));
+
+        if (status < 0) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (2);
+        }
+
+        /* Open the remote ListMP instance */
+        status = ListMP_openByAddr(listMPParams[remoteIndex].sharedAddr,
+                                   (ListMP_Handle *)&(obj->remoteList));
+
+        if (status < 0) {
+            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+            return (2);
+        }
+    }
+
+    /* register the event with Notify */
+    status = Notify_registerEventSingle(
+                 procId,    /* remoteProcId */
+                 0,         /* lineId */
+                 TransportShm_notifyEventId,
+                 (Notify_FnNotifyCbck)TransportShm_notifyFxn,
+                 (UArg)swiHandle);
+    if (status < 0) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (3);
+    }
+
+    /* Register the transport with MessageQ */
+    flag = ti_sdo_ipc_MessageQ_registerTransport(
+            TransportShm_Handle_upCast(obj), procId, params->priority);
+    if (flag == FALSE) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (4);
+    }
+
+    if (params->openFlag == FALSE) {
+        obj->self->creatorProcId = MultiProc_self();
+        obj->self->notifyEventId = TransportShm_notifyEventId;
+        obj->self->priority = obj->priority;
+
+        /* Store the GateMP sharedAddr in the Attrs */
+        obj->self->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
+        obj->self->flag = TransportShm_UP;
+
+        if (obj->cacheEnabled) {
+            Cache_wbInv(obj->self, sizeof(TransportShm_Attrs),
+                     Cache_Type_ALL, TRUE);
+        }
+    }
+    else {
+        obj->other->flag = TransportShm_UP;
+        if (obj->cacheEnabled) {
+            Cache_wbInv(&(obj->other->flag), minAlign, Cache_Type_ALL, TRUE);
+        }
+    }
+
+    obj->status = TransportShm_UP;
+
+    return (0);
+}
+
+/*
+ *  ======== TransportShm_Instance_finalize ========
+ */
+Void TransportShm_Instance_finalize(TransportShm_Object* obj, Int status)
+{
+    Swi_Handle     swiHandle;
+
+    if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC) {
+        /* clear the self flag */
+        obj->self->flag = 0;
+
+        if (obj->cacheEnabled) {
+            Cache_wbInv(&(obj->self->flag),
+                SharedRegion_getCacheLineSize(obj->regionId), Cache_Type_ALL,
+                    TRUE);
+        }
+
+        if (obj->localList != NULL) {
+            ListMP_delete((ListMP_Handle *)&(obj->localList));
+        }
+
+        if (obj->remoteList != NULL) {
+            ListMP_delete((ListMP_Handle *)&(obj->remoteList));
+        }
+    }
+    else {
+        /* other flag was set by remote proc */
+        obj->other->flag = 0;
+
+        if (obj->cacheEnabled) {
+            Cache_wbInv(&(obj->other->flag),
+                SharedRegion_getCacheLineSize(obj->regionId), Cache_Type_ALL,
+                    TRUE);
+        }
+
+        if (obj->gate != NULL) {
+            GateMP_close((GateMP_Handle *)&(obj->gate));
+        }
+
+        if (obj->localList != NULL) {
+            ListMP_close((ListMP_Handle *)&(obj->localList));
+        }
+
+        if (obj->remoteList != NULL) {
+            ListMP_close((ListMP_Handle *)&(obj->remoteList));
+        }
+    }
+
+    switch(status) {
+        case 0:
+            /* MessageQ_registerTransport succeeded */
+            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId, obj->priority);
+            /* OK to fall through */
+        case 1: /* GateMP open failed */
+        case 2: /* ListMP create/open failed */
+        case 3: /* Notify_registerEventSingle failed */
+        case 4: /* MessageQ_registerTransport failed */
+            Notify_unregisterEventSingle(
+                obj->remoteProcId,
+                0,
+                TransportShm_notifyEventId);
+            break;
+    }
+
+    /* Destruct the swi */
+    swiHandle = TransportShm_Instance_State_swiObj(obj);
+    if (swiHandle != NULL) {
+        Swi_destruct(Swi_struct(swiHandle));
+    }
+}
+
+/*
+ *  ======== TransportShm_put ========
+ *  Assuming MessageQ_put is making sure that the arguments are ok
+ */
+Bool TransportShm_put(TransportShm_Object *obj, Ptr msg)
+{
+    Int32 status;
+    Bool retval = TRUE;
+    IArg key;
+    UInt16 id = SharedRegion_getId(msg);
+
+    /* This transport only deals with messages allocated from SR's */
+    Assert_isTrue(id != SharedRegion_INVALIDREGIONID,
+            ti_sdo_ipc_SharedRegion_A_regionInvalid);
+
+    /* writeback invalidate the message */
+    if (SharedRegion_isCacheEnabled(id)) {
+        Cache_wbInv(msg, ((MessageQ_Msg)(msg))->msgSize, Cache_Type_ALL,
+            TRUE);
+    }
+
+    /* make sure ListMP_put and sendEvent are done before remote executes */
+    key = GateMP_enter((GateMP_Handle)obj->gate);
+
+    /* Put the message on the remoteList */
+    ListMP_putTail((ListMP_Handle)obj->remoteList, (ListMP_Elem *)msg);
+
+    /* Notify the remote processor */
+    status = Notify_sendEvent(obj->remoteProcId, 0, TransportShm_notifyEventId,
+        0, FALSE);
+
+    /* check the status of the sendEvent */
+    if (status < 0) {
+        /* remove the message from the List and return 'FALSE' */
+        ListMP_remove((ListMP_Handle)obj->remoteList, (ListMP_Elem *)msg);
+        retval = FALSE;
+    }
+
+    /* leave the gate */
+    GateMP_leave((GateMP_Handle)obj->gate, key);
+
+    return (retval);
+}
+
+/*
+ *  ======== TransportShm_control ========
+ */
+Bool TransportShm_control(TransportShm_Object *obj, UInt cmd, UArg cmdArg)
+{
+    return (FALSE);
+}
+
+/*
+ *  ======== TransportShm_getStatus ========
+ */
+Int TransportShm_getStatus(TransportShm_Object *obj)
+{
+    return (obj->status);
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportShm_close ========
+ */
+Void TransportShm_close(TransportShm_Handle *handle)
+{
+    TransportShm_delete(handle);
+}
+
+/*
+ *  ======== TransportShm_openByAddr ========
+ */
+Int TransportShm_openByAddr(Ptr sharedAddr,
+                      TransportShm_Handle *handlePtr,
+                      Error_Block *eb)
+{
+    TransportShm_Params params;
+    TransportShm_Attrs *attrs;
+    Int status;
+    UInt16 id;
+
+    if (sharedAddr == NULL) {
+        return (MessageQ_E_FAIL);
+    }
+
+    TransportShm_Params_init(&params);
+
+    /* Tell Instance_init() that we're opening */
+    params.openFlag = TRUE;
+
+    attrs = (TransportShm_Attrs *)sharedAddr;
+    id = SharedRegion_getId(sharedAddr);
+
+    /* Assert that the region is valid */
+    Assert_isTrue(id != SharedRegion_INVALIDREGIONID,
+            ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+    /* invalidate the attrs before using it */
+    if (SharedRegion_isCacheEnabled(id)) {
+        Cache_inv(attrs, sizeof(TransportShm_Attrs), Cache_Type_ALL, TRUE);
+    }
+
+    /* set params field */
+    params.sharedAddr    = sharedAddr;
+    params.priority      = attrs->priority;
+
+    if (attrs->flag != TransportShm_UP) {
+        /* make sure transport is up */
+        *handlePtr = NULL;
+        status = MessageQ_E_NOTFOUND;
+    }
+    else {
+        /* Create the object */
+        *handlePtr = TransportShm_create(attrs->creatorProcId, &params, eb);
+        if (*handlePtr == NULL) {
+            status = MessageQ_E_FAIL;
+        }
+        else {
+            status = MessageQ_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== TransportShm_sharedMemReq ========
+ */
+SizeT TransportShm_sharedMemReq(const TransportShm_Params *params)
+{
+    SizeT memReq, minAlign;
+    UInt16 regionId;
+    ListMP_Params listMPParams;
+
+    regionId = SharedRegion_getId(params->sharedAddr);
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    /* for the Attrs structure */
+    memReq = _Ipc_roundup(sizeof(TransportShm_Attrs), minAlign);
+
+    /* for the second Attrs structure */
+    memReq += _Ipc_roundup(sizeof(TransportShm_Attrs), minAlign);
+
+    ListMP_Params_init(&listMPParams);
+    listMPParams.regionId = regionId;
+
+    /* for localListMP */
+    memReq += ListMP_sharedMemReq(&listMPParams);
+
+    /* for remoteListMP */
+    memReq += ListMP_sharedMemReq(&listMPParams);
+
+    return(memReq);
+}
+
+/*
+ *  ======== TransportShm_setErrFxn ========
+ */
+Void TransportShm_setErrFxn(TransportShm_ErrFxn errFxn)
+{
+    /* Ignore errFxn */
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShm.xdc b/packages/ti/sdo/ipc/transports/TransportShm.xdc
new file mode 100644 (file)
index 0000000..c829f91
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShm.xdc ========
+ */
+
+import xdc.runtime.Error;
+import ti.sdo.ipc.Ipc;
+import ti.sdo.ipc.GateMP;
+import ti.sdo.ipc.ListMP;
+import ti.sdo.ipc.SharedRegion;
+import ti.sysbios.knl.Swi;
+
+/*!
+ *  ======== TransportShm ========
+ *  Shared-memory MessageQ transport that uses ListMP to queue messages
+ *
+ *  Messages sent via TransportShm are temporarily queued in a shared memory
+ *  {@link ti.sdo.ipc.ListMP} instance before the messages are moved by the
+ *  receiver to the destination queue.
+ */
+@InstanceFinalize
+@InstanceInitError
+
+module TransportShm inherits ti.sdo.ipc.interfaces.IMessageQTransport
+{
+    /*! @_nodoc
+     *  ======== openByAddr ========
+     *  Open a created TransportShm instance by address
+     *
+     *  Just like {@link #open}, openByAddr returns a handle to a created
+     *  TransportShm instance.  This function is used to open a
+     *  TransportShm using a shared address instead of a name.
+     *  While {@link #open} should generally be used to open transport
+     *  instances that have been either locally or remotely created, openByAddr
+     *  may be used to bypass a NameServer query that would typically be
+     *  required of an {@link #open} call.
+     *
+     *  Opening by address requires that the created instance was created
+     *  by supplying a {@link #sharedAddr} parameter rather than a
+     *  {@link #regionId} parameter.
+     *
+     *  A status value of Status_SUCCESS is returned if the instance
+     *  is successfully opened.  Status_FAIL indicates that the instance
+     *  is not yet ready to be opened.  Status_ERROR indicates that
+     *  an error was raised in the error block.
+     *
+     *  Call {@link #close} when the opened instance is no longer needed.
+     *
+     *  @param(sharedAddr)  Shared address for the instance
+     *  @param(handlePtr)   Pointer to handle to be opened
+     *  @param(eb)          Pointer to error block
+     *
+     *  @a(returns)         TransportShm status
+     */
+    Int openByAddr(Ptr sharedAddr, Handle *handlePtr, Error.Block *eb);
+
+    /*!
+     *  ======== close ========
+     *  Close an opened instance
+     *
+     *  Closing an instance will free local memory consumed by the opened
+     *  instance.  Instances that are opened should be closed before the
+     *  instance is deleted.
+     *
+     *  @param(handle)  handle that is returned from an {@link #openByAddr}
+     */
+    Void close(Handle *handle);
+
+    /*! @_nodoc
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  Can be used to make sure the {link #sharedAddr} buffer is large
+     *  enough before calling create.
+     *
+     *  The {@link #sharedAddr} needs to be
+     *  supplied because the cache alignment settings for the region
+     *  may affect the total amount of shared memory required.
+     *
+     *  @param(params)      Pointer to the parameters that will be used in
+     *                      the create.
+     *
+     *  @a(returns)         Number of MAUs needed to create the instance.
+     */
+    SizeT sharedMemReq(const Params *params);
+
+    /*!
+     *  ======== notifyEventId ========
+     *  Notify event ID for transport.
+     */
+    config UInt16 notifyEventId = 2;
+
+instance:
+
+    /*!
+     *  ======== gate ========
+     *  GateMP used for critical region management of the shared memory
+     */
+    config GateMP.Handle gate = null;
+
+    /*! @_nodoc
+     *  ======== openFlag ========
+     *  Set to 'true' by the open() call. No one else should touch this!
+     */
+    config Bool openFlag = false;
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Physical address of the shared memory
+     *
+     *  The creator must supply the shared memory that is used to maintain
+     *  shared state information.
+     */
+    config Ptr sharedAddr = null;
+
+internal:
+
+    /*!
+     *  Constants that all delegate writers need.
+     */
+    const UInt32 UP = 0xBADC0FFE;
+
+    /*!
+     *  ======== swiFxn ========
+     *  This function takes the messages from the transport ListMP and
+     *  calls MessageQ_put to send them to their destination queue.
+     *  This function is posted by the NotifyFxn.
+     *
+     *  @param(arg)     argument for the function
+     */
+    Void swiFxn(UArg arg);
+
+    /*!
+     *  ======== notifyFxn ========
+     *  This is a callback function registered with Notify.  It is called
+     *  when a remote processor does a Notify_sendEvent().  It is executed
+     *  at ISR level.  It posts the instance Swi object to execute swiFxn.
+     *
+     *  @param(eventId) Notify event id
+     *  @param(arg)     argument for the function
+     *  @param(payload) 32-bit payload value.
+     */
+    Void notifyFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+                   UInt32 payload);
+
+    /* Structure of attributes in shared memory */
+    struct Attrs {
+        Bits32              flag;
+        Bits32              creatorProcId;
+        Bits32              notifyEventId;
+        Bits16              priority;
+        SharedRegion.SRPtr  gateMPAddr;
+    };
+
+    /* Instance State object */
+    struct Instance_State {
+        Attrs           *self;         /* Attrs in shared memory        */
+        Attrs           *other;        /* Only flag field is used       */
+        ListMP.Handle   localList;     /* ListMP to my processor        */
+        ListMP.Handle   remoteList;    /* ListMP to remote processor    */
+        Swi.Object      swiObj;        /* Each instance has a swi       */
+        UInt32          status;        /* Current status                */
+        Ipc.ObjType     objType;       /* Static/Dynamic? open/creator? */
+        SizeT           allocSize;     /* Shared memory allocated       */
+        Bool            cacheEnabled;  /* Whether to do cache calls     */
+        UInt16          regionId;      /* the shared region id          */
+        UInt16          remoteProcId;  /* dst proc id                   */
+        UInt16          priority;      /* priority to register          */
+        GateMP.Handle   gate;          /* Gate for critical regions     */
+    };
+
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShm.xs b/packages/ti/sdo/ipc/transports/TransportShm.xs
new file mode 100644 (file)
index 0000000..32fc748
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShm.xs ========
+ *
+ */
+
+var TransportShm = null;
+var Ipc          = null;
+var GateMP       = null;
+var ListMP       = null;
+var MessageQ     = null;
+var Notify       = null;
+var SharedRegion = null;
+var MultiProc    = null;
+var Cache        = null;
+var Swi          = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportShm = this;
+    Ipc          = xdc.useModule("ti.sdo.ipc.Ipc");
+    GateMP       = xdc.useModule("ti.sdo.ipc.GateMP");
+    ListMP       = xdc.useModule("ti.sdo.ipc.ListMP");
+    MessageQ     = xdc.useModule("ti.sdo.ipc.MessageQ");
+    Notify       = xdc.useModule("ti.sdo.ipc.Notify");
+    SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    MultiProc    = xdc.useModule("ti.sdo.utils.MultiProc");
+    Cache        = xdc.useModule("ti.sysbios.hal.Cache");
+    Swi          = xdc.useModule("ti.sysbios.knl.Swi");
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (Notify.numEvents <= TransportShm.notifyEventId) {
+        TransportShm.$logFatal("TransportShm.notifyEventId (" +
+                TransportShm.notifyEventId +
+                ") is too big: Notify.numEvents = " + Notify.numEvents,
+                TransportShm);
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmCirc.c b/packages/ti/sdo/ipc/transports/TransportShmCirc.c
new file mode 100644 (file)
index 0000000..0058666
--- /dev/null
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmCirc.c ========
+ */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/knl/Swi.h>
+
+#include <ti/sdo/ipc/interfaces/INotifyDriver.h>
+
+#include "package/internal/TransportShmCirc.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+
+/* Bit mask operations */
+#define SET_BIT(num,pos)            ((num) |= (1u << (pos)))
+#define CLEAR_BIT(num,pos)          ((num) &= ~(1u << (pos)))
+#define TEST_BIT(num,pos)           ((num) & (1u << (pos)))
+
+/* Need to use reserved notify events */
+#undef TransportShmCirc_notifyEventId
+#define TransportShmCirc_notifyEventId \
+        ti_sdo_ipc_transports_TransportShmCirc_notifyEventId + \
+                    (UInt32)((UInt32)Notify_SYSTEMKEY << 16)
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportShmCirc_Instance_init ========
+ */
+Int TransportShmCirc_Instance_init(TransportShmCirc_Object *obj,
+        UInt16 remoteProcId, const TransportShmCirc_Params *params,
+        Error_Block *eb)
+{
+    Int         localIndex;
+    Int         remoteIndex;
+    UInt32      minAlign;
+    Int         status;
+    Bool        flag;
+    Swi_Handle  swiHandle;
+    Swi_Params  swiParams;
+    SizeT       ctrlSize, circBufSize, totalSelfSize;
+
+    swiHandle = TransportShmCirc_Instance_State_swiObj(obj);
+
+    /* determine which slot to use */
+    if (MultiProc_self() < remoteProcId) {
+        localIndex  = 0;
+        remoteIndex = 1;
+    }
+    else {
+        localIndex  = 1;
+        remoteIndex = 0;
+    }
+
+    /* Creating using sharedAddr */
+    obj->regionId = SharedRegion_getId(params->sharedAddr);
+
+    /* determine the minimum alignment */
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(obj->regionId);
+    }
+
+    /* Assert that the buffer is in a valid shared region */
+    Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+        ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+
+    /* Assert that sharedAddr is cache aligned */
+    Assert_isTrue(((UInt32)params->sharedAddr % minAlign == 0),
+        ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
+
+    /* set object fields */
+    obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+    obj->objType      = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
+    obj->priority     = params->priority;
+    obj->remoteProcId = remoteProcId;
+
+    /* calculate the circular buffer size one-way */
+    circBufSize =
+        _Ipc_roundup(sizeof(Bits32) * TransportShmCirc_numMsgs, minAlign);
+
+    /* calculate the control size one-way */
+    ctrlSize = _Ipc_roundup(sizeof(Bits32), minAlign);
+
+    /* calculate the total size one-way */
+    totalSelfSize =  circBufSize + (2 * ctrlSize);
+
+    /*
+     *  Init put/get buffer and index pointers.
+     *  These are all on different cache lines.
+     */
+    obj->putBuffer =
+        (Ptr)((UInt32)params->sharedAddr + (localIndex * totalSelfSize));
+
+    obj->putWriteIndex = (Bits32 *)((UInt32)obj->putBuffer + circBufSize);
+
+    obj->putReadIndex = (Bits32 *)((UInt32)obj->putWriteIndex + ctrlSize);
+
+    obj->getBuffer =
+        (Ptr)((UInt32)params->sharedAddr + (remoteIndex * totalSelfSize));
+
+    obj->getWriteIndex = (Bits32 *)((UInt32)obj->getBuffer + circBufSize);
+
+    obj->getReadIndex = (Bits32 *)((UInt32)obj->getWriteIndex + ctrlSize);
+
+    /*
+     *  Calculate the size for cache inv in isr.
+     *  This size is the circular buffer + putWriteIndex.
+     *  [sizeof(Ptr) * numMsgs] + [the sizeof(Ptr)]
+     *  aligned to a cache line.
+     */
+    obj->opCacheSize = ((UInt32)obj->putReadIndex - (UInt32)obj->putBuffer);
+
+    /* construct the Swi */
+    Swi_Params_init(&swiParams);
+    swiParams.arg0 = (UArg)obj;
+    Swi_construct(Swi_struct(swiHandle),
+                 (Swi_FuncPtr)TransportShmCirc_swiFxn,
+                 &swiParams, eb);
+
+    /* register the event with Notify */
+    status = Notify_registerEventSingle(
+                 remoteProcId,    /* remoteProcId */
+                 0,               /* lineId */
+                 TransportShmCirc_notifyEventId,
+                 (Notify_FnNotifyCbck)TransportShmCirc_notifyFxn,
+                 (UArg)swiHandle);
+
+    if (status < 0) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (1);
+    }
+
+    /* Register the transport with MessageQ */
+    flag = ti_sdo_ipc_MessageQ_registerTransport(
+        TransportShmCirc_Handle_upCast(obj), remoteProcId, params->priority);
+
+    if (flag == FALSE) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (2);
+    }
+
+    /* init the putWrite and putRead Index to 0 */
+    obj->putWriteIndex[0] = 0;
+    obj->putReadIndex[0] = 0;
+
+    /* cache wb the putWrite/Read Index but no need to inv them */
+    if (obj->cacheEnabled) {
+        Cache_wb(obj->putWriteIndex,
+                 sizeof(Bits32),
+                 Cache_Type_ALL, TRUE);
+
+        Cache_wb(obj->putReadIndex,
+                 sizeof(Bits32),
+                 Cache_Type_ALL, TRUE);
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== TransportShmCirc_Instance_finalize ========
+ */
+Void TransportShmCirc_Instance_finalize(TransportShmCirc_Object *obj, Int status)
+{
+    switch(status) {
+        case 0: /* MessageQ_registerTransport succeeded */
+            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId,
+                obj->priority);
+
+            /* fall thru OK */
+        case 1: /* Notify_registerEventSingle failed */
+        case 2: /* MessageQ_registerTransport failed */
+            Notify_unregisterEventSingle(
+                obj->remoteProcId,
+                0,
+                TransportShmCirc_notifyEventId);
+            break;
+    }
+}
+
+/*
+ *  ======== TransportShmCirc_put ========
+ */
+Bool TransportShmCirc_put(TransportShmCirc_Object *obj, Ptr msg)
+{
+    Int status;
+    UInt hwiKey;
+    SharedRegion_SRPtr msgSRPtr;
+    UInt32 *eventEntry;
+    UInt32 writeIndex, readIndex;
+    Bool loop       = FALSE;
+    UInt16 regionId = SharedRegion_INVALIDREGIONID;
+
+    /*
+     *  If translation is disabled and we always have to write back the
+     *  message then we can avoid calling SharedRegion_getId(). The wait
+     *  flag is "FALSE" here because we do other cache calls below.
+     */
+    if (ti_sdo_ipc_SharedRegion_translate ||
+        !TransportShmCirc_alwaysWriteBackMsg ) {
+        regionId = SharedRegion_getId(msg);
+        if (SharedRegion_isCacheEnabled(regionId)) {
+            Cache_wbInv(msg, ((MessageQ_Msg)(msg))->msgSize, Cache_Type_ALL,
+                        FALSE);
+        }
+    }
+    else {
+        Cache_wbInv(msg, ((MessageQ_Msg)(msg))->msgSize, Cache_Type_ALL, FALSE);
+    }
+
+    /*
+     *  Get the msg's SRPtr.  OK if (regionId == SharedRegion_INVALIDID &&
+     *  SharedRegion_translate == FALSE)
+     */
+    msgSRPtr = SharedRegion_getSRPtr(msg, regionId);
+
+    /*
+     *  Retrieve the get Index. No need to cache inv the
+     *  readIndex until the writeIndex wraps. Only need to invalidate
+     *  once every N times [N = number of messages].
+     */
+    readIndex = obj->putReadIndex[0];
+
+    do {
+        /* disable interrupts */
+        hwiKey = Hwi_disable();
+
+        /* retrieve the put index */
+        writeIndex = obj->putWriteIndex[0];
+
+        /* if slot available 'break' out of loop */
+        if (((writeIndex + 1) & TransportShmCirc_maxIndex) != readIndex) {
+            break;
+        }
+
+        /* restore interrupts */
+        Hwi_restore(hwiKey);
+
+        /* check to make sure code has looped */
+        if (loop) {
+            /* if no slot available */
+            return (FALSE);
+        }
+
+        /* cache invalidate the putReadIndex */
+        if (obj->cacheEnabled) {
+            Cache_inv(obj->putReadIndex,
+                      sizeof(Bits32),
+                      Cache_Type_ALL,
+                      TRUE);
+        }
+
+        /* re-read the putReadIndex */
+        readIndex = obj->putReadIndex[0];
+
+        /* convey that the code has looped around */
+        loop = TRUE;
+    } while (1);
+
+    /* interrupts are disabled at this point */
+
+    /* calculate the next available entry */
+    eventEntry = (UInt32 *)(
+        (UInt32)obj->putBuffer + (writeIndex * sizeof(Ptr)));
+
+    /* Set the eventId field and payload for the entry */
+    eventEntry[0] = msgSRPtr;
+
+    /*
+     *  Writeback the event entry. No need to invalidate since
+     *  only one processor ever writes here. No need to wait for
+     *  cache operation since another cache operation is done below.
+     */
+    if (obj->cacheEnabled) {
+        Cache_wb(eventEntry,
+                 sizeof(Ptr),
+                 Cache_Type_ALL,
+                 FALSE);
+    }
+
+    /* update the putWriteIndex */
+    obj->putWriteIndex[0] = (writeIndex + 1) & TransportShmCirc_maxIndex;
+
+    /* restore interrupts */
+    Hwi_restore(hwiKey);
+
+    /*
+     *  Writeback the putWriteIndex.
+     *  No need to invalidate since only one processor
+     *  ever writes here.
+     */
+    if (obj->cacheEnabled) {
+        Cache_wb(obj->putWriteIndex,
+                 sizeof(Bits32),
+                 Cache_Type_ALL,
+                 TRUE);
+    }
+
+    /* Notify the remote processor */
+    status = Notify_sendEvent(
+                 obj->remoteProcId,
+                 0,
+                 TransportShmCirc_notifyEventId,
+                 0,
+                 FALSE);
+
+    if (status < 0) {
+        return (FALSE);
+    }
+
+    return (TRUE);
+}
+
+/*
+ *  ======== TransportShmCirc_control ========
+ */
+Bool TransportShmCirc_control(TransportShmCirc_Object *obj, UInt cmd,
+    UArg cmdArg)
+{
+    return (FALSE);
+}
+
+/*
+ *  ======== TransportShmCirc_getStatus ========
+ */
+Int TransportShmCirc_getStatus(TransportShmCirc_Object *obj)
+{
+    return (0);
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportShm_notifyFxn ========
+ */
+Void TransportShmCirc_notifyFxn(UInt16 procId,
+                                UInt16 lineId,
+                                UInt32 eventId,
+                                UArg arg,
+                                UInt32 payload)
+{
+    Swi_Handle swiHandle;
+
+    /* Swi_Handle was passed as arg in register */
+    swiHandle = (Swi_Handle)arg;
+
+    /* post the Swi */
+    Swi_post(swiHandle);
+}
+
+/*
+ *  ======== TransportShmCirc_swiFxn ========
+ */
+Void TransportShmCirc_swiFxn(UArg arg)
+{
+    TransportShmCirc_Object *obj;
+    UInt32 *eventEntry;
+    UInt32 queueId;
+    MessageQ_Msg msg;
+    UInt32 writeIndex, readIndex;
+
+    obj = (TransportShmCirc_Object *)arg;
+
+    /* Make sure the TransportShmCirc_Object is not NULL */
+    Assert_isTrue(obj != NULL, ti_sdo_ipc_Ipc_A_internal);
+
+    /*
+     *  Invalidate both getBuffer and getWriteIndex from cache.
+     */
+    if (obj->cacheEnabled) {
+        Cache_inv(obj->getBuffer,
+                  obj->opCacheSize,
+                  Cache_Type_ALL,
+                  TRUE);
+    }
+
+    /* get the writeIndex and readIndex */
+    writeIndex = obj->getWriteIndex[0];
+    readIndex = obj->getReadIndex[0];
+
+    /* get the next entry to be processed */
+    eventEntry = (UInt32 *)&(obj->getBuffer[readIndex]);
+
+    while (writeIndex != readIndex) {
+        /* get the msg (convert SRPtr to Ptr) */
+        msg = SharedRegion_getPtr((SharedRegion_SRPtr)eventEntry[0]);
+
+        /* get the queue id */
+        queueId = MessageQ_getDstQueue(msg);
+
+        /* put message on local queue */
+        MessageQ_put(queueId, msg);
+
+        /* update the local readIndex. */
+        readIndex = ((readIndex + 1) & TransportShmCirc_maxIndex);
+
+        /* set the getReadIndex */
+        obj->getReadIndex[0] = readIndex;
+
+        /*
+         *  Write back the getReadIndex once every N / 4 messages.
+         *  No need to invalidate since only one processor ever
+         *  writes this . No need to wait for operation to complete
+         *  since remote core updates its readIndex at least once
+         *  every N messages and the remote core will not use a slot
+         *  until it sees that the event has been processed with this
+         *  cache wb. Chances are small that the remote core needs
+         *  to spin due to this since we are doing a wb N / 4.
+         */
+        if ((obj->cacheEnabled) &&
+            ((readIndex % TransportShmCirc_modIndex) == 0)) {
+            Cache_wb(obj->getReadIndex,
+                     sizeof(Bits32),
+                     Cache_Type_ALL,
+                     FALSE);
+        }
+
+        /* get the next entry */
+        eventEntry = (UInt32 *)&(obj->getBuffer[readIndex]);
+    }
+}
+
+/*
+ *  ======== TransportShmCirc_sharedMemReq ========
+ */
+SizeT TransportShmCirc_sharedMemReq(const TransportShmCirc_Params *params)
+{
+    UInt16 regionId;
+    SizeT minAlign, memReq;
+
+    /* Ensure that params is non-NULL */
+    Assert_isTrue(params != NULL, ti_sdo_ipc_Ipc_A_internal);
+
+    regionId = SharedRegion_getId(params->sharedAddr);
+
+    minAlign = Memory_getMaxDefaultTypeAlign();
+    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
+        minAlign = SharedRegion_getCacheLineSize(regionId);
+    }
+
+    /*
+     *  Amount of shared memory:
+     *  1 putBuffer with numMsgs (rounded to CLS) +
+     *  1 putWriteIndex ptr (rounded to CLS) +
+     *  1 putReadIndex put (rounded to CLS) +
+     *  1 getBuffer with numMsgs (rounded to CLS) +
+     *  1 getWriteIndex ptr (rounded to CLS) +
+     *  1 getReadIndex put (rounded to CLS) +
+     *
+     *  For CLS of 128b it is:
+     *      128b + 128b + 128b + 128b+ 128b + 128b = 768b
+     *
+     *  Note: CLS means Cache Line Size
+     */
+    memReq = 2 * (
+        (_Ipc_roundup(sizeof(Ptr) * TransportShmCirc_numMsgs, minAlign)) +
+        ( 2 * _Ipc_roundup(sizeof(Bits32), minAlign)));
+
+    return (memReq);
+}
+
+/*
+ *  ======== TransportShmCirc_setErrFxn ========
+ */
+Void TransportShmCirc_setErrFxn(TransportShmCirc_ErrFxn errFxn)
+{
+    /* Ignore the errFxn */
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmCirc.xdc b/packages/ti/sdo/ipc/transports/TransportShmCirc.xdc
new file mode 100644 (file)
index 0000000..aced221
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmCirc.xdc ================
+ */
+
+import ti.sdo.utils.MultiProc;
+import ti.sdo.ipc.Ipc;
+import ti.sysbios.knl.Swi;
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== TransportShmCirc ========
+ *  Transport for MessageQ that uses a circular buffer to queue messages
+ *
+ *  This is a {@link ti.sdo.ipc.MessageQ} transport that utilizes shared
+ *  memory for passing messages between multiple processors.
+ *
+ *  The transport implements a queue using a circular buffer in the manner
+ *  indicated by the following diagram.
+ *
+ *  @p(code)
+ *
+ *  NOTE: Processors '0' and '1' correspond to the processors with lower and
+ *        higher MultiProc ids, respectively
+ *
+ * sharedAddr -> --------------------------- bytes
+ *               |  entry0  (0) [Put]      | 4
+ *               |  entry1  (0)            | 4
+ *               |  ...                    |
+ *               |  entryN  (0)            | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  putWriteIndex (0)      | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  putReadIndex (0)       | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  entry0  (1) [Get]      | 4
+ *               |  entry1  (1)            | 4
+ *               |  ...                    |
+ *               |  entryN  (1)            | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  getWriteIndex (1)      | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *               |  getReadIndex (1)       | 4
+ *               |  [align to cache size]  |
+ *               |-------------------------|
+ *
+ *
+ *  Legend:
+ *  (0), (1) : Memory that belongs to the proc with lower and higher
+ *             MultiProc.id, respectively
+ *   |----|  : Cache line boundary
+ *
+ *  @p
+ */
+
+@InstanceFinalize
+@InstanceInitError
+
+module TransportShmCirc inherits ti.sdo.ipc.interfaces.IMessageQTransport
+{
+    /*! @_nodoc */
+    metaonly struct BasicView {
+        String      remoteProcName;
+        Bool        cacheEnabled;
+    }
+
+    /*! @_nodoc */
+    metaonly struct EventDataView {
+        UInt        index;
+        String      buffer;
+        Ptr         addr;
+        Ptr         message;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     */
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['Events',
+                    {
+                        type: ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'EventDataView'
+                    }
+                ],
+            ]
+        });
+
+
+    /*!
+     *  @_nodoc
+     *  Determines whether the put() call unconditionally does a Cache_wbInv of
+     *  the message before sending a notification to the remote core.
+     *  The default value of 'true' allows us to skip the additional step of
+     *  checking whether cache is enabled for the message.
+     *
+     *  This should be set to 'false' when it is optimal to perform this
+     *  check.  This may be OPTIMAL when sending a message that is allocated
+     *  from a shared region whose cacheFlag is 'false' and when the write-back
+     *  cache operation is expensive.
+     */
+    config Bool alwaysWriteBackMsg = true;
+
+    /*!
+     *  ======== enableStats ========
+     *  Enable statistics for sending an event
+     *
+     *  If this parameter is to 'TRUE' and 'waitClear' is also set to
+     *  TRUE when calling (@link #sendEvent(), then the module keeps
+     *  track of the number of times the processor spins waiting for
+     *  an empty slot and the max amount of time it waits.
+     */
+    config Bool enableStats = false;
+
+    /*!
+     *  ======== notifyEventId ========
+     *  Notify event ID for transport.
+     */
+    config UInt16 notifyEventId = 2;
+
+    /*!
+     *  ======== numMsgs ========
+     *  The number of messages or slots in the circular buffer
+     *
+     *  This is use to determine the size of the put and get buffers.
+     *  Each eventEntry is two 32bits wide, therefore the total size
+     *  of each circular buffer is [numMsgs * sizeof(eventEntry)].
+     *  The total size of each buffer must be a multiple of the
+     *  the cache line size. For example, if the cacheLineSize = 128
+     *  then numMsgs could be 16, 32, etc...
+     */
+    config UInt numMsgs = 32;
+
+    /*! @_nodoc
+     *  ======== sharedMemReq ========
+     *  Amount of shared memory required for creation of each instance
+     *
+     *  @param(params)      Pointer to parameters that will be used in the
+     *                      create
+     *
+     *  @a(returns)         Number of MAUs in shared memory needed to create
+     *                      the instance.
+     */
+    SizeT sharedMemReq(const Params *params);
+
+instance:
+
+    /*!
+     *  ======== sharedAddr ========
+     *  Address in shared memory where this instance will be placed
+     *
+     *  Use {@link #sharedMemReq} to determine the amount of shared memory
+     *  required.
+     */
+    config Ptr sharedAddr = null;
+
+internal:
+
+    /*! The max index set to (numMsgs - 1) */
+    config UInt maxIndex;
+
+    /*!
+     *  The modulo index value. Set to (numMsgs / 4).
+     *  Used in the isr for doing cache_wb of readIndex.
+     */
+    config UInt modIndex;
+
+    /*!
+     *  ======== swiFxn ========
+     */
+    Void swiFxn(UArg arg);
+
+    /*!
+     *  ======== notifyFxn ========
+     */
+    Void notifyFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+                   UInt32 payload);
+
+    /*! Instance state structure */
+    struct Instance_State {
+        Ptr              *putBuffer;     /* buffer used to put events        */
+        Bits32           *putReadIndex;  /* ptr to readIndex for put buffer  */
+        Bits32           *putWriteIndex; /* ptr to writeIndex for put buffer */
+        Ptr              *getBuffer;     /* buffer used to get events        */
+        Bits32           *getReadIndex;  /* ptr to readIndex for get buffer  */
+        Bits32           *getWriteIndex; /* ptr to writeIndex for put buffer */
+        SizeT            opCacheSize;    /* optimized cache size for wb/inv  */
+        UInt16           regionId;       /* the shared region id             */
+        UInt16           remoteProcId;   /* dst proc id                      */
+        Bool             cacheEnabled;   /* set by param or SharedRegion     */
+        UInt16           priority;       /* priority to register             */
+        Swi.Object       swiObj;         /* Each instance has a swi          */
+        Ipc.ObjType      objType;        /* Static/Dynamic? open/creator?    */
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmCirc.xs b/packages/ti/sdo/ipc/transports/TransportShmCirc.xs
new file mode 100644 (file)
index 0000000..a65c5d4
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmCirc.xs ================
+ */
+
+var TransportShmCirc = null;
+var MultiProc        = null;
+var Notify           = null;
+var Ipc              = null;
+var Cache            = null;
+var Memory           = null;
+var SharedRegion     = null;
+var Timestamp        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportShmCirc = this;
+    MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
+    Notify          = xdc.useModule("ti.sdo.ipc.Notify");
+    Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
+    SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Cache           = xdc.useModule("ti.sysbios.hal.Cache");
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    TransportShmCirc.maxIndex = TransportShmCirc.numMsgs - 1;
+    TransportShmCirc.modIndex = TransportShmCirc.numMsgs / 4;
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (Notify.numEvents <= TransportShmCirc.notifyEventId) {
+        TransportShmCirc.$logFatal("TransportShmCirc.notifyEventId (" +
+                TransportShmCirc.notifyEventId +
+                ") is too big: Notify.numEvents = " + Notify.numEvents,
+                TransportShmNotify);
+    }
+}
+
+/*
+ *************************************************************************
+ *                       ROV View functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== viewInitBasic ========
+ */
+function viewInitBasic(view, obj)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* view.remoteProcName */
+    try {
+        view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+    }
+    catch(e) {
+        Program.displayError(view, 'remoteProcName',
+                             "Problem retrieving proc name: " + e);
+    }
+
+    /* view obj information */
+    view.cacheEnabled = obj.cacheEnabled;
+}
+
+/*
+ *  ======== getEventData ========
+ *  Helper function for use within viewInitData
+ */
+function getEventData(view, obj, bufferPtr, putIndex, getIndex)
+{
+    var TransportShmCirc =
+        xdc.useModule('ti.sdo.ipc.transports.TransportShmCirc');
+    var modCfg =
+        Program.getModuleConfig('ti.sdo.ipc.transports.TransportShmCirc');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+
+    if (bufferPtr == obj.putBuffer) {
+        var bufferName = "put";
+    }
+    else {
+        var bufferName = "get";
+    }
+
+    try {
+        var putBuffer = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
+                                           bufferPtr,
+                                           modCfg.numMsgs);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putBuffer struct from shared memory"));
+    }
+
+    var i = getIndex;
+
+    while (i != putIndex) {
+        /* The event is registered */
+        var elem = Program.newViewStruct(
+                'ti.sdo.ipc.transports.TransportShmCirc',
+                'Events');
+
+        elem.index = i;
+        elem.buffer = bufferName;
+        elem.addr = utils.toHex(putBuffer[i].$addr);
+        elem.message = utils.toHex(putBuffer[i].elem);
+
+        /* Create a new row in the instance data view */
+        view.elements.$add(elem);
+
+        i++;
+    }
+}
+
+
+/*
+ *  ======== viewInitData ========
+ *  Instance data view.
+ */
+function viewInitData(view, obj)
+{
+    var Program         = xdc.useModule('xdc.rov.Program');
+    var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
+    var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
+
+    /* Display the instance label in the tree */
+    view.label = "remoteProcId = " + obj.remoteProcId;
+
+    /* Fetch put/get index's */
+    try {
+        var putWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.putWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putWriteIndex struct from shared memory"));
+    }
+
+    try {
+        var putReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.putReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching putReadIndex struct from shared memory"));
+    }
+
+    try {
+        var getWriteIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                                obj.getWriteIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getWriteIndex struct from shared memory"));
+    }
+
+    try {
+        var getReadIndex = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc,
+                                               obj.getReadIndex);
+    }
+    catch(e) {
+        throw (new Error("Error fetching getReadIndex struct from shared memory"));
+    }
+
+    /* Get event data for the put buffer */
+    getEventData(view, obj, obj.putBuffer, putWriteIndex.elem, putReadIndex.elem);
+
+    /* Get event data for the get buffer */
+    getEventData(view, obj, obj.getBuffer, getWriteIndex.elem, getReadIndex.elem);
+
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmCircSetup.c b/packages/ti/sdo/ipc/transports/TransportShmCircSetup.c
new file mode 100644 (file)
index 0000000..e7f0426
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmCircSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/transports/TransportShmCirc.h>
+
+#include "package/internal/TransportShmCircSetup.xdc.h"
+
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/*
+ *  ======== TransportShmCircSetup_attach ========
+ */
+Int TransportShmCircSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    TransportShmCirc_Handle handle;
+    TransportShmCirc_Params params;
+    Int status = MessageQ_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* init the transport parameters */
+    TransportShmCirc_Params_init(&params);
+    params.sharedAddr = sharedAddr;
+    params.priority = TransportShmCircSetup_priority;
+
+    /* make sure notify driver has been created */
+    if (Notify_intLineRegistered(remoteProcId, 0)) {
+        handle = TransportShmCirc_create(remoteProcId, &params, &eb);
+
+        if (handle != NULL) {
+            TransportShmCircSetup_module->handles[remoteProcId] = handle;
+            status = MessageQ_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== TransportShmCircSetup_detach ========
+ */
+Int TransportShmCircSetup_detach(UInt16 remoteProcId)
+{
+    TransportShmCirc_Handle handle;
+
+    handle = TransportShmCircSetup_module->handles[remoteProcId];
+
+    /* Trying to detach an un-attached processor should fail */
+    if (handle == NULL) {
+        return (MessageQ_E_FAIL);
+    }
+
+    /* Unregister the instance */
+    TransportShmCircSetup_module->handles[remoteProcId] = NULL;
+
+    TransportShmCirc_delete(&handle);
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== TransportShmCircSetup_isRegistered ========
+ */
+Bool TransportShmCircSetup_isRegistered(UInt16 remoteProcId)
+{
+    Bool registered;
+
+    registered = (TransportShmCircSetup_module->handles[remoteProcId] != NULL);
+
+    return (registered);
+}
+
+/*
+ *  ======== TransportShmCircSetup_sharedMemReq ========
+ */
+SizeT TransportShmCircSetup_sharedMemReq(Ptr sharedAddr)
+{
+    TransportShmCirc_Params params;
+    SizeT memReq = 0;
+
+    if (ti_sdo_utils_MultiProc_numProcessors > 1) {
+        params.sharedAddr = sharedAddr;
+        memReq += TransportShmCirc_sharedMemReq(&params);
+    }
+
+    return(memReq);
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmCircSetup.xdc b/packages/ti/sdo/ipc/transports/TransportShmCircSetup.xdc
new file mode 100644 (file)
index 0000000..017664c
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmCircSetup.xdc ========
+ */
+
+/*!
+ *  ======== TransportShmCircSetup ========
+ *  Manages the setup of TransportShmCirc instances.
+ *
+ *  create or open the TransportShmCirc for each pair of devices.
+ */
+
+module TransportShmCircSetup inherits ti.sdo.ipc.interfaces.ITransportSetup
+{
+
+internal:
+
+    /* Module Status object */
+    struct Module_State {
+        TransportShmCirc.Handle handles[]; /* handle per remote proc */
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmCircSetup.xs b/packages/ti/sdo/ipc/transports/TransportShmCircSetup.xs
new file mode 100644 (file)
index 0000000..2621852
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmCircSetup.xs ========
+ */
+
+var TransportShmCircSetup = null;
+var TransportShmCirc      = null;
+var Notify                = null;
+var MultiProc             = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportShmCircSetup = this;
+    TransportShmCirc =
+            xdc.useModule("ti.sdo.ipc.transports.TransportShmCirc");
+    Notify    = xdc.useModule("ti.sdo.ipc.Notify");
+    MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* set the length of handles to the number of processors */
+    mod.handles.length = MultiProc.numProcessors;
+
+    /* init the remote processor handles to null */
+    for (var i=0; i < mod.handles.length; i++) {
+        mod.handles[i] = null;
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmNotify.c b/packages/ti/sdo/ipc/transports/TransportShmNotify.c
new file mode 100644 (file)
index 0000000..78b53ea
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmNotify.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/hal/Cache.h>
+
+#include "package/internal/TransportShmNotify.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+
+/* Need to use reserved notify events */
+#undef TransportShmNotify_notifyEventId
+#define TransportShmNotify_notifyEventId \
+        ti_sdo_ipc_transports_TransportShmNotify_notifyEventId + \
+                    (UInt32)((UInt32)Notify_SYSTEMKEY << 16)
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+
+/*
+ *  ======== TransportShmNotify_notifyFxn ========
+ */
+Void TransportShmNotify_notifyFxn(UInt16 procId,
+                            UInt16 lineId,
+                            UInt32 eventId,
+                            UArg arg,
+                            UInt32 payload)
+{
+    UInt32 queueId;
+    MessageQ_Msg msg;
+
+    msg = SharedRegion_getPtr((SharedRegion_SRPtr)payload);
+
+    queueId = MessageQ_getDstQueue(msg);
+
+    MessageQ_put(queueId, msg);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportShmNotify_Instance_init ========
+ */
+Int TransportShmNotify_Instance_init(TransportShmNotify_Object *obj,
+        UInt16 procId, const TransportShmNotify_Params *params,
+        Error_Block *eb)
+{
+    Int status;
+    Bool flag;
+
+    obj->priority      = params->priority;
+    obj->remoteProcId  = procId;
+
+    /* register the event with Notify */
+    status = Notify_registerEventSingle(
+                 procId,    /* remoteProcId */
+                 0,         /* lineId */
+                 TransportShmNotify_notifyEventId,
+                 (Notify_FnNotifyCbck)TransportShmNotify_notifyFxn, 0);
+
+    if (status < 0) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (1);
+    }
+
+    /* Register the transport with MessageQ */
+    flag = ti_sdo_ipc_MessageQ_registerTransport(
+            TransportShmNotify_Handle_upCast(obj), procId, params->priority);
+
+    if (flag == FALSE) {
+        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
+        return (2);
+    }
+
+    return (0);
+}
+
+/*
+ *  ======== TransportShmNotify_Instance_finalize ========
+ */
+Void TransportShmNotify_Instance_finalize(TransportShmNotify_Object* obj,
+        Int status)
+{
+    switch(status) {
+        case 0: /* MessageQ_registerTransport succeeded */
+            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId,
+                obj->priority);
+
+            /* fall thru OK */
+        case 1: /* Notify_registerEventSingle failed */
+        case 2: /* MessageQ_registerTransport failed */
+            Notify_unregisterEventSingle(
+                obj->remoteProcId,
+                0,
+                TransportShmNotify_notifyEventId);
+            break;
+    }
+}
+
+/*
+ *  ======== TransportShmNotify_put ========
+ *  Assuming MessageQ_put is making sure that the arguments are ok
+ */
+Bool TransportShmNotify_put(TransportShmNotify_Object *obj, Ptr msg)
+{
+    UInt16 regionId = SharedRegion_INVALIDREGIONID;
+    SharedRegion_SRPtr msgSRPtr;
+    Int status;
+
+    /*
+     *  If translation is disabled and we always have to write back the message
+     *  then we can avoid calling SharedRegion_getId()
+     */
+    if (ti_sdo_ipc_SharedRegion_translate ||
+            !TransportShmNotify_alwaysWriteBackMsg ) {
+        regionId = SharedRegion_getId(msg);
+        if (SharedRegion_isCacheEnabled(regionId)) {
+            Cache_wbInv(msg, ((MessageQ_Msg)(msg))->msgSize, Cache_Type_ALL,
+                    TRUE);
+        }
+    }
+    else {
+        Cache_wbInv(msg, ((MessageQ_Msg)(msg))->msgSize, Cache_Type_ALL, TRUE);
+    }
+
+    /*
+     *  Get the msg's SRPtr.  OK if (regionId == SharedRegion_INVALIDID &&
+     *  SharedRegion_translate == FALSE)
+     */
+    msgSRPtr = SharedRegion_getSRPtr(msg, regionId);
+
+    /*
+     * Notify the remote processor and send msg via payload parameter
+     * use waitClear = TRUE to make sure prior message was received
+     */
+    status = Notify_sendEvent(obj->remoteProcId, 0,
+        TransportShmNotify_notifyEventId, (UInt32)msgSRPtr, TRUE);
+    if (status < 0) {
+        return (FALSE);
+    }
+
+    return (TRUE);
+}
+
+/*
+ *  ======== TransportShmNotify_control ========
+ */
+Bool TransportShmNotify_control(TransportShmNotify_Object *obj, UInt cmd,
+    UArg cmdArg)
+{
+    return (FALSE);
+}
+
+/*
+ *  ======== TransportShmNotify_getStatus ========
+ */
+Int TransportShmNotify_getStatus(TransportShmNotify_Object *obj)
+{
+    return (0);
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== TransportShmNotify_setErrFxn ========
+ */
+Void TransportShmNotify_setErrFxn(TransportShmNotify_ErrFxn errFxn)
+{
+    /* Ignore the errFxn */
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmNotify.xdc b/packages/ti/sdo/ipc/transports/TransportShmNotify.xdc
new file mode 100644 (file)
index 0000000..5fea41c
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmNotify.xdc ========
+ */
+
+/*!
+ *  ======== TransportShmNotify ========
+ *  Transport for MessageQ that acts on shared memory.
+ *
+ *  TransportShmSingle is a simplified version of {@link TransportShm}.  This
+ *  transport uses the Notify module to do all the real work.  The 'put'
+ *  function passes the message to the other processor using the 'payload'
+ *  parameter to Notify_sendEvent().  The receive side simply casts this
+ *  payload parameter to a MessageQ_Msg and enqueues it locally.
+ *
+ *  CAVEATS:
+ *
+ *  The sender will spin in Notify_sendEvent until the receive side has
+ *  read the previous message.  This is Notify-driver specific.
+ *  NotifyDriverShm  will spin before sending a new event if the prior event
+ *  hasn't been handled.  Some Notify drivers may support a FIFO or queue
+ *  for these events to mitigate this busy-wait affect.
+ */
+@InstanceFinalize
+@InstanceInitError
+
+module TransportShmNotify inherits ti.sdo.ipc.interfaces.IMessageQTransport
+{
+    /*!
+     *  ======== notifyEventId ========
+     *  Notify event ID for transport.
+     */
+    config UInt16 notifyEventId = 2;
+
+    /*!
+     *  @_nodoc
+     *  Determines whether the put() call unconditionally does a Cache_wbInv of
+     *  the message before sending a notification to the remote core.
+     *  The default value of 'true' allows us to skip the additional step of
+     *  checking whether cache is enabled for the message.
+     *
+     *  This should be set to 'false' when it is optimal to perform this
+     *  check.  This may be OPTIMAL when sending a message that is allocated
+     *  from a shared region whose cacheFlag is 'false' and when the write-back
+     *  cache operation is expensive.
+     */
+    config Bool alwaysWriteBackMsg = true;
+
+instance:
+
+internal:
+
+    Void notifyFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+                   UInt32 payload);
+
+    /* Instance State object */
+    struct Instance_State {
+        UInt16          remoteProcId;  /* dst proc id                   */
+        UInt16          priority;      /* priority to register          */
+    };
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmNotify.xs b/packages/ti/sdo/ipc/transports/TransportShmNotify.xs
new file mode 100644 (file)
index 0000000..d5ddbda
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmNotify.xs ========
+ */
+
+var TransportShmNotify = null;
+var MessageQ     = null;
+var Notify       = null;
+var SharedRegion = null;
+var Cache        = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportShmNotify = this;
+    MessageQ     = xdc.useModule("ti.sdo.ipc.MessageQ");
+    Notify       = xdc.useModule("ti.sdo.ipc.Notify");
+    SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    Cache        = xdc.useModule("ti.sysbios.hal.Cache");
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (Notify.numEvents <= TransportShmNotify.notifyEventId) {
+        TransportShmNotify.$logFatal("TransportShmNotify.notifyEventId (" +
+                TransportShmNotify.notifyEventId +
+                ") is too big: Notify.numEvents = " + Notify.numEvents,
+                TransportShmNotify);
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmNotifySetup.c b/packages/ti/sdo/ipc/transports/TransportShmNotifySetup.c
new file mode 100644 (file)
index 0000000..170d4be
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmNotifySetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/transports/TransportShmNotify.h>
+
+#include "package/internal/TransportShmNotifySetup.xdc.h"
+
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/*
+ *  ======== TransportShmNotifySetup_attach ========
+ */
+Int TransportShmNotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    TransportShmNotify_Handle handle;
+    TransportShmNotify_Params params;
+    Int status = MessageQ_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* init the transport parameters */
+    TransportShmNotify_Params_init(&params);
+    params.priority = TransportShmNotifySetup_priority;
+
+    /* make sure notify driver has been created */
+    if (Notify_intLineRegistered(remoteProcId, 0)) {
+        handle = TransportShmNotify_create(remoteProcId, &params, &eb);
+
+        if (handle != NULL) {
+            TransportShmNotifySetup_module->handles[remoteProcId] = handle;
+            status = MessageQ_S_SUCCESS;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== TransportShmNotifySetup_detach ========
+ */
+Int TransportShmNotifySetup_detach(UInt16 remoteProcId)
+{
+    TransportShmNotify_Handle handle;
+
+    handle = TransportShmNotifySetup_module->handles[remoteProcId];
+
+    /* Trying to detach an un-attached processor should fail */
+    if (handle == NULL) {
+        return (MessageQ_E_FAIL);
+    }
+
+    /* Unregister the instance */
+    TransportShmNotifySetup_module->handles[remoteProcId] = NULL;
+
+    TransportShmNotify_delete(&handle);
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== TransportShmNotifySetup_isRegistered ========
+ */
+Bool TransportShmNotifySetup_isRegistered(UInt16 remoteProcId)
+{
+    Bool registered;
+
+    registered = (TransportShmNotifySetup_module->handles[remoteProcId] != NULL);
+
+    return (registered);
+}
+
+/*
+ *  ======== TransportShmNotifySetup_sharedMemReq ========
+ */
+SizeT TransportShmNotifySetup_sharedMemReq(Ptr sharedAddr)
+{
+    return (0);
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmNotifySetup.xdc b/packages/ti/sdo/ipc/transports/TransportShmNotifySetup.xdc
new file mode 100644 (file)
index 0000000..8141b8a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmNotifySetup.xdc ========
+ */
+
+/*!
+ *  ======== TransportShmNotifySetup ========
+ *  Manages the setup of TransportShmNotify instances.
+ *
+ *  create or open the TransportShmNotify for each pair of devices.
+ */
+
+module TransportShmNotifySetup inherits ti.sdo.ipc.interfaces.ITransportSetup
+{
+
+internal:
+
+    /* Module Status object */
+    struct Module_State {
+        TransportShmNotify.Handle handles[]; /* handle per remote proc */
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmNotifySetup.xs b/packages/ti/sdo/ipc/transports/TransportShmNotifySetup.xs
new file mode 100644 (file)
index 0000000..db8ca73
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmNotifySetup.xs ========
+ */
+
+var TransportShmNotifySetup = null;
+var TransportShmNotify      = null;
+var MultiProc         = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportShmNotifySetup = this;
+    TransportShmNotify =
+            xdc.useModule("ti.sdo.ipc.transports.TransportShmNotify");
+    MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* set the length of handles to the number of processors */
+    mod.handles.length = MultiProc.numProcessors;
+
+    /* init the remote processor handles to null */
+    for (var i=0; i < mod.handles.length; i++) {
+        mod.handles[i] = null;
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmSetup.c b/packages/ti/sdo/ipc/transports/TransportShmSetup.c
new file mode 100644 (file)
index 0000000..68c45ea
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmSetup.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sdo/ipc/transports/TransportShm.h>
+
+#include "package/internal/TransportShmSetup.xdc.h"
+
+#include <ti/sdo/ipc/_Ipc.h>
+#include <ti/sdo/ipc/_GateMP.h>
+#include <ti/sdo/ipc/_MessageQ.h>
+#include <ti/sdo/ipc/_Notify.h>
+#include <ti/sdo/ipc/_SharedRegion.h>
+#include <ti/sdo/utils/_MultiProc.h>
+
+/*
+ *  ======== TransportShmSetup_attach ========
+ */
+Int TransportShmSetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    TransportShm_Params params;
+    TransportShm_Handle handle;
+    Int status = MessageQ_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /* init the transport parameters */
+    TransportShm_Params_init(&params);
+    params.gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
+    params.sharedAddr = sharedAddr;
+    params.priority = TransportShmSetup_priority;
+
+    /* make sure notify driver has been created */
+    if (Notify_intLineRegistered(remoteProcId, 0)) {
+        /* create if self < remoteProcId, otherwise open */
+        if (MultiProc_self() < remoteProcId) {
+            /* create the transport */
+            handle = TransportShm_create(remoteProcId, &params, &eb);
+
+            if (handle != NULL) {
+                TransportShmSetup_module->handles[remoteProcId] = handle;
+                status = MessageQ_S_SUCCESS;
+            }
+        }
+        else {
+            status = TransportShm_openByAddr(params.sharedAddr, &handle, &eb);
+            TransportShmSetup_module->handles[remoteProcId] = handle;
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== TransportShmSetup_detach ========
+ */
+Int TransportShmSetup_detach(UInt16 remoteProcId)
+{
+    TransportShm_Handle handle;
+
+    handle = TransportShmSetup_module->handles[remoteProcId];
+
+    /* Trying to detach an un-attached processor should fail */
+    if (handle == NULL) {
+        return (MessageQ_E_FAIL);
+    }
+
+    /* Unregister the instance */
+    TransportShmSetup_module->handles[remoteProcId] = NULL;
+
+    /* Delete/close the transport */
+    if (MultiProc_self() < remoteProcId) {
+        TransportShm_delete(&handle);
+    }
+    else {
+        TransportShm_close(&handle);
+    }
+
+    return (MessageQ_S_SUCCESS);
+}
+
+/*
+ *  ======== TransportShmSetup_isRegistered ========
+ */
+Bool TransportShmSetup_isRegistered(UInt16 remoteProcId)
+{
+    Bool registered;
+
+    registered = (TransportShmSetup_module->handles[remoteProcId] != NULL);
+
+    return (registered);
+}
+
+/*
+ *  ======== TransportShmSetup_sharedMemReq ========
+ */
+SizeT TransportShmSetup_sharedMemReq(Ptr sharedAddr)
+{
+    TransportShm_Params params;
+    SizeT memReq = 0;
+
+    if (ti_sdo_utils_MultiProc_numProcessors > 1) {
+        params.sharedAddr = sharedAddr;
+        memReq += TransportShm_sharedMemReq(&params);
+    }
+
+    return(memReq);
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmSetup.xdc b/packages/ti/sdo/ipc/transports/TransportShmSetup.xdc
new file mode 100644 (file)
index 0000000..aa35fe7
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== TransportShmSetup.xdc ========
+ *
+ */
+
+/*!
+ *  ======== TransportShmSetup ========
+ *  Manages the setup of TransportShm instances.
+ *
+ *  create() or open() the TransportShm for each pair of devices.
+ */
+
+module TransportShmSetup inherits ti.sdo.ipc.interfaces.ITransportSetup
+{
+
+internal:
+
+    /* Module Status object */
+    struct Module_State {
+        TransportShm.Handle handles[];  /* store a handle per remote proc */
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/TransportShmSetup.xs b/packages/ti/sdo/ipc/transports/TransportShmSetup.xs
new file mode 100644 (file)
index 0000000..fd1cb58
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ======== TransportShmSetup.xs ========
+ *
+ */
+
+var TransportShmSetup = null;
+var GateMP            = null;
+var Ipc               = null;
+var Notify            = null;
+var SharedRegion      = null;
+var TransportShm      = null;
+var MultiProc         = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    TransportShmSetup = this;
+    GateMP       = xdc.useModule("ti.sdo.ipc.GateMP");
+    Ipc          = xdc.useModule("ti.sdo.ipc.Ipc");
+    Notify       = xdc.useModule("ti.sdo.ipc.Notify");
+    SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
+    TransportShm = xdc.useModule("ti.sdo.ipc.transports.TransportShm");
+    MultiProc    = xdc.useModule("ti.sdo.utils.MultiProc");
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* set the length of handles to the number of processors */
+    mod.handles.length = MultiProc.numProcessors;
+
+    /* init the remote processor handles to null */
+    for (var i=0; i < mod.handles.length; i++) {
+        mod.handles[i] = null;
+    }
+}
diff --git a/packages/ti/sdo/ipc/transports/package.bld b/packages/ti/sdo/ipc/transports/package.bld
new file mode 100644 (file)
index 0000000..29c283a
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.bld ========
+ *
+ */
+
+var IpcBuild = xdc.loadCapsule("ti/sdo/ipc/Build.xs");
+
+var objList = [
+      "TransportShm",
+      "TransportShmSetup",
+      "TransportShmCirc",
+      "TransportShmCircSetup",
+      "TransportShmNotify",
+      "TransportShmNotifySetup",
+      "TransportNullSetup",
+];
+
+/* generate makefiles */
+IpcBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+IpcBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [ "package.bld" ];
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/ipc/transports/package.xdc b/packages/ti/sdo/ipc/transports/package.xdc
new file mode 100644 (file)
index 0000000..2ac0b36
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.sdo.ipc.transports ========
+ */
+
+package ti.sdo.ipc.transports [1,0,0,0] {
+    module    TransportShm;
+    module    TransportShmSetup;
+    module    TransportShmCirc;
+    module    TransportShmCircSetup;
+    module    TransportShmNotify;
+    module    TransportShmNotifySetup;
+    module    TransportNullSetup;
+}
diff --git a/packages/ti/sdo/ipc/transports/package.xs b/packages/ti/sdo/ipc/transports/package.xs
new file mode 100644 (file)
index 0000000..033e77e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var Build = xdc.module("ti.sdo.ipc.Build");
+
+    /* use shared getLibs() */
+    return (Build.getLibs(this));
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+}
diff --git a/packages/ti/sdo/utils/Build.xdc b/packages/ti/sdo/utils/Build.xdc
new file mode 100644 (file)
index 0000000..10129dc
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== Build.xdc ========
+ *  metaonly module to support building various package/product libraries
+ *
+ */
+
+/*!
+ *  ======== Build ========
+ */
+
+@Template("./Build.xdt")
+metaonly module Build
+{
+
+    /*!
+     *  ======== libDir ========
+     */
+    metaonly config String libDir = null;
+
+    /*!
+     *  ======== getDefs ========
+     *  Get the compiler -D options necessary to build
+     */
+    metaonly String getDefs();
+
+    /*!
+     *  ======== getCFiles ========
+     *  Get the library C source files.
+     */
+    metaonly String getCFiles(String target);
+
+    /*!
+     *  ======== getAsmFiles ========
+     *  Get the library Asm source files.
+     */
+    metaonly Any getAsmFiles(String target);
+
+    /*
+     *  ======== buildLibs ========
+     *  This function generates the makefile goals for the libraries
+     *  produced by a ti.sysbios package.
+     */
+    function buildLibs(objList, relList, filter, xdcArgs);
+
+    /*!
+     *  ======== getLibs ========
+     *  Common getLibs() for all ipc packages.
+     */
+    function getLibs(pkg);
+}
diff --git a/packages/ti/sdo/utils/Build.xdt b/packages/ti/sdo/utils/Build.xdt
new file mode 100644 (file)
index 0000000..cf71ecb
--- /dev/null
@@ -0,0 +1,69 @@
+%%{
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%/*
+% *  ======== Build.xdt ========
+% */
+%var BIOS = xdc.module("ti.sysbios.BIOS");
+%var Build = xdc.module("ti.sdo.utils.Build");
+%if ((BIOS.libType == BIOS.LibType_Custom)
+%      && (xdc.module('ti.sdo.ipc.Build').$used == false)) {
+%%{
+    /* get the specified output directory (saved when BIOS was "used") */
+    var outputDir = this.$private.outputDir;
+
+    /* generate makefile from makefile.xdt
+     *    $args[0] = the RTSC target, so the makefile knows how to run the
+     *               compiler and archiver
+     */
+    print("generating custom ti.sdo.utils library makefile ... ");
+%%}
+
+%if (Program.build.target.$name.match(/gnu/) &&
+%    (Program.build.target.name.match(/A15/) ||
+%     Program.build.target.name.match(/A9/)  ||
+%     Program.build.target.name.match(/A8/))) {
+%%{
+    var tplt = xdc.loadTemplate(this.$package.packageBase + "/makefile_gccArmLto.xdt");
+%%}
+%}
+%else {
+%%{
+    var tplt = xdc.loadTemplate(this.$package.packageBase + "/makefile.xdt");
+%%}
+%}
+
+%%{
+    tplt.genFile(outputDir + "/makefile", this, [Program.build.target]);
+%%}
+%}
diff --git a/packages/ti/sdo/utils/Build.xs b/packages/ti/sdo/utils/Build.xs
new file mode 100644 (file)
index 0000000..c997f4e
--- /dev/null
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== Build.xs ========
+ */
+
+var BIOS = null;
+var Build = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    BIOS = xdc.module("ti.sysbios.BIOS");
+    Build = this;
+
+    if (("ti.sdo.ipc" in xdc.om) || ("ti.sdo.io" in xdc.om)) {
+        return;
+    }
+
+    /* inform getLibs() about location of library */
+    switch (BIOS.libType) {
+        case BIOS.LibType_Instrumented:
+            this.$private.libraryName = "/utils.a" + Program.build.target.suffix;
+            this.$private.outputDir = this.$package.packageBase + "lib/"
+                        + (BIOS.smpEnabled ? "smputils/instrumented/" : "utils/instrumented/");
+            break;
+
+        case BIOS.LibType_NonInstrumented:
+            this.$private.libraryName = "/utils.a" + Program.build.target.suffix;
+            this.$private.outputDir = this.$package.packageBase + "lib/"
+                        + (BIOS.smpEnabled ? "smputils/nonInstrumented/" : "utils/nonInstrumented/");
+            break;
+
+        case BIOS.LibType_Custom:
+            this.$private.libraryName = "/utils.a" + Program.build.target.suffix;
+            var SourceDir = xdc.useModule("xdc.cfg.SourceDir");
+            /* if building a pre-built library */
+            if (BIOS.buildingAppLib == false) {
+                var appName = Program.name.substring(0, Program.name.lastIndexOf('.'));
+                this.$private.libDir = this.$package.packageBase + Build.libDir;
+                if (!java.io.File(this.$private.libDir).exists()) {
+                    java.io.File(this.$private.libDir).mkdir();
+                }
+            }
+            /*
+             * If building an application in CCS or package.bld world
+             * and libDir has been specified
+             */
+            if ((BIOS.buildingAppLib == true) && (Build.libDir !== null)) {
+                SourceDir.outputDir = Build.libDir;
+                var src = SourceDir.create("utils");
+                src.libraryName = this.$private.libraryName.substring(1);
+                this.$private.outputDir = src.getGenSourceDir();
+            }
+            else {
+                var curPath = java.io.File(".").getCanonicalPath();
+                /* If package.bld world AND building an application OR pre-built lib */
+                if (java.io.File(curPath).getName() != "configPkg") {
+                    var appName = Program.name.substring(0, Program.name.lastIndexOf('.'));
+                    appName = appName + "_p" + Program.build.target.suffix + ".src";
+                    SourceDir.outputDir = "package/cfg/" + appName;
+                    SourceDir.toBuildDir = ".";
+                    var src = SourceDir.create("utils");
+                    src.libraryName = this.$private.libraryName.substring(1);
+                    this.$private.outputDir = src.getGenSourceDir();
+                }
+                /* Here ONLY if building an application in CCS world */
+                else {
+                    /* request output source directory for generated files */
+                    var appName = Program.name.substring(0, Program.name.lastIndexOf('.'));
+                    appName = appName + "_" + Program.name.substr(Program.name.lastIndexOf('.')+1);
+                    SourceDir.toBuildDir = "..";
+                    var src = SourceDir.create("utils/");
+                    src.libraryName = this.$private.libraryName.substring(1);
+
+                    /* save this directory in our private state (to be read during
+                    * generation, see Gen.xdt)
+                    */
+                    this.$private.outputDir = src.getGenSourceDir();
+                }
+            }
+            break;
+    }
+}
+/*
+ * Add pre-built Instrumented and Non-Intrumented release libs
+ */
+
+var utilsSources = "utils/MultiProc.c " +
+                   "utils/List.c " +
+                   "utils/NameServerRemoteNull.c " +
+                   "utils/NameServer.c ";
+
+var utilsPackages = [
+    "ti.sdo.utils",
+];
+
+var asmListNone = [
+];
+
+var cFiles = {
+    "ti.sdo.io.DriverTypes" :
+        { cSources: [] },
+}
+
+/*
+ *  ======== getCFiles ========
+ */
+function getCFiles(target)
+{
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+    var localSources = "utils/UTILS.c ";
+
+    /*
+     * logic to trim the C files down to just what the application needs
+     * 3/2/11 disabled for now ...
+     */
+    if (BIOS.buildingAppLib == true) {
+        for each (var mod in Program.targetModules()) {
+            var mn = mod.$name;
+            var pn = mn.substring(0, mn.lastIndexOf("."));
+            var packageMatch = false;
+
+            for (var i = 0; i < utilsPackages.length; i++) {
+                if (pn == utilsPackages[i]) {
+                    packageMatch = true;
+                    break;
+                }
+            }
+
+            if (packageMatch && !mn.match(/Proxy/)) {
+                if (cFiles[mn] === undefined) {
+                    var prefix = mn.substr(mn.indexOf("sdo")+4);
+                    var mod = mn.substr(mn.lastIndexOf(".")+1);
+                    prefix = prefix.substring(0, prefix.lastIndexOf('.')+1);
+                    prefix = prefix.replace(/\./g, "/");
+                    localSources += prefix + mod + ".c ";
+                }
+                else {
+                    for (i in cFiles[mn].cSources) {
+                        var prefix = mn.substr(mn.indexOf("sdo")+8);
+                        prefix = prefix.substring(0, prefix.lastIndexOf('.')+1);
+                        prefix = prefix.replace(/\./g, "/");
+                        localSources += prefix + cFiles[mn].cSources[i] + " ";
+                    }
+                }
+            }
+        }
+    }
+    else {
+        localSources += utilsSources;
+    }
+
+    /* remove trailing " " */
+    localSources = localSources.substring(0, localSources.length-1);
+
+    return (localSources);
+}
+
+/*
+ *  ======== getAsmFiles ========
+ */
+function getAsmFiles(target)
+{
+    return (asmListNone);
+}
+
+/*
+ *  ======== getDefs ========
+ */
+function getDefs()
+{
+    var Defaults = xdc.module('xdc.runtime.Defaults');
+    var Diags = xdc.module("xdc.runtime.Diags");
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+
+    var defs = "";
+
+    if ((BIOS.assertsEnabled == false) ||
+        ((Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF)
+            && (Defaults.common$.diags_INTERNAL == Diags.ALWAYS_OFF))) {
+        defs += " -Dxdc_runtime_Assert_DISABLE_ALL";
+    }
+
+    if (BIOS.logsEnabled == false) {
+        defs += " -Dxdc_runtime_Log_DISABLE_ALL";
+    }
+
+    return (defs);
+}
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(pkg)
+{
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+print("In utils.Build.getLibs");
+    if (BIOS.libType != BIOS.LibType_Debug) {
+        return null;
+    }
+
+    var lib = "";
+    var name = pkg.$name + ".a" + prog.build.target.suffix;
+
+    if (BIOS.smpEnabled == true) {
+        lib = "lib/smputils/debug/" + name;
+    }
+    else {
+        lib = "lib/utils/debug/" + name;
+    }
+
+    if (java.io.File(pkg.packageBase + lib).exists()) {
+        return lib;
+    }
+
+    /* could not find any library, throw exception */
+    throw Error("Library not found: " + name);
+}
+
+/*
+ *  ======== getProfiles ========
+ *  Determines which profiles to build for.
+ *
+ *  Any argument in XDCARGS which does not contain platform= is treated
+ *  as a profile. This way multiple build profiles can be specified by
+ *  separating them with a space.
+ */
+function getProfiles(xdcArgs)
+{
+    /*
+     * cmdlProf[1] gets matched to "whole_program,debug" if
+     * ["abc", "profile=whole_program,debug"] is passed in as xdcArgs
+     */
+    var cmdlProf = (" " + xdcArgs.join(" ") + " ").match(/ profile=([^ ]+) /);
+
+    if (cmdlProf == null) {
+        /* No profile=XYZ found */
+        return [];
+    }
+
+    /* Split "whole_program,debug" into ["whole_program", "debug"] */
+    var profiles = cmdlProf[1].split(',');
+
+    return profiles;
+}
+
+/*
+ *  ======== buildLibs ========
+ *  This function generates the makefile goals for the libraries
+ *  produced by a ti.sysbios package.
+ */
+function buildLibs(objList, relList, filter, xdcArgs)
+{
+    for (var i = 0; i < xdc.module('xdc.bld.BuildEnvironment').targets.length; i++) {
+        var targ = xdc.module('xdc.bld.BuildEnvironment').targets[i];
+
+        /* skip target if not supported */
+        if (!supportsTarget(targ, filter)) {
+            continue;
+        }
+
+        var profiles = getProfiles(xdcArgs);
+
+        /* If no profiles were assigned, use only the default one. */
+        if (profiles.length == 0) {
+            profiles[0] = "debug";
+        }
+
+        for (var j = 0; j < profiles.length; j++) {
+            var ccopts = "";
+            var asmopts = "";
+
+            if (profiles[j] == "smp") {
+                var libPath = "lib/smputils/debug/";
+                ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
+                asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
+            }
+            else {
+                var libPath = "lib/utils/debug/";
+                /* build all package libs using Hwi macros */
+                ccopts += " -Dti_sysbios_Build_useHwiMacros";
+                ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
+                asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
+            }
+
+            /* confirm that this target supports this profile */
+            if (targ.profiles[profiles[j]] !== undefined) {
+                var profile = profiles[j];
+                var lib = Pkg.addLibrary(libPath + Pkg.name,
+                                targ, {
+                                profile: profile,
+                                copts: ccopts,
+                                aopts: asmopts,
+                                releases: relList
+                                });
+                lib.addObjects(objList);
+            }
+        }
+    }
+}
+
+
+/*
+ *  ======== supportsTarget ========
+ *  Returns true if target is in the filter object. If filter
+ *  is null or empty, that's taken to mean all targets are supported.
+ */
+function supportsTarget(target, filter)
+{
+    var list, field;
+
+    if (filter == null) {
+        return true;
+    }
+
+    /*
+     * For backwards compatibility, we support filter as an array of
+     * target names.  The preferred approach is to specify filter as
+     * an object with 'field' and 'list' elements.
+     *
+     * Old form:
+     *     var trgFilter = [ "Arm9", "Arm9t", "Arm9t_big_endian" ]
+     *
+     * New (preferred) form:
+     *
+     *     var trgFilter = {
+     *         field: "isa",
+     *         list: [ "v5T", "v7R" ]
+     *     };
+     *
+     */
+    if (filter instanceof Array) {
+        list = filter;
+        field = "name";
+    }
+    else {
+        list = filter.list;
+        field = filter.field;
+    }
+
+    if (list == null || field == null) {
+        throw("invalid filter parameter, must specify list and field!");
+    }
+
+    if (field == "noIsa") {
+        if (String(','+list.toString()+',').match(','+target["isa"]+',')) {
+            return (false);
+        }
+        return (true);
+    }
+
+    /*
+     * add ',' at front and and tail of list and field strings to allow
+     * use of simple match API.  For example, the string is updated to:
+     * ',v5T,v7R,' to allow match of ',v5t,'.
+     */
+    if (String(','+list.toString()+',').match(','+target[field]+',')) {
+        return (true);
+    }
+
+    return (false);
+}
diff --git a/packages/ti/sdo/utils/INameServerRemote.xdc b/packages/ti/sdo/utils/INameServerRemote.xdc
new file mode 100644 (file)
index 0000000..4ed61e7
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== INameServerRemote.xdc ========
+ *
+ */
+
+import xdc.runtime.Error;
+
+/*!
+ *  ======== INameServerRemote ========
+ *  Interface for remote NameServer accesses
+ */
+interface INameServerRemote {
+
+    /*!
+     *  ======== Status ========
+     *  Status codes returned by certain calls
+     */
+    enum Status {
+        S_SUCCESS = 0,
+        E_FAIL = -1,
+        E_ERROR = -2
+    };
+
+    /*! Function is called by Ipc_attach() through NameServer_SetupProxy */
+    @DirectCall
+    Int attach(UInt16 remoteProcId, Ptr sharedAddr);
+
+    /*! Function is called by Ipc_detach() through NameServer_SetupProxy */
+    @DirectCall
+    Int detach(UInt16 remoteProcId);
+
+    /*!
+     *  ======== sharedMemReq ========
+     *  Returns the shared memory size requirement for a single instance
+     *
+     *  Function is called during Ipc_attach() through NameServer_SetupProxy.
+     *
+     *  @param(sharedAddr)   Shared address
+     *
+     *  @b(returns)          Number of MAUs needed to create the instance.
+     */
+    @DirectCall
+    SizeT sharedMemReq(Ptr sharedAddr);
+
+instance:
+
+    /*!
+     *  ======== create ========
+     */
+    override create(UInt16 procId);
+
+    /*!
+     *  ======== get ========
+     */
+    Int get(String instanceName,
+            String name,
+            Ptr value,
+            UInt32 *valueLen,
+            xdc.runtime.knl.ISync.Handle syncHandle,
+            Error.Block *eb);
+}
diff --git a/packages/ti/sdo/utils/List.c b/packages/ti/sdo/utils/List.c
new file mode 100644 (file)
index 0000000..323b57c
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== List.c ========
+ *  Implementation of functions specified in List.xdc.
+ */
+
+#include <xdc/std.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+
+#include "package/internal/List.xdc.h"
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== List_Instance_init ========
+ */
+Void List_Instance_init(List_Object *obj, const List_Params *params)
+{
+    obj->elem.next = obj->elem.prev = &(obj->elem);
+}
+
+/*
+ *  ======== List_empty ========
+ *  No thread-safety is needed since this API does not modify
+ *  any of the contents.
+ */
+Bool List_empty(List_Object *obj)
+{
+    return (obj->elem.next == &(obj->elem));
+}
+
+/*
+ *  ======== List_get ========
+ */
+Ptr List_get(List_Object *obj)
+{
+    List_Elem *elem;
+    UInt key;
+
+    key = Hwi_disable();
+
+    elem = List_dequeue(obj);
+
+    Hwi_restore(key);
+
+    return (elem);
+}
+
+/*
+ *  ======== List_put ========
+ */
+Void List_put(List_Object *obj, List_Elem *elem)
+{
+    UInt key;
+
+    key = Hwi_disable();
+
+    List_enqueue(obj, elem);
+
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== List_putHead ========
+ */
+Void List_putHead(List_Object *obj, List_Elem *elem)
+{
+    UInt key;
+
+    key = Hwi_disable();
+
+    List_enqueueHead(obj, elem);
+
+    Hwi_restore(key);
+}
+
+/*
+ *  ======== List_insert ========
+ */
+Void List_insert(List_Object *obj, List_Elem *newElem, List_Elem *curElem)
+{
+    List_enqueue((List_Object *)curElem, newElem);
+}
+
+/*
+ *  ======== List_next ========
+ */
+Ptr List_next(List_Object *obj, List_Elem *elem)
+{
+    List_Elem *retElem;  /* returned elem */
+
+    /* elem == NULL -> start at the head */
+    if (elem == NULL) {
+        retElem = obj->elem.next;
+    }
+    else {
+        retElem = elem->next;
+    }
+
+    if (retElem == (List_Elem *)obj) {
+        retElem = NULL;
+    }
+
+    return (retElem);
+}
+
+/*
+ *  ======== List_prev ========
+ */
+Ptr List_prev(List_Object *obj, List_Elem *elem)
+{
+    List_Elem *retElem;  /* returned elem */
+
+    /* elem == NULL -> start at the tail */
+    if (elem == NULL) {
+        retElem = obj->elem.prev;
+    }
+    else {
+        retElem = elem->prev;
+    }
+
+    if (retElem == (List_Elem *)obj) {
+        retElem = NULL;
+    }
+
+    return (retElem);
+}
+
+/*
+ *  ======== List_remove ========
+ */
+Void List_remove(List_Object *obj, List_Elem *elem)
+{
+    elem->prev->next = elem->next;
+    elem->next->prev = elem->prev;
+}
+
+/*
+ *  ======== List_dequeue ========
+ */
+Ptr List_dequeue(List_Object *obj)
+{
+    List_Elem *elem;
+
+    elem = obj->elem.next;
+
+    /* See if the List was empty */
+    if (elem == (List_Elem *)obj) {
+        elem = NULL;
+    }
+    else {
+        obj->elem.next   = elem->next;
+        elem->next->prev = &(obj->elem);
+    }
+
+    return (elem);
+}
+
+/*
+ *  ======== List_enqueue ========
+ */
+Void List_enqueue(List_Object *obj, List_Elem *elem)
+{
+    elem->next           = &(obj->elem);
+    elem->prev           = obj->elem.prev;
+    obj->elem.prev->next = elem;
+    obj->elem.prev       = elem;
+}
+
+/*
+ *  ======== List_enqueueHead ========
+ */
+Void List_enqueueHead(List_Object *obj, List_Elem *elem)
+{
+    elem->next           = obj->elem.next;
+    elem->prev           = &(obj->elem);
+    obj->elem.next->prev = elem;
+    obj->elem.next       = elem;
+}
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== List_elemClear ========
+ */
+
+Void List_elemClear(List_Elem *elem)
+{
+    elem->next = elem->prev = elem;
+}
diff --git a/packages/ti/sdo/utils/List.xdc b/packages/ti/sdo/utils/List.xdc
new file mode 100644 (file)
index 0000000..d78f5fd
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== List.xdc ========
+ *
+ */
+
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== List ========
+ *  Doubly Linked List Manager
+ *
+ *  The List module makes available a set of functions that manipulate
+ *  List objects accessed through handles of type List_Handle.
+ *  Each List contains a linked sequence of zero or more elements
+ *  referenced through variables of type List_Elem, which are typically
+ *  embedded as the first field within a structure.
+ *
+ *  All List function are atomic unless noted otherwise in the API
+ *  descriptions. An atomic API means that the API completes in core
+ *  functionality without being interrupted. Therefore, atomic APIs are
+ *  thread-safe. An example is {@link #put}. Multiple threads can call
+ *  {@link #put} at the same time. The threads do not have to manage the
+ *  synchronization.
+ *
+ *  The {@link xdc.runtime.Gate#enterSystem}/{@link xdc.runtime.Gate#leaveSystem}
+ *  calls are used to make the APIs atomic. This Gate calls internally use
+ *  {@link xdc.runtime.System}'s gate.
+ *
+ *  The List module can be used both as a queue (i.e. First In First Out),
+ *  as a stack (i.e. Last In First Out), or as a general purpose linked list.
+ *
+ *  Lists are represented as doubly-linked lists, so calls to {@link #next}
+ *  or {@link #prev} can loop continuously over the List.
+ *  Refer to {@link #next} and {@link #prev} for examples.
+ *
+ *  @a(List as a Queue)
+ *
+ *  To treat the list object as a queue:
+ *  @p(blist)
+ *  -Use {@link #put} to put at the tail of the queue
+ *  -Use {@link #get} to get from the head of the queue
+ *  @p
+ *
+ *  Here is sample code that acts on a List instance (listHandle) as a queue
+ *  in a FIFO manner.
+ *
+ *  @p(code)
+ *  List_Elem  elem[4];
+ *  List_Elem *tmpElem;
+ *
+ *  // place at the tail of the queue
+ *  for (i = 0; i < 4; i++) {
+ *      List_put(listHandle, &(elem[i]));
+ *  }
+ *
+ *  // remove the buffers from the head
+ *  while((tmpElem = List_get(listHandle)) != NULL) {
+ *      // process tmpElem
+ *  }
+ *  @p
+ *
+ *  @a(List as a Stack)
+ *
+ *  To treat the list object as a stack:
+ *  @p(blist)
+ *  -Use {@link #putHead} to put at the top of the stack
+ *  -Use {@link #get} to get from the top of the stack
+ *  @p
+ *
+ *  Here is sample code that acts on a List instance (listHandle) as a stack
+ *  in a LIFO manner.
+ *
+ *  @p(code)
+ *  List_Elem  elem[4];
+ *  List_Elem *tmpElem;
+ *
+ *  // push onto the top (i.e. head)
+ *  for (i = 0; i < 4; i++) {
+ *      List_putHead(listHandle, &(elem[i]));
+ *  }
+ *
+ *  // remove the buffers in FIFO order.
+ *  while((tmpElem = List_get(listHandle)) != NULL) {
+ *      // process tmpElem
+ *  }
+ *  @p
+ */
+
+module List
+{
+    metaonly struct BasicView {
+        String  label;
+        Ptr     elems[];
+    }
+
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+                ['Basic', {type: ViewInfo.INSTANCE, viewInitFxn: 'viewInitInstance', structName: 'BasicView'}]
+            ]
+        });
+
+    /*!
+     *  ======== Elem ========
+     *  Opaque List element
+     *
+     *  A field of this type is placed at the head of client structs.
+     */
+    @Opaque struct Elem {
+        Elem *volatile next;    /* must be volatile for whole_program */
+        Elem *volatile prev;    /* must be volatile for whole_program */
+    };
+
+    /*!
+     *  ======== elemClearMeta ========
+     *  Clears a List element's pointers
+     *
+     *  This API is not for removing elements from a List, and
+     *  should never be called on an element in a List--only on deListed
+     *  elements.
+     *
+     *  @param(elem)            element to be cleared
+     */
+    metaonly Void elemClearMeta(Elem *elem);
+
+    /*!
+     *  ======== elemClear ========
+     *  Clears a List element's pointers
+     *
+     *  This API does not removing elements from a List, and
+     *  should never be called on an element in a List--only on deListed
+     *  elements.
+     *
+     *  @param(elem)            element to be cleared
+     */
+    @DirectCall
+    Void elemClear(Elem *elem);
+
+instance:
+
+    /*!
+     *  ======== metaList ========
+     *  @_nodoc
+     *  Used to store elem before the object is initialized.
+     */
+    metaonly config any metaList[];
+
+    /*!
+     *  ======== create ========
+     *  Create a List object
+     */
+    create();
+
+    /*!
+     *  ======== empty ========
+     *  Test for an empty List (atomic)
+     *
+     *  @b(returns)     TRUE if this List is empty
+     */
+    @DirectCall
+    Bool empty();
+
+    /*!
+     *  ======== get ========
+     *  Get element from front of List (atomic)
+     *
+     *  This function atomically removes the element from the front of a
+     *  List and returns a pointer to it.
+     *
+     *  @b(returns)     pointer to former first element or NULL if empty
+     */
+    @DirectCall
+    Ptr get();
+
+    /*!
+     *  ======== put ========
+     *  Put element at end of List (atomic)
+     *
+     *  This function atomically places the element at the end of
+     *  List.
+     *
+     *  @param(elem)    pointer to new List element
+     */
+    @DirectCall
+    Void put(Elem *elem);
+
+    /*!
+     *  ======== putHead ========
+     *  Put element at head of List (atomic)
+     *
+     *  This function atomically places the element at the front of
+     *  List.
+     *
+     *  @param(elem)    pointer to new List element
+     */
+    @DirectCall
+    Void putHead(Elem *elem);
+
+    /*!
+     *  ======== putMeta ========
+     *  @_nodoc
+     *  Put element at end of List.
+     *
+     *  This meta function can be used to place an element onto
+     *  the end of a list during configuration. There currently
+     *  is no meta API to place the elem at the head of the list
+     *  during configuration.
+     *
+     *  @param(elem)            pointer to new List element
+     */
+    metaonly Void putMeta(Elem* elem);
+
+    /*!
+     *  ======== next ========
+     *  Return next element in List (non-atomic)
+     *
+     *  This function returns the next element on a list. It does not
+     *  remove any items from the list. The caller should protect the
+     *  list from being changed while using this call since it is non-atomic.
+     *
+     *  To look at the first elem on the list, use NULL as the elem argument.
+     *
+     *  This function is useful in searching a list. The following code shows
+     *  an example. The scanning of a list should be protected against other
+     *  threads that modify the list.
+     *
+     *  @p(code)
+     *  List_Elem  *elem = NULL;
+     *
+     *  // Begin protection against modification of the list.
+     *
+     *  while ((elem = List_next(listHandle, elem)) != NULL) {
+     *      //act elem as needed. For example call List_remove().
+     *  }
+     *
+     *  // End protection against modification of the list.
+     *  @p
+     *
+     *  @param(elem)    element in list or NULL to start at the head
+     *
+     *  @b(returns)     next element in list or NULL to denote end
+     */
+    @DirectCall
+    Ptr next(Elem *elem);
+
+    /*!
+     *  ======== prev ========
+     *  Return previous element in List (non-atomic)
+     *
+     *  This function returns the previous element on a list. It does not
+     *  remove any items from the list. The caller should protect the
+     *  list from being changed while using this call since it is non-atomic.
+     *
+     *  To look at the last elem on the list, use NULL as the elem argument.
+     *
+     *  This function is useful in searching a list in reverse order. The
+     *  following code shows an example. The scanning of a list should be
+     *  protected against other threads that modify the list.
+     *
+     *  @p(code)
+     *  List_Elem  *elem = NULL;
+     *
+     *  // Begin protection against modification of the list.
+     *
+     *  while ((elem = List_prev(listHandle, elem)) != NULL) {
+     *      //act elem as needed. For example call List_remove().
+     *  }
+     *
+     *  // End protection against modification of the list.
+     *  @p
+     *
+     *  @param(elem)    element in list or NULL to start at the end (i.e. tail)
+     *
+     *  @b(returns)     previous element in list or NULL to denote
+     *                  no previous elem
+     */
+    @DirectCall
+    Ptr prev(Elem *elem);
+
+    /*!
+     *  ======== insert ========
+     *  Insert element at into a List (non-atomic)
+     *
+     *  This function inserts `newElem` in the queue in
+     *  front of `curElem`. The caller should protect the
+     *  list from being changed while using this call since it is non-atomic.
+     *
+     *  To place an elem at the end of the list, use {@link #put}.
+     *  To place a elem at the front of the list, use {@link #putHead}.
+     *
+     *  @param(newElem)         element to insert
+     *
+     *  @param(curElem)         element to insert in front of
+     */
+    @DirectCall
+    Void insert(Elem *newElem, Elem *curElem);
+
+    /*!
+     *  ======== remove ========
+     *  Remove elem from middle of list (non-atomic)
+     *
+     *  This function removes an elem from a list.
+     *  The `elem` parameter is a pointer to an existing element to be removed
+     *  from the List.  The caller should protect the
+     *  list from being changed while using this call since it is non-atomic.
+     *
+     *  @param(elem)            element in list
+     */
+    @DirectCall
+    Void remove(Elem *elem);
+
+    /*!
+     *  ======== dequeue ========
+     *  Get element from front of List (non-atomic)
+     *
+     *  This function atomically removes the element from the front of a
+     *  List and returns a pointer to it.  This API is not thread safe.
+     *  Use {@link #put} and {@link #get} if multiple calling contexts
+     *  share the same list.
+     *
+     *  @b(returns)     pointer to former first element or NULL if empty
+     */
+    @DirectCall
+    Ptr dequeue();
+
+    /*!
+     *  ======== enqueue ========
+     *  Put element at end of List (non-atomic)
+     *
+     *  This function places the element at the end of a List.
+     *  This API is not thread safe.  Use {@link #put} and {@link #get}
+     *  if multiple calling contexts share the same list.
+     *
+     *  @param(elem)    pointer to new List element
+     */
+    @DirectCall
+    Void enqueue(Elem *elem);
+
+    /*!
+     *  ======== enqueueHead ========
+     *  Put element at head of List (non-atomic)
+     *
+     *  This function places the element at the front of the List.
+     *  This API is not thread safe.  Use {@link #putHead}
+     *  if multiple calling contexts share the same list.
+     *
+     *  @param(elem)    pointer to new List element
+     */
+    @DirectCall
+    Void enqueueHead(Elem *elem);
+
+internal:
+
+    /* instance object */
+    struct Instance_State {
+        Elem elem;
+    };
+}
diff --git a/packages/ti/sdo/utils/List.xs b/packages/ti/sdo/utils/List.xs
new file mode 100644 (file)
index 0000000..7955e7e
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== List.xs ========
+ */
+
+var List = null;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    List = this;
+
+    /* to minimize object size */
+    List.common$.namedInstance = false;
+}
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    Hwi = xdc.useModule("ti.sysbios.hal.Hwi");
+}
+
+/*
+ *  ======== instance$static$init ========
+ */
+function instance$static$init(obj, params)
+{
+    obj.elem.next = obj.elem.prev = obj.elem;
+
+    /* Add all the elem that we placed on the metaList */
+    for (var i = 0; i < params.metaList.length; i++) {
+         this.putMeta(params.metaList[i]);
+    }
+}
+
+/*
+ *  ======== elemClearMeta ========
+ */
+function elemClearMeta(elem)
+{
+    elem.next = elem.prev = elem;
+}
+
+/*
+ *  ======== putMeta ========
+ */
+function putMeta(elem)
+{
+    var obj = this.$object;
+
+    /* If the static$init has not been called, add to metaList*/
+    if (obj.elem.prev === undefined) {
+        this.metaList.$add(elem);
+    }
+    else {
+       /* Add directly into the object */
+       elem.next = obj.elem;
+       elem.prev = obj.elem.prev;
+       obj.elem.prev.next = elem;
+       obj.elem.prev = elem;
+    }
+}
+
+/*
+ *  ======== module$validate ========
+ */
+function module$validate()
+{
+    if (List.common$.namedInstance == true) {
+        List.$logError("The List module does not support namedInstances.",
+        List.common$, List.common$.namedInstance);
+    }
+}
+
+/*
+ *  ======== viewInitInstance ========
+ */
+function viewInitInstance(view, obj)
+{
+    var List = xdc.useModule('ti.sdo.utils.List');
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    view.label = Program.getShortName(obj.$label);
+
+    /*
+     * To check for loops, store each address as a key in a map,
+     * then with each new address check first if it is already in
+     * the map.
+     */
+    var addrs = {};
+
+    var e = obj.elem;
+    while (Number(e.next) != Number(obj.$addr)) {
+
+        /* Before fetching the next element, verify we're not in a loop. */
+        if (e.next in addrs) {
+            view.$status["elems"] = "List contains loop. Element " + e.$addr + " points to element " + e.next;
+            break;
+        }
+
+        /* Fetch the next element and add it to the array of elements. */
+        e = Program.fetchStruct(List.Elem$fetchDesc, e.next);
+        view.elems.$add(e.$addr);
+
+        /*
+         * Add the address to a map so we can check for loops.
+         * The value 'true' is just a placeholder to make sure the address
+         * is in the map.
+         */
+        addrs[e.$addr] = true;
+    }
+}
diff --git a/packages/ti/sdo/utils/MultiProc.c b/packages/ti/sdo/utils/MultiProc.c
new file mode 100644 (file)
index 0000000..4749020
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== MultiProc.c ========
+ *  Implementation of functions specified in MultiProc.xdc.
+ */
+
+#include <xdc/std.h>
+#include <string.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+
+#include "package/internal/MultiProc.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(MultiProc_getBaseIdOfCluster);
+    #pragma FUNC_EXT_CALLED(MultiProc_getId);
+    #pragma FUNC_EXT_CALLED(MultiProc_getName);
+    #pragma FUNC_EXT_CALLED(MultiProc_getNumProcessors);
+    #pragma FUNC_EXT_CALLED(MultiProc_getNumProcsInCluster);
+    #pragma FUNC_EXT_CALLED(MultiProc_self);
+    #pragma FUNC_EXT_CALLED(MultiProc_setBaseIdOfCluster);
+    #pragma FUNC_EXT_CALLED(MultiProc_setLocalId);
+#endif
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== MultiProc_getBaseIdOfCluster ========
+ */
+UInt16 MultiProc_getBaseIdOfCluster()
+{
+    return (MultiProc_module->baseIdOfCluster);
+}
+
+/*
+ *  ======== MultiProc_getId ========
+ */
+UInt16 MultiProc_getId(String name)
+{
+    Int    i;
+    UInt16 id;
+
+    Assert_isTrue(name != NULL, ti_sdo_utils_MultiProc_A_invalidProcName);
+
+    id = MultiProc_INVALIDID;
+    for (i = 0; i < ti_sdo_utils_MultiProc_numProcsInCluster; i++) {
+        if ((ti_sdo_utils_MultiProc_nameList[i] != NULL) &&
+            (strcmp(name, ti_sdo_utils_MultiProc_nameList[i]) == 0)) {
+            id = i + MultiProc_module->baseIdOfCluster;
+        }
+    }
+    return (id);
+}
+
+/*
+ *  ======== MultiProc_getClusterId ========
+ */
+UInt16 ti_sdo_utils_MultiProc_getClusterId(UInt16 procId)
+{
+    return (procId - MultiProc_module->baseIdOfCluster);
+}
+
+/*
+ *  ======== MultiProc_getName ========
+ */
+String MultiProc_getName(UInt16 id)
+{
+    Assert_isTrue((id < ti_sdo_utils_MultiProc_numProcessors),
+            ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    return (ti_sdo_utils_MultiProc_nameList[id -
+            MultiProc_module->baseIdOfCluster]);
+}
+
+/*
+ *  ======== MultiProc_getNumProcessors ========
+ */
+UInt16 MultiProc_getNumProcessors()
+{
+    return (ti_sdo_utils_MultiProc_numProcessors);
+}
+
+/*
+ *  ======== MultiProc_getNumProcsInCluster ========
+ */
+UInt16 MultiProc_getNumProcsInCluster()
+{
+    return (ti_sdo_utils_MultiProc_numProcsInCluster);
+}
+
+/*
+ *  ======== MultiProc_self ========
+ */
+UInt16 MultiProc_self()
+{
+    return (MultiProc_module->id);
+}
+
+/*
+ *  ======== MultiProc_setBaseIdOfCluster ========
+ */
+Int MultiProc_setBaseIdOfCluster(UInt16 baseId)
+{
+    /* baseId + numProcsInCluster must be less than the number of processors */
+    Assert_isTrue(((baseId + ti_sdo_utils_MultiProc_numProcsInCluster)
+            < ti_sdo_utils_MultiProc_numProcessors),
+            ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    /*
+     *  Check the following
+     *  1. Make sure the call is made before module startup
+     */
+    if (Startup_rtsDone() == FALSE) {
+       /* It is ok to set clusterBaseId */
+        MultiProc_module->baseIdOfCluster = baseId;
+
+        return (MultiProc_S_SUCCESS);
+    }
+
+    return (MultiProc_E_FAIL);
+}
+
+/*
+ *  ======== MultiProc_setLocalId ========
+ */
+Int MultiProc_setLocalId(UInt16 id)
+{
+    /* id must be less than the number of processors */
+    Assert_isTrue((id < ti_sdo_utils_MultiProc_numProcessors),
+            ti_sdo_utils_MultiProc_A_invalidMultiProcId);
+
+    /*
+     *  Check the following
+     *  1. Make sure the statically configured constant was invalid.
+     *     To call setLocalId, the id must have been set to invalid.
+     *  2. Make sure the call is made before module startup
+     */
+    if ((MultiProc_self() == MultiProc_INVALIDID) &&
+        (Startup_rtsDone() == FALSE)) {
+
+        /* It is ok to set the id */
+        MultiProc_module->id = id;
+        return (MultiProc_S_SUCCESS);
+    }
+
+    return (MultiProc_E_FAIL);
+}
+
+/*
+ *  ======== ti_sdo_utils_MultiProc_dummy ========
+ */
+Void ti_sdo_utils_MultiProc_dummy()
+{
+}
diff --git a/packages/ti/sdo/utils/MultiProc.xdc b/packages/ti/sdo/utils/MultiProc.xdc
new file mode 100644 (file)
index 0000000..d355e85
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProc.xdc ========
+ *
+ */
+
+import xdc.rov.ViewInfo;
+
+import xdc.runtime.Assert;
+
+/*!
+ *  ======== MultiProc ========
+ *  Processor Id Module Manager
+ *
+ *  Many IPC modules require identifying processors in a
+ *  multi-processor environment. The MultiProc module centralizes
+ *  processor id management into one module.  Since this configuration
+ *  is almost always universally required, most IPC applications
+ *  require supplying configuration of this module.
+ *
+ *  Each processor in the MultiProc module may be uniquely identified by
+ *  either a name string or an integer ranging from 0 to MAXPROCESSORS - 1.
+ *  Configuration is supplied using the {@link #setConfig} meta function,
+ *  the {@link #numProcessors} and {@link #baseIdOfCluster}.
+ *
+ *  The setConfig function tells the MultiProc module:
+ *  @p(blist)
+ *      - The specific processor for which the application is being built
+ *      - The number of processors in the cluster
+ *  @p
+ *
+ *  A cluster is a set of processors within a system which share some share
+ *  shared memory and supports notifications. Typically most systems contain
+ *  one cluster.  When there are multiple clusters in the system, the
+ *  {@link #numProcessors} and {@link #baseIdOfCluster} configuration
+ *  paramaters are required to be set before calling {@link #setConfig}
+ *
+ *  For examle in a system with 2 C6678 devices [each C6678 contains 8
+ *  homogeneuous cores].  For first C6678 device:
+ *  @p(code)
+ *  var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+ *  MultiProc.baseIdOfCluster = 0;
+ *  MultiProc.numProcessors = 16;
+ *  MultiProc.setConfig(null, ["CORE0", "CORE1", "CORE2", "CORE3",
+ *                             "CORE4", "CORE5", "CORE6", "CORE7"]);
+ *  @p
+ *
+ *  For second C6678 device:
+ *  @p(code)
+ *  var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+ *  MultiProc.baseIdOfCluster = 8;
+ *  MultiProc.numProcessors = 16;
+ *  MultiProc.setConfig(null, ["CORE0", "CORE1", "CORE2", "CORE3",
+ *                             "CORE4", "CORE5", "CORE6", "CORE7"]);
+ *  @p
+ *
+ *  Using the information supplied using the {@link #setConfig} meta function
+ *  and the {@link #baseIdOfCluster} module configuration, the processor IDs
+ *  are internally set.  Please refer to the documentation for
+ *  {@link #setConfig} and {@link #baseIdOfCluster} for more details.
+ *
+ *  At runtime, the {@link #getId} call returns the MultiProc id of those
+ *  processors within its cluster. At config-time, the {@link #getIdMeta}
+ *  call returns the the same value.
+ *
+ */
+
+module MultiProc
+{
+    metaonly struct ModuleView {
+        UInt16       id;                /* Own ID                           */
+        UInt16       numProcessors;     /* # of processors                  */
+        String       nameList[];        /* Proc names ordered by procId     */
+    }
+
+    @Facet
+    metaonly config ViewInfo.Instance rovViewInfo =
+        ViewInfo.create({
+            viewMap: [
+            [
+                'Module',
+                {
+                    type: ViewInfo.MODULE,
+                    viewInitFxn: 'viewInitModule',
+                    structName: 'ModuleView'
+                }
+            ],
+            ]
+        });
+
+    /*!
+     *  Assert raised when an invalid processor id is used
+     */
+    config Assert.Id A_invalidMultiProcId  = {
+        msg: "A_invalidMultiProcId: Invalid MultiProc id"
+    };
+
+    /*!
+     *  Assert raised when a NULL processor name is encountered
+     */
+    config Assert.Id A_invalidProcName  = {
+        msg: "A_invalidProcName: NULL MultiProc name encountered"
+    };
+
+    /*!
+     *  Invalid processor id constant
+     *
+     *  This constant denotes that the processor id is not valid.
+     */
+    const UInt16 INVALIDID = 0xFFFF;
+
+    /*! @_nodoc
+     *  ======== nameList ========
+     *  Unique name for the each processor used in a multi-processor app
+     *
+     *  This array should never be set or read directly by the MultiProc user.
+     *  The nameList is used to store names configuration supplied via the
+     *  {@link #setConfig} static function.
+     *
+     *  At runtime, the {@link #getName} function may be used to retrieve
+     *  the name of any processor given it's MultiProc id.
+     */
+    config String nameList[];
+
+    /*! @_nodoc
+     *  ======== id ========
+     *  Unique software id number for the processor
+     *
+     *  This value should never be set or read directly by the MultiProc user.
+     *  Instead, the {@link #getId}, {@link #getIdMeta}, and
+     *  {@link #setLocalId} calls should be used to respectively retrieve any
+     *  processors' MultiProc ids or set the local processor's MultiProc id.
+     */
+    metaonly config UInt16 id = 0;
+
+    /*! @_nodoc
+     *  ======== numProcsInCluster ========
+     *  Number of processors in a cluster
+     *
+     *  This parameter should never be set: numProcsInCluster is
+     *  internally set by the {@link #setConfig} meta function.
+     *  setConfig statically sets the value of this configuration to the
+     *  length of the supplied nameList array.
+     */
+    config UInt16 numProcsInCluster = 1;
+
+    /*!
+     *  ======== baseIdOfCluster ========
+     *  The base id of the cluster.
+     *
+     *  Using this base id, the id of each processor in the cluster
+     *  is set based up its position in {@link #setConfig}. When more
+     *  more than one cluster exists in the system, this parameter must
+     *  be set before calling {@link #setConfig}.
+     */
+    metaonly config UInt16 baseIdOfCluster = 0;
+
+    /*!
+     *  ======== numProcessors ========
+     *  Number of processors in the system
+     *
+     *  This configuration should only be set when there is more than one
+     *  cluster in the system.  It must be set before calling
+     *  {@link #setConfig}. If the system contains only one cluster,
+     *  it is internally set by the {@link #setConfig} meta function to the
+     *  length of the supplied nameList array.
+     *  After {@link #setConfig} has been  called, it is possible to
+     *  retrive the maximum # of processors by reading this module config
+     *  either at run-time or at config time.
+     */
+    config UInt16 numProcessors = 1;
+
+    /*! @_nodoc
+     *  ======== getClusterId ========
+     */
+    UInt16 getClusterId(UInt16 procId);
+
+    /*!
+     *  ======== getIdMeta ========
+     *  Meta version of {@link #getId}
+     *
+     *  Statically returns the internally set ID based on configuration
+     *  supplied via {@link #setConfig}.
+     *
+     *  @param(name)        MultiProc procName
+     */
+    metaonly UInt16 getIdMeta(String name);
+
+    /*!
+     *  ======== getDeviceProcNames ========
+     *  Returns an array of all possible processor names on the build device
+     *
+     *  @(return)           Array of valid MultiProc processor names
+     */
+    metaonly Any getDeviceProcNames();
+
+    /*!
+     *  ======== setConfig ========
+     *  Configure the MultiProc module
+     *
+     *  Configuration of the MultiProc module is primarily accomplished using
+     *  the setConfig API at config time.  The setConfig API allows the
+     *  MultiProc module to identify:
+     *  @p(blist)
+     *      - Which is the local processor
+     *      - Which processors are being used
+     *      - Which processors can synchronize
+     *  @p
+     *  The second of these two pieces of information is supplied via the
+     *  nameList argument.  The nameList is a non-empty set of distinct
+     *  processors valid for the particular device.  For a list of valid
+     *  processor names for a given device, please refer to the :
+     *  {@link ./../ipc/family/doc-files/procNames.html Table of
+     *   Valid Names for Each Device}.
+     *
+     *  The local processor is identified by using a single name from
+     *  nameList.  A MultiProc id is internally set to the index of
+     *  'name' in the supplied 'nameList'.  I.e. in the example:
+     *
+     *  @p(code)
+     *  MultiProc.setConfig("DSP", ["HOST", "DSP", "OTHERCORE"]);
+     *  @p
+     *
+     *  The processors, "HOST", "DSP" and "OTHERCORE" get assigned MultiProc
+     *  IDs 0, 1, and 2, respectively.  The local processor, "DSP" is assigned
+     *  an ID of '1'.
+     *
+     *  If the local processor is not known at static time, it is possible to
+     *  supply a null name. MultiProc will set the local id to
+     *  {@link #INVALIDID} until it is set at runtime using
+     *  MultiProc_setLocalId.
+     *
+     *  @param(name)        MultiProc name for the local processor
+     *  @param(nameList)    Array of all processors used by the application
+     */
+    metaonly Void setConfig(String name, String nameList[]);
+
+    /*! @_nodoc
+     *  ======== getName$view ========
+     *  ROV-time version of {@link #getName}
+     */
+    metaonly String getName$view(UInt id);
+
+    /*! @_nodoc
+     *  ======== self$view ========
+     *  ROV-time version of {@link #self}
+     */
+    metaonly UInt self$view();
+
+    /*! @_nodoc
+     *  This is needed to prevent the MultiProc module from being optimized away
+     *  during the whole_program[_debug] partial link.
+     */
+    Void dummy();
+
+internal:
+
+    /* list of processor id's in cluster */
+    config UInt16 procIdList[];
+
+    /* id is in Module_State to support the changing of it via setLocalId */
+    struct Module_State {
+        UInt16 id;
+        UInt16 baseIdOfCluster;
+    };
+}
diff --git a/packages/ti/sdo/utils/MultiProc.xs b/packages/ti/sdo/utils/MultiProc.xs
new file mode 100644 (file)
index 0000000..c9e442d
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== MultiProc.xs ========
+ *
+ */
+
+var MultiProc = null;
+var BaseIdOfCluster = null;
+var NumProcessors = null;
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    MultiProc = this;
+
+    if (((BaseIdOfCluster != MultiProc.baseIdOfCluster) &&
+        (BaseIdOfCluster != null)) ||
+        ((NumProcessors != MultiProc.numProcessors) &&
+        (NumProcessors != null))) {
+        MultiProc.$logError("MultiProc.numProcessors and " +
+                            "MultiProc.baseIdOfCluster must be " +
+                            "set before MultiProc.setConfig()", this);
+    }
+
+    /* Make sure the name list is not too long... */
+    if (MultiProc.nameList.length > MultiProc.numProcsInCluster) {
+        MultiProc.$logError("The name list is too long. numProcessors = " +
+                            MultiProc.numProcsInCluster, this);
+    }
+    else if (MultiProc.nameList.length < MultiProc.numProcsInCluster) {
+        /* If too short, fill in with nulls */
+        var len = MultiProc.nameList.length;
+        MultiProc.nameList.length = MultiProc.numProcsInCluster;
+        for (var i = len; i < MultiProc.numProcsInCluster; i++) {
+            MultiProc.nameList[i] = null;
+        }
+    }
+
+    /*
+     *  Make sure the id is ok (e.g. not equal to or greater than numProcessors)
+     *  If it is INVALID (e.g. set at runtime) do not do the check.
+     */
+    if ((MultiProc.id != MultiProc.INVALIDID) &&
+        (MultiProc.id >= MultiProc.numProcessors)) {
+
+        MultiProc.$logError("The processor id (" + MultiProc.id +
+            ") is larger than numProcessors (" + MultiProc.numProcessors +
+            ")", this);
+    }
+}
+
+/*
+ *  ======== setConfig ========
+ */
+function setConfig(name, nameList)
+{
+    var Settings = xdc.module('ti.sdo.ipc.family.Settings');
+    MultiProc = this;
+
+    MultiProc.nameList          = nameList;
+    MultiProc.id                = MultiProc.INVALIDID;
+
+    /* set/check numProcsInCluster */
+    if (!(MultiProc.$written("numProcsInCluster"))) {
+        /*
+         *  If numProcsInCluster is not set, then set it to the
+         *  length of the nameList.
+         */
+        MultiProc.numProcsInCluster = nameList.length;
+    }
+
+    /* set/check numProcessors */
+    if (!(MultiProc.$written("baseIdOfCluster"))) {
+        if (!(MultiProc.$written("numProcessors"))) {
+            /*
+             *  If baseIdOfCluster is not set and numProcessors is not set
+             *  then set numProcessors to numProcsInCluster
+             */
+            MultiProc.numProcessors = MultiProc.numProcsInCluster;
+        }
+    }
+    else {
+        if (!(MultiProc.$written("numProcessors"))) {
+            /*
+             *  If baseIdOfCluster is set and numProcessors is not set
+             *  then throw error because numProcessors needs to be set
+             */
+            MultiProc.$logError("MultiProc.numProcessors needs to be set" +
+                " before calling MultiProc.setConfig()", this);
+        }
+    }
+
+    /* BaseIdOfCluster and NumProcessors must not change after this point */
+    NumProcessors = MultiProc.numProcessors;
+    BaseIdOfCluster = MultiProc.baseIdOfCluster;
+
+    /* create the list of processor ids */
+    MultiProc.procIdList.length = MultiProc.numProcsInCluster;
+    for (var i = 0; i < MultiProc.numProcsInCluster; i++) {
+        MultiProc.procIdList[i] = i + MultiProc.baseIdOfCluster;
+    }
+
+    if (nameList.length == 0) {
+        /* Empty name array supplied */
+        MultiProc.$logError("'nameList' cannot be empty", this);
+    }
+    else {
+        /* Check for duplicate names in nameList */
+        var temp = [];
+        for each (procName in nameList) {
+            if (temp[procName] != null) {
+                MultiProc.$logError("nameList has a duplicate name: " +
+                        procName, this);
+            }
+            temp[procName] = 1;
+        }
+    }
+
+    /*
+     *  Check for valid nameList names.  I.e. if building on DM6446, the only
+     *  possible names in nameList are "HOST" and "DSP".
+     */
+    if (MultiProc.numProcsInCluster > 1) {
+        for each (var tempName in MultiProc.nameList) {
+            if (tempName != null && !Settings.procInDevice(tempName)) {
+                MultiProc.$logError("The MultiProc name (" + tempName +
+                    ") does not match any of the following possible names on the"
+                    + " device (" + Program.cpu.deviceName + "): " +
+                    Settings.getDeviceProcNames().join(", "),
+                    this);
+            }
+        }
+    }
+
+    /* If name is not null, set the id here otherwise set it at runtime */
+    if (name != null) {
+        /* Set MultiProc.id from the name */
+        var id = this.getIdMeta(name);
+
+        if (id == MultiProc.INVALIDID) {
+            MultiProc.$logError("The processor name (" + name +
+                ") is not contained within the nameList", this);
+        }
+
+        /* only get here if id is valid */
+        MultiProc.id = id + MultiProc.baseIdOfCluster;
+    }
+    else if (MultiProc.numProcsInCluster == 1) {
+        /* There is only 1 processor so set id to the base of cluster */
+        MultiProc.id = MultiProc.baseIdOfCluster;
+    }
+}
+
+/*
+ *  ======== getDeviceProcNames ========
+ */
+function getDeviceProcNames()
+{
+    var Settings = xdc.module('ti.sdo.ipc.family.Settings');
+
+    return (Settings.getDeviceProcNames());
+}
+
+/*
+ *  ======== getIdMeta ========
+ */
+function getIdMeta(name)
+{
+    MultiProc = this;
+
+    var id = MultiProc.INVALIDID;
+
+    if (name != null) {
+        for (var i in MultiProc.nameList) {
+            if (MultiProc.nameList[i] == name) {
+                id = Number(i);
+            }
+        }
+    }
+    else {
+        /* Get our 'own' MultiProc id */
+        id = MultiProc.id;
+    }
+
+    return (id);
+}
+
+/*
+ *  ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    mod.id = params.id;
+    mod.baseIdOfCluster = params.baseIdOfCluster;
+}
+
+/*
+ *  ======== getName$view ========
+ *  ROV helper function that returns a processor name given its id
+ */
+function getName$view(id)
+{
+    var name;
+
+    /*
+     * Scan in the MultiProc view so we have the mapping from processor id
+     * to processor name.
+     */
+    try {
+        var multiProcView = Program.scanModuleView('ti.sdo.utils.MultiProc',
+                                                   'Module');
+    }
+    catch (e) {
+        /*
+         * If there was a problem scanning the MultiProc view, throw an error
+         */
+        throw("Error scanning MultiProc module view: " + String(e));
+    }
+
+    /* Check whether id is valid; throw an error if not */
+    if (id > multiProcView.numProcessors) {
+        throw("Invalid MultiProc id: " + id);
+    }
+
+    /* Since nameList is ordered by id, we can directly index the array */
+    name = multiProcView.nameList[id];
+
+    return (name);
+}
+
+/*
+ *  ======== self$view ========
+ *  ROV helper function that returns the local MultiProc id
+ */
+function self$view()
+{
+    /* Retrieve the module state. */
+    var rawView = Program.scanRawView('ti.sdo.utils.MultiProc');
+    var mod = rawView.modState;
+
+    return (mod.id);
+}
+
+/*
+ *  ======== viewInitModule ========
+ *  Display the module properties in ROV
+ */
+function viewInitModule(view, mod)
+{
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    var Program = xdc.useModule('xdc.rov.Program');
+    var multiprocModConfig =  Program.getModuleConfig(MultiProc.$name);
+
+    view.id            = mod.id;
+    view.numProcessors = multiprocModConfig.numProcsInCluster;
+
+    /* Drop-down of the names */
+    view.nameList.length = multiprocModConfig.nameList.length
+    for (var i =0; i < multiprocModConfig.nameList.length; i++) {
+        if (multiprocModConfig.nameList[i] != null)  {
+            view.nameList[i] = multiprocModConfig.nameList[i];
+        }
+        else {
+            view.nameList[i] = "[unnamed]";
+        }
+    }
+}
diff --git a/packages/ti/sdo/utils/NameServer.c b/packages/ti/sdo/utils/NameServer.c
new file mode 100644 (file)
index 0000000..2f176a2
--- /dev/null
@@ -0,0 +1,958 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== NameServer.c ========
+ *  Implementation of functions specified in NameServer.xdc.
+ */
+
+ /*
+ *  The dynamic name/value table looks like the following. This approach allows
+ *  each instance table to have different value and different name lengths.
+ *  The names block is allocated on the create. The size of that block is
+ *  (maxRuntimeEntries * maxNameLen). That block is sliced and diced up and
+ *  given to each table entry.
+ *  The same thing is done for the values block.
+ *
+ *     names                    table                  values
+ *   -------------           -------------          -------------
+ *   |           |<-\        |   elem    |   /----->|           |
+ *   |           |   \-------|   name    |  /       |           |
+ *   |           |           |   value   |-/        |           |
+ *   |           |           |   len     |          |           |
+ *   |           |<-\        |-----------|          |           |
+ *   |           |   \       |   elem    |          |           |
+ *   |           |    \------|   name    |  /------>|           |
+ *   |           |           |   value   |-/        |           |
+ *   -------------           |   len     |          |           |
+ *                           -------------          |           |
+ *                                                  |           |
+ *                                                  |           |
+ *                                                  -------------
+ *
+ *  There is an optimization for small values (e.g. <= sizeof(UInt32).
+ *  In this case, there is no values block allocated. Instead the value
+ *  field is used directly.  This optimization occurs and is managed when
+ *  obj->maxValueLen <= sizeof(Uint32).
+ *
+ *  The static create is a little different. The static entries point directly
+ *  to a name string (and value). Since it points directly to static items,
+ *  this entries cannot be removed.
+ *  If maxRuntimeEntries is non-zero, a names and values block is created.
+ *  Here is an example of a table with 1 static entry and 2 dynamic entries
+ *
+ *                           -------------
+ *                           |   elem    |
+ *      "myName" <-----------|   name    |----------> someValue
+ *                           |   value   |
+ *     names                 |   len     |              values
+ *   -------------           -------------          -------------
+ *   |           |<-\        |   elem    |   /----->|           |
+ *   |           |   \-------|   name    |  /       |           |
+ *   |           |           |   value   |-/        |           |
+ *   |           |           |   len     |          |           |
+ *   |           |<-\        |-----------|          |           |
+ *   |           |   \       |   elem    |          |           |
+ *   |           |    \------|   name    |  /------>|           |
+ *   |           |           |   value   |-/        |           |
+ *   -------------           |   len     |          |           |
+ *                           -------------          |           |
+ *                                                  |           |
+ *                                                  |           |
+ *                                                  -------------
+ *
+ *  NameServer uses a freeList and nameList to maintain the empty
+ *  and filled-in entries. So when a name/value pair is added, an entry
+ *  is pulled off the freeList, filled-in and placed on the nameList.
+ *  The reverse happens on a remove.
+ *
+ *  For static adds, the entries are placed on the nameList statically.
+ *
+ *  For dynamic creates, the freeList is populated in postInit and there are no
+ *  entries placed on the nameList (this happens when the add is called).
+ */
+
+/* below #define to eliminate strncpy depracation warning for win targets */
+#define _CRT_SECURE_NO_DEPRECATE
+
+#include <xdc/std.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Startup.h>
+
+#include <ti/sysbios/gates/GateSwi.h>
+#include <ti/sysbios/hal/Hwi.h>
+
+#include <ti/sdo/utils/List.h>
+#include <ti/sdo/utils/INameServerRemote.h>
+
+#include <ti/sdo/utils/_MultiProc.h>
+#include <ti/sdo/utils/_NameServer.h>
+
+#include "package/internal/NameServer.xdc.h"
+
+#ifdef __ti__
+    #pragma FUNC_EXT_CALLED(NameServer_Params_init);
+    #pragma FUNC_EXT_CALLED(NameServer_add);
+    #pragma FUNC_EXT_CALLED(NameServer_addUInt32);
+    #pragma FUNC_EXT_CALLED(NameServer_create);
+    #pragma FUNC_EXT_CALLED(NameServer_delete);
+    #pragma FUNC_EXT_CALLED(NameServer_get);
+    #pragma FUNC_EXT_CALLED(NameServer_getHandle);
+    #pragma FUNC_EXT_CALLED(NameServer_getLocal);
+    #pragma FUNC_EXT_CALLED(NameServer_getLocalUInt32);
+    #pragma FUNC_EXT_CALLED(NameServer_getUInt32);
+    #pragma FUNC_EXT_CALLED(NameServer_match);
+    #pragma FUNC_EXT_CALLED(NameServer_remove);
+    #pragma FUNC_EXT_CALLED(NameServer_removeEntry);
+#endif
+
+/*
+ *************************************************************************
+ *                       Common Header Functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== NameServer_Params_init ========
+ */
+Void NameServer_Params_init(NameServer_Params *params)
+{
+    /* init the params to the defaults */
+    params->maxRuntimeEntries = NameServer_ALLOWGROWTH;
+    params->tableHeap         = NULL;
+    params->checkExisting     = TRUE;
+    params->maxValueLen       = 0;
+    params->maxNameLen        = NameServer_Params_MAXNAMELEN;
+}
+
+/*
+ *  ======== NameServer_add ========
+ *  Grab a free entry and fill it up.
+ */
+Ptr NameServer_add(NameServer_Handle handle, String name, Ptr value,
+                   UInt32 len)
+{
+    ti_sdo_utils_NameServer_Object *obj =
+            (ti_sdo_utils_NameServer_Object *)handle;
+    IArg key;
+    ti_sdo_utils_NameServer_TableEntry *tableEntry;
+    Error_Block eb;
+    List_Handle freeList = ti_sdo_utils_NameServer_Instance_State_freeList(obj);
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    /* Make sure the name and value can be copied into the table */
+    Assert_isTrue((len <= obj->maxValueLen),
+            ti_sdo_utils_NameServer_A_invalidLen);
+    Assert_isTrue((strlen(name) < obj->maxNameLen),
+            ti_sdo_utils_NameServer_A_invalidLen);
+
+    Error_init(&eb);
+
+    /* Only check if configured to check */
+    if (obj->checkExisting == TRUE ) {
+        key = GateSwi_enter(NameServer_module->gate);
+        if (NameServer_findLocal(obj, name) != NULL) {
+            GateSwi_leave(NameServer_module->gate, key);
+            Error_raise(&eb, ti_sdo_utils_NameServer_E_entryExists, name, 0);
+            return (NULL);
+        }
+        GateSwi_leave(NameServer_module->gate, key);
+    }
+
+    /* Get a free entry */
+    tableEntry = List_get(freeList);
+
+    /* If no entry, see if numDynamic is set to allow growth or raise error */
+    if (tableEntry == NULL) {
+        if (obj->numDynamic == NameServer_ALLOWGROWTH) {
+
+            tableEntry = Memory_alloc(obj->tableHeap,
+                sizeof(ti_sdo_utils_NameServer_TableEntry), 0, &eb);
+            if (tableEntry == NULL) {
+                return (NULL);
+            }
+
+            tableEntry->name = Memory_alloc(obj->tableHeap,
+                    strlen(name) + 1, 0, &eb);
+            if (tableEntry->name == NULL) {
+                Memory_free(obj->tableHeap, tableEntry,
+                            sizeof(ti_sdo_utils_NameServer_TableEntry));
+                return (NULL);
+            }
+
+            if (!(obj->maxValueLen == sizeof(UInt32))) {
+
+                tableEntry->value = (UArg)Memory_alloc(obj->tableHeap,
+                        obj->maxValueLen, 0, &eb);
+                if (tableEntry->value == NULL) {
+                    Memory_free(obj->tableHeap, tableEntry,
+                            sizeof(ti_sdo_utils_NameServer_TableEntry));
+                    Memory_free(obj->tableHeap, tableEntry->name,
+                            strlen(name) + 1);
+                    return (NULL);
+                }
+            }
+        }
+        else {
+            Error_raise(&eb, ti_sdo_utils_NameServer_E_maxReached,
+                    obj->numDynamic, 0);
+            return (NULL);
+        }
+    }
+
+    /*
+     *  Fill in the value.
+     *  If the maxValueLen is sizeof(UInt32), simply copy
+     *  the value into the value field.
+     */
+    if (obj->maxValueLen == sizeof(UInt32)) {
+        tableEntry->value = *((UInt32 *)value);
+        tableEntry->len = sizeof(UInt32);
+    }
+    else {
+        memcpy((Ptr)(tableEntry->value), (Ptr)value, len);
+        tableEntry->len = len;
+    }
+
+    /* Copy the name. Note the table holds the '\0' also */
+    strncpy(tableEntry->name, name, strlen(name) + 1);
+
+    /* Add to the nameList */
+    List_put(nameList, (List_Elem *)tableEntry);
+
+    return (tableEntry);
+}
+
+/*
+ *  ======== NameServer_addUInt32 ========
+ *  Defer to the add.
+ */
+Ptr NameServer_addUInt32(NameServer_Handle handle, String name, UInt32 value)
+{
+    return (NameServer_add(handle, name, &value, sizeof(UInt32)));
+}
+
+/*
+ *  ======== NameServer_create ========
+ */
+NameServer_Handle NameServer_create(String name, const NameServer_Params *params)
+{
+    ti_sdo_utils_NameServer_Params nsParams;
+    ti_sdo_utils_NameServer_Object *obj;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    if (params != NULL) {
+        /* init the module params struct */
+        ti_sdo_utils_NameServer_Params_init(&nsParams);
+        nsParams.maxRuntimeEntries = params->maxRuntimeEntries;
+        nsParams.tableHeap         = params->tableHeap;
+        nsParams.checkExisting     = params->checkExisting;
+        nsParams.maxValueLen       = params->maxValueLen;
+        nsParams.maxNameLen        = params->maxNameLen;
+
+        /* call the module create */
+        obj = ti_sdo_utils_NameServer_create(name, &nsParams, &eb);
+    }
+    else {
+        /* passing in NULL uses the default params */
+        obj = ti_sdo_utils_NameServer_create(name, NULL, &eb);
+    }
+
+    return ((NameServer_Handle)obj);
+}
+
+/*
+ *  ======== NameServer_delete ========
+ */
+Int NameServer_delete(NameServer_Handle *handlePtr)
+{
+    ti_sdo_utils_NameServer_delete(
+        (ti_sdo_utils_NameServer_Handle *)handlePtr);
+
+    return (NameServer_S_SUCCESS);
+}
+
+/*
+ *  ======== NameServer_get ========
+ *  Currently not using ISync in RemoteProxy call. This is for async support.
+ */
+Int NameServer_get(NameServer_Handle handle, String name, Ptr value,
+                   UInt32 *len, UInt16 procId[])
+{
+    ti_sdo_utils_NameServer_Object *obj =
+            (ti_sdo_utils_NameServer_Object *)handle;
+    Int i;
+    Int status = NameServer_E_FAIL;
+    Error_Block eb;
+
+    Error_init(&eb);
+
+    /*
+     *  Query all the processors.
+     */
+    if (procId == NULL) {
+        /* Query the local one first */
+        status = NameServer_getLocal(handle, name, value, len);
+        if (status == NameServer_E_NOTFOUND) {
+            /* To eliminate code if possible */
+            if (ti_sdo_utils_NameServer_singleProcessor == FALSE) {
+                /* Query all the remote processors */
+                for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+                    /* Skip the local table. It was already searched */
+                    if (i != MultiProc_self()) {
+                        if (NameServer_module->nsRemoteHandle[i] != NULL) {
+                            status = INameServerRemote_get(
+                                     NameServer_module->nsRemoteHandle[i],
+                                     obj->name, name, value, len, NULL, &eb);
+                        }
+
+                        /* continue only if not found */
+                        if ((status >= 0) ||
+                            ((status < 0) &&
+                            (status != NameServer_E_NOTFOUND))) {
+                             break;
+                        }
+                    }
+                }
+            }
+        }
+    }
+    else {
+        /*
+         *  Search the query list. It might contain the local proc
+         *  somewhere in the list.
+         */
+        i = 0;
+        status = NameServer_E_NOTFOUND;
+        while (procId[i] != MultiProc_INVALIDID) {
+            if (procId[i] == MultiProc_self()) {
+                /* Check local */
+                status = NameServer_getLocal(handle, name, value, len);
+            }
+            else if (ti_sdo_utils_NameServer_singleProcessor == FALSE) {
+                /* Check remote */
+                if (NameServer_module->nsRemoteHandle[procId[i]] != NULL) {
+                    status = INameServerRemote_get(
+                             NameServer_module->nsRemoteHandle[procId[i]],
+                             obj->name, name, value, len, NULL, &eb);
+                }
+            }
+
+            /* continue only if not found */
+            if ((status >= 0) ||
+                ((status < 0) &&
+                (status != NameServer_E_NOTFOUND))) {
+                 break;
+            }
+            else {
+                i++;
+
+                /* if we've queried all procs then exit */
+                if (i == MultiProc_getNumProcsInCluster()) {
+                    break;
+                }
+            }
+        }
+    }
+
+    return (status);
+}
+
+/*
+ *  ======== NameServer_getHandle ========
+ *  Helper function to get a handle based on the instance name.
+ */
+NameServer_Handle NameServer_getHandle(String instanceName)
+{
+    ti_sdo_utils_NameServer_Object *obj;
+    IArg key;
+    Int i;
+
+    /* Search static instances */
+    for (i = 0; i < ti_sdo_utils_NameServer_Object_count(); i++) {
+        obj = ti_sdo_utils_NameServer_Object_get(NULL, i);
+        if ((obj->name != NULL) &&
+            (strcmp(obj->name, instanceName) == 0)) {
+            return ((NameServer_Handle)obj);
+        }
+    }
+
+    /* Search dynamic instances (in a thread safe manner) */
+    key = GateSwi_enter(NameServer_module->gate);
+
+    obj = ti_sdo_utils_NameServer_Object_first();
+    while (obj != NULL) {
+        if ((obj->name != NULL) &&
+            (strcmp(obj->name, instanceName) == 0)) {
+            GateSwi_leave(NameServer_module->gate, key);
+            return ((NameServer_Handle)obj);
+        }
+        obj = ti_sdo_utils_NameServer_Object_next(obj);
+    }
+    GateSwi_leave(NameServer_module->gate, key);
+
+    return (NULL);
+}
+
+/*
+ *  ======== NameServer_getLocal ========
+ */
+Int NameServer_getLocal(NameServer_Handle handle, String name, Ptr value,
+                        UInt32 *len)
+{
+    ti_sdo_utils_NameServer_Object *obj =
+            (ti_sdo_utils_NameServer_Object *)handle;
+    IArg key;
+    ti_sdo_utils_NameServer_TableEntry *tableEntry;
+
+    key = GateSwi_enter(NameServer_module->gate);
+
+    /* search the local table */
+    tableEntry = NameServer_findLocal(obj, name);
+
+    if (tableEntry != NULL) {
+        /*
+         *  Found the entry.
+         *  If the table holds value (and not buffers) simply
+         *  copy into value and return
+         */
+        if (obj->maxValueLen == sizeof(UInt32)) {
+            memcpy((Ptr)value, &(tableEntry->value), sizeof(UInt32));
+        }
+        else {
+            Assert_isTrue((tableEntry->len <= *len), ti_sdo_utils_NameServer_A_invalidLen);
+            memcpy((Ptr)value, (Ptr)(tableEntry->value), tableEntry->len);
+        }
+        GateSwi_leave(NameServer_module->gate, key);
+        *len = tableEntry->len;
+        return (NameServer_S_SUCCESS);
+    }
+
+    GateSwi_leave(NameServer_module->gate, key);
+
+    /* Name not found locally. */
+    return (NameServer_E_NOTFOUND);
+}
+
+/*
+ *  ======== NameServer_getLocalUInt32 ========
+ *
+ */
+Int NameServer_getLocalUInt32(NameServer_Handle handle, String name, Ptr value)
+{
+    UInt32 len = sizeof(UInt32);
+    Int status;
+
+    status = NameServer_getLocal(handle, name, value, &len);
+
+    return (status);
+}
+
+/*
+ *  ======== NameServer_getUInt32 ========
+ */
+Int NameServer_getUInt32(NameServer_Handle handle, String name,
+                         Ptr value, UInt16 remoteProcId[])
+{
+    UInt32 len = sizeof(UInt32);
+    Int status;
+
+    status = NameServer_get(handle, name, value, &len, remoteProcId);
+
+    return (status);
+}
+
+/*  ======== NameServer_match ========
+ *  Currently only supporting 32-bit values.
+ */
+Int NameServer_match(NameServer_Handle handle, String name, UInt32 *value)
+{
+    ti_sdo_utils_NameServer_Object *obj =
+            (ti_sdo_utils_NameServer_Object *)handle;
+    Int len = 0;
+    Int foundLen = 0;
+    IArg key;
+    ti_sdo_utils_NameServer_TableEntry *tableEntry = NULL;
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    Assert_isTrue((sizeof(UInt32) == obj->maxValueLen),
+            ti_sdo_utils_NameServer_A_invalidLen);
+
+    key = GateSwi_enter(NameServer_module->gate);
+
+    /* Search the entire table and find the longest match */
+    while ((tableEntry = List_next(nameList, (List_Elem*)tableEntry)) != NULL) {
+
+        len = strlen(tableEntry->name);
+
+        /*
+         *  Only check if the name in the table is going to potentially be
+         *  a better match.
+         */
+        if (len > foundLen) {
+            if (strncmp(name, tableEntry->name, len) == 0) {
+                *value = (UInt32)(tableEntry->value);
+                foundLen = len;
+            }
+        }
+    }
+
+    GateSwi_leave(NameServer_module->gate, key);
+
+    /* The name was not found...return 0 characters matched*/
+    return (foundLen);
+}
+
+/*
+ *  ======== NameServer_remove ========
+ *  Remove a name/value pair.
+ */
+Int NameServer_remove(NameServer_Handle handle, String name)
+{
+    ti_sdo_utils_NameServer_Object *obj =
+            (ti_sdo_utils_NameServer_Object *)handle;
+    UInt i;
+    IArg key;
+    Int status = NameServer_E_INVALIDARG;
+    ti_sdo_utils_NameServer_TableEntry *tableEntry = NULL;
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    /* Skip over the static ones. They are always at the head of the list */
+    for (i = 0; i < obj->numStatic; i++) {
+        tableEntry = List_next(nameList, (List_Elem *)tableEntry);
+    }
+
+    /* Enter the gate. */
+    key = GateSwi_enter(NameServer_module->gate);
+
+    /* Loop through the list searching for the name */
+    while ((tableEntry = List_next(nameList, (List_Elem*)tableEntry)) != NULL) {
+        /* Remove it from the nameList and add to the freeList */
+        if (strcmp(tableEntry->name, name) == 0) {
+            NameServer_removeLocal(obj, tableEntry);
+            status = NameServer_S_SUCCESS;
+            break;
+        }
+    }
+
+    /* Leave the gate */
+    GateSwi_leave(NameServer_module->gate, key);
+
+    return (status);
+}
+
+/*
+ *  ======== NameServer_removeEntry ========
+ */
+Int NameServer_removeEntry(NameServer_Handle handle, Ptr entry)
+{
+    ti_sdo_utils_NameServer_Object *obj =
+            (ti_sdo_utils_NameServer_Object *)handle;
+
+    NameServer_removeLocal(obj, (ti_sdo_utils_NameServer_TableEntry *)entry);
+
+    return (NameServer_S_SUCCESS);
+}
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_utils_NameServer_Instance_init ========
+ */
+Int ti_sdo_utils_NameServer_Instance_init(
+        ti_sdo_utils_NameServer_Object *obj, String name,
+        const ti_sdo_utils_NameServer_Params *params, Error_Block *eb)
+{
+    List_Handle freeList = ti_sdo_utils_NameServer_Instance_State_freeList(obj);
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    obj->name          = name;
+    obj->numStatic     = 0;
+    obj->numDynamic    = params->maxRuntimeEntries;
+    obj->checkExisting = params->checkExisting;
+    obj->maxNameLen    = params->maxNameLen;
+    obj->table         = NULL;
+    obj->values        = NULL;
+    obj->names         = NULL;
+
+    if (params->tableHeap == NULL) {
+        obj->tableHeap = ti_sdo_utils_NameServer_Object_heap();
+    }
+    else {
+        obj->tableHeap = params->tableHeap;
+    }
+
+    /* minimum value of maxValueLen is sizeof(UInt32) */
+    if (params->maxValueLen < sizeof(UInt32)) {
+        obj->maxValueLen = sizeof(UInt32);
+    }
+    else {
+        obj->maxValueLen = params->maxValueLen;
+    }
+
+    /* Construct the free and name lists */
+    List_construct(List_struct(freeList), NULL);
+    List_construct(List_struct(nameList), NULL);
+
+    /* Allocate the entry table. */
+    if (obj->numDynamic != NameServer_ALLOWGROWTH) {
+        obj->table = Memory_alloc(obj->tableHeap,
+            sizeof(ti_sdo_utils_NameServer_TableEntry) * obj->numDynamic, 0, eb);
+
+        if (obj->table == NULL) {
+            return (3);
+        }
+
+        /*
+         * Allocate one big buffer that will be used for a copy of the values.
+         * Allocate not done when size == UInt32 because we copy the value
+         * to obj->values directly and do not need the extra space.
+         */
+        if (!(obj->maxValueLen == sizeof(UInt32))) {
+            obj->values = Memory_alloc(obj->tableHeap,
+                          obj->maxValueLen * obj->numDynamic, 0, eb);
+
+            if (obj->values == NULL) {
+                return (2);
+            }
+        }
+
+        /* Allocate one big buffer that will be used for a copy of the names */
+        obj->names = Memory_alloc(obj->tableHeap,
+                         params->maxNameLen * obj->numDynamic, 0, eb);
+        if (obj->names == NULL) {
+            return (1);
+        }
+
+        /* Finish the rest of the object init */
+        NameServer_postInit(obj);
+    }
+
+    return(0);
+}
+
+/*
+ *  ======== ti_sdo_utils_NameServer_Instance_finalize ========
+ */
+Void ti_sdo_utils_NameServer_Instance_finalize(
+        ti_sdo_utils_NameServer_Object *obj, Int status)
+{
+    List_Handle freeList = ti_sdo_utils_NameServer_Instance_State_freeList(obj);
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+    ti_sdo_utils_NameServer_TableEntry *tableEntry;
+    ti_sdo_utils_NameServer_TableEntry *tableEntryNext;
+
+    if (obj->numDynamic != NameServer_ALLOWGROWTH) {
+        if (obj->names != NULL) {
+            Memory_free(obj->tableHeap, obj->names,
+                        obj->maxNameLen * obj->numDynamic);
+        }
+
+        if (obj->values != NULL && !(obj->maxValueLen == sizeof(UInt32))) {
+            Memory_free(obj->tableHeap, obj->values,
+                        obj->maxValueLen * obj->numDynamic);
+        }
+
+        if (obj->table != NULL) {
+            Memory_free(obj->tableHeap, obj->table,
+                        sizeof(ti_sdo_utils_NameServer_TableEntry) * obj->numDynamic);
+        }
+    }
+    else {
+        tableEntryNext = List_next(nameList, NULL);
+        while (tableEntryNext != NULL) {
+            tableEntry = tableEntryNext;
+            tableEntryNext = List_next(nameList, (List_Elem*)tableEntryNext);
+
+            /* Free the value if not UInt32 */
+            if (!(obj->maxValueLen == sizeof(UInt32))) {
+                Memory_free(obj->tableHeap, (Ptr)(tableEntry->value),
+                            obj->maxValueLen);
+            }
+
+            /* Free the name */
+            Memory_free(obj->tableHeap, tableEntry->name,
+                        strlen(tableEntry->name) + 1);
+
+            /* Free the entry */
+            Memory_free(obj->tableHeap, tableEntry,
+                        sizeof(ti_sdo_utils_NameServer_TableEntry));
+        }
+    }
+
+    List_destruct(List_struct(freeList));
+    List_destruct(List_struct(nameList));
+}
+
+
+
+
+
+/*
+ *  ======== ti_sdo_utils_NameServer_removeLocal ========
+ */
+Void ti_sdo_utils_NameServer_removeLocal(ti_sdo_utils_NameServer_Object *obj,
+                             ti_sdo_utils_NameServer_TableEntry *entry)
+{
+    IArg key;
+    List_Handle freeList = ti_sdo_utils_NameServer_Instance_State_freeList(obj);
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    /* Remove it from the nameList and add to the freeList or free it */
+    if (obj->numDynamic == NameServer_ALLOWGROWTH) {
+
+        key = GateSwi_enter(NameServer_module->gate);
+        List_remove(nameList, (List_Elem *)entry);
+        GateSwi_leave(NameServer_module->gate, key);
+
+        if (!(obj->maxValueLen == sizeof(UInt32))) {
+            Memory_free(obj->tableHeap, (Ptr)entry->value,
+                        obj->maxValueLen);
+        }
+
+        Memory_free(obj->tableHeap, entry->name,
+                    strlen(entry->name) + 1);
+
+        Memory_free(obj->tableHeap, entry,
+                    sizeof(ti_sdo_utils_NameServer_TableEntry));
+    }
+    else {
+        key = GateSwi_enter(NameServer_module->gate);
+        List_remove(nameList, (List_Elem *)entry);
+        GateSwi_leave(NameServer_module->gate, key);
+
+        List_put(freeList, (List_Elem *)entry);
+    }
+}
+
+/*
+ *  ======== ti_sdo_utils_NameServer_getKey ========
+ */
+Ptr ti_sdo_utils_NameServer_getKey(ti_sdo_utils_NameServer_Object *obj,
+        UInt32 val)
+{
+    IArg  key;
+    ti_sdo_utils_NameServer_TableEntry *tableEntry = NULL;
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    /* Need to assume the value length is sizeof(UInt32) */
+    Assert_isTrue(obj->maxValueLen == sizeof(UInt32), NULL);
+
+    key = GateSwi_enter(NameServer_module->gate);
+
+    while ((tableEntry = List_next(nameList, (List_Elem *)tableEntry))
+        != NULL) {
+        /* Do the comparison */
+        if (tableEntry->value == val) {
+            break;
+        }
+    }
+
+    GateSwi_leave(NameServer_module->gate, key);
+
+    return (tableEntry);
+}
+
+
+/*
+ *************************************************************************
+ *                      Module functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_utils_NameServer_Module_startup ========
+ */
+Int ti_sdo_utils_NameServer_Module_startup( Int phase )
+{
+    Int i;
+    ti_sdo_utils_NameServer_Object *obj;
+
+    for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+        NameServer_module->nsRemoteHandle[i] = NULL;
+    }
+
+    /* Finish setting up the freeList */
+    for (i = 0; i < ti_sdo_utils_NameServer_Object_count(); i++) {
+        obj = ti_sdo_utils_NameServer_Object_get(NULL, i);
+        if ((obj->numDynamic != 0) &&
+            (obj->numDynamic != NameServer_ALLOWGROWTH)) {
+            NameServer_postInit(obj);
+        }
+    }
+
+    return (Startup_DONE);
+}
+
+
+/*
+ *  ======== ti_sdo_utils_NameServer_isRegistered ========
+ */
+Bool ti_sdo_utils_NameServer_isRegistered(UInt16 procId)
+{
+    Bool registered;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_utils_NameServer_A_invArgument);
+
+    registered = (NameServer_module->nsRemoteHandle[procId] != NULL);
+
+    return (registered);
+}
+
+/*
+ *  ======== ti_sdo_utils_NameServer_registerRemoteDriver ========
+ */
+Int ti_sdo_utils_NameServer_registerRemoteDriver(INameServerRemote_Handle nsrHandle,
+        UInt16 procId)
+{
+    Int   status;
+    UInt key;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_utils_NameServer_A_invArgument);
+
+    key = Hwi_disable();
+
+    if (NameServer_module->nsRemoteHandle[procId] != NULL) {
+        status = NameServer_E_FAIL;
+    }
+    else {
+        NameServer_module->nsRemoteHandle[procId] = nsrHandle;
+        status = NameServer_S_SUCCESS;
+    }
+
+    Hwi_restore(key);
+
+    return (status);
+}
+
+/*
+ *  ======== ti_sdo_utils_NameServer_unregisterRemoteDriver ========
+ */
+Void ti_sdo_utils_NameServer_unregisterRemoteDriver(UInt16 procId)
+{
+    UInt key;
+
+    Assert_isTrue(procId < ti_sdo_utils_MultiProc_numProcessors,
+            ti_sdo_utils_NameServer_A_invArgument);
+
+    key = Hwi_disable();
+
+    NameServer_module->nsRemoteHandle[procId] = NULL;
+
+    Hwi_restore(key);
+}
+
+/*
+ *************************************************************************
+ *                       Internal functions
+ *************************************************************************
+ */
+
+/*
+ *  ======== ti_sdo_utils_NameServer_findLocal ========
+ *  Searches the local instance table.
+ */
+ti_sdo_utils_NameServer_TableEntry *NameServer_findLocal(
+        ti_sdo_utils_NameServer_Object *obj, String name)
+{
+    IArg  key;
+    ti_sdo_utils_NameServer_TableEntry *tableEntry = NULL;
+
+    List_Handle nameList = ti_sdo_utils_NameServer_Instance_State_nameList(obj);
+
+    /* Search the table in a thread safe manner */
+    key = GateSwi_enter(NameServer_module->gate);
+
+    while ((tableEntry = List_next(nameList, (List_Elem *)tableEntry))
+        != NULL) {
+        /* Do the comparison */
+        if (strcmp(tableEntry->name, name) == 0) {
+            break;
+        }
+    }
+
+    GateSwi_leave(NameServer_module->gate, key);
+
+    return (tableEntry);
+}
+
+/*
+ *  ======== ti_sdo_utils_NameServer_postInit ========
+ *  Function to be called during
+ *  1. module startup to complete the initialization of all static instances
+ *  2. instance_init to complete the initialization of a dynamic instance
+ *
+ *  The empty entries are added into the freeList. There can be non-empty
+ *  entries on statically created instances. The instance$static$init already
+ *  put those entries onto the nameList.
+ */
+Int ti_sdo_utils_NameServer_postInit(ti_sdo_utils_NameServer_Object *obj)
+{
+    UInt i;
+    List_Handle freeList = ti_sdo_utils_NameServer_Instance_State_freeList(obj);
+    ti_sdo_utils_NameServer_TableEntry *tableEntry;
+    String name;
+
+    name = obj->names;
+    for (i = 0; i < obj->numDynamic; i++) {
+        tableEntry = &(obj->table[i + obj->numStatic]);
+
+        /* Carve out some room for the dynamically added names */
+        tableEntry->name = name;
+        name += obj->maxNameLen;
+
+        /* Carve out some room for the dynamically added values */
+        if (obj->maxValueLen > sizeof(UInt32)) {
+            tableEntry->value = (UArg)((UInt32)obj->values +
+                    (i * obj->maxValueLen));
+            tableEntry->len   = obj->maxValueLen;
+        }
+
+        /* Put the entry onto the freeList */
+        List_put(freeList, (List_Elem *)(tableEntry));
+    }
+
+    return (0);
+}
diff --git a/packages/ti/sdo/utils/NameServer.xdc b/packages/ti/sdo/utils/NameServer.xdc
new file mode 100644 (file)
index 0000000..4d891b7
--- /dev/null
@@ -0,0 +1,491 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServer.xdc ========
+ *
+ */
+
+import xdc.runtime.Error;
+import xdc.runtime.Assert;
+import xdc.runtime.IHeap;
+import ti.sysbios.gates.GateSwi;
+import xdc.rov.ViewInfo;
+
+/*!
+ *  ======== NameServer ========
+ *  Manages and serves names to remote/local processor
+ *
+ *  @p(html)
+ *  This module has a common header that can be found in the {@link ti.ipc}
+ *  package.  Application code should include the common header file (not the
+ *  RTSC-generated one):
+ *
+ *  <PRE>#include &lt;ti/ipc/NameServer.h&gt;</PRE>
+ *
+ *  The RTSC module must be used in the application's RTSC configuration file
+ *  (.cfg) if runtime APIs will be used in the application:
+ *
+ *  <PRE>NameServer = xdc.useModule('ti.sdo.ipc.NameServer');</PRE>
+ *
+ *  Documentation for all runtime APIs, instance configuration parameters,
+ *  error codes macros and type definitions available to the application
+ *  integrator can be found in the
+ *  <A HREF="../../../../doxygen/html/files.html">Doxygen documenation</A>
+ *  for the IPC product.  However, the documentation presented on this page
+ *  should be referred to for information specific to the RTSC module, such as
+ *  module configuration, Errors, and Asserts.
+ *  @p
+ *
+ */
+
+@ModuleStartup
+@InstanceInitError /* Initialization may throw errors */
+@InstanceFinalize
+
+module NameServer
+{
+    /*!
+     *  ======== BasicView ========
+     *  @_nodoc
+     */
+    metaonly struct BasicView {
+        String  name;
+        Bool    checkExisting;
+        UInt    maxNameLen;
+        UInt    maxValueLen;
+        UInt    numStatic;
+        String  numDynamic;
+    }
+
+    /*!
+     *  ======== NamesListView ========
+     *  @_nodoc
+     */
+    metaonly struct NamesListView {
+        String  name;
+        String  value;
+        UInt    len;
+        Ptr     nsKey;
+    }
+
+    /*!
+     *  ======== rovViewInfo ========
+     *  @_nodoc
+     */
+    @Facet
+    metaonly config xdc.rov.ViewInfo.Instance rovViewInfo =
+        xdc.rov.ViewInfo.create({
+            viewMap: [
+                ['Basic',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE,
+                        viewInitFxn: 'viewInitBasic',
+                        structName: 'BasicView'
+                    }
+                ],
+                ['NamesValues',
+                    {
+                        type: xdc.rov.ViewInfo.INSTANCE_DATA,
+                        viewInitFxn: 'viewInitData',
+                        structName: 'NamesListView'
+                    }
+                ]
+            ]
+        });
+
+    /*!
+     *  Assert raised when the name or value is too long
+     */
+    config Assert.Id A_invalidLen  = {
+        msg: "A_invalidLen: Invalid length"
+    };
+
+    /*!
+     *  ======== A_invArgument ========
+     *  Assert raised when an argument is invalid
+     */
+    config Assert.Id A_invArgument  = {
+        msg: "A_invArgument: Invalid argument supplied"
+    };
+
+    /*!
+     *  Error raised if all the entries in the instance Name/Value table
+     *  are taken
+     */
+    config Error.Id E_maxReached  = {
+        msg: "E_maxReached: All entries in use. NameServer.maxRuntimeEntries is %d"
+    };
+
+    /*!
+     *  Error raised when the name already exists in the instance
+     *  Name/Value table
+     */
+    config Error.Id E_entryExists  = {
+        msg: "E_entryExists: %s name already in table "
+    };
+
+    /*!
+     *  Allow dynamic growth of the NameServer instance table
+     *
+     *  This value can be used to set the {@link #maxRuntimeEntries}.
+     *  This flag tells NameServer to allow dynamic growth
+     *  of the table.
+     */
+    const UInt ALLOWGROWTH = (~0);
+
+    /*!
+     *  Structure of entry in Name/Value table
+     *
+     *  This structure is returned from the {@link #getMeta}
+     *  API.
+     *
+     *  @field(name)  Name portion of the name/value pair.
+     *  @field(len)   Length of the value field.
+     *  @field(value) Value portion of the name/value entry.
+     */
+    metaonly struct Entry {
+        String      name;
+        UInt        len;
+        UArg        value;
+    };
+
+    /*!
+     *  ======== SetupProxy ========
+     *  NameServer setup proxy
+     */
+    proxy SetupProxy inherits INameServerRemote;
+
+    /*!
+     *  ======== isRegistered ========
+     *  Determines if a remote driver is registered for the specified id.
+     *
+     *  @param(procId)  The remote processor id.
+     */
+    @DirectCall
+    Bool isRegistered(UInt16 procId);
+
+    /*!
+     *  ======== registerRemoteDriver ========
+     *  Register the NameServer remote handle for the specified processor id.
+     *
+     *  This function is used by NameServer remote driver to register
+     *  themselves with NameServer. Only one remote driver can be registered
+     *  with a remote processor. The API returns {@link #Status_FAIL} if there
+     *  is already a registered remote driver for the processor id.
+     *
+     *  @param(handle)  The handle for a NameServer remote driver instance.
+     *  @param(procId)  The remote processor id.
+     *
+     *  @b(returns)     Returns {@link #Status_SUCCESS} if successful or
+     *                  {@link #Status_FAIL} if the processor id has already
+     *                  been set.
+     */
+    @DirectCall
+    Int registerRemoteDriver(INameServerRemote.Handle handle, UInt16 procId);
+
+    /*!
+     *  ======== unregisterRemoteDriver ========
+     *  Unregister the NameServer remote handle for the specified processor id.
+     *
+     *  This function is used by NameServer Remote implementations to unregister
+     *  themselves with NameServer.
+     *
+     *  @param(procId)  The remote processor id to unregister.
+     */
+    @DirectCall
+    Void unregisterRemoteDriver(UInt16 procId);
+
+    /*!
+     *  ======== modAddMeta ========
+     *  Add a name/value pair into the specified instance's table during
+     *  configuration
+     *
+     *  This function adds any length value into the local table. The function
+     *  makes sure the name does not already exist in the local table.
+     *
+     *  This function should be used by modules when adding into a NameServer
+     *  instance. The application configuration file, should
+     *  use {@link #addMeta}.
+     *
+     *  The function does not query remote processors to make sure the
+     *  name is unique.
+     *
+     *  @param(instName)   NameServer instance name
+     *  @param(name)       Name portion of the name/value pair
+     *  @param(value)      Value portion of the name/value pair
+     *  @param(len)        Length of the value buffer
+     */
+    metaonly Void modAddMeta(String instName, String name, Any value, UInt len);
+
+    /*!
+     *  ======== getName$view ========
+     *  @_nodoc
+     *  Used at ROV time to display reverse-lookup name from 32-bit value and
+     *  tableName
+     */
+    metaonly String getName$view(String tableName, UInt32 value);
+
+    /*!
+     *  ======== getNameByKey$view ========
+     *  @_nodoc
+     *  ROV function for retrieving an entry by its address. Throws an exception
+     *  if the name was not found
+     */
+    metaonly String getNameByKey$view(Ptr addr);
+
+
+instance:
+
+    /*!
+     *  Maximum number of name/value pairs that can be dynamically created.
+     *
+     *  This parameter allows NameServer to pre-allocate memory.
+     *  When NameServer_add or NameServer_addUInt32 is called, no memory
+     *  allocation occurs.
+     *
+     *  If the number of pairs is not known at configuration time, set this
+     *  value to {@link #ALLOWGROWTH}. This instructs NameServer to grow the
+     *  table as needed. NameServer will allocate memory from the
+     *  {@link #tableHeap} when a name/value pair is added.
+     *
+     *  The default is {@link #ALLOWGROWTH}.
+     */
+    config UInt maxRuntimeEntries = ALLOWGROWTH;
+
+    /*!
+     *  Name/value table is allocated from this heap.
+     *
+     *  The instance table and related buffers are allocated out of this heap
+     *  during the dynamic create. This heap is also used to allocate new
+     *  name/value pairs when {@link #ALLOWGROWTH} for
+     *  {@link #maxRuntimeEntries}
+     *
+     *  The default is to use the same heap that instances are allocated
+     *  from which can be configured via the
+     *  NameServer.common$.instanceHeap configuration parameter.
+     */
+    config IHeap.Handle tableHeap = null;
+
+    /*!
+     *  Name/value table is placed into this section on static creates.
+     *
+     *  The instance table and related buffers are placed into this section
+     *  during the static create.
+     *
+     *  The default is no explicit section placement.
+     */
+    metaonly config String tableSection = null;
+
+    /*!
+     *  Check if a name already exists in the name/value table.
+     *
+     *  When a name/value pair is added during runtime, if this boolean is true,
+     *  the table is searched to see if the name already exists. If it does,
+     *  the name is not added and the {@link #E_entryExists} error is raised.
+     *
+     *  If this flag is false, the table will not be checked to see if the name
+     *  already exists. It will simply be added. This mode has better
+     *  performance at the expense of potentially having non-unique names in the
+     *  table.
+     *
+     *  This flag is used for runtime adds only. Adding non-unique names during
+     *  configuration results in a build error.
+     */
+    config Bool checkExisting = true;
+
+    /*!
+     *  Length, in MAUs, of the value field in the table.
+     *
+     *  Any value less than sizeof(UInt32) will be rounded up to sizeof(UInt32).
+     */
+    config UInt maxValueLen = 0;
+
+    /*!
+     *  Length, in MAUs, of the name field in the table.
+     *
+     *  The maximum length of the name portion of the name/value
+     *  pair. The length includes the null terminator ('\0').
+     */
+    config UInt maxNameLen = 16;
+
+    /*!
+     *  ======== metaTable ========
+     *  @_nodoc
+     *  Table to hold the statically added name/value pairs until
+     *  they ready to be added to the object.
+     */
+    metaonly config Entry metaTable[];
+
+   /*!
+     *  ======== create ========
+     *  @_nodoc (Refer to doxygen for ti/ipc/NameServer.h)
+     *  Create a NameServer instance
+     *
+     *  This function creates a NameServer instance. The name is
+     *  used for remote processor queries and diagnostic tools. For
+     *  single processor system (e.g. no remote queries), the name
+     *  can be NULL.
+     *
+     *  @param(name)    Name of the instance
+     */
+    create(String name);
+
+    /*!
+     *  ======== addUInt32Meta ========
+     *  Add a name/value pair into the instance's table during configuration
+     *
+     *  This function adds a UInt32 value into the local table. The function
+     *  makes sure the name does not already exist in the local table.
+     *
+     *  The function does not query remote processors to make sure the
+     *  name is unique.
+     *
+     *  @param(name)   Name portion of the name/value pair
+     *  @param(value)  Value portion of the name/value pair
+     */
+    metaonly Void addUInt32Meta(String name, any value);
+
+    /*!
+     *  ======== addMeta ========
+     *  Add a name/value pair into the instance's table during configuration
+     *
+     *  This function adds any length value into the local table. The function
+     *  makes sure the name does not already exist in the local table.
+     *
+     *  This function should be used by within the application configuration
+     *  file. XDC modules should use {@link #modAddMeta}.
+     *
+     *  The function does not query remote processors to make sure the
+     *  name is unique.
+     *
+     *  @param(name)   Name portion of the name/value pair
+     *  @param(value)  Value portion of the name/value pair
+     *  @param(len)    Length of the value buffer
+     */
+    metaonly Void addMeta(String name, Any value, UInt len);
+
+    /*!
+     *  ======== getMeta ========
+     *  Retrieves the name/value entry
+     *
+     *  If the name is found, the entry is returned. The caller can parse the
+     *  entry as needed. If the name is not found, null is returned.
+     *
+     *  The search only occurs on the local table.
+     *
+     *  @param(name)     Name in question
+     *
+     *  @b(returns)      Name/value entry
+     */
+    metaonly Entry getMeta(String name);
+
+    /*!
+     *  ======== getKey ========
+     *  @_nodoc
+     *  Returns a pointer to the TableEntry containing the argument 'val'.
+     *  This should only be used internally by Ipc modules during their
+     *  initialization process.
+     *
+     *  This function can only be used when maxValueLen = sizeof(UInt32)
+     */
+    @DirectCall
+    Ptr getKey(UInt32 val);
+
+internal:
+
+    /* Used to eliminate code when doing whole-program */
+    config Bool singleProcessor = true;
+
+    metaonly typedef Entry EntryMap[];
+
+    /*! Structure of entry in Name/Value table */
+    struct TableEntry {
+        List.Elem   elem;
+        String      name;
+        UInt        len;
+        UArg        value;
+    };
+
+    /*!
+     *  ======== metaModTable ========
+     *  Table to hold the static added name/value pairs until
+     *  they ready to be added to the object.
+     */
+    metaonly config EntryMap metaModTable[string];
+
+    /*
+     *  ======== postInit ========
+     *  Finish initializing static and dynamic NameServer instances
+     */
+    Int postInit(Object *obj);
+
+    /*
+     *  ======== findLocal ========
+     *  Searches to the local instance table.
+     *
+     *  This is an internal function because it returns an internal structure.
+     */
+    TableEntry *findLocal(Object *obj, String name);
+
+    /*
+     *  ======== removeLocal ========
+     *  removes an entry from the local instance table.
+     */
+    Void removeLocal(Object *obj, TableEntry *entry);
+
+    /*
+     *  ======== editLocal ========
+     *  replaces the value of an entry from the local instance table.
+     */
+    Void editLocal(Object *obj, TableEntry *entry, Ptr newValue);
+
+    /* instance object */
+    struct Instance_State {
+        String       name;           /* Name of the instance           */
+        List.Object  freeList;       /* Empty entries list             */
+        List.Object  nameList;       /* Filled entries list            */
+        UInt         maxNameLen;     /* Max name length                */
+        UInt         maxValueLen;    /* Max value length               */
+        UInt         numStatic;      /* Total static entries in table  */
+        UInt         numDynamic;     /* Total dynamic entries in table */
+        TableEntry   table[];        /* Table                          */
+        Char         names[];        /* Buffer for names               */
+        UInt8        values[];       /* Buffer for values              */
+        IHeap.Handle tableHeap;      /* Heap used to alloc table       */
+        Bool         checkExisting;  /* check ig name already exists   */
+    };
+
+    struct Module_State {
+        INameServerRemote.Handle nsRemoteHandle[];
+        GateSwi.Handle gate;
+    };
+}
diff --git a/packages/ti/sdo/utils/NameServer.xs b/packages/ti/sdo/utils/NameServer.xs
new file mode 100644 (file)
index 0000000..c359337
--- /dev/null
@@ -0,0 +1,478 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServer.xs ========
+ *
+ */
+
+var NameServer = null;
+var GateSwi    = null;
+var Memory     = null;
+var List       = null;
+var MultiProc  = null;
+var Settings   = null;
+
+/*
+ *  ======== module$meta$init ========
+ */
+function module$meta$init()
+{
+    /* Only process during "cfg" phase */
+    if (xdc.om.$name != "cfg") {
+        return;
+    }
+
+    NameServer = this;
+    NameServer.common$.namedInstance = false;
+
+    /*
+     *  Plug in the Remote Proxy 'NameServerRemoteNull' by default.
+     *  Ipc will plug in the real Remote Proxy when its used.
+     */
+    NameServer.SetupProxy = xdc.useModule('ti.sdo.utils.NameServerRemoteNull');
+}
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    GateSwi    = xdc.useModule("ti.sysbios.gates.GateSwi");
+    Hwi        = xdc.useModule("ti.sysbios.hal.Hwi");
+    Memory     = xdc.useModule("xdc.runtime.Memory");
+    List       = xdc.useModule("ti.sdo.utils.List");
+    MultiProc  = xdc.useModule("ti.sdo.utils.MultiProc");
+    Settings   = xdc.useModule('ti.sdo.ipc.family.Settings');
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(mod, params)
+{
+    /* This will result is some code reduction if building whole_program. */
+    if (MultiProc.numProcessors == 1) {
+        NameServer.singleProcessor = true;
+    }
+    else {
+        NameServer.singleProcessor = false;
+    }
+
+    /* Array of NameServerRemote instances */
+    mod.nsRemoteHandle.length = MultiProc.numProcessors;
+
+    /* Gate for all NameServer critical regions */
+    mod.gate = GateSwi.create();
+}
+
+/*
+ *  ======== instance$static$init ========
+ *  Initialize instance values.
+ */
+function instance$static$init(obj, name, params)
+{
+    var index;
+    var numModTable = 0;
+    var numStatic = params.metaTable.length;
+
+    if (NameServer.metaModTable[name]) {
+        numModTable = NameServer.metaModTable[name].length;
+        var numStatic = params.metaTable.length + numModTable;
+    }
+
+    /* Fill in the object */
+    obj.name          = name;
+    obj.maxNameLen    = params.maxNameLen;
+    obj.numDynamic    = params.maxRuntimeEntries;
+    obj.checkExisting = params.checkExisting;
+    obj.numStatic     = numStatic;
+    obj.table.length  = numStatic;
+    if (params.tableHeap == null) {
+        obj.tableHeap     = NameServer.common$.instanceHeap;
+    }
+    else {
+        obj.tableHeap     = params.tableHeap;
+    }
+
+    /* Make sure the minumim size is UInt32 */
+    var target  = Program.build.target;
+    if (params.maxValueLen < target.stdTypes["t_Int32"].size) {
+        obj.maxValueLen  = target.stdTypes["t_Int32"].size;
+    }
+    else {
+        obj.maxValueLen  = params.maxValueLen;
+    }
+
+    List.construct(obj.nameList);
+    List.construct(obj.freeList);
+
+    /* Move the metaTable into the object. */
+    for (index = 0; index < params.metaTable.length; index++) {
+        /* Make sure the name and value are not too long */
+        if (this.metaTable[index].len > obj.maxValueLen) {
+            NameServer.$logError("Value length "
+                                 + this.metaTable[index].len
+                                 + " is larger than maxValueLen value of "
+                                 + obj.maxValueLen, this);
+        }
+        if (this.metaTable[index].name.length > obj.maxNameLen) {
+            NameServer.$logError("Name length is of " +
+                                 this.metaTable[index].name.length +
+                                 " is larger than maxNameLen value of " +
+                                 obj.maxNameLen, this);
+        }
+
+        obj.table[index].name  = this.metaTable[index].name;
+        obj.table[index].len   = this.metaTable[index].len;
+        obj.table[index].value = this.metaTable[index].value;
+        obj.nameList.putMeta(obj.table[index].elem);
+    }
+
+    /* Move the metaModTable into the object. */
+    for (var k = 0; k < numModTable; k++) {
+        /* Make sure the name and value are no too long */
+        if (NameServer.metaModTable[name][k].len > obj.maxValueLen) {
+            NameServer.$logError("Value length is of "
+                                 + NameServer.metaModTable[name][k].len
+                                 + " is larger than maxValueLen value of "
+                                 + obj.maxValueLen, this);
+        }
+        if (NameServer.metaModTable[name][k].name.length > obj.maxNameLen) {
+            NameServer.$logError("Name length is of " +
+                            + NameServer.metaModTable[name][k].name.length
+                            + " is larger than maxNameLen value of "
+                            + obj.maxNameLen, this);
+        }
+
+        obj.table[index].name  = NameServer.metaModTable[name][k].name;
+        obj.table[index].len   = NameServer.metaModTable[name][k].len;
+        obj.table[index].value = NameServer.metaModTable[name][k].value;
+        obj.nameList.putMeta(obj.table[index].elem);
+        index++;
+    }
+
+    this.metaTable.$seal();
+
+    /* Handle the creation of the runtime entries */
+    if ((obj.numDynamic != 0) && (obj.numDynamic != NameServer.ALLOWGROWTH)) {
+        /* Create the table and place it */
+        obj.table.length += params.maxRuntimeEntries;
+
+        /*
+         *  Create the block that will contain a copy of the names and
+         *  place it.
+         */
+        obj.names.length  = params.maxRuntimeEntries * params.maxNameLen;
+        Memory.staticPlace(obj.names,  0, params.tableSection);
+
+        /*
+         *  Create the block that will contain a copy of the values and
+         *  place it.
+         *  If the values are small, simply use the values UArg to store
+         *  the UInt32. Thus no need for the block of memory.
+         */
+        if (params.maxValueLen == target.stdTypes["t_Int32"].size) {
+            obj.values.length = 0;
+        }
+        else {
+            obj.values.length = params.maxRuntimeEntries * params.maxValueLen;
+            Memory.staticPlace(obj.values, 0, params.tableSection);
+        }
+
+        /*
+         *  Need to fill in all values, else we get an undefined
+         *  The majority of the work in done in the Module_startup.
+         */
+        for (var j = numStatic; j < obj.table.length; j++) {
+            obj.table[j].name  = null;
+            obj.table[j].len   = 0;
+            obj.table[j].value = 0;
+            obj.freeList.putMeta(obj.table[j].elem);
+        }
+    }
+    Memory.staticPlace(obj.table,  0, params.tableSection);
+}
+
+/*
+ *  ======== addUInt32Meta ========
+ */
+function addUInt32Meta(name, value)
+{
+    var target  = Program.build.target;
+    this.addMeta(name, value, target.stdTypes["t_Int32"].size);
+}
+
+/*
+ *  ======== modAddMeta ========
+ */
+function modAddMeta(instName, name, value, len)
+{
+    /* Check to see if NameServer instance already exists */
+    if (!NameServer.metaModTable[instName]) {
+        NameServer.metaModTable[instName] = new NameServer.EntryMap();
+        var instLen = 0;
+    }
+    else {
+        var instLen = NameServer.metaModTable[instName].length;
+
+        /* Make sure the name does not already exist. */
+        for (var i = 0; i < instLen; i++) {
+            if (name == NameServer.metaModTable[instName][i].name) {
+                NameServer.$logError("Cannot add \"" + name +
+                                 "\". It already exists.", NameServer);
+            }
+        }
+    }
+    NameServer.metaModTable[instName].length++;
+
+    /* Add it into this table */
+    NameServer.metaModTable[instName][instLen].name = name;
+    NameServer.metaModTable[instName][instLen].len = len;
+    NameServer.metaModTable[instName][instLen].value = value;
+
+}
+
+/*
+ *  ======== addMeta ========
+ */
+function addMeta(name, value, len)
+{
+    if (this.metaTable.$sealed() == true) {
+        NameServer.$logError("Cannot add into the NameServer during " +
+                             "this phase (" + xdc.om.$$phase + ")" , this);
+    }
+
+    NameServer = xdc.module('ti.sdo.utils.NameServer');
+
+    /* Make sure the name does not already exist. */
+    for (var i = 0; i < this.metaTable.length; i++) {
+        if (name == this.metaTable[i].name) {
+            NameServer.$logError("Cannot add \"" + name +
+                                 "\". It already exists.", this);
+        }
+    }
+
+    var entry = new NameServer.Entry();
+
+    entry.name  = name;
+    entry.len   = len;
+    entry.value = value;
+
+    /* Add it into this table */
+    this.metaTable.$add(entry);
+}
+
+/*
+ *  ======== getMeta ========
+ *  Return the entry
+ */
+function getMeta(name, value)
+{
+    for (var i = 0; i < this.metaTable.length; i++) {
+        if (this.metaTable[i].name == name) {
+            return (this.metaTable[i])
+        }
+    }
+}
+
+/*
+ *  ======== viewInitBasic ========
+ *  Processes the 'Basic' view for a NameServer instance.
+ */
+function viewInitBasic(view, obj)
+{
+    var NameServer = xdc.useModule('ti.sdo.utils.NameServer');
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    view.name = Program.fetchString(obj.name);
+    view.checkExisting = obj.checkExisting;
+    view.maxNameLen    = obj.maxNameLen;
+    view.maxValueLen   = obj.maxValueLen;
+    view.numStatic     = obj.numStatic;
+    if (obj.numDynamic == 0xffffffff) {
+        view.numDynamic = "ALLOWGROWTH";
+    }
+    else {
+        view.numDynamic = "0x" + Number(obj.numDynamic).toString(16);
+    }
+}
+
+/*
+ *  ======== viewInitData ========
+ *  Processes the 'NamesValues' view for a NameServer instance.
+ */
+function viewInitData(view, obj)
+{
+    /* Retrieve the instance name. */
+    view.label = Program.fetchString(obj.name);
+    view.elements = getNameList(obj);
+    return(view);
+}
+
+/*
+ *  ======== getNameList ========
+ */
+function getNameList(obj)
+{
+    var NameServer      = xdc.useModule('ti.sdo.utils.NameServer');
+    var List            = xdc.useModule('ti.sdo.utils.List');
+    var Program         = xdc.useModule('xdc.rov.Program');
+
+    var nameList = new Array();
+
+    /* List Object is the head */
+    var head = obj.nameList.elem;
+
+    /* Get the first entry on the List */
+    try {
+        // elem is the current element
+        var elem = Program.fetchStruct(List.Elem$fetchDesc, head.next);
+    }
+    catch (error) {
+        view.$status["freeList"] = "Error fetching List Elem struct: " + error.toString(); // TODO freeList -> ?
+        throw (error);
+    }
+
+    /*
+     * Maintain a map of the entries by their address to
+     * support 'getEntryByKey'.
+     */
+    var data = Program.getPrivateData('ti.sdo.utils.NameServer');
+    if (data.entryMap == undefined) {
+        data.entryMap = {};
+    }
+
+    /* While the entry is not the head */
+    while (Number(elem.$addr) != Number(head.$addr)) {
+        /* Fetch the next block */
+        try {
+            var nameEntry = Program.fetchStruct(NameServer.TableEntry$fetchDesc,
+                elem.$addr);
+        }
+        catch (elem) {
+            print("Error: Caught exception from fetchStruct: " +
+                elem.toString());
+            throw (elem);
+        }
+
+        /* Add this block to the list */
+        var entry = Program.newViewStruct('ti.sdo.utils.NameServer',
+            'NamesValues');
+        entry.name = Program.fetchString(nameEntry.name);
+
+        var int32len = Program.build.target.stdTypes["t_Int32"].size;
+        if (obj.maxValueLen > int32len) {
+            entry.value = "[large value]";
+        }
+        else {
+            entry.value = "0x" + Number(nameEntry.value).toString(16);
+        }
+        entry.len = nameEntry.len;
+        entry.nsKey = nameEntry.elem.$addr;
+
+        /* Add the entry to the view. */
+        nameList[nameList.length] = entry;
+
+        /* Add the view to the map. */
+        data.entryMap[Number(elem.$addr)] = entry;
+
+        elem = Program.fetchStruct(List.Elem$fetchDesc, elem.next);
+    }
+
+    return (nameList);
+}
+
+/*
+ *  ======== getNameByKey$view ========
+ *  In ROV, returns a NameServer name given its key.
+ *  Throws an exception if there is no entry at the given address.
+ */
+function getNameByKey$view(addr)
+{
+    var Program = xdc.useModule('xdc.rov.Program');
+
+    /*
+     *  Scan the instance view to retrieve all of the entries.
+     *  This function may throw an exception, let it propogate to the caller.
+     */
+    Program.scanInstanceDataView('ti.sdo.utils.NameServer', 'NamesValues');
+
+    /* Retrieve the private data. */
+    var data = Program.getPrivateData('ti.sdo.utils.NameServer');
+
+    /* Get the entry from the map. */
+    var entry = data.entryMap[Number(addr)];
+
+    /* Throw an exception if there's no entry at this address. */
+    if (entry == undefined) {
+        throw (new Error("There is no NameServer entry at the address: 0x" +
+                         Number(addr).toString(16)));
+    }
+
+    var name = entry.name;
+
+    return (name);
+}
+
+/*
+ *  ======== getName$view ========
+ *  Only used for ROV. Returns a name in a supplied 'tableName' corresponding
+ *  to 'value'.
+ */
+function getName$view(tableName, value)
+{
+    var name = null;
+
+    try {
+        var NamesValuesView = Program.scanInstanceDataView(
+            'ti.sdo.utils.NameServer',
+            'NamesValues');
+
+        for (var i in NamesValuesView) {
+            if (NamesValuesView[i].label == tableName) {
+                elements = NamesValuesView[i].elements;
+                for (var j in elements) {
+                    if (elements[j].value == "0x" + value.toString(16)) {
+                        /* elem found */
+                        name = elements[j].name;
+                    }
+                }
+            }
+        }
+    }
+    catch(e) {
+        var msg = "error when scaning NameServer instance data view: " + e;
+        throw(msg);
+    }
+
+    return (name);
+}
diff --git a/packages/ti/sdo/utils/NameServerRemoteNull.c b/packages/ti/sdo/utils/NameServerRemoteNull.c
new file mode 100644 (file)
index 0000000..9a4e7fb
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * */
+/*
+ *  ======== NameServerRemoteNull.c ========
+ */
+
+#include <xdc/std.h>
+
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/knl/ISync.h>
+
+#include <ti/ipc/NameServer.h>
+
+#include "package/internal/NameServerRemoteNull.xdc.h"
+
+
+/*
+ *************************************************************************
+ *                       Instance functions
+ *************************************************************************
+ */
+Void NameServerRemoteNull_Instance_init(NameServerRemoteNull_Object *obj,
+        UInt16 remoteProcId,
+        const NameServerRemoteNull_Params *params)
+{
+}
+
+/*
+ *************************************************************************
+ *                       Module functions
+ *************************************************************************
+ */
+
+ /*
+ *  ======== NameServerRemoteNull_attach ========
+ */
+Int NameServerRemoteNull_attach(UInt16 remoteProcId, Ptr sharedAddr)
+{
+    return (NameServer_S_SUCCESS);
+}
+
+/*
+ *  ======== NameServerRemoteNull_detach ========
+ */
+Int NameServerRemoteNull_detach(UInt16 remoteProcId)
+{
+    return (NameServer_S_SUCCESS);
+}
+
+/*
+ *  ======== NameServerRemoteNull_get ========
+ */
+Int NameServerRemoteNull_get(NameServerRemoteNull_Object *obj,
+                        String instanceName,
+                        String name,
+                        Ptr value,
+                        UInt32 *valueLen,
+                        ISync_Handle syncHandle,
+                        Error_Block *eb)
+{
+    return (NameServer_S_SUCCESS);
+}
+
+/*
+ *  ======== NameServerRemoteNull_sharedMemReq ========
+ */
+SizeT NameServerRemoteNull_sharedMemReq(Ptr sharedAddr)
+{
+    return (0);
+}
diff --git a/packages/ti/sdo/utils/NameServerRemoteNull.xdc b/packages/ti/sdo/utils/NameServerRemoteNull.xdc
new file mode 100644 (file)
index 0000000..07f5238
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteNull.xdc ========
+ */
+
+/*!
+ *  ======== NameServerRemoteNull ========
+ */
+
+module NameServerRemoteNull inherits INameServerRemote
+{
+
+internal:
+
+    struct Instance_State {
+    };
+}
diff --git a/packages/ti/sdo/utils/NameServerRemoteNull.xs b/packages/ti/sdo/utils/NameServerRemoteNull.xs
new file mode 100644 (file)
index 0000000..5561d97
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== NameServerRemoteNull.xs ========
+ */
+
+/*
+ *  ======== module$use ========
+ */
+function module$use()
+{
+    this.common$.fxntab = false;
+}
diff --git a/packages/ti/sdo/utils/UTILS.c b/packages/ti/sdo/utils/UTILS.c
new file mode 100644 (file)
index 0000000..c104b36
--- /dev/null
@@ -0,0 +1,3 @@
+void ti_sdo_utils_dummy()
+{
+}
diff --git a/packages/ti/sdo/utils/_MultiProc.h b/packages/ti/sdo/utils/_MultiProc.h
new file mode 100644 (file)
index 0000000..7575aa6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _MultiProc.h ========
+ *  This file should only be used by Ipc modules
+ */
+#define ti_sdo_utils_MultiProc__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/utils/MultiProc.h>
+
+/* the common .h file */
+#include <ti/ipc/MultiProc.h>
diff --git a/packages/ti/sdo/utils/_NameServer.h b/packages/ti/sdo/utils/_NameServer.h
new file mode 100644 (file)
index 0000000..640f9bd
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== _NameServer.h ========
+ *  This file should only be used by Ipc modules
+ */
+#define ti_sdo_utils_NameServer__nolocalnames
+
+/* include the xdc generated .h file */
+#include <ti/sdo/utils/NameServer.h>
+
+/* the common .h file */
+#include <ti/ipc/NameServer.h>
diff --git a/packages/ti/sdo/utils/instrumented.cfg b/packages/ti/sdo/utils/instrumented.cfg
new file mode 100644 (file)
index 0000000..c0ee150
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/utils/instrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = false;
+
+BIOS.libDir = "lib/sysbios/instrumented/";
+
+var Build = xdc.useModule('ti.sdo.utils.Build');
+Build.libDir = "lib/utils/instrumented/";
diff --git a/packages/ti/sdo/utils/instrumented.cfg.xs b/packages/ti/sdo/utils/instrumented.cfg.xs
new file mode 100644 (file)
index 0000000..6d81567
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.libType = BIOS.LibType_Custom;
+BIOS.buildingAppLib = false;
+BIOS.assertsEnabled = true;
+BIOS.logsEnabled = true;
+
+var SourceDir = xdc.module("xdc.cfg.SourceDir");
+SourceDir.verbose = 1;
+
+/* suppress un-placed sections warning from m3 Hwi.meta$init() */
+if (Program.sectMap[".vecs"] !== undefined) {
+    Program.sectMap[".vecs"].type = "DSECT";
+}
+if (Program.sectMap[".resetVecs"] !== undefined) {
+    Program.sectMap[".resetVecs"].type= "DSECT";
+}
diff --git a/packages/ti/sdo/utils/makefile.xdt b/packages/ti/sdo/utils/makefile.xdt
new file mode 100644 (file)
index 0000000..f5dd6c8
--- /dev/null
@@ -0,0 +1,158 @@
+%%{
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%%{
+    var File = xdc.module("xdc.services.io.File");
+
+    var Build = xdc.module("ti.sdo.utils.Build");
+
+    var TARGET = $args[0];
+
+    var XDCROOT = String(environment['xdc.rootDir'] + '/packages/').replace(/\\/g, "/");
+
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+
+    var CGEN = TARGET.rootDir.replace(/\\/g, "/");
+
+    function baseName(path) {
+       return path.substr(path.lastIndexOf('/') + 1).replace(/\.[^\.]+$/, "");
+    }
+
+    function packageName(path) {
+       var dirpath = path.substring(0, path.lastIndexOf('/'));
+       return dirpath.substr(dirpath.lastIndexOf('/') + 1);
+    }
+    var OBJS = [];
+%%}
+vpath % `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
+vpath %.c `XDCROOT`
+
+XOPTS = `'-I"' + XDCROOT + '"' + " -Dxdc_target_types__=" + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude + " -Dxdc_target_name__=" + TARGET.name`
+
+CCOPTS ?= `BIOS.getCCOpts(TARGET.$name)`
+
+XDC_ROOT  = `XDCROOT`
+
+IPC_ROOT = `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
+
+BUILD_DEFS = `Build.getDefs()`
+
+BIOS_INC  = -I"`xdc.getPackageRepository("ti.bios")`"
+
+SYSBIOS_INC  = -I"`xdc.getPackageRepository("ti.sysbios")`"
+
+IPC_INC    = -I"`xdc.getPackageRepository("ti.sdo.ipc")`"
+
+UTILS_INC    = -I"`xdc.getPackageRepository("ti.sdo.utils")`"
+
+CC = `CGEN`/bin/`TARGET.cc.cmd` $(CCOPTS) -I `CGEN`/include
+
+ASM = `CGEN`/bin/`TARGET.asm.cmd` $(CCOPTS) -I `CGEN`/include
+
+AR = `CGEN`/bin/`TARGET.ar.cmd` `TARGET.ar.opts`
+
+%if (environment["os.name"].match(/Windows.*/i)) {
+%if (BIOS.buildingAppLib == false) {
+%    Build.$private.libDir = Build.$private.libDir.replace(/\//g,'\\');
+%}
+DEL = cmd.exe /q /c del /f
+CP = cmd.exe /q /c copy /Y
+%}
+%else {
+DEL = rm -f
+CP = cp -f
+%}
+
+define RM
+       $(if $(wildcard $1),$(DEL) $1,:)
+endef
+
+define ASSEMBLE
+       @echo asm`TARGET.suffix` $< ...
+       @$(ASM) $(BUILD_DEFS) $(XOPTS) $(UTILS_INC) $<
+endef
+
+%var LIB = "utils.a" + TARGET.suffix;
+
+%if (BIOS.buildingAppLib == false) {
+all: `Build.$private.libDir``LIB`
+%}
+%else {
+all: `LIB`
+%}
+
+%var sources = Build.getAsmFiles(TARGET.$name);
+%for each (var s in sources) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".obj";
+%    OBJS.push(obj)
+`obj`: `s` makefile
+       @-$(call RM, $@)
+       $(ASSEMBLE) --output_file=`obj`
+
+%}
+
+UTILS.obj: `Build.getCFiles(TARGET.$name)` makefile
+       @-$(call RM, $@)
+       @echo cl`TARGET.suffix` $< ...
+       @$(CC) $(BUILD_DEFS) $(XOPTS) $(SYSBIOS_INC) $(BIOS_INC) \
+       $(IPC_INC) $(UTILS_INC) \
+%var sources = Build.getCFiles(TARGET.$name).split(' ');
+%for each (var s in sources) {
+%    if (s.substring(0,4) == "xdc/") {
+       $(XDC_ROOT)`s` \
+%    } else {
+       $(IPC_ROOT)`s` \
+%    }
+%}
+
+`LIB`: UTILS.obj `OBJS.join(" ")`
+       @echo ar`TARGET.suffix` $^ ...
+       @-$(call RM, $@)
+       @$(AR) $@ $^
+
+%if (BIOS.buildingAppLib == false) {
+`Build.$private.libDir``LIB`: `LIB`
+       @echo cp `LIB`
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+       @$(CP) `LIB` "`Build.$private.libDir``LIB`"
+%}
+
+clean:
+       @-$(call RM, `LIB`)
+%if (BIOS.buildingAppLib == false) {
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+%}
+       @-$(call RM, UTILS.obj)
+%for (var i = 0; i < OBJS.length; i++) {
+       @-$(call RM, `OBJS[i]`)
+%}
diff --git a/packages/ti/sdo/utils/makefile_gccArmLto.xdt b/packages/ti/sdo/utils/makefile_gccArmLto.xdt
new file mode 100644 (file)
index 0000000..2e30ddd
--- /dev/null
@@ -0,0 +1,150 @@
+%%{
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%}
+%%{
+    var File = xdc.module("xdc.services.io.File");
+
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+
+    var Build = xdc.module("ti.sdo.utils.Build");
+
+    var TARGET = $args[0];
+
+    var XDCROOT = String(environment['xdc.rootDir'] + '/packages/').replace(/\\/g, "/");
+
+    var XOPTS = '-I "' + XDCROOT + '"'
+       + " -Dxdc_target_types__=" + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude
+       + " -Dxdc_target_name__=" + TARGET.name;
+
+    var CGEN = TARGET.rootDir.replace(/\\/g, "/");
+
+    function baseName(path) {
+       return path.substr(path.lastIndexOf('/') + 1).replace(/\.[^\.]+$/, "");
+    }
+
+    function packageName(path) {
+       var dirpath = path.substring(0, path.lastIndexOf('/'));
+       return dirpath.substr(dirpath.lastIndexOf('/') + 1);
+    }
+    var OBJS = [];
+%%}
+vpath % `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
+vpath %.c `XDCROOT`
+
+CCOPTS    = `BIOS.getCCOpts(TARGET.$name)`
+
+XDC_ROOT  = `XDCROOT`
+
+BUILD_DEFS = `Build.getDefs()`
+
+BIOS_INC  = -I"`xdc.getPackageRepository("ti.sysbios")`"
+
+UTILS_INC    = -I"`xdc.getPackageRepository("ti.sdo.utils")`"
+
+
+CC = `CGEN`/`TARGET.ccBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
+ASM = `CGEN`/`TARGET.asmBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
+AR = `CGEN`/`TARGET.arBin.cmd` `TARGET.ar.opts`
+
+%if (environment["os.name"].match(/Windows.*/i)) {
+%if (BIOS.buildingAppLib == false) {
+%    Build.$private.libDir = Build.$private.libDir.replace(/\//g,'\\');
+%}
+DEL = cmd.exe /q /c del /f
+CP = cmd.exe /q /c copy /Y
+%}
+%else {
+DEL = rm -f
+CP = cp -f
+%}
+
+define RM
+       $(if $(wildcard $1),$(DEL) $1,:)
+endef
+
+define ASSEMBLE
+       @echo asm`TARGET.suffix` $< ...
+       @$(ASM) $(BUILD_DEFS) `XOPTS` $(BIOS_INC) $<
+endef
+
+define COMPILE
+       @echo cl`TARGET.suffix` $< ...
+       @$(CC) $(BUILD_DEFS) `XOPTS` $(BIOS_INC) $(UTILS_INC) $<
+endef
+
+%var LIB = "utils.a" + TARGET.suffix;
+
+all: `LIB`
+
+%var sources = Build.getAsmFiles(TARGET.$name);
+%for each (var s in sources) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".o";
+%    OBJS.push(obj)
+`obj`: `s` makefile
+       @-$(call RM, $@)
+       $(ASSEMBLE) -o `obj`
+
+%}
+
+%var sources = Build.getCFiles(TARGET.$name).split(' ');
+%for each (var s in sources) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".o";
+%    OBJS.push(obj)
+`obj`: `s` makefile
+       @-$(call RM, `obj`)
+       $(COMPILE) -o `obj`
+%}
+
+`LIB`: `OBJS.join(" ")`
+       @echo ar`TARGET.suffix` $^ ...
+       @-$(call RM, $@)
+       @$(AR) $@ $^
+%if (BIOS.buildingAppLib == false) {
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+       $(CP) `LIB` "`Build.$private.libDir``LIB`"
+%}
+
+clean:
+       @-$(call RM, `LIB`)
+%if (BIOS.buildingAppLib == false) {
+       @-$(call RM, "`Build.$private.libDir``LIB`")
+%}
+%if (TARGET.$name.match(/gnu/)) {
+       @-$(call RM, BIOS.o)
+%}
+%else {
+       @-$(call RM, BIOS.obj)
+%}
+%for (var i = 0; i < OBJS.length; i++) {
+       @-$(call RM, `OBJS[i]`)
+%}
diff --git a/packages/ti/sdo/utils/nonInstrumented.cfg b/packages/ti/sdo/utils/nonInstrumented.cfg
new file mode 100644 (file)
index 0000000..01d3042
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/utils/nonInstrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = false;
+
+BIOS.libDir = "lib/sysbios/nonInstrumented/";
+
+var Build = xdc.useModule('ti.sdo.utils.Build');
+Build.libDir = "lib/utils/nonInstrumented/";
diff --git a/packages/ti/sdo/utils/nonInstrumented.cfg.xs b/packages/ti/sdo/utils/nonInstrumented.cfg.xs
new file mode 100644 (file)
index 0000000..bb326e2
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.libType = BIOS.LibType_Custom;
+BIOS.buildingAppLib = false;
+BIOS.assertsEnabled = false;
+BIOS.logsEnabled = false;
+
+var SourceDir = xdc.module("xdc.cfg.SourceDir");
+SourceDir.verbose = 1;
+
+/* suppress un-placed sections warning from m3 Hwi.meta$init() */
+if (Program.sectMap[".vecs"] !== undefined) {
+    Program.sectMap[".vecs"].type = "DSECT";
+}
+if (Program.sectMap[".resetVecs"] !== undefined) {
+    Program.sectMap[".resetVecs"].type= "DSECT";
+}
diff --git a/packages/ti/sdo/utils/package.bld b/packages/ti/sdo/utils/package.bld
new file mode 100644 (file)
index 0000000..333dcfb
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2010-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== package.bld ========
+ */
+
+var UtilsBuild = xdc.loadCapsule("ti/sdo/utils/Build.xs");
+
+var objList = [
+    "NameServer",
+    "NameServerRemoteNull",
+    "List",
+    "MultiProc",
+];
+
+
+/* generate makefiles */
+UtilsBuild.buildLibs(objList, undefined, null, arguments);
+
+/* generate smp makefiles */
+UtilsBuild.buildLibs(objList, undefined, null, ["profile=smp"]);
+
+Pkg.otherFiles = [
+    "package.bld",
+    "_MultiProc.h",
+    "_NameServer.h",
+    "UTILS.c",
+    "makefile.xdt",
+    "makefile_gccArmLto.xdt",
+    "instrumented.cfg.xs", "nonInstrumented.cfg.xs",
+    "instrumented.cfg", "nonInstrumented.cfg",
+    "smpInstrumented.cfg", "smpNonInstrumented.cfg",
+];
+
+var testArray = [
+    {   name: 'instrumented',
+        config: "instrumented",
+        libdir: "instrumented",
+    },
+    {   name: 'nonInstrumented',
+        config: "nonInstrumented",
+        libdir: "nonInstrumented",
+    },
+];
+
+/* Build non-SMP pre-built libs */
+for each (var targ in Build.targets) {
+
+    /* For each test... */
+    for each (var test in testArray) {
+
+        var platform = test.platform ? test.platform : targ.platform;
+
+        var cfg = Pkg.addConfiguration(test.name,
+                                        targ, platform, {
+                                        cfgScript: test.config,
+                                        prelink: false,
+                                        profile: "release",
+                                        exportCfg: false,
+                                        exportSrc: false,
+                                     });
+
+        var myLib = "lib/utils/"
+                + test.libdir + "/utils.a" + targ.suffix;
+
+        Pkg.otherFiles[Pkg.otherFiles.length++] = myLib;
+    }
+}
+
+var smpTestArray = [
+    {   name: 'smpInstrumented',
+        config: "smpInstrumented",
+        libdir: "instrumented",
+    },
+    {   name: 'smpNonInstrumented',
+        config: "smpNonInstrumented",
+        libdir: "nonInstrumented",
+    },
+];
+
+/* Build SMP pre-built libs */
+for each (var targ in Build.targets) {
+
+    if (targ.profiles["smp"] === undefined) continue;
+
+    /* For each test... */
+    for each (var test in smpTestArray) {
+        var platform = test.platform ? test.platform : targ.platform;
+
+        var cfg = Pkg.addConfiguration(test.name,
+                                        targ, platform, {
+                                        cfgScript: test.config,
+                                        prelink: false,
+                                        profile: "release",
+                                        exportCfg: false,
+                                        exportSrc: false,
+                                     });
+
+        var myLib = "lib/smputils/"
+                + test.libdir + "/utils.a" + targ.suffix;
+
+        Pkg.otherFiles[Pkg.otherFiles.length++] = myLib;
+    }
+}
+
+
+/* include source files in the release package */
+Pkg.attrs.exportSrc = true;
+Pkg.attrs.exportCfg = true;
+
+Pkg.generatedFiles.$add("lib/");
diff --git a/packages/ti/sdo/utils/package.xdc b/packages/ti/sdo/utils/package.xdc
new file mode 100644 (file)
index 0000000..9a2cf1c
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+/*!
+ *  ======== ti.sdo.utils ========
+ *  Utility modules
+ *
+ *  Contains modules utility in nature and that are OS independent
+ */
+
+package ti.sdo.utils [1,0,0,0] {
+    module    Build;
+    interface INameServerRemote;
+    module    NameServer;
+    module    NameServerRemoteNull;
+    module    MultiProc;
+    module    List;
+}
diff --git a/packages/ti/sdo/utils/package.xs b/packages/ti/sdo/utils/package.xs
new file mode 100644 (file)
index 0000000..e51f411
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== package.xs ========
+ */
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+function getLibs(prog)
+{
+    var suffix;
+
+    /* find a compatible suffix */
+    if ("findSuffix" in prog.build.target) {
+        suffix = prog.build.target.findSuffix(this);
+    }
+    else {
+        suffix = prog.build.target.suffix;
+    }
+
+    var name = this.$name + ".a" + suffix;
+    var lib = "";
+
+    var BIOS = xdc.module("ti.sysbios.BIOS");
+    var Build = xdc.module("ti.sdo.utils.Build");
+
+    if (BIOS.smpEnabled == true) {
+        libdir = "lib/smputils/";
+    }
+    else {
+        libdir = "lib/utils/";
+    }
+
+    switch (BIOS.libType) {
+        case BIOS.LibType_Instrumented:
+        case BIOS.LibType_NonInstrumented:
+        case BIOS.LibType_Custom:
+            if ((xdc.module('ti.sdo.ipc.Build').$used == false)
+                 && (Build.$used == true)) {
+                lib = Build.$private.outputDir + Build.$private.libraryName;
+                return ("!" + String(java.io.File(lib).getCanonicalPath()));
+            }
+            else {
+                return null;
+            }
+            break;
+
+        case BIOS.LibType_Debug:
+            lib = libdir + "debug/" + name;
+            if (java.io.File(this.packageBase + lib).exists()) {
+                return lib;
+            }
+            break;
+    }
+
+    /* could not find any library, throw exception */
+    throw Error("Library not found: " + name);
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+
+    /*
+     * Force the Build module to get used if any module
+     * in this package is used
+     */
+    for (var mod in this.$modules) {
+        if (this.$modules[mod].$used == true) {
+            xdc.useModule('ti.sdo.utils.Build');
+            break;
+        }
+    }
+}
diff --git a/packages/ti/sdo/utils/smpInstrumented.cfg b/packages/ti/sdo/utils/smpInstrumented.cfg
new file mode 100644 (file)
index 0000000..c1207b1
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/utils/instrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = true;
+
+BIOS.libDir = "lib/sysbios/instrumented/";
+
+var Build = xdc.useModule('ti.sdo.utils.Build');
+Build.libDir = "lib/smputils/instrumented/";
diff --git a/packages/ti/sdo/utils/smpNonInstrumented.cfg b/packages/ti/sdo/utils/smpNonInstrumented.cfg
new file mode 100644 (file)
index 0000000..2f1e6cb
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("ti/sdo/utils/nonInstrumented.cfg.xs")
+
+var BIOS = xdc.module('ti.sysbios.BIOS');
+
+BIOS.smpEnabled = true;
+
+BIOS.libDir = "lib/sysbios/nonInstrumented/";
+
+var Build = xdc.useModule('ti.sdo.utils.Build');
+Build.libDir = "lib/smputils/nonInstrumented/";
diff --git a/products.mak b/products.mak
new file mode 100644 (file)
index 0000000..ad22d53
--- /dev/null
@@ -0,0 +1,87 @@
+#
+#   Copyright (c) 2012-2013, Texas Instruments Incorporated
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#   *  Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   *  Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+#   *  Neither the name of Texas Instruments Incorporated nor the names of
+#      its contributors may be used to endorse or promote products derived
+#      from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+#   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+#   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+#   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+#   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#  ======== products.mak ========
+#
+
+# Optional: recommended to install all dependent components in one folder.
+#
+DEPOT = _your_depot_folder_
+
+#################### IPC Linux ####################
+
+# Set up required cross compiler path for IPC Linux configuration and build
+TOOLCHAIN_LONGNAME ?=arm-none-linux-gnueabi
+TOOLCHAIN_INSTALL_DIR ?= $(DEPOT)/_your_arm_code_gen_install_
+TOOLCHAIN_PREFIX= $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+
+# Linux platform to build (optional)
+# Run './configure --help' for available PLATFORM options
+PLATFORM ?=
+
+# Path to TI Linux Utils package to locate the pre-built CMEM libraries (optional):
+CMEM_INSTALL_DIR ?=
+
+#################### IPC Bios ####################
+
+# Set up required dependencies for IPC Bios builds
+XDC_INSTALL_DIR ?= $(DEPOT)/_your_xdctools_install_
+BIOS_INSTALL_DIR ?= $(DEPOT)/_your_bios_install_
+
+#
+# Set location of various cgtools for Bios builds needed
+# These variables can be set here or on the command line.  The ?= makes
+# the command line to take precedence over the setting in this file.
+#
+ti.targets.C28_large ?=
+ti.targets.C28_float ?=
+ti.targets.C64P ?=
+ti.targets.C64P_big_endian ?=
+ti.targets.C674 ?=
+
+ti.targets.elf.C64P ?=
+ti.targets.elf.C64P_big_endian ?=
+ti.targets.elf.C64T ?=
+ti.targets.elf.C66 ?=
+ti.targets.elf.C66_big_endian ?=
+ti.targets.elf.C674 ?=
+
+ti.targets.arm.elf.Arm9 ?=
+ti.targets.arm.elf.A8F ?=
+ti.targets.arm.elf.A8Fnv ?=
+ti.targets.arm.elf.M3 ?=
+ti.targets.arm.elf.M4 ?=
+ti.targets.arm.elf.M4F ?=
+
+ti.targets.arp32.elf.ARP32 ?=
+ti.targets.arp32.elf.ARP32_far ?=
+
+gnu.targets.arm.A8F ?=
+gnu.targets.arm.A15F ?=