Contiki-Inga 3.x
httpd-fs-arch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, TU Braunschweig
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  */
32 
33 /**
34  * \file
35  * File system functions for the raven/inga-webserver.
36  * \author
37  * Enrico Joerns <e.joerns@tu-bs.de>
38  */
39 
40 /*
41  * Provides file system functions for the raven/inga-webserver.
42  *
43  * Currently implemented for coffee on internal flash, external flash and sd card
44  */
45 
46 #ifndef HTTPD_FS_ARCH_H
47 #define HTTPD_FS_ARCH_H
48 
49 
50 #if COFFEE_FILES
51 
52 /* Coffee file system can be static or dynamic. If static, new files
53  can not be created and rewrites of an existing file can not be
54  made beyond the initial allocation.
55  */
56 #include "cfs-coffee-arch.h"
57 
58 #define httpd_fs_cpy avr_httpd_fs_cpy
59 #define httpd_fs_getchar avr_httpd_fs_getchar
60 #define httpd_fs_strcmp avr_httpd_fs_strcmp
61 #define httpd_fs_strchr avr_httpd_fs_strchr
62 
63 #ifdef COFFEE_AVR_FLASH
64 #define avr_httpd_fs_cpy(dest,addr,size) avr_flash_read((CFS_CONF_OFFSET_TYPE) addr, (uint8_t *)dest, (CFS_CONF_OFFSET_TYPE) size)
65 #define http_fs_read avr_flash_read
66 #endif
67 
68 #ifdef COFFEE_AVR_EXTERNAL
69 #define avr_httpd_fs_cpy(dest,addr,size) external_flash_read((CFS_CONF_OFFSET_TYPE) addr, (uint8_t *)dest, (CFS_CONF_OFFSET_TYPE) size)
70 #define http_fs_read external_flash_read
71 #endif
72 
73 #ifdef COFFEE_AVR_SDCARD
74 #define avr_httpd_fs_cpy(dest,addr,size) sd_read((CFS_CONF_OFFSET_TYPE) addr, (uint8_t *)dest, (CFS_CONF_OFFSET_TYPE) size)
75 #define http_fs_read sd_read
76 #endif
77 
78 #endif
79 
80 
81 #endif /* HTTPD_FS_ARCH_H */
82