mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
Added Doxygen documentation
This commit is contained in:
parent
ca6abb286b
commit
b51977a693
@ -1,39 +1,42 @@
|
||||
/*
|
||||
* 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.c,v 1.2 2006/08/10 16:42:11 bg- Exp $
|
||||
* @(#)$Id: xmem.c,v 1.3 2007/11/10 20:45:29 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Device driver for the ST M25P80 40MHz 1Mbyte external memory.
|
||||
/**
|
||||
* \file
|
||||
* Device driver for the ST M25P80 40MHz 1Mbyte external memory.
|
||||
* \author
|
||||
* Björn Grönvall <bg@sics.se>
|
||||
*
|
||||
* Data is written bit inverted (~-operator) to flash so that
|
||||
* unwritten data will read as zeros (UNIX style).
|
||||
* Data is written bit inverted (~-operator) to flash so that
|
||||
* unwritten data will read as zeros (UNIX style).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -64,13 +67,13 @@
|
||||
#define SPI_FLASH_INS_BE 0xc7
|
||||
#define SPI_FLASH_INS_DP 0xb9
|
||||
#define SPI_FLASH_INS_RES 0xab
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
spi_tx(unsigned byte)
|
||||
{
|
||||
FASTSPI_TX(byte);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
write_enable(void)
|
||||
{
|
||||
@ -84,7 +87,7 @@ write_enable(void)
|
||||
SPI_FLASH_DISABLE();
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static unsigned
|
||||
read_status_register(void)
|
||||
{
|
||||
@ -105,7 +108,7 @@ read_status_register(void)
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Wait for a write/erase operation to finish.
|
||||
*/
|
||||
@ -118,7 +121,7 @@ wait_ready(void)
|
||||
} while(u & 0x01); /* WIP=1, write in progress */
|
||||
return u;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Erase 64k bytes of data. It takes about 1s before WIP goes low!
|
||||
*/
|
||||
@ -142,7 +145,7 @@ erase_sector(off_t offset)
|
||||
SPI_FLASH_DISABLE();
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Initialize external flash *and* SPI bus!
|
||||
*/
|
||||
@ -157,7 +160,7 @@ xmem_init(void)
|
||||
SPI_FLASH_DISABLE(); /* Unselect flash. */
|
||||
SPI_FLASH_UNHOLD();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
xmem_pread(void *_p, int size, off_t offset)
|
||||
{
|
||||
@ -186,7 +189,7 @@ xmem_pread(void *_p, int size, off_t offset)
|
||||
splx(s);
|
||||
return size;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const char *
|
||||
program_page(off_t offset, const unsigned char *p, int nbytes)
|
||||
{
|
||||
@ -214,7 +217,7 @@ program_page(off_t offset, const unsigned char *p, int nbytes)
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
xmem_pwrite(const void *_buf, int size, off_t addr)
|
||||
{
|
||||
@ -231,7 +234,7 @@ xmem_pwrite(const void *_buf, int size, off_t addr)
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
xmem_erase(long size, off_t addr)
|
||||
{
|
||||
@ -252,3 +255,4 @@ xmem_erase(long size, off_t addr)
|
||||
|
||||
return size;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user