Permalink
Browse files

Initial Commit

  • Loading branch information...
0 parents commit b99b452292b2717f4ca25a5ef0f82399c235f0aa @Wiladams committed Oct 6, 2012
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
@@ -0,0 +1,163 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
@@ -0,0 +1,18 @@
+local ffi = require "ffi"
+
+ffi.cdef [[
+void bcm_host_init(void);
+void bcm_host_deinit(void);
+
+int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *width, uint32_t *height);
+]]
+
+ffi.C.bcm_host_init();
+
+--[[
+require "interface/vmcs_host/vc_dispmanx"
+require "interface/vmcs_host/vc_tvservice"
+require "interface/vmcs_host/vc_cec"
+require "interface/vmcs_host/vc_cecservice"
+require "interface/vmcs_host/vcgencmd"
+--]]
@@ -0,0 +1,94 @@
+-- Raspberry Pi GPIO module.
+-- Written by Mike Pall. Public domain.
+
+
+local error, tostring, setmt = error, tostring, setmetatable
+local bit = require("bit")
+local band, bor, shl, shr = bit.band, bit.bor, bit.lshift, bit.rshift
+local ffi = require("ffi")
+local C = ffi.C
+require "syscall"
+
+
+local function gpio_open()
+ local fd = C.open("/dev/mem", 2, 0)
+ if fd < 0 then
+ error("You must be root to control the GPIO pins on the Raspberry Pi")
+ end
+ local gp = ffi.cast("volatile int32_t *",
+ C.mmap(nil, 4096, 3, 1, fd, 0x20200000))
+ C.close(fd)
+ if ffi.cast("intptr_t", gp) == -1 then
+ error("Mapping of GPIO registers failed")
+ end
+ return gp
+end
+
+local gp = ffi.gc(gpio_open(), function(gp)
+ -- Restore default values.
+ gp[0] = 0x00040000; gp[1] = 0x00064000; gp[2] = 0x00000000
+ gp[10] = 0x03e6cf93
+ C.munmap(ffi.cast("void *", gp), 4096)
+end)
+
+module(...)
+
+-- WARNING: You may only use one of the following raw pin numbers!
+-- 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25
+-- These correspond to the BCM2835 GPIO numbering scheme.
+
+-- Set direction of raw GPIO pin. 0 = input, 1 = output.
+local function _rawdir(pin, dir)
+ local idx = pin % 10
+ local reg = (pin - idx) / 10
+ gp[reg] = bor(band(gp[reg], shl(7, idx*3)), shl(dir, idx*3))
+end
+rawdir = _rawdir
+
+-- Turn raw GPIO output pin on.
+function rawon(pin)
+ gp[7] = shl(1, pin)
+end
+
+-- Turn raw GPIO output pin off.
+function rawoff(pin)
+ gp[10] = shl(1, pin)
+end
+
+-- Get state of raw GPIO input pin.
+function rawin(pin)
+ return band(shr(gp[13], pin), 1)
+end
+
+-- User-level (non-raw) GPIO API. The numbers correspond to the numbering
+-- on the GPIO connector drawing: http://elinux.org/File:GPIOs.png
+-- Input/output direction is automatically selected.
+
+local function pinerror(t, i)
+ error("bad GPIO pin number "..tostring(i), 2)
+end
+local rawmap = {[0]=17, 18, 21, 22, 23, 24, 25, 4}
+local inmap = setmt({[0]=-1,-1,-1,-1,-1,-1,-1,-1}, {__index=pinerror})
+local outmap = setmt({[0]=-1,-1,-1,-1,-1,-1,-1,-1}, {__index=pinerror})
+
+pin = setmt({}, {
+ __index = function(t, i)
+ local pin = inmap[i]
+ if pin < 0 then
+ pin = rawmap[i]; inmap[i] = pin; outmap[i] = -1; _rawdir(pin, 0)
+ end
+ return band(shr(gp[13], pin), 1)
+ end,
+ __newindex = function(t, i, v)
+ local pin = outmap[i]
+ if pin < 0 then
+ pin = rawmap[i]; outmap[i] = pin; inmap[i] = -1; _rawdir(pin, 1)
+ end
+ gp[10-band(v, 1)*3] = shl(1, pin)
+ end,
+})
+
+function msleep(ms)
+ C.poll(nil, 0, ms)
+end
+
@@ -0,0 +1,70 @@
+
+
+--[[
+=============================================================================
+VideoCore OS Abstraction Layer - platform-specific types and defines
+=============================================================================
+--]]
+
+--[[
+#include <inttypes.h> /* for PRId64, PRIi64, etc */
+#include <stdint.h>
+
+#define VCOSPRE_ extern
+#define VCOSPOST_
+
+#if defined(__GNUC__) && (( __GNUC__ > 2 ) || (( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 3 )))
+#define VCOS_FORMAT_ATTR_(ARCHETYPE, STRING_INDEX, FIRST_TO_CHECK) __attribute__ ((format (ARCHETYPE, STRING_INDEX, FIRST_TO_CHECK)))
+#else
+#define VCOS_FORMAT_ATTR_(ARCHETYPE, STRING_INDEX, FIRST_TO_CHECK)
+#endif
+
+/*#define VCOS_BKPT vcos_abort() */
+
+#define VCOS_ASSERT_LOGGING 1
+#define VCOS_ASSERT_LOGGING_DISABLE 0
+
+extern void
+vcos_pthreads_logging_assert(const char *file, const char *func, unsigned int line, const char *fmt, ...);
+
+#define VCOS_ASSERT_MSG(...) ((VCOS_ASSERT_LOGGING && !VCOS_ASSERT_LOGGING_DISABLE) ? vcos_pthreads_logging_assert(__FILE__, __func__, __LINE__, __VA_ARGS__) : (void)0)
+--]]
+
+--[[
+#define VCOS_INLINE_BODIES
+#define VCOS_INLINE_DECL extern __inline__
+#define VCOS_INLINE_IMPL static __inline__
+--]]
+
+ PRId64 ="lld";
+ PRIi64 ="lli";
+ PRIo64 ="llo";
+ PRIu64 ="llu";
+ PRIx64 ="llx";
+
+--[[
+Copyright (c) 2012, Broadcom Europe Ltd
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+--]]
Oops, something went wrong.

0 comments on commit b99b452

Please sign in to comment.