fixed workaround for memcpy/set to be memory efficient but slower

This commit is contained in:
joxe 2010-03-19 14:39:45 +00:00
parent 29335f2f7d
commit 7e6919cc8c
2 changed files with 32 additions and 3 deletions

View file

@ -28,16 +28,39 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: msp430.c,v 1.10 2009/02/04 18:28:44 joxe Exp $ * @(#)$Id: msp430.c,v 1.11 2010/03/19 14:39:45 joxe Exp $
*/ */
#include <io.h> #include <io.h>
#include <signal.h> #include <signal.h>
#include <sys/unistd.h> #include <sys/unistd.h>
#include "msp430.h" #include "msp430.h"
#include "msp430def.h"
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include "net/uip.h" #include "net/uip.h"
/* /\*---------------------------------------------------------------------------*\/ */
/* void * */
/* w_memcpy(void *out, const void *in, size_t n) */
/* { */
/* uint8_t *src, *dest; */
/* src = (uint8_t *) in; */
/* dest = (uint8_t *) out; */
/* while(n-- > 0) { */
/* *dest++ = *src++; */
/* } */
/* return out; */
/* } */
/* /\*---------------------------------------------------------------------------*\/ */
/* void * */
/* w_memset(void *out, int value, size_t n) */
/* { */
/* uint8_t *dest; */
/* dest = (uint8_t *) out; */
/* while(n-- > 0) { */
/* *dest++ = value & 0xff; */
/* } */
/* return out; */
/* } */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
msp430_init_dco(void) msp430_init_dco(void)

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)$Id: msp430def.h,v 1.3 2009/04/06 13:07:37 nifi Exp $ * @(#)$Id: msp430def.h,v 1.4 2010/03/19 14:39:45 joxe Exp $
*/ */
#ifndef MSP430DEF_H #ifndef MSP430DEF_H
@ -76,6 +76,9 @@ spl_t splhigh_(void);
#ifndef memcpy #ifndef memcpy
#include <string.h> #include <string.h>
/* void *w_memcpy(void *out, const void *in, size_t n); */
/* #define memcpy(dest, src, count) w_memcpy(dest, src, count) */
#define memcpy(dest, src, count) do { \ #define memcpy(dest, src, count) do { \
if(count == 2) { \ if(count == 2) { \
*((uint8_t *)dest) = *((uint8_t *)src); \ *((uint8_t *)dest) = *((uint8_t *)src); \
@ -85,6 +88,9 @@ spl_t splhigh_(void);
} \ } \
} while(0) } while(0)
/* void *w_memset(void *out, int value, size_t n); */
/* #define memset(dest, value, count) w_memset(dest, value, count) */
#define memset(dest, value, count) do { \ #define memset(dest, value, count) do { \
if(count == 2) { \ if(count == 2) { \
*((uint8_t *)dest) = (uint8_t)value; \ *((uint8_t *)dest) = (uint8_t)value; \