Added a fix in crt.S for the trampoline bug in the M16c GCC implementation.
Fixed a bug in m16c62phardware.h with the atomic statements, the flag register was saved after the interrupts were disabled which is not correct.
Some Mulle defines in the Deluge code had accidentally been removed, added these again.
Added a faster software spi implementation for the RF230 specific Mulle code. It is still not fast enough, but it could be made faster if the RF230 chip code also would be modified. (Look into this in the future).
.text
.global __vector_default
-
+ .global m32c_jsri16
.extern _main
.section .init0,"ax",@progbits
/* In case we return, should realy generate a reset :/ */
jmp.b 0
+m32c_jsri16:
+ add.w #-1, sp
+ /* Read the address (16 bits) and return address (24 bits) off
+ the stack. */
+ mov.w 4[sp], r0
+ mov.w 1[sp], r3
+ mov.b 3[sp], a0 /* This zero-extends, so the high byte has
+ zero in it. */
+ /* Write the return address, then new address, to the stack. */
+ mov.w a0, 1[sp] /* Just to get the zero in 2[sp]. */
+ mov.w r0, 0[sp]
+ mov.w r3, 3[sp]
+ mov.b a0, 5[sp]
+
+ /* This "returns" to the target address, leaving the pending
+ return address on the stack. */
+ rts
+
+
/* We should probably not get here. */
__vector_default:
jmp.a __vector_default
OBJDUMP = m32c-elf-objdump
SET_ID = tos-set-symbols
NCC = ncc
-LIBS = -lm -lc -lgcc
+LIBS = #-lm -lc -lgcc
AMADDR = _ActiveMessageAddressC\$$addr
# Uncomment the next two lines if you have a toolchain without the dollar sign
@echo " installing $(PLATFORM) with bootloader using sm16cf"
srec_cat $(BOOTLOADER_IMG) $(INSTALL_SREC) -exclude 0x000FFFDC 0x00100000 -o $(BUILDDIR)/main_boot.srec -CRLF
sed '/S5/d' $(BUILDDIR)/main_boot.srec > $(BUILDDIR)/main_boot2.srec
- $(PROGRAMMER) --device=$(SM16CF) --input-file=$(BUILDDIR)/main_boot2.srec --flash-program
+ $(PROGRAMMER) --baud-rate=57600 --device=$(SM16CF) --input-file=$(BUILDDIR)/main_boot2.srec --flash-program
rm $(BUILDDIR)/main_boot.srec
rm $(BUILDDIR)/main_boot2.srec
else
program: FORCE
@echo " installing $(PLATFORM) using sm16cf"
- $(PROGRAMMER) --device=$(SM16CF) --input-file=$(INSTALL_SREC) --flash-program
+ $(PROGRAMMER) --baud-rate=57600 --device=$(SM16CF) --input-file=$(INSTALL_SREC) --flash-program
endif
program_bl: FORCE
inline __nesc_atomic_t __nesc_atomic_start(void) @spontaneous()
{
__nesc_atomic_t result;
- // Disable interrupts
- __nesc_disable_interrupt();
// Save the flag register (FLG)
asm volatile ("stc flg, %0": "=r"(result): : "%flg");
+ // Disable interrupts
+ __nesc_disable_interrupt();
asm volatile("" : : : "memory"); // ensure atomic section effect visibility
return result;
}
components ActiveMessageAddressC;
NetProgM.setAmAddress -> ActiveMessageAddressC;
-#if !defined(PLATFORM_TINYNODE)
+#if !defined(PLATFORM_TINYNODE) && !defined(PLATFORM_MULLE)
components CC2420ControlP;
NetProgM.CC2420Config -> CC2420ControlP;
#endif
interface InternalFlash as IFlash;
interface Crc;
interface Leds;
-#if !defined(PLATFORM_TINYNODE)
+#if !defined(PLATFORM_TINYNODE) && !defined(PLATFORM_MULLE)
interface CC2420Config;
#endif
async command void setAmAddress(am_addr_t a);
TOS_NODE_ID = bootArgs.address;
call setAmAddress(bootArgs.address);
}
-#if !defined(PLATFORM_TINYNODE)
+#if !defined(PLATFORM_TINYNODE) && !defined(PLATFORM_MULLE)
call CC2420Config.setShortAddr(bootArgs.address);
call CC2420Config.sync();
#endif
}
}
-#if !defined(PLATFORM_TINYNODE)
+#if !defined(PLATFORM_TINYNODE) && !defined(PLATFORM_MULLE)
event void CC2420Config.syncDone(error_t error) {}
#endif
}
%T/lib/timer
%T/lib/serial
%T/lib/diagmsg
- %T/lib/printf
+ %T/lib/net/Deluge
) );
@opts = qw(
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+
/**
* Implementation of the time capture on RF230 interrupt and the
* FastSpiBus interface.
uses
{
interface GeneralIO as PortIRQ;
- interface GeneralIO as PortVCC;
+ interface GeneralIO as PortVCC;
interface GpioInterrupt as GIRQ;
interface SoftSpiBus as Spi;
interface Alarm<TRadio, uint16_t> as Alarm;
call GIRQ.disable();
}
+ /**
+ * Faster software implementation of the SPI bus for communication
+ * with the RF230 chip.
+ */
+ uint8_t fastWrite(uint8_t byte)
+ {
+#define fwMOSIset() P1.BIT.P1_1 = 1
+#define fwMOSIclr() P1.BIT.P1_1 = 0
+#define fwSCLKset() P3.BIT.P3_3 = 1
+#define fwSCLKclr() P3.BIT.P3_3 = 0
+#define fwMISOget() P1.BIT.P1_0
+ uint8_t data = 0;
+ uint8_t mask = 0x80;
+ atomic {
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+
+ if (byte & mask)
+ {
+ fwMOSIset();
+ }
+ else
+ {
+ fwMOSIclr();
+ }
+ fwSCLKclr();
+ if( fwMISOget() )
+ data |= mask;
+ fwSCLKset();
+ mask >>= 1;
+ }
+ return data;
+ }
+
uint8_t tmp_data;
- async command void FastSpiByte.splitWrite(uint8_t data)
+ inline async command void FastSpiByte.splitWrite(uint8_t data)
{
- atomic tmp_data = data;
+ atomic tmp_data = fastWrite(data);
}
- async command uint8_t FastSpiByte.splitRead()
+ inline async command uint8_t FastSpiByte.splitRead()
{
- atomic return call Spi.write(tmp_data);
+ atomic return tmp_data;
}
- async command uint8_t FastSpiByte.splitReadWrite(uint8_t data)
+ inline async command uint8_t FastSpiByte.splitReadWrite(uint8_t data)
{
uint8_t b;
atomic
{
- b = call Spi.write(tmp_data);
- tmp_data = data;
+ b = tmp_data;
+ tmp_data = fastWrite(data);
}
return b;
}
- async command uint8_t FastSpiByte.write(uint8_t data)
+ inline async command uint8_t FastSpiByte.write(uint8_t data)
{
- return call Spi.write(data);
+ return fastWrite(data);
}
}