Hey,

Thanks for your answer!

Diffs for src/common/atomic.h and src/common/RTMath.cpp are in attachment.
Hope the format is ok...

I'm working on a "hardware" sampler, to be used with a MIDI keyboard, and
easily suitable for rehearsals and shows (= not a computer). I started by
making a C (SDL, alsa) program from scratch, but I saw Linuxsampler was
already doing better. Only drawback: its minimum buffer length is 1024 on
RPi, vs 512 for my own program... Don't know why, as ALSA PCM should be
lower-level and faster than SDL...

Cheers,
Benoît


2014-09-29 12:33 GMT+02:00 raf <rmouney...@gmail.com>:

> Hello,
> you can send the diff for the two files here, Christian should grab them
> one day.
>
> what project are you working on ? (i'm interstingly curious)
>
> Raphaël
> 06 89 85 58 81
> http://www.jerashmusic.fr
>
>
> Le 26 sept. 2014 à 17:56, Benoît Guchet <benoit.guc...@gmail.com> a écrit
> :
>
> > Hi,
> >
> > I made a working fix for LinuxSampler to support ARM11 processors.
> > Only 2 files changed.
> > How could I submit it, so that somebody can review it and/or commit it?
> Here? On Bugzilla?
> >
> > Many thanks!
> > BG
> >
> ------------------------------------------------------------------------------
> > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
> > Linuxsampler-devel mailing list
> > Linuxsampler-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
>
>


-- 
Benoît Guchet
43 quai de la Fosse
44000 Nantes
06 71 09 33 14

Fairy Tales in Yoghourt <http://fairytalesinyoghourt.com> / Classe Mannequin
<https://www.facebook.com/classemannequin>
Überland Deluxe <https://www.facebook.com/uberlanddeluxe> / Forever Young
<https://www.facebook.com/foreveryoungnantes>
Index: RTMath.cpp
===================================================================
--- RTMath.cpp  (revision 2676)
+++ RTMath.cpp  (working copy)
@@ -22,6 +22,9 @@
  ***************************************************************************/
 
 #include "RTMath.h"
+#if defined(__arm__)
+#include <time.h>
+#endif
 
 static float CentsToFreqTable[CONFIG_MAX_PITCH * 1200 * 2 + 1]; // +-1200 
cents per octave
 
@@ -71,6 +74,11 @@
     return t;
     #elif defined(__APPLE__)
     return GetMachTime();
+       #elif defined(__arm__)
+    timespec tp;
+    clock_gettime(CLOCK_MONOTONIC, &tp);
+    return tp.tv_nsec;
+
     #else // we don't want to use a slow generic solution
     #  error "Sorry, LinuxSampler lacks time stamp code for your system."
     #  error "Please report this error and the CPU you are using to the 
LinuxSampler developers mailing list!"
Index: src/common/atomic.h
===================================================================
--- src/common/atomic.h (revision 2676)
+++ src/common/atomic.h (working copy)
@@ -1186,7 +1186,128 @@
 #endif /* __ARCH_M68K_ATOMIC __ */
 
 #else
+#ifdef __arm__
 
+/*
+ * That part of code for ARM11 was taken from ALSA's iatomic.h
+ */
+
+/*
+ * FIXME: bellow code is valid only for SA11xx
+ */
+
+/*
+ * Save the current interrupt enable state & disable IRQs
+ */
+#define local_irq_save(x)                                      \
+       ({                                                      \
+               unsigned long temp;                             \
+       __asm__ __volatile__(                                   \
+       "mrs    %0, cpsr                @ local_irq_save\n"     \
+"      orr     %1, %0, #128\n"                                 \
+"      msr     cpsr_c, %1"                                     \
+       : "=r" (x), "=r" (temp)                                 \
+       :                                                       \
+       : "memory");                                            \
+       })
+
+/*
+ * restore saved IRQ & FIQ state
+ */
+#define local_irq_restore(x)                                   \
+       __asm__ __volatile__(                                   \
+       "msr    cpsr_c, %0              @ local_irq_restore\n"  \
+       :                                                       \
+       : "r" (x)                                               \
+       : "memory")
+
+#define __save_flags_cli(x) local_irq_save(x)
+#define __restore_flags(x) local_irq_restore(x)
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i)        (((v)->counter) = (i))
+
+static __inline__ void atomic_add(int i, volatile atomic_t *v)
+{
+       unsigned long flags;
+
+       __save_flags_cli(flags);
+       v->counter += i;
+       __restore_flags(flags);
+}
+
+static __inline__ void atomic_sub(int i, volatile atomic_t *v)
+{
+       unsigned long flags;
+
+       __save_flags_cli(flags);
+       v->counter -= i;
+       __restore_flags(flags);
+}
+
+static __inline__ void atomic_inc(volatile atomic_t *v)
+{
+       unsigned long flags;
+
+       __save_flags_cli(flags);
+       v->counter += 1;
+       __restore_flags(flags);
+}
+
+static __inline__ void atomic_dec(volatile atomic_t *v)
+{
+       unsigned long flags;
+
+       __save_flags_cli(flags);
+       v->counter -= 1;
+       __restore_flags(flags);
+}
+
+static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
+{
+       unsigned long flags;
+       int result;
+
+       __save_flags_cli(flags);
+       v->counter -= 1;
+       result = (v->counter == 0);
+       __restore_flags(flags);
+
+       return result;
+}
+
+static inline int atomic_add_negative(int i, volatile atomic_t *v)
+{
+       unsigned long flags;
+       int result;
+
+       __save_flags_cli(flags);
+       v->counter += i;
+       result = (v->counter < 0);
+       __restore_flags(flags);
+
+       return result;
+}
+
+static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long 
*addr)
+{
+       unsigned long flags;
+
+       __save_flags_cli(flags);
+       *addr &= ~mask;
+       __restore_flags(flags);
+}
+
+#define mb() __asm__ __volatile__ ("" : : : "memory")
+#define rmb() mb()
+#define wmb() mb()
+
+#else
+
 #warning libs/pbd has no implementation of strictly atomic operations for your 
hardware.
 
 #define __NO_STRICT_ATOMIC
@@ -1231,6 +1352,7 @@
 }
 
 #  endif /* __NO_STRICT_ATOMIC */
+#  endif /* arm */
 #  endif /* m68k */
 #  endif /* mips */
 #  endif /* s390 */
------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to