bindings-ppdev (empty) → 0.0.1
raw patch · 4 files changed
+223/−0 lines, 4 filesdep +basedep +bindings-DSLdep +ioctlsetup-changed
Dependencies added: base, bindings-DSL, ioctl
Files
- LICENSE +29/−0
- Setup.hs +6/−0
- bindings-ppdev.cabal +26/−0
- src/Bindings/PpDev.hsc +162/−0
+ LICENSE view
@@ -0,0 +1,29 @@+Copyright (c) <2009>, <Maurício C. Antunes>+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above copyright+ 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 author nor the names of contributors+ may be used to endorse or promote products derived from this+ software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,6 @@+#!/usr/bin/env runhaskell++module Main (main) where+import Distribution.Simple++main = defaultMain
+ bindings-ppdev.cabal view
@@ -0,0 +1,26 @@+Name: bindings-ppdev+Version: 0.0.1+Cabal-version: >= 1.2.3+Synopsis: PPDev bindings+License: BSD3+License-file: LICENSE+Maintainer: joe7mail@gmail.com+Author: Joe M+Build-type: Simple+Category: FFI++Library+ HS-Source-Dirs: src+ GHC-Options: -Wall+ Extensions: ForeignFunctionInterface+ FunctionalDependencies,+ MultiParamTypeClasses,+ DeriveDataTypeable,+ StandaloneDeriving,+ TypeSynonymInstances+ Build-Depends: base >= 3 && < 5,+ bindings-DSL >= 1.0,+ ioctl >= 0.0.1+ Exposed-Modules: Bindings.PpDev+ Build-tools: hsc2hs+
+ src/Bindings/PpDev.hsc view
@@ -0,0 +1,162 @@++{-# OPTIONS_GHC -Wall #-}+{-# LANGUAGE DeriveDataTypeable+ , ForeignFunctionInterface+ , MultiParamTypeClasses+ , StandaloneDeriving+ , TypeSynonymInstances #-}++#include <bindings.dsl.h>+#include <linux/ppdev.h>+#include <linux/ioctl.h>+#include <linux/time.h>++module Bindings.PpDev where+import System.Posix.IOCtl+#strict_import+import Data.Typeable (Typeable)+deriving instance Typeable C'timeval+deriving instance Typeable C'ppdev_frob_struct++#starttype struct timeval+#field tv_sec , CLong+#field tv_usec , CLong+#stoptype++#num PP_IOCTL++-- | Set mode for read/write (e.g. IEEE1284_MODE_EPP)+#num PPSETMODE+#opaque_t PPSETMODE+instance IOControl C'PPSETMODE CInt where ioctlReq _ = c'PPSETMODE++-- | Read status+#num PPRSTATUS+#opaque_t PPRSTATUS+instance IOControl C'PPRSTATUS CUChar where ioctlReq _ = c'PPRSTATUS++-- | Read/write control+#num PPRCONTROL+#opaque_t PPRCONTROL+instance IOControl C'PPRCONTROL CUChar where ioctlReq _ = c'PPRCONTROL++#num PPWCONTROL+#opaque_t PPWCONTROL+instance IOControl C'PPWCONTROL CUChar where ioctlReq _ = c'PPWCONTROL++#starttype struct ppdev_frob_struct+#field mask , CUChar+#field val , CUChar+#stoptype++#num PPFCONTROL+#opaque_t PPFCONTROL+instance IOControl C'PPFCONTROL C'ppdev_frob_struct where ioctlReq _ = c'PPFCONTROL+++-- | Read/write data+#num PPRDATA+#opaque_t PPRDATA+instance IOControl C'PPRDATA CUChar where ioctlReq _ = c'PPRDATA++#num PPWDATA+#opaque_t PPWDATA+instance IOControl C'PPWDATA CUChar where ioctlReq _ = c'PPWDATA++-- | Claim the port to start using it+#num PPCLAIM+#opaque_t PPCLAIM+instance IOControl C'PPCLAIM CInt where ioctlReq _ = c'PPCLAIM++-- | Release the port when you aren't using it+#num PPRELEASE+#opaque_t PPRELEASE+instance IOControl C'PPRELEASE CInt where ioctlReq _ = c'PPRELEASE+++-- | Yield the port (release it if another driver is waiting,+-- then reclaim)+#num PPYIELD+#opaque_t PPYIELD+instance IOControl C'PPYIELD CInt where ioctlReq _ = c'PPYIELD+++-- | Register device exclusively (must be before PPCLAIM).+#num PPEXCL+#opaque_t PPEXCL+instance IOControl C'PPEXCL CInt where ioctlReq _ = c'PPEXCL+++-- | Data line direction: non-zero for input mode.+#num PPDATADIR+#opaque_t PPDATADIR+instance IOControl C'PPDATADIR CInt where ioctlReq _ = c'PPDATADIR+++-- | Negotiate a particular IEEE 1284 mode.+#num PPNEGOT+#opaque_t PPNEGOT+instance IOControl C'PPNEGOT CInt where ioctlReq _ = c'PPNEGOT+++-- | Set control lines when an interrupt occurs.+#num PPWCTLONIRQ+#opaque_t PPWCTLONIRQ+instance IOControl C'PPWCTLONIRQ CUChar where ioctlReq _ = c'PPWCTLONIRQ+++-- | Clear (and return) interrupt count.+#num PPCLRIRQ+#opaque_t PPCLRIRQ+instance IOControl C'PPCLRIRQ CInt where ioctlReq _ = c'PPCLRIRQ+++-- | Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE)+#num PPSETPHASE+#opaque_t PPSETPHASE+instance IOControl C'PPSETPHASE CInt where ioctlReq _ = c'PPSETPHASE+++-- | Set and get port timeout (struct timeval's)+#num PPGETTIME+#opaque_t PPGETTIME+instance IOControl C'PPGETTIME C'timeval where ioctlReq _ = c'PPGETTIME++#num PPSETTIME+#opaque_t PPSETTIME+instance IOControl C'PPSETTIME C'timeval where ioctlReq _ = c'PPSETTIME+++-- | Get available modes (what the hardware can do)+#num PPGETMODES+#opaque_t PPGETMODES+instance IOControl C'PPGETMODES CUInt where ioctlReq _ = c'PPGETMODES+++-- | Get the current mode and phaze+#num PPGETMODE+#opaque_t PPGETMODE+instance IOControl C'PPGETMODE CInt where ioctlReq _ = c'PPGETMODE++#num PPGETPHASE+#opaque_t PPGETPHASE+instance IOControl C'PPGETPHASE CInt where ioctlReq _ = c'PPGETPHASE+++-- | get/set flags+#num PPGETFLAGS+#opaque_t PPGETFLAGS+instance IOControl C'PPGETFLAGS CInt where ioctlReq _ = c'PPGETFLAGS++#num PPSETFLAGS+#opaque_t PPSETFLAGS+instance IOControl C'PPSETFLAGS CInt where ioctlReq _ = c'PPSETFLAGS++-- | flags visible to the world+#num PP_FASTWRITE+#num PP_FASTREAD+#num PP_W91284PIC++-- | only masks user-visible flags+#num PP_FLAGMASK+