packages feed

sdr 0.1.0.13 → 0.1.0.14

raw patch · 4 files changed

+78/−87 lines, 4 filesdep ~QuickCheckdep ~bytestringdep ~criterion

Dependency ranges changed: QuickCheck, bytestring, criterion, dynamic-graph, mwc-random, optparse-applicative, primitive, time, transformers, vector

Files

Readme.md view
@@ -39,17 +39,6 @@ cabal install sdr ``` -Or, you can build it with cabal sandboxes:--```-cabal sandbox init-git clone https://github.com/adamwalker/dynamic-graph-git clone https://github.com/adamwalker/haskell-fftw-simple-git clone https://github.com/adamwalker/sdr-cabal sandbox add-source dynamic-graph haskell-fftw-simple sdr-cabal install sdr-```- If you want to use the BladeRF, you will also need [bladerf-pipes](https://github.com/adamwalker/bladerf-pipes) and [hlibBladeRF](https://github.com/victoredwardocallaghan/hlibBladeRF).   ## Example Applications@@ -60,23 +49,25 @@  ``` git clone https://github.com/adamwalker/sdr-apps  -cabal sandbox add-source sdr-apps-cabal install sdr-apps+cd sdr-apps+cabal install ```  To run the FM receiver:++(Assuming cabal-built binaries are in your path) ```-.cabal-sandbox/bin/fm -f <your favourite station, e.g. 90.2M>  +fm -f <your favourite station, e.g. 90.2M>   ```  To run the waterfall plot: ```-.cabal-sandbox/bin/waterfall -f <center frequency, e.g. 90.2M> -r <sample rate, e.g. 1280M>+waterfall -f <center frequency, e.g. 90.2M> -r <sample rate, e.g. 1280M> ```  To run the AM receiver: ```-.cabal-sandbox/bin/am -f <center frequency, e.g. 124.4M> +am -f <center frequency, e.g. 124.4M>  ```  # Usage
hs_sources/SDR/FilterInternal.hs view
@@ -65,16 +65,16 @@  filterFFIR :: FilterCRR -> FilterRR  filterFFIR func coeffs num inBuf outBuf = -    VS.unsafeWith (coerce coeffs) $ \cPtr -> -        VS.unsafeWith (coerce inBuf) $ \iPtr -> -            VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector coeffs) $ \cPtr -> +        VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +            VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->                  func (fromIntegral num) (fromIntegral $ VG.length coeffs) cPtr iPtr oPtr  filterFFIC :: FilterCRR -> FilterRC  filterFFIC func coeffs num inBuf outBuf = -    VS.unsafeWith (coerce coeffs) $ \cPtr -> -        VS.unsafeWith (coerce inBuf) $ \iPtr -> -            VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector coeffs) $ \cPtr -> +        VS.unsafeWith (VS.unsafeCast inBuf) $ \iPtr -> +            VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->                  func (fromIntegral num) (fromIntegral $ VG.length coeffs) cPtr iPtr oPtr  foreign import ccall unsafe "filterRR"@@ -164,16 +164,16 @@  decimateFFIR :: DecimateCRR -> DecimateRR  decimateFFIR func factor coeffs num inBuf outBuf = -    VS.unsafeWith (coerce coeffs) $ \cPtr -> -        VS.unsafeWith (coerce inBuf) $ \iPtr -> -            VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector coeffs) $ \cPtr -> +        VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +            VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->                  func (fromIntegral num) (fromIntegral factor) (fromIntegral $ VG.length coeffs) cPtr iPtr oPtr  decimateFFIC :: DecimateCRR -> DecimateRC  decimateFFIC func factor coeffs num inBuf outBuf = -    VS.unsafeWith (coerce coeffs) $ \cPtr -> -        VS.unsafeWith (coerce inBuf) $ \iPtr -> -            VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector coeffs) $ \cPtr -> +        VS.unsafeWith (VS.unsafeCast inBuf) $ \iPtr -> +            VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->                  func (fromIntegral num) (fromIntegral factor) (fromIntegral $ VG.length coeffs) cPtr iPtr oPtr  foreign import ccall unsafe "decimateRR"@@ -269,9 +269,9 @@  resampleCRR :: Int -> Int -> Int -> Int -> VS.Vector Float -> VS.Vector Float -> VS.MVector RealWorld Float -> IO () resampleCRR num interpolation decimation offset coeffs inBuf outBuf = -    VS.unsafeWith (coerce coeffs) $ \cPtr -> -        VS.unsafeWith (coerce inBuf) $ \iPtr -> -            VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector coeffs) $ \cPtr -> +        VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +            VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->                  resample_c (fromIntegral num) (fromIntegral $ VG.length coeffs) (fromIntegral interpolation) (fromIntegral decimation) (fromIntegral offset) cPtr iPtr oPtr  pad :: a -> Int -> [a] -> [a]@@ -320,14 +320,14 @@  resampleFFIR :: (Ptr CFloat -> Ptr CFloat -> IO CInt) -> VS.Vector Float -> VSM.MVector RealWorld Float -> IO Int resampleFFIR func inBuf outBuf = liftM fromIntegral $-    VS.unsafeWith (coerce inBuf) $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +        VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->              func iPtr oPtr  resampleFFIC :: (Ptr CFloat -> Ptr CFloat -> IO CInt) -> VS.Vector (Complex Float) -> VSM.MVector RealWorld (Complex Float) -> IO Int resampleFFIC func inBuf outBuf = liftM fromIntegral $-    VS.unsafeWith (coerce inBuf) $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCast inBuf) $ \iPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              func iPtr oPtr  type ResampleR = CInt -> CInt -> CInt -> CInt -> Ptr CInt -> Ptr (Ptr CFloat) -> Ptr CFloat -> Ptr CFloat -> IO CInt@@ -429,8 +429,8 @@ dcBlocker num lastSample lastOutput inBuf outBuf =      alloca $ \fsp ->          alloca $ \fop -> -            VS.unsafeWith (coerce inBuf) $ \iPtr -> -                VSM.unsafeWith (coerce outBuf) $ \oPtr -> do+            VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +                VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr -> do                     c_dcBlocker (fromIntegral num) (realToFrac lastSample) (realToFrac lastOutput) fsp fop iPtr oPtr                     r1 <- peek fsp                     r2 <- peek fop
hs_sources/SDR/Util.hs view
@@ -105,7 +105,7 @@ interleavedIQUnsignedByteToFloat inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf `quot` 2     VS.unsafeWith inBuf $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              convertC_c (fromIntegral $ VG.length inBuf) iPtr oPtr     VG.freeze outBuf @@ -117,7 +117,7 @@ interleavedIQUnsignedByteToFloatSSE inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf `quot` 2     VS.unsafeWith inBuf $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              convertCSSE_c (fromIntegral $ VG.length inBuf) iPtr oPtr     VG.freeze outBuf @@ -129,7 +129,7 @@ interleavedIQUnsignedByteToFloatAVX inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf `quot` 2     VS.unsafeWith inBuf $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              convertCAVX_c (fromIntegral $ VG.length inBuf) iPtr oPtr     VG.freeze outBuf @@ -155,7 +155,7 @@ interleavedIQSignedWordToFloat inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf `quot` 2     VS.unsafeWith inBuf $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              convertCBladeRF_c (fromIntegral $ VG.length inBuf) iPtr oPtr     VG.freeze outBuf @@ -167,7 +167,7 @@ interleavedIQSignedWordToFloatSSE inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf `quot` 2     VS.unsafeWith inBuf $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              convertCSSEBladeRF_c (fromIntegral $ VG.length inBuf) iPtr oPtr     VG.freeze outBuf @@ -179,7 +179,7 @@ interleavedIQSignedWordToFloatAVX inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf `quot` 2     VS.unsafeWith inBuf $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +        VSM.unsafeWith (VSM.unsafeCast outBuf) $ \oPtr ->              convertCAVXBladeRF_c (fromIntegral $ VG.length inBuf) iPtr oPtr     VG.freeze outBuf @@ -205,7 +205,7 @@ complexFloatToInterleavedIQSignedWord :: VS.Vector (Complex Float) -> VS.Vector CShort complexFloatToInterleavedIQSignedWord inBuf = unsafePerformIO $ do     outBuf <- VGM.new $ VG.length inBuf * 2-    VS.unsafeWith (coerce inBuf) $ \iPtr -> +    VS.unsafeWith (VS.unsafeCast inBuf) $ \iPtr ->          VSM.unsafeWith outBuf $ \oPtr ->              convertBladeRFTransmit_c (fromIntegral $ VG.length inBuf * 2) iPtr oPtr     VG.freeze outBuf@@ -220,8 +220,8 @@        -> VS.MVector RealWorld Float -- ^ Output vector        -> IO () scaleC factor inBuf outBuf = -    VS.unsafeWith (coerce inBuf) $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +        VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->              scale_c (fromIntegral (VG.length inBuf)) (coerce factor) iPtr oPtr  foreign import ccall unsafe "scaleSSE"@@ -233,8 +233,8 @@           -> VS.MVector RealWorld Float -- ^ Output vector           -> IO () scaleCSSE factor inBuf outBuf = -    VS.unsafeWith (coerce inBuf) $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +        VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->              scaleSSE_c (fromIntegral (VG.length inBuf)) (coerce factor) iPtr oPtr  foreign import ccall unsafe "scaleAVX"@@ -246,8 +246,8 @@           -> VS.MVector RealWorld Float -- ^ Output vector           -> IO () scaleCAVX factor inBuf outBuf = -    VS.unsafeWith (coerce inBuf) $ \iPtr -> -        VSM.unsafeWith (coerce outBuf) $ \oPtr -> +    VS.unsafeWith (VS.unsafeCoerceVector inBuf) $ \iPtr -> +        VSM.unsafeWith (VSM.unsafeCoerceMVector outBuf) $ \oPtr ->              scaleAVX_c (fromIntegral (VG.length inBuf)) (coerce factor) iPtr oPtr  -- | Scale a vector. Uses the fastest SIMD instruction set your processor supports.
sdr.cabal view
@@ -1,5 +1,5 @@ name:                sdr-version:             0.1.0.13+version:             0.1.0.14 synopsis:            A software defined radio library description:              Write software defined radio applications in Haskell.@@ -68,36 +68,36 @@     -- other-modules:            other-extensions:    ScopedTypeVariables, GADTs     build-depends:       -        base                 >=4.7   && <5,-        fftwRaw              >=0.1   && <0.2, -        bytestring           >=0.10  && <0.11, -        pulse-simple         >=0.1   && <0.2, -        pipes                >=4.1   && <4.4, -        pipes-concurrency    >=2.0   && <2.1, -        time                 >=1.4   && <1.10, -        rtlsdr               >=0.1   && <0.2, -        storable-complex     >=0.2   && <0.3, -        pipes-bytestring     >=2.0   && <2.2, -        dynamic-graph        >=0.1.0.12,-        array                >=0.4   && <0.6, -        vector               >=0.11  && <0.13,-        tuple                >=0.2   && <0.4, -        OpenGL               >=2.11  && <3.1,-        GLFW-b               >=1.4.8 && <4,-        primitive            >=0.5   && <0.8, -        colour               >=2.3   && <2.4, -        pango                >=0.13  && <0.14, -        containers           >=0.5   && <0.7, -        cairo                >=0.13  && <0.14, -        cereal               >=0.4   && <0.6, -        optparse-applicative >=0.11  && <0.16, -        Decimal              >=0.4   && <0.6,-        Chart                >=1.3   && <1.10, -        Chart-cairo          >=1.3   && <1.10,-        transformers         >=0.5   && <0.6,-        network              >=3     && <4,-        bytestring-to-vector >=0.3   && <0.5,-        mwc-random+        base                 >=4.7      && <5,+        fftwRaw              >=0.1      && <0.2, +        bytestring           >=0.10     && <0.12, +        pulse-simple         >=0.1      && <0.2, +        pipes                >=4.1      && <4.4, +        pipes-concurrency    >=2.0      && <2.1, +        time                 >=1.4      && <1.13, +        rtlsdr               >=0.1      && <0.2, +        storable-complex     >=0.2      && <0.3, +        pipes-bytestring     >=2.0      && <2.2, +        dynamic-graph        >=0.1.0.12 && <0.2,+        array                >=0.4      && <0.6, +        vector               >=0.11     && <0.14,+        tuple                >=0.2      && <0.4, +        OpenGL               >=2.11     && <3.1,+        GLFW-b               >=1.4.8    && <4,+        primitive            >=0.5      && <0.9, +        colour               >=2.3      && <2.4, +        pango                >=0.13     && <0.14, +        containers           >=0.5      && <0.7, +        cairo                >=0.13     && <0.14, +        cereal               >=0.4      && <0.6, +        optparse-applicative >=0.11     && <0.19, +        Decimal              >=0.4      && <0.6,+        Chart                >=1.3      && <1.10, +        Chart-cairo          >=1.3      && <1.10,+        transformers         >=0.5      && <0.7,+        network              >=3        && <4,+        bytestring-to-vector >=0.3      && <0.5,+        mwc-random           >=0.15     && <0.16     -- hs-source-dirs:           default-language:    Haskell2010     ghc-options:         -O2@@ -118,9 +118,9 @@     main-is:             TestSuite.hs     build-depends:                base                       >=4.6  && <5, -        QuickCheck                 >=2.8  && <2.14, -        vector                     >=0.11 && <0.13, -        primitive                  >=0.5  && <0.8, +        QuickCheck                 >=2.8  && <2.15, +        vector                     >=0.11 && <0.14, +        primitive                  >=0.5  && <0.9,          storable-complex           >=0.2  && <0.3,         test-framework             >=0.8  && <0.9,         test-framework-quickcheck2 >=0.3  && <0.4,@@ -134,9 +134,9 @@     main-is:             Benchmarks.hs     build-depends:                base             >=4.6  && <5, -        criterion        >=1.0  && <1.6,-        vector           >=0.11 && <0.13, -        primitive        >=0.5  && <0.8, +        criterion        >=1.0  && <1.7,+        vector           >=0.11 && <0.14, +        primitive        >=0.5  && <0.9,          storable-complex >=0.2  && <0.3,         sdr     hs-source-dirs:      benchmarks