Changed type from off_t (that potentially conflicts with existing types.h typedefs) to unsigned long
This commit is contained in:
parent
84a42a0bb3
commit
51f4ab8b2c
@ -1,32 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
* @(#)$Id: xmem.h,v 1.1 2006/06/17 22:41:17 adamdunkels Exp $
|
||||
* @(#)$Id: xmem.h,v 1.2 2008/07/03 23:12:10 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#ifndef XMEM_H
|
||||
@ -34,10 +34,10 @@
|
||||
|
||||
void xmem_init(void);
|
||||
|
||||
int xmem_pread(void *buf, int nbytes, off_t offset);
|
||||
int xmem_pread(void *buf, int nbytes, unsigned long offset);
|
||||
|
||||
int xmem_pwrite(const void *buf, int nbytes, off_t offset);
|
||||
int xmem_pwrite(const void *buf, int nbytes, unsigned long offset);
|
||||
|
||||
int xmem_erase(long nbytes, off_t offset);
|
||||
int xmem_erase(long nbytes, unsigned long offset);
|
||||
|
||||
#endif /* XMEM_H */
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)$Id: xmem.c,v 1.6 2008/02/11 10:43:31 adamdunkels Exp $
|
||||
* @(#)$Id: xmem.c,v 1.7 2008/07/03 23:12:10 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ wait_ready(void)
|
||||
* Erase 64k bytes of data. It takes about 1s before WIP goes low!
|
||||
*/
|
||||
static void
|
||||
erase_sector(off_t offset)
|
||||
erase_sector(unsigned long offset)
|
||||
{
|
||||
int s;
|
||||
wait_ready();
|
||||
@ -162,7 +162,7 @@ xmem_init(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
xmem_pread(void *_p, int size, off_t offset)
|
||||
xmem_pread(void *_p, int size, unsigned long offset)
|
||||
{
|
||||
unsigned char *p = _p;
|
||||
const unsigned char *end = p + size;
|
||||
@ -190,7 +190,7 @@ xmem_pread(void *_p, int size, off_t offset)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const char *
|
||||
program_page(off_t offset, const unsigned char *p, int nbytes)
|
||||
program_page(unsigned long offset, const unsigned char *p, int nbytes)
|
||||
{
|
||||
const unsigned char *end = p + nbytes;
|
||||
int s;
|
||||
@ -218,11 +218,11 @@ program_page(off_t offset, const unsigned char *p, int nbytes)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
xmem_pwrite(const void *_buf, int size, off_t addr)
|
||||
xmem_pwrite(const void *_buf, int size, unsigned long addr)
|
||||
{
|
||||
const unsigned char *p = _buf;
|
||||
const off_t end = addr + size;
|
||||
off_t i, next_page;
|
||||
const unsigned long end = addr + size;
|
||||
unsigned long i, next_page;
|
||||
|
||||
for(i = addr; i < end;) {
|
||||
next_page = (i | 0xff) + 1;
|
||||
@ -236,9 +236,9 @@ xmem_pwrite(const void *_buf, int size, off_t addr)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
xmem_erase(long size, off_t addr)
|
||||
xmem_erase(long size, unsigned long addr)
|
||||
{
|
||||
off_t end = addr + size;
|
||||
unsigned long end = addr + size;
|
||||
|
||||
if(size % XMEM_ERASE_UNIT_SIZE != 0) {
|
||||
PRINTF("xmem_erase: bad size\n");
|
||||
|
Loading…
Reference in New Issue
Block a user