mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Deleted unused files
This commit is contained in:
parent
c06399abe9
commit
7791271e8e
@ -1,42 +0,0 @@
|
||||
Copyright (C) 2009, H&D Wireless AB All rights reserved.
|
||||
|
||||
The license to use this software in whole and in part and to
|
||||
redistribute it in any form follows with the WiFi HW module from H&D
|
||||
Wireless and is granted under the following restrictions:
|
||||
|
||||
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. The name of H&D Wireless AB may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
4. The software may only be used together with hardware from H&D
|
||||
Wireless all other use is prohibited.
|
||||
|
||||
5. The license to use and redistribute the software is granted
|
||||
together with the purchase of a hardware platform on a one to one
|
||||
basis
|
||||
|
||||
6. The binary code may not be reversed engineered or by other means
|
||||
copied to circumvent this license.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT
|
||||
SHALL HD WIRELESS AB 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.
|
||||
|
||||
For more information regarding this software license Contact H&D
|
||||
Wireless AB (support@hd-wireless.se).
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
Revision: 707
|
@ -1,101 +0,0 @@
|
||||
/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <avr32/io.h>
|
||||
#include "board.h"
|
||||
#include "clocks.h"
|
||||
#include "pm.h"
|
||||
//#include "flashc.h"
|
||||
#include "gpio.h"
|
||||
|
||||
/**
|
||||
* Initializes the MCU system clocks.
|
||||
*/
|
||||
void
|
||||
init_sys_clocks(void)
|
||||
{
|
||||
/* switch to OSC0 to speed up the booting */
|
||||
pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);
|
||||
|
||||
#ifndef USE_PLL
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* For audio, ee have to use OSC1 on to generate the correct clockrate
|
||||
* for the SSC
|
||||
*/
|
||||
#if OSC == 1
|
||||
/* start oscillator1 */
|
||||
pm_enable_osc1_crystal(&AVR32_PM, FOSC1);
|
||||
pm_enable_clk1(&AVR32_PM, OSC1_STARTUP);
|
||||
#endif
|
||||
|
||||
/* configure pll multipliers */
|
||||
pm_pll_setup(&AVR32_PM,
|
||||
0, /* pll */
|
||||
PLL_MUL, /* mul */
|
||||
1, /* div */
|
||||
OSC, /* osc */
|
||||
16); /* lockcount */
|
||||
|
||||
/* set PLL operating range and divider (fpll = fvco/2)
|
||||
* this gives PLL output = 66 MHz (62.0928 MHz for EVK1105/OSC1)
|
||||
*/
|
||||
pm_pll_set_option(&AVR32_PM,
|
||||
0, /* pll */
|
||||
1, /* pll_freq */
|
||||
1, /* pll_div2 */
|
||||
0); /* pll_wbwdisable. */
|
||||
|
||||
|
||||
/* start PLL0 and wait for the lock */
|
||||
pm_pll_enable(&AVR32_PM, 0);
|
||||
pm_wait_for_pll0_locked(&AVR32_PM);
|
||||
|
||||
/* Set all peripheral clocks torun at master clock rate */
|
||||
pm_cksel(&AVR32_PM,
|
||||
0, /* pbadiv */
|
||||
0, /* pbasel */
|
||||
0, /* pbbdiv */
|
||||
0, /* pbbsel */
|
||||
0, /* hsbdiv */
|
||||
0); /* hsbsel */
|
||||
|
||||
/* Set one waitstate for the flash */
|
||||
// flashc_set_wait_state(1);
|
||||
|
||||
/* Switch to PLL0 as the master clock */
|
||||
pm_switch_to_clock(&AVR32_PM, AVR32_PM_MCCTRL_MCSEL_PLL0);
|
||||
|
||||
#if OSC == 1
|
||||
pm_configure_usb_clock();
|
||||
#endif
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
|
||||
#ifndef CLOCKS_H
|
||||
#define CLOCKS_H
|
||||
|
||||
#include "board.h"
|
||||
|
||||
|
||||
#if BOARD == EVK1100
|
||||
# define USE_PLL
|
||||
# define OSC 0
|
||||
# define PLL_MUL 10
|
||||
#elif BOARD == EVK1101
|
||||
# define USE_PLL
|
||||
# define OSC 0
|
||||
# define PLL_MUL 9
|
||||
#elif BOARD == EVK1104
|
||||
# define USE_PLL
|
||||
# define OSC 0
|
||||
# define PLL_MUL 9 /* for some reason we cant use 66 MHz */
|
||||
#elif BOARD == EVK1105
|
||||
# define USE_PLL
|
||||
# define OSC 1
|
||||
# define PLL_MUL 10
|
||||
#elif BOARD == ARDUINO
|
||||
# define USE_PLL
|
||||
# define OSC 0
|
||||
# define PLL_MUL 8
|
||||
#endif
|
||||
|
||||
#if OSC == 0
|
||||
# define FOSC FOSC0 /* 12 MHz */
|
||||
#else
|
||||
# define FOSC FOSC1 /* 11.2896 MHz */
|
||||
#endif
|
||||
|
||||
#ifdef USE_PLL
|
||||
# define FMCK_HZ ((FOSC * (PLL_MUL + 1)) / 2)
|
||||
#else
|
||||
# define FMCK_HZ FOSC
|
||||
#endif
|
||||
|
||||
#define FCPU_HZ FMCK_HZ
|
||||
#define FHSB_HZ FCPU_HZ
|
||||
#define FPBB_HZ FMCK_HZ
|
||||
#define FPBA_HZ FMCK_HZ
|
||||
|
||||
void init_sys_clocks(void);
|
||||
|
||||
#endif
|
@ -1,265 +0,0 @@
|
||||
/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef WITH_HTTP
|
||||
|
||||
#define httpd_start() 0
|
||||
#define httpd_stop()
|
||||
|
||||
#else
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "httpd.h"
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
|
||||
#include "fs.h"
|
||||
#include "printf-stdarg.h"
|
||||
|
||||
struct http_state {
|
||||
char *file;
|
||||
u16_t left;
|
||||
u8_t retries;
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
conn_err(void *arg, err_t err)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(err);
|
||||
|
||||
hs = arg;
|
||||
mem_free(hs);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
close_conn(struct tcp_pcb *pcb, struct http_state *hs)
|
||||
{
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
mem_free(hs);
|
||||
tcp_close(pcb);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_data(struct tcp_pcb *pcb, struct http_state *hs)
|
||||
{
|
||||
err_t err;
|
||||
u16_t len;
|
||||
|
||||
/* We cannot send more data than space available in the send
|
||||
buffer. */
|
||||
if (tcp_sndbuf(pcb) < hs->left) {
|
||||
len = tcp_sndbuf(pcb);
|
||||
} else {
|
||||
len = hs->left;
|
||||
}
|
||||
|
||||
do {
|
||||
err = tcp_write(pcb, hs->file, len, 0);
|
||||
if (err == ERR_MEM) {
|
||||
len /= 2;
|
||||
}
|
||||
} while (err == ERR_MEM && len > 1);
|
||||
|
||||
if (err == ERR_OK) {
|
||||
hs->file += len;
|
||||
hs->left -= len;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_poll(void *arg, struct tcp_pcb *pcb)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
hs = arg;
|
||||
|
||||
if (hs == NULL) {
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
} else {
|
||||
++hs->retries;
|
||||
if (hs->retries == 4) {
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
send_data(pcb, hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
|
||||
hs = arg;
|
||||
|
||||
hs->retries = 0;
|
||||
|
||||
if (hs->left > 0) {
|
||||
send_data(pcb, hs);
|
||||
} else {
|
||||
close_conn(pcb, hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
int i;
|
||||
char *data;
|
||||
struct fs_file file;
|
||||
struct http_state *hs;
|
||||
hs = arg;
|
||||
|
||||
if (err == ERR_OK && p != NULL) {
|
||||
|
||||
/* Inform TCP that we have taken the data. */
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
|
||||
if (hs->file == NULL) {
|
||||
data = p->payload;
|
||||
|
||||
if (strncmp(data, "GET ", 4) == 0) {
|
||||
for(i = 0; i < 40; i++) {
|
||||
if (((char *)data + 4)[i] == ' ' ||
|
||||
((char *)data + 4)[i] == '\r' ||
|
||||
((char *)data + 4)[i] == '\n') {
|
||||
((char *)data + 4)[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (*(char *)(data + 4) == '/' &&
|
||||
*(char *)(data + 5) == 0) {
|
||||
fs_open("/index.html", &file);
|
||||
} else if (!fs_open((char *)data + 4, &file)) {
|
||||
fs_open("/404.html", &file);
|
||||
}
|
||||
|
||||
hs->file = file.data;
|
||||
hs->left = file.len;
|
||||
|
||||
pbuf_free(p);
|
||||
send_data(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish be to informed of data that has been
|
||||
successfully sent by a call to the http_sent() function. */
|
||||
tcp_sent(pcb, http_sent);
|
||||
}
|
||||
else {
|
||||
printk("%s\n", p->payload);
|
||||
pbuf_free(p);
|
||||
close_conn(pcb, hs);
|
||||
}
|
||||
} else {
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == ERR_OK && p == NULL) {
|
||||
close_conn(pcb, hs);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
|
||||
tcp_setprio(pcb, TCP_PRIO_MIN);
|
||||
|
||||
/* Allocate memory for the structure that holds the state of the
|
||||
connection. */
|
||||
hs = (struct http_state *)mem_malloc(sizeof(struct http_state));
|
||||
|
||||
if (hs == NULL) {
|
||||
printk("http_accept: Out of memory\n");
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
/* Initialize the structure. */
|
||||
hs->file = NULL;
|
||||
hs->left = 0;
|
||||
hs->retries = 0;
|
||||
|
||||
/* Tell TCP that this is the structure we wish to be passed for our
|
||||
callbacks. */
|
||||
tcp_arg(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish to be informed of incoming data by a call
|
||||
to the http_recv() function. */
|
||||
tcp_recv(pcb, http_recv);
|
||||
|
||||
tcp_err(pcb, conn_err);
|
||||
|
||||
tcp_poll(pcb, http_poll, 4);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
struct tcp_pcb *pcb = NULL;
|
||||
|
||||
err_t httpd_start(void)
|
||||
{
|
||||
pcb = tcp_new();
|
||||
if (pcb == NULL)
|
||||
return ERR_MEM;
|
||||
tcp_bind(pcb, IP_ADDR_ANY, 80);
|
||||
pcb = tcp_listen(pcb);
|
||||
tcp_accept(pcb, http_accept);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void httpd_stop(void)
|
||||
{
|
||||
if (pcb)
|
||||
tcp_close(pcb);
|
||||
}
|
||||
#endif
|
@ -1,48 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __HTTPD_H__
|
||||
#define __HTTPD_H__
|
||||
|
||||
#include "lwip/err.h"
|
||||
#ifndef WITH_HTTP
|
||||
|
||||
#define httpd_start() 0
|
||||
#define httpd_stop()
|
||||
|
||||
#else
|
||||
err_t httpd_start(void);
|
||||
void httpd_stop(void);
|
||||
#endif
|
||||
|
||||
#endif /* __HTTPD_H__ */
|
@ -1,99 +0,0 @@
|
||||
/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "compiler.h"
|
||||
#include "preprocessor.h"
|
||||
#include "board.h"
|
||||
#include "power_clocks_lib.h"
|
||||
#include "gpio.h"
|
||||
#include "spi.h"
|
||||
#include "conf_at45dbx.h"
|
||||
#include "at45dbx.h"
|
||||
#include "clocks.h"
|
||||
|
||||
|
||||
void flash_init(void)
|
||||
{
|
||||
static const gpio_map_t AT45DBX_SPI_GPIO_MAP = {
|
||||
{ AT45DBX_SPI_SCK_PIN, AT45DBX_SPI_SCK_FUNCTION },
|
||||
{ AT45DBX_SPI_MISO_PIN, AT45DBX_SPI_MISO_FUNCTION },
|
||||
{ AT45DBX_SPI_MOSI_PIN, AT45DBX_SPI_MOSI_FUNCTION },
|
||||
{ AT45DBX_SPI_NPCS2_PIN, AT45DBX_SPI_NPCS2_FUNCTION },
|
||||
};
|
||||
|
||||
spi_options_t spiOptions = {
|
||||
.reg = AT45DBX_SPI_FIRST_NPCS,
|
||||
.baudrate = AT45DBX_SPI_MASTER_SPEED,
|
||||
.bits = AT45DBX_SPI_BITS,
|
||||
.spck_delay = 0,
|
||||
.trans_delay = 0,
|
||||
.stay_act = 1,
|
||||
.spi_mode = 0,
|
||||
.modfdis = 1
|
||||
};
|
||||
|
||||
gpio_enable_module(AT45DBX_SPI_GPIO_MAP,
|
||||
sizeof(AT45DBX_SPI_GPIO_MAP) /
|
||||
sizeof(AT45DBX_SPI_GPIO_MAP[0]));
|
||||
|
||||
spi_initMaster(AT45DBX_SPI, &spiOptions);
|
||||
|
||||
spi_selectionMode(AT45DBX_SPI, 0, 0, 0);
|
||||
spi_enable(AT45DBX_SPI);
|
||||
|
||||
/* put up flash reset pin */
|
||||
gpio_set_gpio_pin(AT45DBX_CHIP_RESET);
|
||||
|
||||
at45dbx_init(spiOptions, FPBA_HZ);
|
||||
}
|
||||
|
||||
void flash_write(U32 addr, const U8* buf, U32 len)
|
||||
{
|
||||
U32 sector = addr / AT45DBX_SECTOR_SIZE;
|
||||
U32 i;
|
||||
Assert(addr % AT45DBX_SECTOR_SIZE == 0);
|
||||
|
||||
at45dbx_write_open(sector);
|
||||
for (i = 0; i < len; i++)
|
||||
at45dbx_write_byte(buf[i]);
|
||||
at45dbx_write_close();
|
||||
}
|
||||
|
||||
void flash_read(U32 addr, U8* buf, U32 len)
|
||||
{
|
||||
U32 sector = addr / AT45DBX_SECTOR_SIZE;
|
||||
U32 i;
|
||||
Assert(addr % AT45DBX_SECTOR_SIZE == 0);
|
||||
|
||||
at45dbx_read_open(sector);
|
||||
for (i = 0; i < len; i++)
|
||||
buf[i] = at45dbx_read_byte();
|
||||
at45dbx_read_close();
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#ifndef NOR_FLASH_H
|
||||
#define NOR_FLASH_H
|
||||
|
||||
#include "at45dbx.h"
|
||||
|
||||
#define SECTOR_SIZE AT45DBX_SECTOR_SIZE
|
||||
|
||||
void flash_init(void);
|
||||
void flash_write(U32 addr, const U8* buf, U32 len);
|
||||
void flash_read(U32 addr, U8* buf, U32 len);
|
||||
|
||||
#endif
|
@ -1,59 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#ifndef PLATFORM_SPI_H
|
||||
#define PLATFORM_SPI_H
|
||||
#include <inttypes.h>
|
||||
#include "spb.h"
|
||||
|
||||
#define MAX_BLOCK_LEN 512
|
||||
|
||||
enum {
|
||||
IRQ_OP_ENABLE,
|
||||
IRQ_OP_DISABLE
|
||||
};
|
||||
|
||||
enum {
|
||||
SPI_FLAG_POLL = (1 << 0),
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
SPI_IRQ_RX = (1 << 0),
|
||||
};
|
||||
|
||||
void platform_init(uint8_t *flags);
|
||||
void platform_reset(void);
|
||||
void platform_txrx(const uint8_t *in, uint8_t* out, uint16_t len);
|
||||
void platform_spi_irq(uint8_t op);
|
||||
void platform_spi_cs(uint8_t enable);
|
||||
|
||||
extern void spi_irq_handler(uint8_t status);
|
||||
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#ifndef SPB_H
|
||||
#define SPB_H
|
||||
|
||||
#define SPB104 104
|
||||
#define SPB105 105
|
||||
|
||||
#endif
|
@ -1,77 +0,0 @@
|
||||
/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#include "startup.h"
|
||||
#include "pm.h"
|
||||
#include "intc.h"
|
||||
#include "board.h"
|
||||
#include "print_funcs.h"
|
||||
#include "clocks.h"
|
||||
#include "ard_spi.h"
|
||||
#include "ard_utils.h"
|
||||
|
||||
|
||||
static void init_exceptions(void)
|
||||
{
|
||||
extern void _evba;
|
||||
Set_system_register(AVR32_EVBA, (int)&_evba);
|
||||
Enable_global_exception();
|
||||
}
|
||||
|
||||
static void init_hmatrix(void)
|
||||
{
|
||||
union {
|
||||
unsigned long scfg;
|
||||
avr32_hmatrix_scfg_t SCFG;
|
||||
} u_avr32_hmatrix_scfg = {
|
||||
AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH]
|
||||
};
|
||||
u_avr32_hmatrix_scfg.SCFG.defmstr_type =
|
||||
AVR32_HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT;
|
||||
AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH] =
|
||||
u_avr32_hmatrix_scfg.scfg;
|
||||
}
|
||||
|
||||
static void init_interrupts(void)
|
||||
{
|
||||
INTC_init_interrupts();
|
||||
Enable_global_interrupt();
|
||||
}
|
||||
|
||||
void startup_init(void)
|
||||
{
|
||||
INIT_SIGNAL_FOR_SPI();
|
||||
BUSY_FOR_SPI();
|
||||
|
||||
init_exceptions();
|
||||
init_hmatrix();
|
||||
init_sys_clocks();
|
||||
init_interrupts();
|
||||
init_dbg_rs232(FPBA_HZ);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#ifndef STARTUP_H
|
||||
#define STARTUP_H
|
||||
|
||||
void startup_init(void);
|
||||
|
||||
#endif
|
@ -1,84 +0,0 @@
|
||||
/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
#include "top_defs.h"
|
||||
#include "wl_util.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
int equal_ssid(const struct wl_ssid_t* ssid1,
|
||||
const struct wl_ssid_t* ssid2) {
|
||||
if (ssid1->len == ssid2->len &&
|
||||
(memcmp(ssid1->ssid, ssid2->ssid, ssid1->len) == 0)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int equal_bssid(const struct wl_mac_addr_t* bssid1,
|
||||
const struct wl_mac_addr_t* bssid2) {
|
||||
if (memcmp(bssid1, bssid2, sizeof *bssid1) == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ssid2str(struct wl_ssid_t *ssid) {
|
||||
static char buf[WL_SSID_MAX_LENGTH + 1];
|
||||
|
||||
memset(buf, 0, sizeof buf);
|
||||
memcpy(buf, ssid->ssid, ssid->len);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
const char* mac2str(uint8_t* mac)
|
||||
{
|
||||
static char buf[18] ALIGN;
|
||||
sniprintf(buf, sizeof(buf), "%02x-%02x-%02x-%02x-%02x-%02x",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
char* enc_type2str(enum wl_enc_type enc_type)
|
||||
{
|
||||
switch(enc_type) {
|
||||
case ENC_TYPE_WEP:
|
||||
return "WEP";
|
||||
case ENC_TYPE_CCMP:
|
||||
return "CCMP";
|
||||
case ENC_TYPE_TKIP:
|
||||
return "TKIP";
|
||||
default:
|
||||
return "";
|
||||
};
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
|
||||
|
||||
/*! \page License
|
||||
* Copyright (C) 2009, H&D Wireless AB 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. The name of H&D Wireless AB may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
/*! \file wl_util.h **************************************************************
|
||||
*
|
||||
* \brief Optional WiFi support/convenience functions
|
||||
*
|
||||
* This file provides a support interface for wl_api.
|
||||
*
|
||||
* - Compiler: GNU GCC for AVR32
|
||||
* - Supported devices: EVK1104 with SPB104 card
|
||||
* - AppNote:
|
||||
*
|
||||
* \author H&D Wireless: \n
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#include "top_defs.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "wl_api.h"
|
||||
|
||||
#ifndef WL_UTIL_H
|
||||
#define WL_UTIL_H
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/* Important note!
|
||||
*
|
||||
* These functions are used internally by the wl_api library. Since
|
||||
* they are useful for the application using the wl_api library they
|
||||
* are included as source code. To avoid duplicating code these
|
||||
* functions are declared as weak symbols so that the ones compiled
|
||||
* into the library will be replaced by the ones compiled with the
|
||||
* application (if any). However, this means that these functions
|
||||
* _must not_ be rewritten as the library depends on the current
|
||||
* implementation. If other functionality is desired then these
|
||||
* functions should be renamed.
|
||||
*/
|
||||
|
||||
/*! Return a buffer with the SSID as a printable string.
|
||||
* The returned buffer is static and should not be freed and
|
||||
* this function is not
|
||||
* thread safe.
|
||||
*/
|
||||
const char* ssid2str(struct wl_ssid_t *ssid) WEAK_DECL;
|
||||
|
||||
const char* mac2str(uint8_t mac[6]) WEAK_DECL;
|
||||
|
||||
char* enc_type2str(enum wl_enc_type enc_type) WEAK_DECL;
|
||||
|
||||
int equal_ssid(const struct wl_ssid_t* ssid1,
|
||||
const struct wl_ssid_t* ssid2) WEAK_DECL;
|
||||
|
||||
int equal_bssid(const struct wl_mac_addr_t* bssid1,
|
||||
const struct wl_mac_addr_t* bssid2) WEAK_DECL;
|
||||
|
||||
|
||||
#define NET_SET_SSID(net, xssid, ssid_len) do { \
|
||||
memcpy((net)->ssid.ssid, (xssid), (ssid_len)); \
|
||||
(net)->ssid.len = (ssid_len); \
|
||||
} while (0)
|
||||
|
||||
#define NET_SET_BSSID(net, xbssid) do { \
|
||||
memcpy(&(net)->bssid, &(xbssid), sizeof (xbssid)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#endif /* WL_UTIL_H */
|
Loading…
x
Reference in New Issue
Block a user