diff --git a/.travis.yml b/.travis.yml index 9bbf04133..7d1e59067 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_script: export CC65_HOME=/tmp/cc65/ && cc65 --version || true" ## Compile cooja.jar only when it's going to be needed - - "[ ${BUILD_CATEGORY:-sim} = sim ] && java -version && ant -q -f tools/cooja/build.xml jar || true" + - "[ ${BUILD_CATEGORY:-sim} = sim ] && java -version && ant -q -f tools/cooja/build.xml jar && sudo java -Xshare:dump -version || true" ## IMPORTANT: The commands here have to end with `|| true`, ## because it would make the test fail if BUILD_TYPE test fails diff --git a/Makefile.include b/Makefile.include index fb215a404..7310cb2dc 100644 --- a/Makefile.include +++ b/Makefile.include @@ -64,14 +64,13 @@ SYSTEM = process.c procinit.c autostart.c elfloader.c \ compower.c serial-line.c THREADS = mt.c LIBS = memb.c mmem.c timer.c list.c etimer.c ctimer.c energest.c rtimer.c stimer.c trickle-timer.c \ - print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c settings.c + print-stats.c ifft.c crc16.c random.c ringbuf.c settings.c DEV = nullradio.c include $(CONTIKI)/core/net/Makefile.uip include $(CONTIKI)/core/net/rpl/Makefile.rpl CTK = ctk.c -CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c ifndef CONTIKI_NO_NET CONTIKIFILES = $(SYSTEM) $(LIBS) $(NET) $(THREADS) $(DHCP) $(DEV) diff --git a/apps/about/about-dsc.h b/apps/about/about-dsc.h index 83cae0f90..13e4fe6e8 100644 --- a/apps/about/about-dsc.h +++ b/apps/about/about-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __ABOUT_DSC_H__ -#define __ABOUT_DSC_H__ +#ifndef ABOUT_DSC_H_ +#define ABOUT_DSC_H_ #include "sys/dsc.h" DSC_HEADER(about_dsc); -#endif /* __ABOUT_DSC_H__ */ +#endif /* ABOUT_DSC_H_ */ diff --git a/apps/calc/calc-dsc.h b/apps/calc/calc-dsc.h index 48be8da31..e583f6edb 100644 --- a/apps/calc/calc-dsc.h +++ b/apps/calc/calc-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __CALC_DSC_H__ -#define __CALC_DSC_H__ +#ifndef CALC_DSC_H_ +#define CALC_DSC_H_ #include "sys/dsc.h" DSC_HEADER(calc_dsc); -#endif /* __CALC_DSC_H__ */ +#endif /* CALC_DSC_H_ */ diff --git a/apps/cmdd/cmdd.h b/apps/cmdd/cmdd.h index a4ec4e908..ab8a48c1b 100644 --- a/apps/cmdd/cmdd.h +++ b/apps/cmdd/cmdd.h @@ -1,8 +1,8 @@ -#ifndef __CMDD_H__ -#define __CMDD_H__ +#ifndef CMDD_H_ +#define CMDD_H_ #include "contiki.h" PROCESS_NAME(cmdd_process); -#endif /* __CMDD_H__ */ +#endif /* CMDD_H_ */ diff --git a/apps/codeprop/codeprop-tmp.h b/apps/codeprop/codeprop-tmp.h index 510925b9d..4be406310 100644 --- a/apps/codeprop/codeprop-tmp.h +++ b/apps/codeprop/codeprop-tmp.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __CODEPROP_H__ -#define __CODEPROP_H__ +#ifndef CODEPROP_H_ +#define CODEPROP_H_ #include "contiki.h" @@ -43,4 +43,4 @@ void codeprop_start_broadcast(unsigned int len); void codeprop_exit_program(void); int codeprop_start_program(void); -#endif /* __CODEPROP_H__ */ +#endif /* CODEPROP_H_ */ diff --git a/apps/codeprop/codeprop.h b/apps/codeprop/codeprop.h index a30d13f98..baea35341 100644 --- a/apps/codeprop/codeprop.h +++ b/apps/codeprop/codeprop.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __CODEPROP_H__ -#define __CODEPROP_H__ +#ifndef CODEPROP_H_ +#define CODEPROP_H_ #include "contiki.h" @@ -50,4 +50,4 @@ void codeprop_set_rate(clock_time_t time); void codeprop_start_broadcast(unsigned int len); void codeprop_start_program(void); -#endif /* __CODEPROP_H__ */ +#endif /* CODEPROP_H_ */ diff --git a/apps/dhcp/dhcp-dsc.h b/apps/dhcp/dhcp-dsc.h index bced638a8..77c65fa12 100644 --- a/apps/dhcp/dhcp-dsc.h +++ b/apps/dhcp/dhcp-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __DHCP_DSC_H__ -#define __DHCP_DSC_H__ +#ifndef DHCP_DSC_H_ +#define DHCP_DSC_H_ #include "sys/dsc.h" DSC_HEADER(dhcp_dsc); -#endif /* __DHCP_DSC_H__ */ +#endif /* DHCP_DSC_H_ */ diff --git a/apps/directory/directory-dsc.h b/apps/directory/directory-dsc.h index 4c959c888..7a9b3181a 100644 --- a/apps/directory/directory-dsc.h +++ b/apps/directory/directory-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __DIRECTORY_DSC_H__ -#define __DIRECTORY_DSC_H__ +#ifndef DIRECTORY_DSC_H_ +#define DIRECTORY_DSC_H_ #include "sys/dsc.h" DSC_HEADER(directory_dsc); -#endif /* __DIRECTORY_DSC_H__ */ +#endif /* DIRECTORY_DSC_H_ */ diff --git a/apps/email/email-dsc.h b/apps/email/email-dsc.h index c1508b4d0..d93112986 100644 --- a/apps/email/email-dsc.h +++ b/apps/email/email-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __EMAIL_DSC_H__ -#define __EMAIL_DSC_H__ +#ifndef EMAIL_DSC_H_ +#define EMAIL_DSC_H_ #include "sys/dsc.h" DSC_HEADER(email_dsc); -#endif /* __EMAIL_DSC_H__ */ +#endif /* EMAIL_DSC_H_ */ diff --git a/apps/email/email.h b/apps/email/email.h index 64ef9dd28..4d1ce1045 100644 --- a/apps/email/email.h +++ b/apps/email/email.h @@ -31,9 +31,9 @@ * * */ -#ifndef __EMAIL_H__ -#define __EMAIL_H__ +#ifndef EMAIL_H_ +#define EMAIL_H_ PROCESS_NAME(email_process); -#endif /* __EMAIL_H__ */ +#endif /* EMAIL_H_ */ diff --git a/apps/email/smtp.h b/apps/email/smtp.h index e0ea74604..1dbeafd7d 100644 --- a/apps/email/smtp.h +++ b/apps/email/smtp.h @@ -30,8 +30,8 @@ * * */ -#ifndef __SMTP_H__ -#define __SMTP_H__ +#ifndef SMTP_H_ +#define SMTP_H_ #include "contiki-net.h" @@ -60,4 +60,4 @@ void smtp_appcall(void *state); void smtp_init(void); -#endif /* __SMTP_H__ */ +#endif /* SMTP_H_ */ diff --git a/apps/ftp/ftp-dsc.h b/apps/ftp/ftp-dsc.h index b06d7836d..7559b7a74 100644 --- a/apps/ftp/ftp-dsc.h +++ b/apps/ftp/ftp-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __FTP_DSC_H__ -#define __FTP_DSC_H__ +#ifndef FTP_DSC_H_ +#define FTP_DSC_H_ #include "sys/dsc.h" DSC_HEADER(ftp_dsc); -#endif /* __FTP_DSC_H__ */ +#endif /* FTP_DSC_H_ */ diff --git a/apps/ftp/ftp.h b/apps/ftp/ftp.h index a78c96cdf..2f31a5a5f 100644 --- a/apps/ftp/ftp.h +++ b/apps/ftp/ftp.h @@ -31,9 +31,9 @@ * * */ -#ifndef __FTP_H__ -#define __FTP_H__ +#ifndef FTP_H_ +#define FTP_H_ PROCESS_NAME(ftp_process); -#endif /* __FTP_H__ */ +#endif /* FTP_H_ */ diff --git a/apps/ftp/ftpc.h b/apps/ftp/ftpc.h index b8bd4e314..81cf9c2dc 100644 --- a/apps/ftp/ftpc.h +++ b/apps/ftp/ftpc.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __FTPC_H__ -#define __FTPC_H__ +#ifndef FTPC_H_ +#define FTPC_H_ #include "contiki-net.h" @@ -64,4 +64,4 @@ void ftpc_timedout(void); void ftpc_list_file(char *filename); void ftpc_data(uint8_t *data, uint16_t len); -#endif /* __FTPC_H__ */ +#endif /* FTPC_H_ */ diff --git a/apps/http-post-auth/http-post-auth.h b/apps/http-post-auth/http-post-auth.h index 5204b6430..82242b406 100644 --- a/apps/http-post-auth/http-post-auth.h +++ b/apps/http-post-auth/http-post-auth.h @@ -30,8 +30,8 @@ * */ -#ifndef __HTTP_POST_AUTH_H__ -#define __HTTP_POST_AUTH_H__ +#ifndef HTTP_POST_AUTH_H_ +#define HTTP_POST_AUTH_H_ #include "contiki-net.h" @@ -39,4 +39,4 @@ PROCESS_NAME(http_post_auth_process); int http_post_auth(const uint8_t *username_password, const char *message); -#endif /* __HTTP_POST_AUTH_H__ */ +#endif /* HTTP_POST_AUTH_H_ */ diff --git a/apps/httpd-ws/httpd-ws.h b/apps/httpd-ws/httpd-ws.h index bf60df778..9b6429979 100644 --- a/apps/httpd-ws/httpd-ws.h +++ b/apps/httpd-ws/httpd-ws.h @@ -38,8 +38,8 @@ * Joakim Eriksson */ -#ifndef __HTTPD_WS_H__ -#define __HTTPD_WS_H__ +#ifndef HTTPD_WS_H_ +#define HTTPD_WS_H_ #include "contiki-net.h" @@ -122,4 +122,4 @@ httpd_ws_script_t httpd_ws_get_script(struct httpd_ws_state *s); PROCESS_NAME(httpd_ws_process); -#endif /* __HTTPD_WS_H__ */ +#endif /* HTTPD_WS_H_ */ diff --git a/apps/irc/irc-dsc.h b/apps/irc/irc-dsc.h index a17431965..3f88694d7 100644 --- a/apps/irc/irc-dsc.h +++ b/apps/irc/irc-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __IRC_DSC_H__ -#define __IRC_DSC_H__ +#ifndef IRC_DSC_H_ +#define IRC_DSC_H_ #include "sys/dsc.h" DSC_HEADER(irc_dsc); -#endif /* __IRC_DSC_H__ */ +#endif /* IRC_DSC_H_ */ diff --git a/apps/irc/irc.h b/apps/irc/irc.h index a70a4c22d..cc5eae016 100644 --- a/apps/irc/irc.h +++ b/apps/irc/irc.h @@ -31,9 +31,9 @@ * * */ -#ifndef __IRC_H__ -#define __IRC_H__ +#ifndef IRC_H_ +#define IRC_H_ PROCESS_NAME(irc_process); -#endif /* __IRC_H__ */ +#endif /* IRC_H_ */ diff --git a/apps/irc/ircc.h b/apps/irc/ircc.h index 7f0985fb3..c42860f5e 100644 --- a/apps/irc/ircc.h +++ b/apps/irc/ircc.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __IRCC_H__ -#define __IRCC_H__ +#ifndef IRCC_H_ +#define IRCC_H_ #include "contiki-net.h" @@ -75,4 +75,4 @@ void ircc_closed(struct ircc_state *s); void ircc_quit(struct ircc_state *s); -#endif /* __IRCC_H__ */ +#endif /* IRCC_H_ */ diff --git a/apps/json/json.h b/apps/json/json.h index 703f6d57c..a698464a5 100644 --- a/apps/json/json.h +++ b/apps/json/json.h @@ -37,8 +37,8 @@ * Joakim Eriksson */ -#ifndef __JSON_H__ -#define __JSON_H__ +#ifndef JSON_H_ +#define JSON_H_ #define JSON_TYPE_ARRAY '[' #define JSON_TYPE_OBJECT '{' @@ -67,4 +67,4 @@ enum { #define JSON_CONTENT_TYPE "application/json" -#endif /* __JSON_H__ */ +#endif /* JSON_H_ */ diff --git a/apps/json/jsonparse.h b/apps/json/jsonparse.h index 3821b67db..419186249 100644 --- a/apps/json/jsonparse.h +++ b/apps/json/jsonparse.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. */ -#ifndef __JSONPARSE_H__ -#define __JSONPARSE_H__ +#ifndef JSONPARSE_H_ +#define JSONPARSE_H_ #include "contiki-conf.h" #include "json.h" @@ -88,4 +88,4 @@ int jsonparse_get_type(struct jsonparse_state *state); /* compare the JSON value with the specified string */ int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str); -#endif /* __JSONPARSE_H__ */ +#endif /* JSONPARSE_H_ */ diff --git a/apps/json/jsontree.h b/apps/json/jsontree.h index 8e2a11243..476487183 100644 --- a/apps/json/jsontree.h +++ b/apps/json/jsontree.h @@ -37,8 +37,8 @@ * Joakim Eriksson */ -#ifndef __JSONTREE_H__ -#define __JSONTREE_H__ +#ifndef JSONTREE_H_ +#define JSONTREE_H_ #include "contiki-conf.h" #include "json.h" @@ -132,4 +132,4 @@ int jsontree_print_next(struct jsontree_context *js_ctx); struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx, int type); -#endif /* __JSONTREE_H__ */ +#endif /* JSONTREE_H_ */ diff --git a/apps/netconf/netconf-dsc.h b/apps/netconf/netconf-dsc.h index 8cd788cdd..1e573ef61 100644 --- a/apps/netconf/netconf-dsc.h +++ b/apps/netconf/netconf-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __NETCONF_DSC_H__ -#define __NETCONF_DSC_H__ +#ifndef NETCONF_DSC_H_ +#define NETCONF_DSC_H_ #include "sys/dsc.h" DSC_HEADER(netconf_dsc); -#endif /* __NETCONF_DSC_H__ */ +#endif /* NETCONF_DSC_H_ */ diff --git a/apps/ping6/ping6.h b/apps/ping6/ping6.h index 9f3c017b2..0640b16f6 100644 --- a/apps/ping6/ping6.h +++ b/apps/ping6/ping6.h @@ -1,8 +1,8 @@ -#ifndef __PING6_H__ -#define __PING6_H__ +#ifndef PING6_H_ +#define PING6_H_ #include "contiki.h" PROCESS_NAME(ping6_process); -#endif /* __PING6_H__ */ +#endif /* PING6_H_ */ diff --git a/apps/process-list/process-list-dsc.h b/apps/process-list/process-list-dsc.h index 82d5f8495..c8af0af36 100644 --- a/apps/process-list/process-list-dsc.h +++ b/apps/process-list/process-list-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __PROCESSES_DSC_H__ -#define __PROCESSES_DSC_H__ +#ifndef PROCESSES_DSC_H_ +#define PROCESSES_DSC_H_ #include "sys/dsc.h" DSC_HEADER(processes_dsc); -#endif /* __PROCESSES_DSC_H__ */ +#endif /* PROCESSES_DSC_H_ */ diff --git a/apps/program-handler/program-handler.h b/apps/program-handler/program-handler.h index 855b614b3..463199993 100644 --- a/apps/program-handler/program-handler.h +++ b/apps/program-handler/program-handler.h @@ -31,8 +31,8 @@ * * */ -#ifndef __PROGRAM_HANDLER_H__ -#define __PROGRAM_HANDLER_H__ +#ifndef PROGRAM_HANDLER_H_ +#define PROGRAM_HANDLER_H_ #include "sys/dsc.h" @@ -48,4 +48,4 @@ void program_handler_setscreensaver(char *name); void program_handler_add(struct dsc *dsc, char *menuname, unsigned char desktop); -#endif /* __PROGRAM_HANDLER_H__ */ +#endif /* PROGRAM_HANDLER_H_ */ diff --git a/apps/serial-shell/serial-shell.h b/apps/serial-shell/serial-shell.h index 1ee638629..d00dee489 100644 --- a/apps/serial-shell/serial-shell.h +++ b/apps/serial-shell/serial-shell.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SERIAL_SHELL_H__ -#define __SERIAL_SHELL_H__ +#ifndef SERIAL_SHELL_H_ +#define SERIAL_SHELL_H_ #include "contiki.h" void serial_shell_init(void); -#endif /* __SERIAL_SHELL_H__ */ +#endif /* SERIAL_SHELL_H_ */ diff --git a/apps/shell/Makefile.shell b/apps/shell/Makefile.shell index 10ceec53a..97cd5663f 100644 --- a/apps/shell/Makefile.shell +++ b/apps/shell/Makefile.shell @@ -5,7 +5,7 @@ shell_src = shell.c shell-reboot.c \ shell-rime-ping.c shell-rime-sniff.c shell-rime-netcmd.c \ shell-rime-debug.c shell-rime-debug-runicast.c shell-coffee.c \ shell-wget.c shell-httpd.c shell-irc.c \ - shell-checkpoint.c shell-power.c \ + shell-power.c \ shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c \ shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \ shell-rime-unicast.c \ diff --git a/apps/shell/shell-base64.h b/apps/shell/shell-base64.h index 9d4eeabe4..8b55ddf6b 100644 --- a/apps/shell/shell-base64.h +++ b/apps/shell/shell-base64.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_BASE64_H__ -#define __SHELL_BASE64_H__ +#ifndef SHELL_BASE64_H_ +#define SHELL_BASE64_H_ #include "shell.h" void shell_base64_init(void); -#endif /* __SHELL_BASE64_H__ */ +#endif /* SHELL_BASE64_H_ */ diff --git a/apps/shell/shell-blink.h b/apps/shell/shell-blink.h index 24547408d..34dadf417 100644 --- a/apps/shell/shell-blink.h +++ b/apps/shell/shell-blink.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_BLINK_H__ -#define __SHELL_BLINK_H__ +#ifndef SHELL_BLINK_H_ +#define SHELL_BLINK_H_ #include "shell.h" void shell_blink_init(void); -#endif /* __SHELL_BLINK_H__ */ +#endif /* SHELL_BLINK_H_ */ diff --git a/apps/shell/shell-checkpoint.c b/apps/shell/shell-checkpoint.c deleted file mode 100644 index 3a6bf308b..000000000 --- a/apps/shell/shell-checkpoint.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "shell.h" - -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "lib/checkpoint.h" - -#include - -/*---------------------------------------------------------------------------*/ -PROCESS(shell_checkpoint_process, "checkpoint"); -SHELL_COMMAND(checkpoint_command, - "checkpoint", - "checkpoint : checkpoint local state to file", - &shell_checkpoint_process); -PROCESS(shell_rollback_process, "rollback"); -SHELL_COMMAND(rollback_command, - "rollback", - "rollback : rollback local state from file", - &shell_rollback_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(shell_checkpoint_process, ev, data) -{ - int fd = 0; - - PROCESS_BEGIN(); - - /* Make sure file does not already exist */ - cfs_remove(data); - - cfs_coffee_reserve(data, checkpoint_arch_size()); - fd = cfs_open(data, CFS_WRITE); - - if(fd < 0) { - shell_output_str(&checkpoint_command, - "checkpoint: could not open file for writing: ", data); - } else { - shell_output_str(&checkpoint_command, "checkpoint to: ", data); - checkpoint_checkpoint(fd); - cfs_close(fd); - shell_output_str(&checkpoint_command, "checkpointing done", ""); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(shell_rollback_process, ev, data) -{ - int fd = 0; - - PROCESS_BEGIN(); - - fd = cfs_open(data, CFS_READ); - - if(fd < 0) { - shell_output_str(&rollback_command, - "rollback: could not open file for reading: ", data); - } else { - shell_output_str(&rollback_command, "rollback from: ", data); - checkpoint_rollback(fd); - cfs_close(fd); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -shell_checkpoint_init(void) -{ - checkpoint_init(); - shell_register_command(&checkpoint_command); - shell_register_command(&rollback_command); -} -/*---------------------------------------------------------------------------*/ diff --git a/apps/shell/shell-checkpoint.h b/apps/shell/shell-checkpoint.h deleted file mode 100644 index 3ba06b6fd..000000000 --- a/apps/shell/shell-checkpoint.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -#ifndef __SHELL_CHECKPOINT_H__ -#define __SHELL_CHECKPOINT_H__ - -#include "shell.h" - -void shell_checkpoint_init(void); - -#endif /* __SHELL_CHECKPOINT_H__ */ diff --git a/apps/shell/shell-coffee.h b/apps/shell/shell-coffee.h index a9496cf4f..37144274c 100644 --- a/apps/shell/shell-coffee.h +++ b/apps/shell/shell-coffee.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_COFFEE_H__ -#define __SHELL_COFFEE_H__ +#ifndef SHELL_COFFEE_H_ +#define SHELL_COFFEE_H_ #include "shell.h" void shell_coffee_init(void); -#endif /* __SHELL_COFFEE_H__ */ +#endif /* SHELL_COFFEE_H_ */ diff --git a/apps/shell/shell-crc.h b/apps/shell/shell-crc.h index c7fd1574e..a99dc9795 100644 --- a/apps/shell/shell-crc.h +++ b/apps/shell/shell-crc.h @@ -29,11 +29,11 @@ * This file is part of the Contiki operating system. */ -#ifndef __SHELL_CRC_H__ -#define __SHELL_CRC_H__ +#ifndef SHELL_CRC_H_ +#define SHELL_CRC_H_ #include "shell.h" void shell_crc_init(void); -#endif /* __SHELL_CRC_H__ */ +#endif /* SHELL_CRC_H_ */ diff --git a/apps/shell/shell-download.h b/apps/shell/shell-download.h index bed99e157..c8f6a61e3 100644 --- a/apps/shell/shell-download.h +++ b/apps/shell/shell-download.h @@ -30,11 +30,11 @@ * */ -#ifndef __SHELL_DOWNLOAD_H__ -#define __SHELL_DOWNLOAD_H__ +#ifndef SHELL_DOWNLOAD_H_ +#define SHELL_DOWNLOAD_H_ #include "shell.h" void shell_download_init(void); -#endif /* __SHELL_DOWNLOAD_H__ */ +#endif /* SHELL_DOWNLOAD_H_ */ diff --git a/apps/shell/shell-dsc.h b/apps/shell/shell-dsc.h index 90e6c5507..7fa4edc62 100644 --- a/apps/shell/shell-dsc.h +++ b/apps/shell/shell-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __SHELL_DSC_H__ -#define __SHELL_DSC_H__ +#ifndef SHELL_DSC_H_ +#define SHELL_DSC_H_ #include "sys/dsc.h" DSC_HEADER(shell_dsc); -#endif /* __SHELL_DSC_H__ */ +#endif /* SHELL_DSC_H_ */ diff --git a/apps/shell/shell-exec.h b/apps/shell/shell-exec.h index bcc100d17..e748e3806 100644 --- a/apps/shell/shell-exec.h +++ b/apps/shell/shell-exec.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_EXEC_H__ -#define __SHELL_EXEC_H__ +#ifndef SHELL_EXEC_H_ +#define SHELL_EXEC_H_ #include "shell.h" void shell_exec_init(void); -#endif /* __SHELL_EXEC_H__ */ +#endif /* SHELL_EXEC_H_ */ diff --git a/apps/shell/shell-file.h b/apps/shell/shell-file.h index 0e3560306..625ce0ca4 100644 --- a/apps/shell/shell-file.h +++ b/apps/shell/shell-file.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_FILE_H__ -#define __SHELL_FILE_H__ +#ifndef SHELL_FILE_H_ +#define SHELL_FILE_H_ #include "shell.h" void shell_file_init(void); -#endif /* __SHELL_FILE_H__ */ +#endif /* SHELL_FILE_H_ */ diff --git a/apps/shell/shell-httpd.h b/apps/shell/shell-httpd.h index 4ce71cc0d..c527816c2 100644 --- a/apps/shell/shell-httpd.h +++ b/apps/shell/shell-httpd.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_HTTPD_H__ -#define __SHELL_HTTPD_H__ +#ifndef SHELL_HTTPD_H_ +#define SHELL_HTTPD_H_ #include "shell.h" void shell_httpd_init(void); -#endif /* __SHELL_HTTPD_H__ */ +#endif /* SHELL_HTTPD_H_ */ diff --git a/apps/shell/shell-irc.h b/apps/shell/shell-irc.h index 8190d2a41..8b68096e5 100644 --- a/apps/shell/shell-irc.h +++ b/apps/shell/shell-irc.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_IRC_H__ -#define __SHELL_IRC_H__ +#ifndef SHELL_IRC_H_ +#define SHELL_IRC_H_ #include "shell.h" void shell_irc_init(void); -#endif /* __SHELL_IRC_H__ */ +#endif /* SHELL_IRC_H_ */ diff --git a/apps/shell/shell-memdebug.h b/apps/shell/shell-memdebug.h index a9361a7a8..7aa7f3389 100644 --- a/apps/shell/shell-memdebug.h +++ b/apps/shell/shell-memdebug.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_MEMDEBUG_H__ -#define __SHELL_MEMDEBUG_H__ +#ifndef SHELL_MEMDEBUG_H_ +#define SHELL_MEMDEBUG_H_ #include "shell.h" void shell_memdebug_init(void); -#endif /* __SHELL_MEMDEBUG_H__ */ +#endif /* SHELL_MEMDEBUG_H_ */ diff --git a/apps/shell/shell-netfile.h b/apps/shell/shell-netfile.h index e87a714bb..2cbe362f0 100644 --- a/apps/shell/shell-netfile.h +++ b/apps/shell/shell-netfile.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_NETFILE_H__ -#define __SHELL_NETFILE_H__ +#ifndef SHELL_NETFILE_H_ +#define SHELL_NETFILE_H_ #include "shell.h" void shell_netfile_init(void); -#endif /* __SHELL_NETFILE_H__ */ +#endif /* SHELL_NETFILE_H_ */ diff --git a/apps/shell/shell-netperf.h b/apps/shell/shell-netperf.h index 25cd55586..0dd3ecb35 100644 --- a/apps/shell/shell-netperf.h +++ b/apps/shell/shell-netperf.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_NETPERF_H__ -#define __SHELL_NETPERF_H__ +#ifndef SHELL_NETPERF_H_ +#define SHELL_NETPERF_H_ #include "shell.h" void shell_netperf_init(void); -#endif /* __SHELL_NETPERF_H__ */ +#endif /* SHELL_NETPERF_H_ */ diff --git a/apps/shell/shell-netstat.h b/apps/shell/shell-netstat.h index 256ab6f28..ee122b8ab 100644 --- a/apps/shell/shell-netstat.h +++ b/apps/shell/shell-netstat.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_NETSTAT_H__ -#define __SHELL_NETSTAT_H__ +#ifndef SHELL_NETSTAT_H_ +#define SHELL_NETSTAT_H_ #include "shell.h" void shell_netstat_init(void); -#endif /* __SHELL_NETSTAT_H__ */ +#endif /* SHELL_NETSTAT_H_ */ diff --git a/apps/shell/shell-ping.h b/apps/shell/shell-ping.h index b77b8f1af..0aaad4144 100644 --- a/apps/shell/shell-ping.h +++ b/apps/shell/shell-ping.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_PING_H__ -#define __SHELL_PING_H__ +#ifndef SHELL_PING_H_ +#define SHELL_PING_H_ #include "shell.h" void shell_ping_init(void); -#endif /* __SHELL_PING_H__ */ +#endif /* SHELL_PING_H_ */ diff --git a/apps/shell/shell-power.h b/apps/shell/shell-power.h index e4f89f9d6..568594252 100644 --- a/apps/shell/shell-power.h +++ b/apps/shell/shell-power.h @@ -37,9 +37,9 @@ * Adam Dunkels */ -#ifndef __SHELL_POWER_H__ -#define __SHELL_POWER_H__ +#ifndef SHELL_POWER_H_ +#define SHELL_POWER_H_ void shell_power_init(void); -#endif /* __SHELL_POWER_H__ */ +#endif /* SHELL_POWER_H_ */ diff --git a/apps/shell/shell-profile.h b/apps/shell/shell-profile.h index 202a6036f..337a02b34 100644 --- a/apps/shell/shell-profile.h +++ b/apps/shell/shell-profile.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_PROFILE_H__ -#define __SHELL_PROFILE_H__ +#ifndef SHELL_PROFILE_H_ +#define SHELL_PROFILE_H_ #include "shell.h" void shell_profile_init(void); -#endif /* __SHELL_PROFILE_H__ */ +#endif /* SHELL_PROFILE_H_ */ diff --git a/apps/shell/shell-ps.h b/apps/shell/shell-ps.h index c8437a8b2..e80499fc4 100644 --- a/apps/shell/shell-ps.h +++ b/apps/shell/shell-ps.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_PS_H__ -#define __SHELL_PS_H__ +#ifndef SHELL_PS_H_ +#define SHELL_PS_H_ #include "shell.h" void shell_ps_init(void); -#endif /* __SHELL_PS_H__ */ +#endif /* SHELL_PS_H_ */ diff --git a/apps/shell/shell-reboot.h b/apps/shell/shell-reboot.h index 6761dccb6..6265a4d6f 100644 --- a/apps/shell/shell-reboot.h +++ b/apps/shell/shell-reboot.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_REBOOT_H__ -#define __SHELL_REBOOT_H__ +#ifndef SHELL_REBOOT_H_ +#define SHELL_REBOOT_H_ #include "shell.h" void shell_reboot_init(void); -#endif /* __SHELL_REBOOT_H__ */ +#endif /* SHELL_REBOOT_H_ */ diff --git a/apps/shell/shell-rime-debug-runicast.h b/apps/shell/shell-rime-debug-runicast.h index a8e54e105..050ebe6e6 100644 --- a/apps/shell/shell-rime-debug-runicast.h +++ b/apps/shell/shell-rime-debug-runicast.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_DEBUG_RUNICAST_H__ -#define __SHELL_RIME_DEBUG_RUNICAST_H__ +#ifndef SHELL_RIME_DEBUG_RUNICAST_H_ +#define SHELL_RIME_DEBUG_RUNICAST_H_ #include "shell.h" void shell_rime_debug_runicast_init(void); -#endif /* __SHELL_RIME_DEBUG_RUNICAST_H__ */ +#endif /* SHELL_RIME_DEBUG_RUNICAST_H_ */ diff --git a/apps/shell/shell-rime-debug.h b/apps/shell/shell-rime-debug.h index d19521b05..5764ce72c 100644 --- a/apps/shell/shell-rime-debug.h +++ b/apps/shell/shell-rime-debug.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_DEBUG_H__ -#define __SHELL_RIME_DEBUG_H__ +#ifndef SHELL_RIME_DEBUG_H_ +#define SHELL_RIME_DEBUG_H_ #include "shell.h" void shell_rime_debug_init(void); -#endif /* __SHELL_RIME_DEBUG_H__ */ +#endif /* SHELL_RIME_DEBUG_H_ */ diff --git a/apps/shell/shell-rime-neighbors.h b/apps/shell/shell-rime-neighbors.h index 6929b3a70..e10905e5b 100644 --- a/apps/shell/shell-rime-neighbors.h +++ b/apps/shell/shell-rime-neighbors.h @@ -37,9 +37,9 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_NEIGHBORS_H__ -#define __SHELL_RIME_NEIGHBORS_H__ +#ifndef SHELL_RIME_NEIGHBORS_H_ +#define SHELL_RIME_NEIGHBORS_H_ void shell_rime_neighbors_init(void); -#endif /* __SHELL-RIME_-NEIGHBORS_H__ */ +#endif /* SHELL-RIME_-NEIGHBORS_H_ */ diff --git a/apps/shell/shell-rime-netcmd.h b/apps/shell/shell-rime-netcmd.h index c21da643b..015d4052a 100644 --- a/apps/shell/shell-rime-netcmd.h +++ b/apps/shell/shell-rime-netcmd.h @@ -37,9 +37,9 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_NETCMD_H__ -#define __SHELL_RIME_NETCMD_H__ +#ifndef SHELL_RIME_NETCMD_H_ +#define SHELL_RIME_NETCMD_H_ void shell_rime_netcmd_init(void); -#endif /* __SHELL_RIME_NETCMD_H__ */ +#endif /* SHELL_RIME_NETCMD_H_ */ diff --git a/apps/shell/shell-rime-ping.h b/apps/shell/shell-rime-ping.h index e807aa757..17ca01a95 100644 --- a/apps/shell/shell-rime-ping.h +++ b/apps/shell/shell-rime-ping.h @@ -37,9 +37,9 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_PING_H__ -#define __SHELL_RIME_PING_H__ +#ifndef SHELL_RIME_PING_H_ +#define SHELL_RIME_PING_H_ void shell_rime_ping_init(void); -#endif /* __SHELL-RIME_-PING_H__ */ +#endif /* SHELL-RIME_-PING_H_ */ diff --git a/apps/shell/shell-rime-sendcmd.h b/apps/shell/shell-rime-sendcmd.h index e24d797ec..09be3a511 100644 --- a/apps/shell/shell-rime-sendcmd.h +++ b/apps/shell/shell-rime-sendcmd.h @@ -30,9 +30,9 @@ * */ -#ifndef __SHELL_RIME_SENDCMD_H__ -#define __SHELL_RIME_SENDCMD_H__ +#ifndef SHELL_RIME_SENDCMD_H_ +#define SHELL_RIME_SENDCMD_H_ void shell_rime_sendcmd_init(void); -#endif /* __SHELL_RIME_SENDCMD_H__ */ +#endif /* SHELL_RIME_SENDCMD_H_ */ diff --git a/apps/shell/shell-rime-sniff.h b/apps/shell/shell-rime-sniff.h index de0369e63..7bbe83f56 100644 --- a/apps/shell/shell-rime-sniff.h +++ b/apps/shell/shell-rime-sniff.h @@ -37,9 +37,9 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_SNIFF_H__ -#define __SHELL_RIME_SNIFF_H__ +#ifndef SHELL_RIME_SNIFF_H_ +#define SHELL_RIME_SNIFF_H_ void shell_rime_sniff_init(void); -#endif /* __SHELL_RIME_SNIFF_H__ */ +#endif /* SHELL_RIME_SNIFF_H_ */ diff --git a/apps/shell/shell-rime-unicast.h b/apps/shell/shell-rime-unicast.h index bfec89209..6661bd960 100644 --- a/apps/shell/shell-rime-unicast.h +++ b/apps/shell/shell-rime-unicast.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_UNICAST_H__ -#define __SHELL_RIME_UNICAST_H__ +#ifndef SHELL_RIME_UNICAST_H_ +#define SHELL_RIME_UNICAST_H_ #include "shell.h" void shell_rime_unicast_init(void); -#endif /* __SHELL_RIME_UNICAST_H__ */ +#endif /* SHELL_RIME_UNICAST_H_ */ diff --git a/apps/shell/shell-rime.h b/apps/shell/shell-rime.h index 86be38c8a..b22d4a648 100644 --- a/apps/shell/shell-rime.h +++ b/apps/shell/shell-rime.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __SHELL_RIME_H__ -#define __SHELL_RIME_H__ +#ifndef SHELL_RIME_H_ +#define SHELL_RIME_H_ #include "shell.h" @@ -86,4 +86,4 @@ void shell_rime_init(void); extern struct collect_conn shell_collect_conn; -#endif /* __SHELL_RIME_H__ */ +#endif /* SHELL_RIME_H_ */ diff --git a/apps/shell/shell-rsh.h b/apps/shell/shell-rsh.h index 2bfd75305..03e69a922 100644 --- a/apps/shell/shell-rsh.h +++ b/apps/shell/shell-rsh.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_RSH_H__ -#define __SHELL_RSH_H__ +#ifndef SHELL_RSH_H_ +#define SHELL_RSH_H_ #include "shell.h" void shell_rsh_init(void); -#endif /* __SHELL_RSH_H__ */ +#endif /* SHELL_RSH_H_ */ diff --git a/apps/shell/shell-run.h b/apps/shell/shell-run.h index cd6e00953..b8a98f996 100644 --- a/apps/shell/shell-run.h +++ b/apps/shell/shell-run.h @@ -30,11 +30,11 @@ * */ -#ifndef __SHELL_RUN_H__ -#define __SHELL_RUN_H__ +#ifndef SHELL_RUN_H_ +#define SHELL_RUN_H_ #include "shell.h" void shell_run_init(void); -#endif /* __SHELL_RUN_H__ */ +#endif /* SHELL_RUN_H_ */ diff --git a/apps/shell/shell-sendtest.h b/apps/shell/shell-sendtest.h index 9a15c12a1..0bdd3e57f 100644 --- a/apps/shell/shell-sendtest.h +++ b/apps/shell/shell-sendtest.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_SENDTEST_H__ -#define __SHELL_SENDTEST_H__ +#ifndef SHELL_SENDTEST_H_ +#define SHELL_SENDTEST_H_ #include "shell.h" void shell_sendtest_init(void); -#endif /* __SHELL_SENDTEST_H__ */ +#endif /* SHELL_SENDTEST_H_ */ diff --git a/apps/shell/shell-sky.h b/apps/shell/shell-sky.h index 3f962c798..9af21c4fe 100644 --- a/apps/shell/shell-sky.h +++ b/apps/shell/shell-sky.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_SKY_H__ -#define __SHELL_SKY_H__ +#ifndef SHELL_SKY_H_ +#define SHELL_SKY_H_ #include "shell.h" void shell_sky_init(void); -#endif /* __SHELL_SKY_H__ */ +#endif /* SHELL_SKY_H_ */ diff --git a/apps/shell/shell-tcpsend.h b/apps/shell/shell-tcpsend.h index 867fb0552..f5f813b02 100644 --- a/apps/shell/shell-tcpsend.h +++ b/apps/shell/shell-tcpsend.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_TCPSEND_H__ -#define __SHELL_TCPSEND_H__ +#ifndef SHELL_TCPSEND_H_ +#define SHELL_TCPSEND_H_ #include "shell.h" void shell_tcpsend_init(void); -#endif /* __SHELL_TCPSEND_H__ */ +#endif /* SHELL_TCPSEND_H_ */ diff --git a/apps/shell/shell-text.h b/apps/shell/shell-text.h index 71705f030..b559d569c 100644 --- a/apps/shell/shell-text.h +++ b/apps/shell/shell-text.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_TEXT_H__ -#define __SHELL_TEXT_H__ +#ifndef SHELL_TEXT_H_ +#define SHELL_TEXT_H_ #include "shell.h" void shell_text_init(void); -#endif /* __SHELL_TEXT_H__ */ +#endif /* SHELL_TEXT_H_ */ diff --git a/apps/shell/shell-time.h b/apps/shell/shell-time.h index 85b4bffe6..c7c67c54b 100644 --- a/apps/shell/shell-time.h +++ b/apps/shell/shell-time.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_TIME_H__ -#define __SHELL_TIME_H__ +#ifndef SHELL_TIME_H_ +#define SHELL_TIME_H_ #include "shell.h" void shell_time_init(void); -#endif /* __SHELL_TIME_H__ */ +#endif /* SHELL_TIME_H_ */ diff --git a/apps/shell/shell-udpsend.h b/apps/shell/shell-udpsend.h index 92a26cbe9..a33036584 100644 --- a/apps/shell/shell-udpsend.h +++ b/apps/shell/shell-udpsend.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_UDPSEND_H__ -#define __SHELL_UDPSEND_H__ +#ifndef SHELL_UDPSEND_H_ +#define SHELL_UDPSEND_H_ #include "shell.h" void shell_udpsend_init(void); -#endif /* __SHELL_UDPSEND_H__ */ +#endif /* SHELL_UDPSEND_H_ */ diff --git a/apps/shell/shell-vars.h b/apps/shell/shell-vars.h index 72d720872..07e8a9f73 100644 --- a/apps/shell/shell-vars.h +++ b/apps/shell/shell-vars.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_VARS_H__ -#define __SHELL_VARS_H__ +#ifndef SHELL_VARS_H_ +#define SHELL_VARS_H_ #include "shell.h" void shell_vars_init(void); -#endif /* __SHELL_VARS_H__ */ +#endif /* SHELL_VARS_H_ */ diff --git a/apps/shell/shell-wget.h b/apps/shell/shell-wget.h index 2a97113cd..9d1ed0254 100644 --- a/apps/shell/shell-wget.h +++ b/apps/shell/shell-wget.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __SHELL_WGET_H__ -#define __SHELL_WGET_H__ +#ifndef SHELL_WGET_H_ +#define SHELL_WGET_H_ #include "shell.h" void shell_wget_init(void); -#endif /* __SHELL_WGET_H__ */ +#endif /* SHELL_WGET_H_ */ diff --git a/apps/shell/shell.h b/apps/shell/shell.h index 7d955b303..750cee02f 100644 --- a/apps/shell/shell.h +++ b/apps/shell/shell.h @@ -57,8 +57,8 @@ * Adam Dunkels */ -#ifndef __SHELL_H__ -#define __SHELL_H__ +#ifndef SHELL_H_ +#define SHELL_H_ #include "sys/process.h" @@ -374,7 +374,6 @@ struct shell_input { #include "shell-base64.h" #include "shell-blink.h" -#include "shell-checkpoint.h" #include "shell-collect-view.h" #include "shell-coffee.h" #include "shell-download.h" @@ -411,7 +410,7 @@ struct shell_input { #include "shell-vars.h" #include "shell-wget.h" -#endif /* __SHELL_H__ */ +#endif /* SHELL_H_ */ /** @} */ diff --git a/apps/slip-cmd/cmd.h b/apps/slip-cmd/cmd.h index 078e95041..d363ac933 100644 --- a/apps/slip-cmd/cmd.h +++ b/apps/slip-cmd/cmd.h @@ -35,8 +35,8 @@ * Joakim Eriksson */ -#ifndef __CMD_H__ -#define __CMD_H__ +#ifndef CMD_H_ +#define CMD_H_ #include "contiki.h" @@ -50,4 +50,4 @@ const cmd_handler_t cmd_handlers[] = {__VA_ARGS__, NULL} void cmd_input(const uint8_t *data, int data_len); void cmd_send(const uint8_t *data, int data_len); -#endif /* __CMD_H__ */ +#endif /* CMD_H_ */ diff --git a/apps/slip-cmd/packetutils.h b/apps/slip-cmd/packetutils.h index 4e3af02f7..09ae4ed15 100644 --- a/apps/slip-cmd/packetutils.h +++ b/apps/slip-cmd/packetutils.h @@ -27,11 +27,11 @@ * SUCH DAMAGE. */ -#ifndef __PACKETUTILS_H__ -#define __PACKETUTILS_H__ +#ifndef PACKETUTILS_H_ +#define PACKETUTILS_H_ int packetutils_serialize_atts(uint8_t *data, int size); int packetutils_deserialize_atts(const uint8_t *data, int size); -#endif /* __PACKETUTILS_H__ */ +#endif /* PACKETUTILS_H_ */ diff --git a/apps/telnet/simpletelnet.h b/apps/telnet/simpletelnet.h index 6eb09bdb7..6b55b1669 100644 --- a/apps/telnet/simpletelnet.h +++ b/apps/telnet/simpletelnet.h @@ -31,8 +31,8 @@ * * */ -#ifndef __SIMPLETELNET_H__ -#define __SIMPLETELNET_H__ +#ifndef SIMPLETELNET_H_ +#define SIMPLETELNET_H_ #ifdef TELNET_CONF_WINDOW_WIDTH #define TELNET_WINDOW_WIDTH TELNET_CONF_WINDOW_WIDTH @@ -63,4 +63,4 @@ void simpletelnet_init(char *arg); -#endif /* __SIMPLETELNET_H__ */ +#endif /* SIMPLETELNET_H_ */ diff --git a/apps/telnet/telnet-dsc.h b/apps/telnet/telnet-dsc.h index e32e3e698..4cee9bed8 100644 --- a/apps/telnet/telnet-dsc.h +++ b/apps/telnet/telnet-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __TELNET_DSC_H__ -#define __TELNET_DSC_H__ +#ifndef TELNET_DSC_H_ +#define TELNET_DSC_H_ #include "sys/dsc.h" DSC_HEADER(telnet_dsc); -#endif /* __TELNET_DSC_H__ */ +#endif /* TELNET_DSC_H_ */ diff --git a/apps/telnet/telnet.h b/apps/telnet/telnet.h index 482d7f934..a9aaf7e65 100644 --- a/apps/telnet/telnet.h +++ b/apps/telnet/telnet.h @@ -30,8 +30,8 @@ * * */ -#ifndef __TELNET_H__ -#define __TELNET_H__ +#ifndef TELNET_H_ +#define TELNET_H_ #include "contiki-net.h" @@ -57,4 +57,4 @@ void telnet_sent(struct telnet_state *s); void telnet_aborted(struct telnet_state *s); void telnet_timedout(struct telnet_state *s); void telnet_newdata(struct telnet_state *s, char *data, uint16_t len); -#endif /* __TELNET_H__ */ +#endif /* TELNET_H_ */ diff --git a/apps/telnetd/telnetd-dsc.h b/apps/telnetd/telnetd-dsc.h index 01389ce61..143d58800 100644 --- a/apps/telnetd/telnetd-dsc.h +++ b/apps/telnetd/telnetd-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __TELNETD_DSC_H__ -#define __TELNETD_DSC_H__ +#ifndef TELNETD_DSC_H_ +#define TELNETD_DSC_H_ #include "sys/dsc.h" DSC_HEADER(telnetd_dsc); -#endif /* __TELNETD_DSC_H__ */ +#endif /* TELNETD_DSC_H_ */ diff --git a/apps/telnetd/telnetd.h b/apps/telnetd/telnetd.h index 9db26ebec..ddae0b051 100644 --- a/apps/telnetd/telnetd.h +++ b/apps/telnetd/telnetd.h @@ -31,8 +31,8 @@ * * */ -#ifndef __TELNETD_H__ -#define __TELNETD_H__ +#ifndef TELNETD_H_ +#define TELNETD_H_ #include "contiki.h" @@ -47,4 +47,4 @@ void telnetd_gui_output(const char *str1, int len1, const char *str2, int len2); void telnetd_gui_quit(void); void telnetd_quit(void); -#endif /* __TELNETD_H__ */ +#endif /* TELNETD_H_ */ diff --git a/apps/vnc/Makefile.vnc b/apps/vnc/Makefile.vnc deleted file mode 100644 index e950ef8f2..000000000 --- a/apps/vnc/Makefile.vnc +++ /dev/null @@ -1,2 +0,0 @@ -vnc_src = vnc.c vnc-viewer.c vnc-draw.c -vnc_dsc = vnc-dsc.c diff --git a/apps/vnc/vnc-draw.h b/apps/vnc/vnc-draw.h deleted file mode 100644 index e8a253396..000000000 --- a/apps/vnc/vnc-draw.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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 Contiki VNC client. - * - * - */ - -#ifndef __VNC_DRAW_H__ -#define __VNC_DRAW_H__ - -#include "net/uip_arch.h" - -/* Pointer to the bitmap area in memory. */ -extern uint8_t vnc_draw_bitmap[]; - -/* Initialize the vnc-draw module. */ -void vnc_draw_init(void); - -/* Draw one line of pixels starting at point (x, y). The pixel data is - given by the "data" argument and the length of data is given by the - "datalen" argument. The data format is one pixel per byte in bgr233 - format (bbgggrrr). */ -void vnc_draw_pixelline(uint16_t x, uint16_t y, - uint8_t *data, uint16_t datalen); - -/* The following functions should return the x and y coordinates and - the width and height of the viewport. */ -uint16_t vnc_draw_viewport_x(void); -uint16_t vnc_draw_viewport_y(void); -uint16_t vnc_draw_viewport_w(void); -uint16_t vnc_draw_viewport_h(void); - -#endif /* __VNC_DRAW_H__ */ diff --git a/apps/vnc/vnc-dsc.c b/apps/vnc/vnc-dsc.c deleted file mode 100644 index df1d1fbe8..000000000 --- a/apps/vnc/vnc-dsc.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 Contiki desktop environment - * - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char vncicon_bitmap[3*3*8] = { - 0x00, 0x7e, 0x40, 0x73, 0x46, 0x4c, 0x18, 0x13, - 0x00, 0x00, 0xff, 0x81, 0x34, 0xc9, 0x00, 0xb6, - 0x00, 0x7e, 0x02, 0xce, 0x72, 0x32, 0x18, 0x48, - - 0x30, 0x27, 0x24, 0x20, 0x37, 0x24, 0x20, 0x33, - 0x00, 0x7b, 0x42, 0x00, 0x7b, 0x42, 0x00, 0x3b, - 0x0c, 0x24, 0x24, 0x04, 0xa4, 0x24, 0x04, 0x4c, - - 0x12, 0x19, 0x4c, 0x46, 0x63, 0x40, 0x7c, 0x00, - 0x22, 0x91, 0x00, 0xc4, 0x81, 0xff, 0x00, 0x00, - 0x08, 0x18, 0x32, 0x62, 0xc6, 0x02, 0x3e, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char vncicon_textmap[9] = { - 'V', 'N', 'C', - 'c', 'l', 'i', - 'e', 'n', 't' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon vnc_icon = - {CTK_ICON("VNC viewer", vncicon_bitmap, vncicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(vnc_dsc, - "Remote control your PC using Contiki", - "vnc.prg", - vnc_process, - &vnc_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/apps/vnc/vnc-dsc.h b/apps/vnc/vnc-dsc.h deleted file mode 100644 index e55d8dfd6..000000000 --- a/apps/vnc/vnc-dsc.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 Contiki desktop environment - * - * - */ -#ifndef __VNC_DSC_H__ -#define __VNC_DSC_H__ - -#include "sys/dsc.h" - -DSC_HEADER(vnc_dsc); - -#endif /* __VNC_DSC_H__ */ diff --git a/apps/vnc/vnc-viewer.c b/apps/vnc/vnc-viewer.c deleted file mode 100644 index 946a63852..000000000 --- a/apps/vnc/vnc-viewer.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -/* A micro implementation of a VNC client. VNC is a protocol for - remote network displays. See http://www.uk.research.att.com/vnc/ - for information about VNC. -*/ - -#include "vnc-draw.h" -#include "net/uip.h" -#include "vnc-viewer.h" - -#include /* XXX for memcpy */ -#include /* XXX for printf */ - -/* RFB server initial handshaking string. */ -#define RFB_SERVER_VERSION_STRING rfb_server_version_string - -/* "RFB 003.003" */ -static uint8_t rfb_server_version_string[12] = - {82,70,66,32,48,48,51,46,48,48,51,10}; - -#if 0 -#define PRINTF(x) -#else -#define PRINTF(x) printf x -#endif - -#ifndef NULL -#define NULL (void *)0 -#endif - -static struct vnc_viewer_state vnc_viewer_state; -#define vs (&vnc_viewer_state) - -/*-----------------------------------------------------------------------------------*/ -void -vnc_viewer_init(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_viewer_close(void) -{ - vs->close = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_viewer_connect(uint16_t *server, uint8_t display) -{ - struct uip_conn *conn; - - vnc_draw_init(); - - memset(vs, 0, sizeof(struct vnc_viewer_state)); - conn = uip_connect((uip_ipaddr_t *)server, uip_htons(5900 + display)); - if(conn == NULL) { - return; - } - tcp_markconn(conn, NULL); - - vs->close = 0; -} -/*-----------------------------------------------------------------------------------*/ -static void -senddata(void) -{ - register uint8_t *dataptr; - uint16_t dataleft; - - dataptr = (uint8_t *)uip_appdata; - - switch(vs->sendmsg) { - case VNC_SEND_VERSION: - PRINTF(("Sending VERSION_STRING\n")); - uip_send(RFB_SERVER_VERSION_STRING, sizeof(RFB_SERVER_VERSION_STRING)); - break; - case VNC_SEND_AUTH: - /* Send 16 bytes of encrypted challange response. */ - /* XXX: not implemented. */ - PRINTF(("Sending AUTH\n")); - uip_send(uip_appdata, 16); - break; - case VNC_SEND_CINIT: - PRINTF(("Sending CINIT\n")); - /* Send one byte of client init. */ - *(uint8_t *)dataptr = 1; - uip_send(uip_appdata, 1); - break; - case VNC_SEND_PFMT: - PRINTF(("Sending PFMT\n")); - ((struct rfb_set_pixel_format *)dataptr)->type = RFB_SET_PIXEL_FORMAT; - - /* Set to BGR233 pixel format. */ - ((struct rfb_set_pixel_format *)dataptr)->format.bps = 8; - ((struct rfb_set_pixel_format *)dataptr)->format.depth = 8; - ((struct rfb_set_pixel_format *)dataptr)->format.endian = 1; - ((struct rfb_set_pixel_format *)dataptr)->format.truecolor = 1; - ((struct rfb_set_pixel_format *)dataptr)->format.red_max = uip_htons(7); - ((struct rfb_set_pixel_format *)dataptr)->format.green_max = uip_htons(7); - ((struct rfb_set_pixel_format *)dataptr)->format.blue_max = uip_htons(3); - ((struct rfb_set_pixel_format *)dataptr)->format.red_shift = 0; - ((struct rfb_set_pixel_format *)dataptr)->format.green_shift = 3; - ((struct rfb_set_pixel_format *)dataptr)->format.blue_shift = 6; - - uip_send(uip_appdata, sizeof(struct rfb_set_pixel_format)); - - break; - case VNC_SEND_ENCODINGS: - PRINTF(("Sending ENCODINGS\n")); - ((struct rfb_set_encodings *)dataptr)->type = RFB_SET_ENCODINGS; - ((struct rfb_set_encodings *)dataptr)->encodings = uip_htons(1); - dataptr += sizeof(struct rfb_set_encodings); - dataptr[0] = dataptr[1] = dataptr[2] = 0; - dataptr[3] = RFB_ENC_RAW; - /* ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[4] = - ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[5] = - ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[6] = 0; - ((uint8_t *)dataptr + sizeof(struct rfb_set_encodings))[7] = RFB_ENC_RRE;*/ - uip_send(uip_appdata, sizeof(struct rfb_set_encodings) + 4); - break; - case VNC_SEND_UPDATERQ: - ((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ; - ((struct rfb_fb_update_request *)dataptr)->incremental = 0; - ((struct rfb_fb_update_request *)dataptr)->x = uip_htons(vnc_draw_viewport_x()); - ((struct rfb_fb_update_request *)dataptr)->y = uip_htons(vnc_draw_viewport_y()); - ((struct rfb_fb_update_request *)dataptr)->w = uip_htons(vnc_draw_viewport_w()); - ((struct rfb_fb_update_request *)dataptr)->h = uip_htons(vnc_draw_viewport_h()); - uip_send(uip_appdata, sizeof(struct rfb_fb_update_request)); - break; - case VNC_SEND_UPDATERQ_INC: - ((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ; - ((struct rfb_fb_update_request *)dataptr)->incremental = 1; - ((struct rfb_fb_update_request *)dataptr)->x = uip_htons(vnc_draw_viewport_x()); - ((struct rfb_fb_update_request *)dataptr)->y = uip_htons(vnc_draw_viewport_y()); - ((struct rfb_fb_update_request *)dataptr)->w = uip_htons(vnc_draw_viewport_w()); - ((struct rfb_fb_update_request *)dataptr)->h = uip_htons(vnc_draw_viewport_h()); - uip_send(uip_appdata, sizeof(struct rfb_fb_update_request)); - break; - - case VNC_SEND_EVENTS: - - dataleft = uip_mss(); - - vs->eventptr_unacked = vs->eventptr_acked; - while(vs->eventptr_unacked != vs->eventptr_next && - dataleft > sizeof(struct rfb_key_event)) { - switch(vs->event_queue[vs->eventptr_unacked].type) { - case VNC_POINTER_EVENT: - ((struct rfb_pointer_event *)dataptr)->type = RFB_POINTER_EVENT; - ((struct rfb_pointer_event *)dataptr)->buttonmask = - vs->event_queue[vs->eventptr_unacked].ev.ptr.buttonmask; - ((struct rfb_pointer_event *)dataptr)->x = - uip_htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.x); - ((struct rfb_pointer_event *)dataptr)->y = - uip_htons(vs->event_queue[vs->eventptr_unacked].ev.ptr.y); - /* uip_send(uip_appdata, sizeof(struct rfb_pointer_event));*/ - dataptr += sizeof(struct rfb_pointer_event); - dataleft -= sizeof(struct rfb_pointer_event); - break; - case VNC_KEY_EVENT: - PRINTF(("Send key event.\n")); - ((struct rfb_key_event *)dataptr)->type = RFB_KEY_EVENT; - ((struct rfb_key_event *)dataptr)->down = - vs->event_queue[vs->eventptr_unacked].ev.key.down; - ((struct rfb_key_event *)dataptr)->key[0] = - ((struct rfb_key_event *)dataptr)->key[1]; - ((struct rfb_key_event *)dataptr)->key[2] = - vs->event_queue[vs->eventptr_unacked].ev.key.key >> 8; - - ((struct rfb_key_event *)dataptr)->key[3] = - vs->event_queue[vs->eventptr_unacked].ev.key.key & 0xff; - /* uip_send(uip_appdata, sizeof(struct rfb_key_event));*/ - dataptr += sizeof(struct rfb_key_event); - dataleft -= sizeof(struct rfb_key_event); - break; - case VNC_UPDATERQ_EVENT: - ((struct rfb_fb_update_request *)dataptr)->type = RFB_FB_UPDATE_REQ; - ((struct rfb_fb_update_request *)dataptr)->incremental = 0; - ((struct rfb_fb_update_request *)dataptr)->x = - uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.x); - ((struct rfb_fb_update_request *)dataptr)->y = - uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.y); - ((struct rfb_fb_update_request *)dataptr)->w = - uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.w); - ((struct rfb_fb_update_request *)dataptr)->h = - uip_htons(vs->event_queue[vs->eventptr_unacked].ev.urq.h); - /* uip_send(uip_appdata, sizeof(struct rfb_fb_update_request)); */ - dataptr += sizeof(struct rfb_fb_update_request); - dataleft -= sizeof(struct rfb_fb_update_request); - break; - } - vs->eventptr_unacked = (vs->eventptr_unacked + 1) % VNC_EVENTQUEUE_SIZE; - } - - uip_send(uip_appdata, uip_mss() - dataleft); - break; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -buffer_data(uint8_t *data, uint16_t datalen) -{ - PRINTF(("Buffering %d bytes of data\n", datalen)); - - if(vs->buffersize + datalen > VNC_BUFFERSIZE) { - PRINTF(("Out of buffer space!\n")); - vs->buffersize = 0; - return; - } - - memcpy(&(vs->buffer[vs->buffersize]), data, datalen); - - vs->buffersize += datalen; - vs->bufferleft -= datalen; -} -/*-----------------------------------------------------------------------------------*/ -static void -clearbuffer(void) -{ - PRINTF(("Clearing buffer\n")); - vs->buffersize = 0; -} -/*-----------------------------------------------------------------------------------*/ -/* Returns: the amount of bytes actually read. */ -static uint16_t -recv_rectstate(uint8_t *dataptr, uint16_t datalen) -{ - uint16_t pixels; - uint16_t pixelsleft; - - switch(vs->rectstate) { - case VNC_RECTSTATE_RAW: - - if(vs->rectstateleft > datalen) { - pixels = datalen; - vs->rectstateleft -= datalen; - } else { - pixels = vs->rectstateleft; - datalen = datalen - vs->rectstateleft; - vs->rectstateleft = 0; - vs->rectstate = VNC_RECTSTATE_NONE; - vs->sendmsg = VNC_SEND_NONE; - vs->waitmsg = VNC_WAIT_NONE; - vnc_viewer_refresh(); - } - - - pixelsleft = pixels; - while(pixelsleft > 0) { - if(pixelsleft >= vs->rectstatex2 - vs->rectstatex) { - vnc_draw_pixelline(vs->rectstatex, vs->rectstatey, - dataptr, - vs->rectstatex2 - vs->rectstatex); - dataptr += vs->rectstatex2 - vs->rectstatex; - pixelsleft -= vs->rectstatex2 - vs->rectstatex; - vs->rectstatex = vs->rectstatex0; - ++vs->rectstatey; - vnc_viewer_refresh(); - } else { - vnc_draw_pixelline(vs->rectstatex, vs->rectstatey, - dataptr, - pixelsleft); - vs->rectstatex += pixelsleft; - pixelsleft = 0; - } - - } - - break; - case VNC_RECTSTATE_RRE: - break; - } - return pixels; -} -/*-----------------------------------------------------------------------------------*/ -/* Returns: the amount of bytes that needs to be buffered before the - rect can be drawn. */ -static unsigned short -recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr, - uint16_t dataleft) -{ - struct rfb_rre_hdr *rrehdr; - - - if((rhdr->encoding[0] | - rhdr->encoding[1] | - rhdr->encoding[2]) == 0) { - switch(rhdr->encoding[3]) { - case RFB_ENC_RAW: - vs->rectstateleft = (uint32_t)uip_htons(rhdr->rect.w) * (uint32_t)uip_htons(rhdr->rect.h); - vs->rectstate = VNC_RECTSTATE_RAW; - vs->rectstatex0 = vs->rectstatex = uip_htons(rhdr->rect.x); - vs->rectstatey0 = vs->rectstatey = uip_htons(rhdr->rect.y); - vs->rectstatew = uip_htons(rhdr->rect.w); - vs->rectstateh = uip_htons(rhdr->rect.h); - vs->rectstatex2 = vs->rectstatex0 + vs->rectstatew; - vs->rectstatey2 = vs->rectstatey0 + vs->rectstateh; - break; - - case RFB_ENC_RRE: - rrehdr = (struct rfb_rre_hdr *)((uint8_t *)rhdr + - sizeof(struct rfb_fb_update_rect_hdr)); - PRINTF(("Received RRE subrects %d (%d)\n", - (uip_htons(rrehdr->subrects[1]) << 16) + - uip_htons(rrehdr->subrects[0]), - rrehdr->bgpixel)); - vs->rectstateleft = ((uint32_t)(uip_htons(rrehdr->subrects[1]) << 16) + - (uint32_t)uip_htons(rrehdr->subrects[0])); - vs->rectstate = VNC_RECTSTATE_RRE; - - break; - - default: - PRINTF(("Bad encoding %02x%02x%02x%02x\n", rhdr->encoding[0], - rhdr->encoding[1],rhdr->encoding[2],rhdr->encoding[3])); - break; - } - - } - - return 0; - - PRINTF(("recv_update_rect: returning%d\n", vs->rectstateleft)); - return sizeof(struct rfb_fb_update_rect_hdr) + vs->rectstateleft; -} -/*-----------------------------------------------------------------------------------*/ -/* identify_data(): - * - * This function looks at the state of the connection (i.e., if it is - * handshaking or in steady-state) as well as on the contents of the - * incoming message and returns the number of bytes of data that is to - * be expected. - */ -static uint16_t -identify_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen) -{ - switch(vs->waitmsg) { - case VNC_WAIT_VERSION: - /* Expecting version string (12 bytes). */ - return 12; - break; - case VNC_WAIT_AUTH: - return 4; - break; - case VNC_WAIT_AUTH_RESPONSE: - return 1; - break; - case VNC_WAIT_SINIT: - /* XXX: We should check that the entire message header is - received, otherwise we should buffer it. */ - return sizeof(struct rfb_server_init) + - ((struct rfb_server_init *)uip_appdata)->namelength[3] + - ((struct rfb_server_init *)uip_appdata)->namelength[2]; - - case VNC_WAIT_UPDATE: - case VNC_WAIT_NONE: - switch(*data) { - case RFB_FB_UPDATE: - PRINTF(("RFB FB UPDATE received\n")); - return sizeof(struct rfb_fb_update); - - case RFB_BELL: - return 1; - - case RFB_SERVER_CUT_TEXT: - PRINTF(("Cut text received, unhandled\n")); - return 8 + (data[6] << 8) + data[7]; - - case RFB_SET_COLORMAP_ENTRIES: - uip_abort(); - PRINTF(("Set colormap entries received, unhandled\n")); - return 0; - - default: - uip_abort(); - PRINTF(("Weird message type received (%d)\n", *(uint8_t *)uip_appdata)); - return 0; - } - break; - - case VNC_WAIT_UPDATE_RECT: - return sizeof(struct rfb_fb_update_rect_hdr); - - default: - PRINTF(("identify: bad waitmsg %d\n", vs->waitmsg)); - } - - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/* handle_data(): - * - * Handles the data. - */ -static unsigned short -handle_data(CC_REGISTER_ARG uint8_t *data, uint16_t datalen) -{ - - switch(vs->waitmsg) { - case VNC_WAIT_VERSION: - /* Make sure we get the right version string from the server. */ - /* XXX: not implemented. */ - PRINTF(("Got version, waiting for auth, sending version\n")); - vs->waitmsg = VNC_WAIT_AUTH; - vs->sendmsg = VNC_SEND_VERSION; - break; - case VNC_WAIT_AUTH: - switch(data[3]) { - case RFB_AUTH_FAILED: - PRINTF(("Connection failed.\n")); - uip_abort(); - return 0; - - case RFB_AUTH_NONE: - vs->sendmsg = VNC_SEND_CINIT; - vs->waitmsg = VNC_WAIT_SINIT; - PRINTF(("No authentication needed.\n")); - break; - case RFB_AUTH_VNC: - vs->sendmsg = VNC_SEND_AUTH; - vs->waitmsg = VNC_WAIT_AUTH_RESPONSE; - PRINTF(("VNC authentication needed.\n")); - break; - } - break; - case VNC_WAIT_SINIT: - /* PRINTF(("Server init: w %d h %d, bps %d, d %d, name '%s'\n", - uip_htons(((struct rfb_server_init *)data)->width), - uip_htons(((struct rfb_server_init *)data)->height), - ((struct rfb_server_init *)data)->format.bps, - ((struct rfb_server_init *)data)->format.depth, - ((uint8_t *)data + sizeof(struct rfb_server_init))));*/ - vs->w = uip_htons(((struct rfb_server_init *)data)->width); - vs->h = uip_htons(((struct rfb_server_init *)data)->height); - vs->sendmsg = VNC_SEND_PFMT; - vs->waitmsg = VNC_WAIT_NONE; - break; - - case VNC_WAIT_UPDATE: - case VNC_WAIT_NONE: - switch(*data) { - case RFB_FB_UPDATE: - vs->waitmsg = VNC_WAIT_UPDATE_RECT; - vs->rectsleft = uip_htons(((struct rfb_fb_update *)data)->rects); - PRINTF(("Handling RFB FB UPDATE for %d rects\n", vs->rectsleft)); - break; - - case RFB_BELL: - PRINTF(("BELL\n")); - break; - - case RFB_SERVER_CUT_TEXT: - PRINTF(("Cut text received, unhandled\n")); - break; - - case RFB_SET_COLORMAP_ENTRIES: - PRINTF(("Set colormap entries received, unhandled\n")); - break; - - default: - PRINTF(("Weird message type received (%d)\n", *(uint8_t *)data)); - break; - } - break; - - case VNC_WAIT_UPDATE_RECT: - PRINTF(("Handling data in WAIT_UPDATE_RECT, %d rects left (%d bytes)\n", vs->rectsleft, datalen)); - --vs->rectsleft; - if(vs->rectsleft > 0) { - vs->waitmsg = VNC_WAIT_UPDATE_RECT; - } else { - vs->waitmsg = VNC_WAIT_NONE; - vs->sendmsg = VNC_SEND_NONE; - vs->rectstate = VNC_RECTSTATE_NONE; - } - return recv_update_rect((struct rfb_fb_update_rect_hdr *)data, datalen); - break; - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/* newdata(): - * - * Called whenever new data arrives. - * - * First, checks if data needs to be buffered before a previously - * identified request can be fulfilled. If so, the incoming data is - * buffered and the data handler is called. If no data needs to be - * buffered, the code proceeds to identify the incoming request. If - * the incoming request can be processed immediately (i.e., all data - * is contained in this message) the data handler is invoked. If data - * has to be buffered to fulfill the request, this is noted and taken - * care of the next time this function is invoked (i.e., for the next - * incoming data chunk). - */ -static uint8_t -newdata(void) -{ - uint16_t datalen; - uint16_t readlen; - uint8_t *dataptr; - - datalen = uip_datalen(); - dataptr = (uint8_t *)uip_appdata; - - PRINTF(("newdata: %d bytes\n", datalen)); - - /* If we are in a "rectstate", meaning that the incoming data is - part of a rectangle that is being incrementaly drawn on the - screen, we handle that first. */ - if(vs->rectstate != VNC_RECTSTATE_NONE) { - readlen = recv_rectstate(dataptr, datalen); - PRINTF(("newdata: vs->rectstate %d, datalen %d, readlen %d\n", - vs->rectstate, datalen, readlen)); - datalen -= readlen; - dataptr += readlen; - } - - /* Next, check if we are supposed to buffer data from the incoming - segment. */ - while(vs->bufferleft > 0 && datalen > 0) { - if(datalen >= vs->bufferleft) { - /* There is more data in the incoming chunk than we need to - buffer, so we buffer as much as we can and handle the - buffered data, and repeat the (identify->buffer->handle) - sequence for the data that is left in the incoming chunk. */ - datalen -= vs->bufferleft; - dataptr += vs->bufferleft; - buffer_data((uint8_t *)uip_appdata, vs->bufferleft); - handle_data(vs->buffer, vs->buffersize); - clearbuffer(); - } else { /* datalen < vs->bufferleft */ - /* We need to buffer more data than was received with this - chunk, so we buffer the avaliable data and return. */ - buffer_data(dataptr, datalen); - return 0; - } - } - - /* Finally, if there is data left in the segment, we handle it. */ - while(datalen > 0) { - - if(vs->rectstate != VNC_RECTSTATE_NONE) { - readlen = recv_rectstate(dataptr, datalen); - PRINTF(("newdata (2): vs->rectstate %d, datalen %d, readlen %d\n", - vs->rectstate, datalen, readlen)); - datalen -= readlen; - dataptr += readlen; - } else { - - /* We get here if there is data to be identified in the incoming - chunk. */ - readlen = identify_data(dataptr, datalen); - - if(readlen == 0) { - PRINTF(("Identify returned 0\n")); - return 0; - } - - PRINTF(("Reading %d bytes more\n", readlen)); - /* The data has been identified and the amount of data that - needs to be read to be able to process the data is in the - "readlen" variable. If the incoming chunk contains enough - data, we handle it directly, otherwise we buffer the incoming - data and set the state so that we know that there is more - data to be buffered. */ - if(readlen > datalen) { - clearbuffer(); /* Should not be needed, but just in case... */ - vs->bufferleft = readlen; - buffer_data(dataptr, datalen); - return 0; - } - if(readlen <= datalen) { - PRINTF(("Before handle_data %d\n", readlen)); - readlen += handle_data(dataptr, readlen); - PRINTF(("After handle_data %d\n", readlen)); - datalen -= readlen; - dataptr += readlen; - } - - } - if(datalen > 0) { - PRINTF(("newdata: there is more data left after first iteration... %d\n", datalen)); - } - - } - - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/* Called when there is nothing else to do - checks for any pending - events (mouse movements or keypresses). If no events are found, it - makes sure that we send out an incremental update request. */ -static void -check_events(void) -{ - if(vs->sendmsg == VNC_SEND_NONE && - vs->eventptr_next != vs->eventptr_acked && - vs->eventptr_acked == vs->eventptr_unacked) { - vs->sendmsg = VNC_SEND_EVENTS; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -request_update(void) -{ - if(vs->sendmsg == VNC_SEND_NONE) { - vs->sendmsg = VNC_SEND_UPDATERQ_INC; - vs->waitmsg = VNC_WAIT_UPDATE; - PRINTF(("request_update: requesting\n")); - } else { - PRINTF(("request_update: not requesting\n")); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -acked(void) -{ - switch(vs->sendmsg) { - case VNC_SEND_PFMT: - vs->sendmsg = VNC_SEND_ENCODINGS; - break; - case VNC_SEND_ENCODINGS: - vs->sendmsg = VNC_SEND_UPDATERQ; - vs->waitmsg = VNC_WAIT_UPDATE; - clearbuffer(); - break; - case VNC_SEND_EVENTS: - vs->eventptr_acked = vs->eventptr_unacked; - vs->sendmsg = VNC_SEND_NONE; - check_events(); - break; - default: - vs->sendmsg = VNC_SEND_NONE; - break; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_viewer_appcall(void * nullptr) -{ - if(vs->close == 1) { - uip_close(); - return; - } - - if(uip_connected()) { - vs->sendmsg = VNC_SEND_NONE; - vs->waitmsg = VNC_WAIT_VERSION; - return; - } - - if(uip_acked()) { - acked(); - } - - if(uip_newdata()) { - newdata(); - } - - if(vs->sendmsg == VNC_SEND_NONE && - vs->waitmsg == VNC_WAIT_NONE && - vs->rectstate == VNC_RECTSTATE_NONE) { - check_events(); - request_update(); - } - PRINTF(("vs->sendmsg %d, vs->waitmsg %d, vs->rectstate %d\n", - vs->sendmsg, vs->waitmsg, vs->rectstate)); - - if(uip_rexmit() || - uip_newdata() || - uip_acked()) { - senddata(); - } else if(uip_poll()) { - check_events(); - senddata(); - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_viewer_post_event(uint8_t type, - uint16_t data1, uint16_t data2, - uint16_t data3, uint16_t data4) -{ - register struct vnc_event *ev; - struct vnc_event *ev0; - - ev0 = &(vs->event_queue[(vs->eventptr_next - 1) % VNC_EVENTQUEUE_SIZE]); - - ev = &(vs->event_queue[vs->eventptr_next]); - switch(type) { - case VNC_POINTER_EVENT: - if(0 && vs->eventptr_next != vs->eventptr_acked && - ev0->type == VNC_POINTER_EVENT && - data1 == ev0->ev.ptr.buttonmask) { - ev0->ev.ptr.x = data2; - ev0->ev.ptr.y = data3; - return; - } else { - ev->type = type; - ev->ev.ptr.buttonmask = data1; - ev->ev.ptr.x = data2; - ev->ev.ptr.y = data3; - } - break; - case VNC_KEY_EVENT: - PRINTF(("Key event posted\n")); - ev->type = type; - ev->ev.key.down = data1; - ev->ev.key.key = data2; - break; - case VNC_UPDATERQ_EVENT: - PRINTF(("Update request event posted\n")); - ev->type = type; - ev->ev.urq.x = data1; - ev->ev.urq.y = data2; - ev->ev.urq.w = data3; - ev->ev.urq.h = data4; - break; - } - vs->eventptr_next = (vs->eventptr_next + 1) % VNC_EVENTQUEUE_SIZE; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/apps/vnc/vnc-viewer.h b/apps/vnc/vnc-viewer.h deleted file mode 100644 index a2e9176c8..000000000 --- a/apps/vnc/vnc-viewer.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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 Contiki VNC client. - * - * - */ - -#ifndef __VNC_VIEWER_H__ -#define __VNC_VIEWER_H__ - - -struct vnc_viewer_state; - -/*typedef unsigned long uint32_t;*/ - -void vnc_viewer_init(void); -void vnc_viewer_appcall(void *nullptr); - -void vnc_viewer_connect(uint16_t *server, uint8_t display); -void vnc_viewer_close(void); - -/* Callback: redraws the VNC viewer bitmap area. */ -void vnc_viewer_refresh(void); - -#define VNC_POINTER_EVENT RFB_POINTER_EVENT -#define VNC_KEY_EVENT RFB_KEY_EVENT -#define VNC_UPDATERQ_EVENT 7 - -#define VNC_VIEWER_POST_POINTER_EVENT(x, y, button) \ - vnc_viewer_post_event(VNC_POINTER_EVENT, button, x, y, 0) - -#define VNC_VIEWER_POST_KEY_EVENT(key) \ - vnc_viewer_post_event(VNC_KEY_EVENT, key, 0, 0, 0) - -#define VNC_VIEWER_POST_UPDATERQ_EVENT(x1,y1,x2,y2) \ - vnc_viewer_post_event(VNC_UPDATERQ_EVENT, x1, y1, x2, y2) - -void vnc_viewer_post_event(uint8_t event, - uint16_t data1, uint16_t data2, - uint16_t data3, uint16_t data4); - -/* UIP_APPCALL: the name of the application function. This function - must return void and take no arguments (i.e., C type "void - appfunc(void)"). */ -#ifndef UIP_APPCALL -#define UIP_APPCALL vnc_viewer_app -#endif - -struct vnc_key_event { - uint8_t down; - uint16_t key; -}; - -struct vnc_pointer_event { - uint8_t buttonmask; - uint16_t x, y; -}; - -struct vnc_updaterq_event { - uint16_t x, y; - uint16_t w, h; -}; - -struct vnc_event { - uint8_t type; - union { - struct vnc_key_event key; - struct vnc_pointer_event ptr; - struct vnc_updaterq_event urq; - } ev; -}; - -enum vnc_sendmsg { - VNC_SEND_NONE, - - VNC_SEND_VERSION, - VNC_SEND_AUTH, - VNC_SEND_CINIT, - VNC_SEND_PFMT, - VNC_SEND_ENCODINGS, - - VNC_SEND_UPDATERQ, - VNC_SEND_UPDATERQ_INC, - VNC_SEND_EVENTS, -}; - -enum vnc_waitmsg { - VNC_WAIT_NONE, - - VNC_WAIT_VERSION, - VNC_WAIT_AUTH, - VNC_WAIT_AUTH_RESPONSE, - VNC_WAIT_SINIT, - - VNC_WAIT_UPDATE, - VNC_WAIT_UPDATE_RECT, - -}; - - -enum vnc_rectstate { - VNC_RECTSTATE_NONE, - VNC_RECTSTATE_RAW, - VNC_RECTSTATE_RRE, -}; - -struct vnc_viewer_state { - uint8_t close; - uint16_t w, h; - - uint8_t sendmsg; - - uint8_t waitmsg; - - uint16_t rectsleft; - - uint8_t rectstate; - uint32_t rectstateleft; - uint16_t rectstatex, rectstatey; - uint16_t rectstateh, rectstatew; - uint16_t rectstatex0, rectstatey0; - uint16_t rectstatex2, rectstatey2; - - - uint16_t eventptr_acked; - uint16_t eventptr_unacked; - uint16_t eventptr_next; -#define VNC_EVENTQUEUE_SIZE 32 - struct vnc_event event_queue[VNC_EVENTQUEUE_SIZE]; - - - uint16_t bufferleft; - uint16_t buffersize; -#define VNC_BUFFERSIZE 64 - uint8_t buffer[VNC_BUFFERSIZE]; -}; - -extern static struct vnc_viewer_state vnc_viewer_state; - -/* Definitions of the RFB (Remote Frame Buffer) protocol - structures and constants. */ - -#include "net/uipopt.h" - - -/* Generic rectangle - x, y coordinates, width and height. */ -struct rfb_rect { - uint16_t x; - uint16_t y; - uint16_t w; - uint16_t h; -}; - -/* Pixel format definition. */ -struct rfb_pixel_format { - uint8_t bps; /* Bits per pixel: 8, 16 or 32. */ - uint8_t depth; /* Color depth: 8-32 */ - uint8_t endian; /* 1 - big endian (motorola), 0 - little endian - (x86) */ - uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */ - - /* The following fields are only used if true color is used. */ - uint16_t red_max, green_max, blue_max; - uint8_t red_shift, green_shift, blue_shift; - uint8_t pad1; - uint16_t pad2; -}; - - -/* RFB authentication constants. */ - -#define RFB_AUTH_FAILED 0 -#define RFB_AUTH_NONE 1 -#define RFB_AUTH_VNC 2 - -#define RFB_VNC_AUTH_OK 0 -#define RFB_VNC_AUTH_FAILED 1 -#define RFB_VNC_AUTH_TOOMANY 2 - -/* RFB message types. */ - -/* From server to client: */ -#define RFB_FB_UPDATE 0 -#define RFB_SET_COLORMAP_ENTRIES 1 -#define RFB_BELL 2 -#define RFB_SERVER_CUT_TEXT 3 - -/* From client to server. */ -#define RFB_SET_PIXEL_FORMAT 0 -#define RFB_FIX_COLORMAP_ENTRIES 1 -#define RFB_SET_ENCODINGS 2 -#define RFB_FB_UPDATE_REQ 3 -#define RFB_KEY_EVENT 4 -#define RFB_POINTER_EVENT 5 -#define RFB_CLIENT_CUT_TEXT 6 - -/* Encoding types. */ -#define RFB_ENC_RAW 0 -#define RFB_ENC_COPYRECT 1 -#define RFB_ENC_RRE 2 -#define RFB_ENC_CORRE 3 -#define RFB_ENC_HEXTILE 4 - -/* Message definitions. */ - -/* Server to client messages. */ - -struct rfb_server_init { - uint16_t width; - uint16_t height; - struct rfb_pixel_format format; - uint8_t namelength[4]; - /* Followed by name. */ -}; - -struct rfb_fb_update { - uint8_t type; - uint8_t pad; - uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr + - data) that follows. */ -}; - -struct rfb_fb_update_rect_hdr { - struct rfb_rect rect; - uint8_t encoding[4]; -}; - -struct rfb_copy_rect { - uint16_t srcx; - uint16_t srcy; -}; - -struct rfb_rre_hdr { - uint16_t subrects[2]; /* Number of subrectangles (struct - rfb_rre_subrect) to follow. */ - uint8_t bgpixel; -}; - -struct rfb_rre_subrect { - uint8_t pixel; - struct rfb_rect rect; -}; - -struct rfb_corre_rect { - uint8_t x; - uint8_t y; - uint8_t w; - uint8_t h; -}; - -/* Client to server messages. */ - -struct rfb_set_pixel_format { - uint8_t type; - uint8_t pad; - uint16_t pad2; - struct rfb_pixel_format format; -}; - -struct rfb_fix_colormap_entries { - uint8_t type; - uint8_t pad; - uint16_t firstcolor; - uint16_t colors; -}; - -struct rfb_set_encodings { - uint8_t type; - uint8_t pad; - uint16_t encodings; -}; - -struct rfb_fb_update_request { - uint8_t type; - uint8_t incremental; - uint16_t x; - uint16_t y; - uint16_t w; - uint16_t h; -}; - -struct rfb_key_event { - uint8_t type; - uint8_t down; - uint16_t pad; - uint8_t key[4]; -}; - -#define RFB_BUTTON_MASK1 1 -#define RFB_BUTTON_MASK2 2 -#define RFB_BUTTON_MASK3 4 -struct rfb_pointer_event { - uint8_t type; - uint8_t buttonmask; - uint16_t x; - uint16_t y; -}; - -#endif /* __VNC_VIEWER_H__ */ diff --git a/apps/vnc/vnc.c b/apps/vnc/vnc.c deleted file mode 100644 index b9bdb7e07..000000000 --- a/apps/vnc/vnc.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 Contiki VNC client - * - * - */ - -#include - -#include "contiki.h" - -/*#include "petsciiconv.h"*/ -#include "net/uiplib.h" -#include "net/uip.h" -#include "ctk/ctk.h" -#include "ctk/ctk-mouse.h" -#include "net/resolv.h" -/*#include "telnet.h"*/ -#include "vnc.h" -#include "vnc-draw.h" -#include "vnc-viewer.h" -#include "contiki-conf.h" - -#include "sys/loader.h" - -#if 1 -#define PRINTF(x) -#else -#include -#define PRINTF(x) printf x -#endif - - -#ifdef VNC_CONF_VIEWPORT_WIDTH -#define VNC_VIEWPORT_WIDTH VNC_CONF_VIEWPORT_WIDTH -#else -#define VNC_VIEWPORT_WIDTH 10 -#endif - -#ifdef VNC_CONF_VIEWPORT_HEIGHT -#define VNC_VIEWPORT_HEIGHT VNC_CONF_VIEWPORT_HEIGHT -#else -#define VNC_VIEWPORT_HEIGHT 10 -#endif - -#define HEIGHT (4 + VNC_VIEWPORT_HEIGHT/8) - -/* Main window */ -static struct ctk_window mainwindow; - -static char host[20]; -static struct ctk_textentry hosttextentry = - {CTK_TEXTENTRY(0, 0, 18, 1, host, 18)}; - -static char portentry[4]; -static struct ctk_textentry porttextentry = - {CTK_TEXTENTRY(21, 0, 3, 1, portentry, 3)}; - -static struct ctk_button connectbutton = - {CTK_BUTTON(27, 0, 7, "Connect")}; -/*static struct ctk_button disconnectbutton = - {CTK_BUTTON(25, 3, 10, "Disconnect")};*/ - -static struct ctk_separator sep1 = - {CTK_SEPARATOR(0, 1, 36)}; - -static struct ctk_bitmap vncbitmap = - {CTK_BITMAP(2, 2, - VNC_VIEWPORT_WIDTH / 8, - VNC_VIEWPORT_HEIGHT / 8, - vnc_draw_bitmap, - VNC_VIEWPORT_WIDTH, - VNC_VIEWPORT_HEIGHT)}; - -static struct ctk_button leftbutton = - {CTK_BUTTON(6, HEIGHT - 1, 4, "Left")}; - -static struct ctk_button upbutton = - {CTK_BUTTON(13, HEIGHT - 1, 2, "Up")}; - -static struct ctk_button downbutton = - {CTK_BUTTON(18, HEIGHT - 1, 4, "Down")}; - -static struct ctk_button rightbutton = - {CTK_BUTTON(25, HEIGHT - 1, 5, "Right")}; - -PROCESS(vnc_process, "VNC viewer"); - -/*-----------------------------------------------------------------------------------*/ -static void -show(char *text) -{ - -} -/*-----------------------------------------------------------------------------------*/ -static void -connect(void) -{ - uip_ipaddr_t addr, *addrptr; - uint16_t port; - char *cptr; - - /* Find the first space character in host and put a zero there - to end the string. */ - for(cptr = host; *cptr != ' ' && *cptr != 0; ++cptr); - *cptr = 0; - - addrptr = &addr; - if(uiplib_ipaddrconv(host, &addr) == 0) { - if(resolv_lookup(host, &addrptr) == RESOLV_STATUS_UNCACHED) { - resolv_query(host); - show("Resolving host..."); - return; - } - } - - port = 0; - for(cptr = portentry; *cptr != ' ' && *cptr != 0; ++cptr) { - if(*cptr < '0' || *cptr > '9') { - show("Port number error"); - return; - } - port = 10 * port + *cptr - '0'; - } - - - vnc_viewer_connect(addrptr, port); - - show("Connecting..."); - -} -/*-----------------------------------------------------------------------------------*/ -PROCESS_THREAD(vnc_process, ev, data) -{ - unsigned short x, y; - unsigned char xc, yc; - - PROCESS_BEGIN(); - - ctk_window_new(&mainwindow, 36, HEIGHT, "VNC client"); - ctk_window_move(&mainwindow, 0, 0); - - CTK_WIDGET_ADD(&mainwindow, &hosttextentry); - CTK_WIDGET_FOCUS(&mainwindow, &hosttextentry); - CTK_WIDGET_ADD(&mainwindow, &porttextentry); - CTK_WIDGET_ADD(&mainwindow, &connectbutton); - - CTK_WIDGET_ADD(&mainwindow, &sep1); - - CTK_WIDGET_ADD(&mainwindow, &vncbitmap); - - CTK_WIDGET_ADD(&mainwindow, &leftbutton); - CTK_WIDGET_ADD(&mainwindow, &upbutton); - CTK_WIDGET_ADD(&mainwindow, &downbutton); - CTK_WIDGET_ADD(&mainwindow, &rightbutton); - - vnc_draw_init(); - - ctk_window_open(&mainwindow); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == ctk_signal_button_activate) { - if(data == (process_data_t)&connectbutton) { - connect(); - } - } else if(ev == ctk_signal_window_close) { - process_exit(&vnc_process); - LOADER_UNLOAD(); - } else if(ev == resolv_event_found) { - if(strcmp(data, host) == 0) { - if(resolv_lookup(host, NULL) == RESOLV_STATUS_CACHED) { - connect(); - } else { - show("Host not found"); - } - } - } else if(ev == ctk_signal_pointer_move) { - /* Check if pointer is within the VNC viewer area */ - x = ctk_mouse_x(); - y = ctk_mouse_y(); - - xc = ctk_mouse_xtoc(x); - yc = ctk_mouse_ytoc(y); - - if(xc >= 2 && yc >= 2 && - xc < 2 + VNC_VIEWPORT_WIDTH / 8 && - yc < 2 + VNC_VIEWPORT_HEIGHT / 8) { - - VNC_VIEWER_POST_POINTER_EVENT(x, y, 0); - } - - } else if(ev == tcpip_event) { - vnc_viewer_appcall(data); - } - } - - PROCESS_END(); -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_viewer_refresh(void) -{ - CTK_WIDGET_REDRAW(&vncbitmap); -} -/*-----------------------------------------------------------------------------------*/ diff --git a/apps/vnc/vnc.h b/apps/vnc/vnc.h deleted file mode 100644 index 5be0ff890..000000000 --- a/apps/vnc/vnc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 Contiki VNC client. - * - * - */ -#ifndef __VNC_H__ -#define __VNC_H__ - -void vnc_init(char *arg); - -#endif /* __VNC_H__ */ diff --git a/apps/webbrowser/htmlparser.h b/apps/webbrowser/htmlparser.h index a42d43c18..233c94e5b 100644 --- a/apps/webbrowser/htmlparser.h +++ b/apps/webbrowser/htmlparser.h @@ -31,8 +31,8 @@ * * */ -#ifndef __HTMLPARSER_H__ -#define __HTMLPARSER_H__ +#ifndef HTMLPARSER_H_ +#define HTMLPARSER_H_ #include "contiki-net.h" @@ -62,4 +62,4 @@ void htmlparser_init(void); void htmlparser_parse(char *data, uint16_t len); -#endif /* __HTMLPARSER_H__ */ +#endif /* HTMLPARSER_H_ */ diff --git a/apps/webbrowser/webclient.h b/apps/webbrowser/webclient.h index 2be57aa9c..c8b1b8b00 100644 --- a/apps/webbrowser/webclient.h +++ b/apps/webbrowser/webclient.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBCLIENT_H__ -#define __WEBCLIENT_H__ +#ifndef WEBCLIENT_H_ +#define WEBCLIENT_H_ #include "contiki-net.h" #include "http-strings.h" @@ -62,4 +62,4 @@ char *webclient_filename(void); char *webclient_hostname(void); unsigned short webclient_port(void); -#endif /* __WEBCLIENT_H__ */ +#endif /* WEBCLIENT_H_ */ diff --git a/apps/webbrowser/www-dsc.h b/apps/webbrowser/www-dsc.h index ee2046735..15ed64792 100644 --- a/apps/webbrowser/www-dsc.h +++ b/apps/webbrowser/www-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __WWW_DSC_H__ -#define __WWW_DSC_H__ +#ifndef WWW_DSC_H_ +#define WWW_DSC_H_ #include "sys/dsc.h" DSC_HEADER(www_dsc); -#endif /* __WWW_DSC_H__ */ +#endif /* WWW_DSC_H_ */ diff --git a/apps/webbrowser/www.h b/apps/webbrowser/www.h index b5becc5c8..d7ffd6fd6 100644 --- a/apps/webbrowser/www.h +++ b/apps/webbrowser/www.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WWW_H__ -#define __WWW_H__ +#ifndef WWW_H_ +#define WWW_H_ #ifndef WWW_CONF_WEBPAGE_WIDTH #define WWW_CONF_WEBPAGE_WIDTH 80 @@ -64,4 +64,4 @@ PROCESS_NAME(www_process); -#endif /* __WWW_H__ */ +#endif /* WWW_H_ */ diff --git a/apps/webserver-nano/httpd-cfs.h b/apps/webserver-nano/httpd-cfs.h index f99e2271d..fabf3fd76 100644 --- a/apps/webserver-nano/httpd-cfs.h +++ b/apps/webserver-nano/httpd-cfs.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CFS_H__ -#define __HTTPD_CFS_H__ +#ifndef HTTPD_CFS_H_ +#define HTTPD_CFS_H_ #include "contiki-net.h" @@ -58,4 +58,4 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#endif /* __HTTPD_CFS_H__ */ +#endif /* HTTPD_CFS_H_ */ diff --git a/apps/webserver-nano/httpd-cgi.h b/apps/webserver-nano/httpd-cgi.h index 21b337a82..db32f6fef 100644 --- a/apps/webserver-nano/httpd-cgi.h +++ b/apps/webserver-nano/httpd-cgi.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ +#ifndef HTTPD_CGI_H_ +#define HTTPD_CGI_H_ #include "contiki.h" #include "httpd.h" @@ -53,4 +53,4 @@ void httpd_cgi_add(struct httpd_cgi_call *c); static struct httpd_cgi_call name = {NULL, str, function} void httpd_cgi_init(void); -#endif /* __HTTPD_CGI_H__ */ +#endif /* HTTPD_CGI_H_ */ diff --git a/apps/webserver-nano/httpd-fs.h b/apps/webserver-nano/httpd-fs.h index 49a8778ab..b68825fc4 100644 --- a/apps/webserver-nano/httpd-fs.h +++ b/apps/webserver-nano/httpd-fs.h @@ -28,8 +28,8 @@ * * This file is part of the lwIP TCP/IP stack. */ -#ifndef __HTTPD_FS_H__ -#define __HTTPD_FS_H__ +#ifndef HTTPD_FS_H_ +#define HTTPD_FS_H_ #include "contiki-net.h" #include "httpd.h" @@ -51,4 +51,4 @@ void* httpd_fs_get_root(void); void httpd_fs_init(void); -#endif /* __HTTPD_FS_H__ */ +#endif /* HTTPD_FS_H_ */ diff --git a/apps/webserver-nano/httpd-fsdata.h b/apps/webserver-nano/httpd-fsdata.h index 5d27e299d..ab1b4cff8 100644 --- a/apps/webserver-nano/httpd-fsdata.h +++ b/apps/webserver-nano/httpd-fsdata.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FSDATA_H__ -#define __HTTPD_FSDATA_H__ +#ifndef HTTPD_FSDATA_H_ +#define HTTPD_FSDATA_H_ #include "contiki-net.h" @@ -60,4 +60,4 @@ struct httpd_fsdata_file_noconst { #endif /* HTTPD_FS_STATISTICS */ }; -#endif /* __HTTPD_FSDATA_H__ */ +#endif /* HTTPD_FSDATA_H_ */ diff --git a/apps/webserver-nano/httpd.h b/apps/webserver-nano/httpd.h index d10d389ef..8d86ea094 100644 --- a/apps/webserver-nano/httpd.h +++ b/apps/webserver-nano/httpd.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_H__ -#define __HTTPD_H__ +#ifndef HTTPD_H_ +#define HTTPD_H_ /* * The default number of simultaneous server connections is 4. Multiple connections can be triggered * by requests for embedded images, style sheets, icons, etc. and a TCP RESET is issued when no more @@ -328,4 +328,4 @@ char TCPBUF[512]; #endif -#endif /* __HTTPD_H__ */ +#endif /* HTTPD_H_ */ diff --git a/apps/webserver-nano/urlconv.h b/apps/webserver-nano/urlconv.h index 75090a090..d5dc1b8d5 100644 --- a/apps/webserver-nano/urlconv.h +++ b/apps/webserver-nano/urlconv.h @@ -30,10 +30,10 @@ * */ -#ifndef __URLCONV_H__ -#define __URLCONV_H__ +#ifndef URLCONV_H_ +#define URLCONV_H_ void urlconv_init(void); void urlconv_tofilename(char *dest, char *source, unsigned char maxlen); -#endif /* __URLCONV_H__ */ +#endif /* URLCONV_H_ */ diff --git a/apps/webserver-nano/webserver-dsc.h b/apps/webserver-nano/webserver-dsc.h index c329f41d8..35aee6e7c 100644 --- a/apps/webserver-nano/webserver-dsc.h +++ b/apps/webserver-nano/webserver-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __WEBSERVER_DSC_H__ -#define __WEBSERVER_DSC_H__ +#ifndef WEBSERVER_DSC_H_ +#define WEBSERVER_DSC_H_ #include "sys/dsc.h" DSC_HEADER(webserver_dsc); -#endif /* __WEBSERVER_DSC_H__ */ +#endif /* WEBSERVER_DSC_H_ */ diff --git a/apps/webserver-nano/webserver-nogui.h b/apps/webserver-nano/webserver-nogui.h index 7f1867016..78f7126b2 100644 --- a/apps/webserver-nano/webserver-nogui.h +++ b/apps/webserver-nano/webserver-nogui.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_NOGUI_H__ -#define __WEBSERVER_NOGUI_H__ +#ifndef WEBSERVER_NOGUI_H_ +#define WEBSERVER_NOGUI_H_ #include "contiki-net.h" @@ -41,4 +41,4 @@ PROCESS_NAME(webserver_nogui_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/apps/webserver-nano/webserver.h b/apps/webserver-nano/webserver.h index fe9f255a1..c96e7a32c 100644 --- a/apps/webserver-nano/webserver.h +++ b/apps/webserver-nano/webserver.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_H__ -#define __WEBSERVER_H__ +#ifndef WEBSERVER_H_ +#define WEBSERVER_H_ #include "contiki-net.h" @@ -41,4 +41,4 @@ PROCESS_NAME(webserver_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/apps/webserver/httpd-cfs.h b/apps/webserver/httpd-cfs.h index f99e2271d..fabf3fd76 100644 --- a/apps/webserver/httpd-cfs.h +++ b/apps/webserver/httpd-cfs.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CFS_H__ -#define __HTTPD_CFS_H__ +#ifndef HTTPD_CFS_H_ +#define HTTPD_CFS_H_ #include "contiki-net.h" @@ -58,4 +58,4 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#endif /* __HTTPD_CFS_H__ */ +#endif /* HTTPD_CFS_H_ */ diff --git a/apps/webserver/httpd-cgi.h b/apps/webserver/httpd-cgi.h index 21b337a82..db32f6fef 100644 --- a/apps/webserver/httpd-cgi.h +++ b/apps/webserver/httpd-cgi.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ +#ifndef HTTPD_CGI_H_ +#define HTTPD_CGI_H_ #include "contiki.h" #include "httpd.h" @@ -53,4 +53,4 @@ void httpd_cgi_add(struct httpd_cgi_call *c); static struct httpd_cgi_call name = {NULL, str, function} void httpd_cgi_init(void); -#endif /* __HTTPD_CGI_H__ */ +#endif /* HTTPD_CGI_H_ */ diff --git a/apps/webserver/httpd-fs.h b/apps/webserver/httpd-fs.h index c8cab68d3..ce69ac58d 100644 --- a/apps/webserver/httpd-fs.h +++ b/apps/webserver/httpd-fs.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FS_H__ -#define __HTTPD_FS_H__ +#ifndef HTTPD_FS_H_ +#define HTTPD_FS_H_ #include "contiki-net.h" @@ -55,4 +55,4 @@ uint16_t httpd_fs_count(char *name); void httpd_fs_init(void); -#endif /* __HTTPD_FS_H__ */ +#endif /* HTTPD_FS_H_ */ diff --git a/apps/webserver/httpd-fsdata.h b/apps/webserver/httpd-fsdata.h index 5d27e299d..ab1b4cff8 100644 --- a/apps/webserver/httpd-fsdata.h +++ b/apps/webserver/httpd-fsdata.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FSDATA_H__ -#define __HTTPD_FSDATA_H__ +#ifndef HTTPD_FSDATA_H_ +#define HTTPD_FSDATA_H_ #include "contiki-net.h" @@ -60,4 +60,4 @@ struct httpd_fsdata_file_noconst { #endif /* HTTPD_FS_STATISTICS */ }; -#endif /* __HTTPD_FSDATA_H__ */ +#endif /* HTTPD_FSDATA_H_ */ diff --git a/apps/webserver/httpd.h b/apps/webserver/httpd.h index 8b0e99818..05080b038 100644 --- a/apps/webserver/httpd.h +++ b/apps/webserver/httpd.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_H__ -#define __HTTPD_H__ +#ifndef HTTPD_H_ +#define HTTPD_H_ #include "contiki-net.h" @@ -63,4 +63,4 @@ void httpd_appcall(void *state); uint8_t httpd_sprint_ip6(uip_ip6addr_t addr, char * result); #endif /* UIP_CONF_IPV6 */ -#endif /* __HTTPD_H__ */ +#endif /* HTTPD_H_ */ diff --git a/apps/webserver/urlconv.h b/apps/webserver/urlconv.h index 75090a090..d5dc1b8d5 100644 --- a/apps/webserver/urlconv.h +++ b/apps/webserver/urlconv.h @@ -30,10 +30,10 @@ * */ -#ifndef __URLCONV_H__ -#define __URLCONV_H__ +#ifndef URLCONV_H_ +#define URLCONV_H_ void urlconv_init(void); void urlconv_tofilename(char *dest, char *source, unsigned char maxlen); -#endif /* __URLCONV_H__ */ +#endif /* URLCONV_H_ */ diff --git a/apps/webserver/webserver-dsc.h b/apps/webserver/webserver-dsc.h index c329f41d8..35aee6e7c 100644 --- a/apps/webserver/webserver-dsc.h +++ b/apps/webserver/webserver-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __WEBSERVER_DSC_H__ -#define __WEBSERVER_DSC_H__ +#ifndef WEBSERVER_DSC_H_ +#define WEBSERVER_DSC_H_ #include "sys/dsc.h" DSC_HEADER(webserver_dsc); -#endif /* __WEBSERVER_DSC_H__ */ +#endif /* WEBSERVER_DSC_H_ */ diff --git a/apps/webserver/webserver-nogui.h b/apps/webserver/webserver-nogui.h index 7f1867016..78f7126b2 100644 --- a/apps/webserver/webserver-nogui.h +++ b/apps/webserver/webserver-nogui.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_NOGUI_H__ -#define __WEBSERVER_NOGUI_H__ +#ifndef WEBSERVER_NOGUI_H_ +#define WEBSERVER_NOGUI_H_ #include "contiki-net.h" @@ -41,4 +41,4 @@ PROCESS_NAME(webserver_nogui_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/apps/webserver/webserver.h b/apps/webserver/webserver.h index fe9f255a1..c96e7a32c 100644 --- a/apps/webserver/webserver.h +++ b/apps/webserver/webserver.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_H__ -#define __WEBSERVER_H__ +#ifndef WEBSERVER_H_ +#define WEBSERVER_H_ #include "contiki-net.h" @@ -41,4 +41,4 @@ PROCESS_NAME(webserver_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/core/cfs/cfs.h b/core/cfs/cfs.h index b5de47235..5b22e0931 100644 --- a/core/cfs/cfs.h +++ b/core/cfs/cfs.h @@ -55,8 +55,8 @@ * Author: Adam Dunkels * */ -#ifndef __CFS_H__ -#define __CFS_H__ +#ifndef CFS_H_ +#define CFS_H_ #include "contiki.h" @@ -276,7 +276,7 @@ CCIF int cfs_readdir(struct cfs_dir *dirp, struct cfs_dirent *dirent); CCIF void cfs_closedir(struct cfs_dir *dirp); #endif -#endif /* __CFS_H__ */ +#endif /* CFS_H_ */ /** @} */ /** @} */ diff --git a/core/contiki-lib.h b/core/contiki-lib.h index efacd954a..7ff67fbb0 100644 --- a/core/contiki-lib.h +++ b/core/contiki-lib.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __CONTIKI_LIB_H__ -#define __CONTIKI_LIB_H__ +#ifndef CONTIKI_LIB_H_ +#define CONTIKI_LIB_H_ #include "contiki.h" #include "lib/list.h" @@ -40,4 +40,4 @@ #include "lib/mmem.h" #include "lib/random.h" -#endif /* __CONTIKI_LIB_H__ */ +#endif /* CONTIKI_LIB_H_ */ diff --git a/core/contiki-net.h b/core/contiki-net.h index 935e2a211..5e6cddd40 100644 --- a/core/contiki-net.h +++ b/core/contiki-net.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __CONTIKI_NET_H__ -#define __CONTIKI_NET_H__ +#ifndef CONTIKI_NET_H_ +#define CONTIKI_NET_H_ #include "contiki.h" @@ -58,4 +58,4 @@ #include "net/netstack.h" -#endif /* __CONTIKI_NET_H__ */ +#endif /* CONTIKI_NET_H_ */ diff --git a/core/contiki.h b/core/contiki.h index e3f72fe92..804c3dab0 100644 --- a/core/contiki.h +++ b/core/contiki.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __CONTIKI_H__ -#define __CONTIKI_H__ +#ifndef CONTIKI_H_ +#define CONTIKI_H_ #include "contiki-version.h" #include "contiki-conf.h" @@ -55,4 +55,4 @@ #include "sys/energest.h" -#endif /* __CONTIKI_H__ */ +#endif /* CONTIKI_H_ */ diff --git a/core/ctk/ctk-conio.h b/core/ctk/ctk-conio.h index df4073c62..0c6ec6709 100644 --- a/core/ctk/ctk-conio.h +++ b/core/ctk/ctk-conio.h @@ -32,8 +32,8 @@ * */ -#ifndef __CTK_CONIO_H__ -#define __CTK_CONIO_H__ +#ifndef CTK_CONIO_H_ +#define CTK_CONIO_H_ #include @@ -62,4 +62,4 @@ typedef char ctk_arch_key_t; #define CH_CURS_LEFT 255 #endif /* CH_CURS_LEFT */ -#endif /* __CTK_CONIO_H__ */ +#endif /* CTK_CONIO_H_ */ diff --git a/core/ctk/ctk-draw.h b/core/ctk/ctk-draw.h index bdd72d717..ed3c0d493 100644 --- a/core/ctk/ctk-draw.h +++ b/core/ctk/ctk-draw.h @@ -48,8 +48,8 @@ * */ -#ifndef __CTK_DRAW_H__ -#define __CTK_DRAW_H__ +#ifndef CTK_DRAW_H_ +#define CTK_DRAW_H_ #include "ctk/ctk.h" #include "contiki-conf.h" @@ -281,7 +281,7 @@ extern unsigned char ctk_draw_windowborder_width, ctk_draw_windowtitle_height; -#endif /* __CTK_DRAW_H__ */ +#endif /* CTK_DRAW_H_ */ /** diff --git a/core/ctk/ctk-mouse.h b/core/ctk/ctk-mouse.h index 6742f40e9..d2fc553e0 100644 --- a/core/ctk/ctk-mouse.h +++ b/core/ctk/ctk-mouse.h @@ -31,8 +31,8 @@ * * */ -#ifndef __CTK_MOUSE_H__ -#define __CTK_MOUSE_H__ +#ifndef CTK_MOUSE_H_ +#define CTK_MOUSE_H_ #include "contiki-conf.h" @@ -68,4 +68,4 @@ void ctk_mouse_show(void); #endif /* CTK_CONF_MOUSE_SUPPORT */ -#endif /* __CTK_MOUSE_H__ */ +#endif /* CTK_MOUSE_H_ */ diff --git a/core/ctk/ctk-vncarch.h b/core/ctk/ctk-vncarch.h deleted file mode 100644 index 7082005d8..000000000 --- a/core/ctk/ctk-vncarch.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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 "ctk" console GUI toolkit for cc65 - * - * - */ -#ifndef __CTK_VNCARCH_H__ -#define __CTK_VNCARCH_H__ - -#define CTK_ARCH_KEY_T unsigned char - -unsigned char ctk_arch_keyavail(void); -CTK_ARCH_KEY_T ctk_arch_getkey(void); - -#define CH_ENTER 0x0d -#define CH_DEL 0x08 - -#define CH_ESC 0x1b - -#define CH_HOME 0x50 - -#define CH_TAB 0x09 - -#define CH_CURS_LEFT 0x51 -#define CH_CURS_UP 0x52 -#define CH_CURS_RIGHT 0x53 -#define CH_CURS_DOWN 0x54 - - -#define CH_F1 0xbe -#define CH_F2 0xbf -#define CH_F3 0xc0 -#define CH_F4 0xc1 -#define CH_F5 0xc2 -#define CH_F6 0xc3 -#define CH_F7 0xc4 - - - -#endif /* __CTK_VNCARCH_H__ */ diff --git a/core/ctk/ctk-vncfont.c b/core/ctk/ctk-vncfont.c deleted file mode 100644 index a75f28c58..000000000 --- a/core/ctk/ctk-vncfont.c +++ /dev/null @@ -1,1203 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 Contiki VNC server - * - * - */ - -#define _ 0x00 -#define o 0x01 /* 1001 0010 */ -#define X 0x02 /* 1111 0110 */ - -#ifdef __AVR__ -#include -const unsigned char vncfont[] PROGMEM = { -#else -const unsigned char vncfont[] = { -#endif -/* char 0 */ -X,o,_,_,_,_, -o,X,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 1 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,X,X,o,_,_, -_,o,o,X,_,_, -o,X,X,X,_,_, -X,o,o,X,_,_, -o,X,X,X,_,_, -_,_,_,_,_,_, -/* char 2 */ -X,_,_,_,_,_, -X,o,_,_,_,_, -X,X,X,o,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -X,X,X,o,_,_, -_,_,_,_,_,_, -/* char 3 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -o,X,X,o,_,_, -X,o,o,X,_,_, -X,_,_,o,_,_, -X,o,o,X,_,_, -o,X,X,o,_,_, -_,_,_,_,_,_, -/* char 4 */ -_,_,_,X,_,_, -_,_,o,X,_,_, -o,X,X,X,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -o,X,X,X,_,_, -_,_,_,_,_,_, -/* char 5 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -o,X,X,o,_,_, -X,o,o,X,_,_, -X,X,X,X,_,_, -X,o,o,_,_,_, -o,X,X,_,_,_, -_,_,_,_,_,_, -/* char 6 */ -_,o,X,X,_,_, -o,X,o,_,_,_, -X,X,X,_,_,_, -o,X,o,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,_,_,_,_,_, -/* char 7 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -o,X,X,X,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -o,X,X,X,_,_, -_,o,o,X,_,_, -/* char 8 */ -X,_,_,_,_,_, -X,o,_,_,_,_, -X,X,X,o,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -_,_,_,_,_,_, -/* char 9 */ -_,X,_,_,_,_, -_,o,_,_,_,_, -X,X,_,_,_,_, -o,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,_,_,_,_,_, -/* char 10 */ -_,_,X,_,_,_, -_,_,o,_,_,_, -_,X,X,_,_,_, -_,o,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,o,X,_,_,_, -/* char 11 */ -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,o,X,_,_, -X,o,X,o,_,_, -X,X,o,_,_,_, -X,o,X,o,_,_, -X,_,o,X,_,_, -_,_,_,_,_,_, -/* char 12 */ -_,X,X,_,_,_, -_,o,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 13 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,o,X,o, -X,o,o,X,o,X, -X,_,_,X,_,X, -X,_,_,X,_,X, -X,_,_,X,_,X, -_,_,_,_,_,_, -/* char 14 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,o,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -_,_,_,_,_,_, -/* char 15 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -o,X,X,o,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -o,X,X,o,_,_, -_,_,_,_,_,_, -/* char 16 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,o,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -X,X,X,o,_,_, -X,o,_,_,_,_, -/* char 17 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -o,X,X,X,_,_, -X,o,o,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -o,X,X,X,_,_, -_,_,o,X,_,_, -/* char 18 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,o,X,X,_,_, -X,X,o,_,_,_, -X,o,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -/* char 19 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -o,X,X,X,_,_, -X,o,o,_,_,_, -o,X,X,o,_,_, -_,o,o,X,_,_, -X,X,X,o,_,_, -_,_,_,_,_,_, -/* char 20 */ -_,_,X,_,_,_, -_,o,X,o,_,_, -_,X,X,X,_,_, -_,o,X,o,_,_, -_,_,X,_,_,_, -_,_,X,o,_,_, -_,_,o,X,_,_, -_,_,_,_,_,_, -/* char 21 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -o,X,X,X,_,_, -_,_,_,_,_,_, -/* char 22 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,o,_,o,X,_, -o,X,o,X,o,_, -_,X,o,X,_,_, -_,o,X,o,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 23 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,o,_,_,o,X, -o,X,o,X,o,X, -o,X,o,X,o,X, -_,o,X,o,X,o, -_,_,X,o,X,_, -_,_,_,_,_,_, -/* char 24 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,o,_,o,X,_, -o,X,o,X,o,_, -_,o,X,o,_,_, -o,X,o,X,o,_, -X,o,_,o,X,_, -_,_,_,_,_,_, -/* char 25 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -X,_,_,X,_,_, -X,o,o,X,_,_, -o,X,X,X,_,_, -_,o,o,X,_,_, -/* char 26 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,X,_,_, -_,o,X,o,_,_, -o,X,o,_,_,_, -X,o,_,_,_,_, -X,X,X,X,_,_, -_,_,_,_,_,_, -/* char 27 */ -_,X,o,_,_,_, -_,X,_,_,_,_, -o,X,_,_,_,_, -X,o,_,_,_,_, -o,X,_,_,_,_, -_,X,_,_,_,_, -_,X,o,_,_,_, -_,o,X,_,_,_, -/* char 28 */ -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -/* char 29 */ -o,X,_,_,_,_, -_,X,_,_,_,_, -_,X,o,_,_,_, -_,o,X,_,_,_, -_,X,o,_,_,_, -_,X,_,_,_,_, -o,X,_,_,_,_, -X,o,_,_,_,_, -/* char 30 */ -o,X,X,o,X,_, -X,o,X,X,o,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 31 */ -_,X,X,_,_,_, -_,X,X,_,_,_, -_,X,X,_,_,_, -_,X,X,_,_,_, -_,X,X,_,_,_, -_,X,X,_,_,_, -_,X,X,_,_,_, -_,X,X,_,_,_, -/* char 32 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 33 */ -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,o,_,_,_,_, -_,X,_,_,_,_, -_,_,_,_,_,_, -/* char 34 */ -X,o,X,_,_,_, -X,o,X,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 35 */ -X,X,X,X,X,_, -o,X,o,X,o,_, -X,X,X,X,X,_, -o,X,o,X,o,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 36 */ -o,X,X,X,o,_, -X,o,X,o,X,_, -X,o,X,o,_,_, -o,X,X,X,o,_, -_,o,X,o,X,_, -X,o,X,o,X,_, -o,X,X,X,o,_, -_,o,X,o,_,_, -/* char 37 */ -o,X,X,X,X,X, -X,o,o,X,o,o, -X,o,o,X,o,X, -o,X,X,o,X,X, -_,_,o,X,X,o, -_,o,X,o,X,o, -o,X,o,_,o,X, -_,_,_,_,_,_, -/* char 38 */ -_,X,o,o,X,_, -_,X,o,X,o,_, -_,o,X,o,_,_, -o,X,o,X,o,X, -X,o,_,o,X,o, -X,o,o,X,o,X, -o,X,X,o,_,_, -_,_,_,_,_,_, -/* char 39 */ -X,_,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 40 */ -o,X,o,_,_,_, -X,o,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,o,_,_,_,_, -o,X,o,_,_,_, -_,o,X,_,_,_, -/* char 41 */ -o,X,o,_,_,_, -_,o,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,o,X,_,_,_, -o,X,o,_,_,_, -X,o,_,_,_,_, -/* char 42 */ -_,X,o,X,_,_, -_,o,X,o,_,_, -X,X,X,X,X,_, -_,o,X,o,_,_, -_,X,o,X,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 43 */ -_,_,X,_,_,_, -_,o,X,o,_,_, -X,X,X,X,X,_, -_,o,X,o,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 44 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,X,_,_,_,_, -o,X,_,_,_,_, -/* char 45 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,X,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 46 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 47 */ -_,_,o,X,_,_, -_,_,X,o,_,_, -_,o,X,_,_,_, -_,X,o,_,_,_, -o,X,_,_,_,_, -X,o,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -/* char 48 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 49 */ -_,o,X,_,_,_, -_,X,X,_,_,_, -_,o,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 50 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -_,_,_,o,X,_, -_,_,o,X,o,_, -_,o,X,o,_,_, -o,X,o,_,_,_, -X,X,X,X,X,_, -_,_,_,_,_,_, -/* char 51 */ -X,X,X,X,X,_, -_,_,o,X,o,_, -_,o,X,o,_,_, -_,X,X,X,o,_, -_,_,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 52 */ -_,_,o,X,_,_, -_,o,X,X,_,_, -o,X,o,X,_,_, -X,o,o,X,o,_, -X,X,X,X,X,_, -_,_,o,X,o,_, -_,_,_,X,_,_, -_,_,_,_,_,_, -/* char 53 */ -X,X,X,X,X,_, -X,o,o,o,_,_, -X,X,X,X,o,_, -_,_,_,o,X,_, -_,_,_,_,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 54 */ -_,o,X,X,_,_, -o,X,o,_,_,_, -X,o,_,_,_,_, -X,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 55 */ -X,X,X,X,X,_, -_,_,_,o,X,_, -_,_,_,X,o,_, -_,_,o,X,_,_, -_,_,X,o,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 56 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 57 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,X,_, -_,_,_,o,X,_, -_,_,o,X,o,_, -_,X,X,o,_,_, -_,_,_,_,_,_, -/* char 58 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -/* char 59 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,X,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,X,_,_,_,_, -o,X,_,_,_,_, -/* char 60 */ -_,_,_,_,_,_, -_,o,X,_,_,_, -o,X,o,_,_,_, -X,o,_,_,_,_, -o,X,o,_,_,_, -_,o,X,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 61 */ -_,_,_,_,_,_, -X,X,X,X,X,_, -o,o,o,o,o,_, -X,X,X,X,X,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 62 */ -_,_,_,_,_,_, -X,o,_,_,_,_, -o,X,o,_,_,_, -_,o,X,_,_,_, -o,X,o,_,_,_, -X,o,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 63 */ -o,X,X,o,_,_, -X,o,o,X,_,_, -_,_,o,X,_,_, -_,o,X,o,_,_, -_,X,o,_,_,_, -_,o,_,_,_,_, -_,X,_,_,_,_, -_,_,_,_,_,_, -/* char 64 */ -_,o,X,X,X,o, -o,X,o,o,o,X, -X,o,o,X,X,o, -X,o,X,o,X,_, -X,o,X,o,X,o, -X,o,o,X,X,X, -o,X,o,o,o,_, -_,o,X,X,X,_, -/* char 65 */ -_,_,X,_,_,_, -_,o,X,o,_,_, -_,X,o,X,_,_, -o,X,o,X,o,_, -X,X,X,X,X,_, -X,o,_,o,X,_, -X,_,_,_,X,_, -_,_,_,_,_,_, -/* char 66 */ -X,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -X,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -X,X,X,X,o,_, -_,_,_,_,_,_, -/* char 67 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 68 */ -X,X,X,o,_,_, -X,o,o,X,o,_, -X,_,_,o,X,_, -X,_,_,_,X,_, -X,_,_,o,X,_, -X,o,o,X,o,_, -X,X,X,o,_,_, -_,_,_,_,_,_, -/* char 69 */ -X,X,X,X,_,_, -X,o,_,_,_,_, -X,o,_,_,_,_, -X,X,X,_,_,_, -X,o,_,_,_,_, -X,o,_,_,_,_, -X,X,X,X,_,_, -_,_,_,_,_,_, -/* char 70 */ -X,X,X,X,_,_, -X,o,_,_,_,_, -X,o,_,_,_,_, -X,X,X,_,_,_, -X,o,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -/* char 71 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,_,_,_,o,_, -X,_,_,X,X,_, -X,_,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 72 */ -X,_,_,_,X,_, -X,_,_,_,X,_, -X,o,_,o,X,_, -X,X,X,X,X,_, -X,o,_,o,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -_,_,_,_,_,_, -/* char 73 */ -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 74 */ -_,_,_,_,X,_, -_,_,_,_,X,_, -_,_,_,_,X,_, -_,_,_,_,X,_, -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 75 */ -X,_,_,o,X,_, -X,_,o,X,o,_, -X,o,X,o,_,_, -X,X,o,_,_,_, -X,o,X,o,_,_, -X,_,o,X,o,_, -X,_,_,o,X,_, -_,_,_,_,_,_, -/* char 76 */ -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,o,_,_,_,_, -X,X,X,X,_,_, -_,_,_,_,_,_, -/* char 77 */ -X,o,_,_,o,X, -X,X,o,_,o,X, -X,o,X,o,X,X, -X,_,o,X,o,X, -X,_,_,_,_,X, -X,_,_,_,_,X, -X,_,_,_,_,X, -_,_,_,_,_,_, -/* char 78 */ -X,X,_,_,X,_, -X,X,o,_,X,_, -X,o,X,o,X,_, -X,o,X,o,X,_, -X,_,o,X,X,_, -X,_,_,X,X,_, -X,_,_,o,X,_, -_,_,_,_,_,_, -/* char 79 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 80 */ -X,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -X,X,X,X,o,_, -X,o,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -_,_,_,_,_,_, -/* char 81 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,o,X,o,X,_, -o,X,X,X,o,_, -_,_,o,X,_,_, -/* char 82 */ -X,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,o,X,_, -X,X,X,X,o,_, -X,o,X,o,_,_, -X,_,o,X,o,_, -X,_,_,o,X,_, -_,_,_,_,_,_, -/* char 83 */ -o,X,X,X,o,_, -X,o,_,o,X,_, -X,o,_,_,_,_, -o,X,X,X,o,_, -_,_,_,o,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 84 */ -X,X,X,X,X,_, -_,o,X,o,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 85 */ -X,_,_,_,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,X,X,o,_, -_,_,_,_,_,_, -/* char 86 */ -X,_,_,_,X,_, -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,o,X,o,_, -_,X,o,X,_,_, -_,o,X,o,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 87 */ -X,_,_,_,_,X, -X,o,_,_,_,X, -o,X,o,X,o,X, -o,X,o,X,o,X, -_,o,X,o,X,o, -_,_,X,o,X,_, -_,_,X,o,X,_, -_,_,_,_,_,_, -/* char 88 */ -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,o,X,o,_, -_,o,X,o,_,_, -o,X,o,X,o,_, -X,o,_,o,X,_, -X,_,_,_,X,_, -_,_,_,_,_,_, -/* char 89 */ -X,_,_,_,X,_, -X,o,_,o,X,_, -o,X,o,X,o,_, -_,o,X,o,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,_,_,_,_, -/* char 90 */ -X,X,X,X,_,_, -_,_,o,X,_,_, -_,o,X,o,_,_, -o,X,o,_,_,_, -X,o,_,_,_,_, -X,o,_,_,_,_, -X,X,X,X,_,_, -_,_,_,_,_,_, -/* char 91 */ -X,o,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,o,_,_,_,_, -X,X,_,_,_,_, -/* char 92 */ -X,o,_,_,_,_, -o,X,_,_,_,_, -_,X,o,_,_,_, -_,o,X,_,_,_, -_,_,X,o,_,_, -_,_,o,X,_,_, -_,_,_,X,_,_, -_,_,_,_,_,_, -/* char 93 */ -o,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -_,X,_,_,_,_, -o,X,_,_,_,_, -X,X,_,_,_,_, -/* char 94 */ -o,X,o,_,_,_, -X,o,X,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* char 95 */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,X,X,X, -_,_,_,_,_,_, - - - - - -/* Char 0x60 '`' */ -X,3,3,3,3,3, -X,4,4,4,4,4, -X,3,3,3,3,3, -X,4,4,4,4,4, -X,3,3,3,3,3, -X,4,4,4,4,4, -X,3,3,3,3,3, -X,5,5,5,5,5, -/* Char 0x61 'a' */ -3,3,3,3,3,3, -4,4,4,4,4,4, -3,3,3,3,3,3, -4,4,4,4,4,4, -3,3,3,3,3,3, -4,4,4,4,4,4, -3,3,3,3,3,3, -5,5,5,5,5,5, -/* Char 0x62 'b' */ -3,3,3,3,3,X, -4,4,4,4,4,X, -3,3,3,3,3,X, -4,4,4,4,4,X, -3,3,3,3,3,X, -4,4,4,4,4,X, -3,3,3,3,3,X, -5,5,5,5,5,X, -/* Char 0x63 'c' */ -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -/* Char 0x64 'd' */ -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -_,_,_,_,5,X, -5,5,5,5,5,X, -X,X,X,X,X,X, -/* Char 0x65 'e' */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -5,5,5,5,5,5, -X,X,X,X,X,X, -/* Char 0x66 'f' */ -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,5,5,5,5,5, -X,X,X,X,X,X, -/* Char 0x67 'g' */ -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -/* Char 0x68 'h' */ -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -_,_,X,_,_,_, -/* Char 0x69 'i' */ -X,X,X,X,X,X, -_,_,_,_,_,_, -X,X,X,X,X,X, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x6a 'j' */ -X,X,X,X,X,X, -_,_,_,_,_,X, -X,X,X,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -/* Char 0x6b 'k' */ -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -/* Char 0x6c 'l' */ -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -_,_,_,X,_,X, -X,X,X,X,_,X, -_,_,_,_,_,X, -X,X,X,X,X,X, -/* Char 0x6d 'm' */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,X,X,X, -_,_,_,_,_,_, -X,X,X,X,X,X, -/* Char 0x6e 'n' */ -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,X,X,X, -X,_,_,_,_,_, -X,X,X,X,X,X, -/* Char 0x6f 'o' */ -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -/* Char 0x70 'p' */ -5,5,5,5,5,5, -5,6,6,6,6,_, -5,6,_,_,_,_, -5,6,_,_,_,_, -5,6,_,_,_,_, -5,6,_,_,_,_, -5,6,_,_,_,_, -5,_,_,_,_,_, -/* Char 0x71 'q' */ -_,_,_,_,_,4, -_,_,_,_,3,4, -_,_,_,_,3,4, -_,_,_,_,3,4, -_,_,_,_,3,4, -_,_,_,_,3,4, -_,3,3,3,3,4, -4,4,4,4,4,4, -/* Char 0x72 'r' */ -X,X,X,X,X,X, -X,_,_,_,_,_, -X,_,X,X,X,X, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -X,_,X,_,_,_, -/* Char 0x73 's' */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,X,X,X, -X,X,X,X,X,X, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x74 't' */ -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -X,_,_,_,_,_, -/* Char 0x75 'u' */ -X,X,_,_,_,_, -X,X,_,_,_,_, -X,X,_,_,_,_, -X,X,_,_,_,_, -X,X,_,_,_,_, -X,X,_,_,_,_, -X,X,_,_,_,_, -X,X,_,_,_,_, -/* Char 0x76 'v' */ -_,_,_,_,X,X, -_,_,_,_,X,X, -_,_,_,_,X,X, -_,_,_,_,X,X, -_,_,_,_,X,X, -_,_,_,_,X,X, -_,_,_,_,X,X, -_,_,_,_,X,X, -/* Char 0x77 'w' */ -X,X,X,X,X,X, -X,X,X,X,X,X, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x78 'x' */ -X,X,X,X,X,X, -X,X,X,X,X,X, -X,X,X,X,X,X, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x79 'y' */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,X,X,X, -X,X,X,X,X,X, -X,X,X,X,X,X, -/* Char 0x7a 'z' */ -_,_,_,_,_,_, -_,_,_,_,o,X, -_,_,_,o,X,X, -X,X,o,X,X,o, -X,X,X,X,o,_, -X,X,X,o,_,_, -X,X,o,_,_,_, -_,_,_,_,_,_, -/* Char 0x7b '{' */ -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -/* Char 0x7c '|' */ -_,_,_,X,X,X, -_,_,_,X,X,X, -_,_,_,X,X,X, -_,_,_,X,X,X, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x7d '}' */ -_,_,X,X,_,_, -_,_,X,X,_,_, -_,o,X,X,_,_, -X,X,X,X,_,_, -X,X,X,X,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x7e '~' */ -X,X,X,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -_,_,_,_,_,_, -/* Char 0x7f '?' */ -X,X,X,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -X,X,X,_,_,_, -_,_,_,X,X,X, -_,_,_,X,X,X, -_,_,_,X,X,X, -_,_,_,X,X,X, - -}; diff --git a/core/ctk/ctk-vncfont.h b/core/ctk/ctk-vncfont.h deleted file mode 100644 index bd277bd3e..000000000 --- a/core/ctk/ctk-vncfont.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 Contiki VNC server - * - * - */ -#ifndef __CTK_VNCFONT_H__ -#define __CTK_VNCFONT_H__ - -#define CTK_VNCFONT_WIDTH 6 -#define CTK_VNCFONT_HEIGHT 8 - - -extern unsigned char ctk_vncfont[CTK_VNCFONT_WIDTH * - CTK_VNCFONT_HEIGHT * - 128]; - -#endif /* __CTK_VNCFONT_H__ */ diff --git a/core/ctk/ctk-vncserver.c b/core/ctk/ctk-vncserver.c deleted file mode 100644 index ad7330325..000000000 --- a/core/ctk/ctk-vncserver.c +++ /dev/null @@ -1,1098 +0,0 @@ -/** - * \file - * The ctk-draw implementation for the CTK VNC server. - * \author Adam Dunkels - * - */ - -/** - * \defgroup CTKVNCServer The CTK VNC server - * @{ - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * 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 "ctk" console GUI toolkit for cc65 - * - * - */ - -#include /* For strlen() */ - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" - -#include "contiki-net.h" - -#include "ctk/vnc-server.h" -#include "ctk/vnc-out.h" - -#include "ctk/ctk-vncfont.h" -#include "ctk/ctk-vncserver.h" - - -static unsigned char sizex, sizey; - -#define CH_ULCORNER 0x00 -#define CH_TITLEBAR 0x01 -#define CH_URCORNER 0x02 -#define CH_WINDOWRBORDER 0x03 -#define CH_LRCORNER 0x04 -#define CH_WINDOWLOWERBORDER 0x05 -#define CH_LLCORNER 0x06 -#define CH_WINDOWLBORDER 0x07 - -#define CH_DIALOG_ULCORNER 0x12 -#define CH_DIALOGUPPERBORDER 0x09 -#define CH_DIALOG_URCORNER 0x0a -#define CH_DIALOGRBORDER 0x0b -#define CH_DIALOG_LRCORNER 0x0c -#define CH_DIALOGLOWERBORDER 0x0d -#define CH_DIALOG_LLCORNER 0x0e -#define CH_DIALOGLBORDER 0x0f - -#define CH_BUTTONLEFT 0x10 -#define CH_BUTTONRIGHT 0x11 - -#define CH_SEPARATOR 0x13 - -#include "lib/libconio.h" - -#define SCREENCOLOR 0 -#define BORDERCOLOR 1 - -#define WIDGETCOLOR 2 -#define WIDGETCOLOR_FWIN 3 -#define WIDGETCOLOR_FOCUS 4 -#define WIDGETCOLOR_DIALOG 5 -#define WIDGETCOLOR_HLINK 6 -#define WIDGETCOLOR_HLINK_FOCUS 7 - -#define WINDOWCOLOR 8 -#define WINDOWCOLOR_FOCUS 9 - -#define WINDOWBORDER 10 -#define WINDOWBORDER_FOCUS 11 - -#define DIALOGCOLOR 12 - -#define OPENMENUCOLOR 13 - -#define ACTIVEMENUITEMCOLOR 14 - -#define MENUCOLOR 15 - - -PROCESS(ctk_vncserver_process, "CTK VNC server"); - -static struct vnc_server_state conns[CTK_VNCSERVER_CONF_NUMCONNS]; - -#define PRINTF(x) - -#define revers(x) - -unsigned char ctk_draw_windowborder_height = 1; -unsigned char ctk_draw_windowborder_width = 1; -unsigned char ctk_draw_windowtitle_height = 1; - - -/*-----------------------------------------------------------------------------------*/ -/** - * Add an update request from a client to the list of pending updates - * for the connection. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * \param a The area that is requested to be updated. - */ -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_update_add(struct vnc_server_state *vs, - struct vnc_server_update *a) -{ - /* XXX: test both head and tail placement!*/ - a->next = vs->updates_pending; - vs->updates_pending = a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Allocate an update request from the VNC connection state. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * - * \return Memory for an update structure, or NULL if no update could - * be allocated. - */ -/*-----------------------------------------------------------------------------------*/ -struct vnc_server_update * -vnc_server_update_alloc(struct vnc_server_state *vs) -{ - struct vnc_server_update *a; - - a = vs->updates_free; - if(a == NULL) { - return NULL; - } - vs->updates_free = a->next; - a->next = NULL; - return a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Deallocate an update request from the VNC connection state. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * - * \param a The update structure to be deallocated. - */ -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_update_free(struct vnc_server_state *vs, - struct vnc_server_update *a) -{ - a->next = vs->updates_free; - vs->updates_free = a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Dequeue the first update on the queue of updates. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * - * \return The first update on the queue, or NULL if the queue is empty. - */ -/*-----------------------------------------------------------------------------------*/ -struct vnc_server_update * -vnc_server_update_dequeue(struct vnc_server_state *vs) -{ - struct vnc_server_update *a; - - a = vs->updates_pending; - if(a == NULL) { - return a; - } - vs->updates_pending = a->next; - a->next = NULL; - return a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Remove a specific update on the queue of updates. - * - * \param vs The VNC connection state. - * \param a The update to be removed. - */ -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_update_remove(struct vnc_server_state *vs, - struct vnc_server_update *a) -{ - struct vnc_server_update *b, *c; - - if(a == vs->updates_pending) { - vs->updates_pending = a->next; - } else { - b = vs->updates_pending; - for(c = vs->updates_pending; c != a; b = c, c = c->next); - - b->next = a->next; - } -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Flag an area to be updated for all open VNC server connections. - * - */ -/*-----------------------------------------------------------------------------------*/ -static void -update_area(uint8_t x, uint8_t y, uint8_t w, uint8_t h) -{ - uint8_t i; - - if(h == 0 || w == 0) { - return; - } - - /* Update for all active VNC connections. */ - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - if(conns[i].state != VNC_DEALLOCATED) { - vnc_out_update_area(&conns[i], - x, y, w, h); - } - } - -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Allocate a VNC server connection state from the array of available - * VNC connection states. - */ -/*-----------------------------------------------------------------------------------*/ -static struct vnc_server_state * -alloc_state(void) -{ - uint8_t i; - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - if(conns[i].state == VNC_DEALLOCATED) { - return &conns[i]; - } - } - - /* We are overloaded! XXX: we'll just kick all other connections! */ - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - conns[i].state = VNC_DEALLOCATED; - } - - return NULL; -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Deallocate a VNC connection state. - */ -/*-----------------------------------------------------------------------------------*/ -static void -dealloc_state(struct vnc_server_state *s) -{ - s->state = VNC_DEALLOCATED; -} -/*-----------------------------------------------------------------------------------*/ -static void -cputsn(char *str, unsigned char len) -{ - char c; - - while(len > 0) { - --len; - c = *str; - if(c == 0) { - break; - } - cputc(c); - ++str; - } -} -/*-----------------------------------------------------------------------------------*/ -/** - * Initialize the VNC ctk-draw module. Called by the CTK module. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_init(void) -{ - bgcolor(SCREENCOLOR); - bordercolor(BORDERCOLOR); - screensize(&sizex, &sizey); - ctk_draw_clear(0, sizey); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_widget(struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, unsigned char clipy2, - unsigned char focus) -{ - unsigned char xpos, ypos, xscroll; - unsigned char i, j; - unsigned char iconnum; - char c, *text; - unsigned char len; - - /* - if(focus & CTK_FOCUS_WINDOW) { - textcolor(WIDGETCOLOR_FWIN); - if(focus & CTK_FOCUS_WIDGET) { - textcolor(WIDGETCOLOR_FOCUS); - } - } else if(focus & CTK_FOCUS_DIALOG) { - textcolor(WIDGETCOLOR_DIALOG); - if(focus & CTK_FOCUS_WIDGET) { - textcolor(WIDGETCOLOR_FOCUS); - } - } else { - textcolor(WIDGETCOLOR); - } -*/ - xpos = x + w->x; - ypos = y + w->y; - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - textcolor(VNC_OUT_SEPARATORCOLOR + focus); - if(ypos >= clipy1 && ypos < clipy2) { - /* chlinexy(xpos, ypos, w->w);*/ - gotoxy(xpos, ypos); - for(i = 0; i < w->w; ++i) { - cputc(CH_SEPARATOR); - } - } - break; - case CTK_WIDGET_LABEL: - textcolor(VNC_OUT_LABELCOLOR + focus); - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - cputsn(text, w->w); - if(w->w - (wherex() - xpos) > 0) { - cclear(w->w - (wherex() - xpos)); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - textcolor(VNC_OUT_BUTTONCOLOR + focus); - if(ypos >= clipy1 && ypos < clipy2) { - if(focus & CTK_FOCUS_WIDGET) { - revers(1); - } else { - revers(0); - } - cputcxy(xpos, ypos, CH_BUTTONLEFT); - cputsn(w->widget.button.text, w->w); - cputc(CH_BUTTONRIGHT); - revers(0); - } - break; - case CTK_WIDGET_HYPERLINK: - textcolor(VNC_OUT_HYPERLINKCOLOR + focus); - if(ypos >= clipy1 && ypos < clipy2) { - /* if(focus & CTK_FOCUS_WIDGET) { - textcolor(WIDGETCOLOR_HLINK_FOCUS); - revers(0); - } else { - textcolor(WIDGETCOLOR_HLINK); - revers(1); - }*/ - gotoxy(xpos, ypos); - cputsn(w->widget.button.text, w->w); - revers(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - textcolor(VNC_OUT_TEXTENTRYCOLOR + focus); - text = w->widget.textentry.text; - xscroll = 0; - if(w->widget.textentry.xpos >= w->w - 1) { - xscroll = w->widget.textentry.xpos - w->w + 1; - } - for(j = 0; j < w->h; ++j) { - if(ypos >= clipy1 && ypos < clipy2) { - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - w->widget.textentry.ypos == j) { - revers(0); - cputcxy(xpos, ypos, '>'); - c = 1; - for(i = 0; i < w->w; ++i) { - if(c != 0) { - c = text[i + xscroll]; - } - if(i == w->widget.textentry.xpos - xscroll) { - textcolor(VNC_OUT_TEXTENTRYCOLOR + (focus ^ 0x01)); - revers(1); - } else { - revers(0); - } - if(c == 0) { - cputc(' '); - } else { - cputc(c); - } - revers(0); - textcolor(VNC_OUT_TEXTENTRYCOLOR + focus); - } - cputc('<'); - } else { - if(focus & CTK_FOCUS_WIDGET && j == w->widget.textentry.ypos) { - revers(1); - } else { - revers(0); - } - cvlinexy(xpos, ypos, 1); - gotoxy(xpos + 1, ypos); - cputsn(text, w->w); - i = wherex(); - if(i - xpos - 1 < w->w) { - cclear(w->w - (i - xpos) + 1); - } - cvline(1); - } - } - ++ypos; - text += w->widget.textentry.len + 1; - } - revers(0); - break; -#if CTK_CONF_ICONS - case CTK_WIDGET_ICON: - if(ypos >= clipy1 && ypos < clipy2) { - textcolor(VNC_OUT_ICONCOLOR + focus); - if(focus & 1) { - revers(1); - } else { - revers(0); - } - - x = xpos; - len = strlen(w->widget.icon.title); - if(x + len >= sizex) { - x = sizex - len; - } - - gotoxy(x, ypos + 3); - if(ypos >= clipy1 && ypos < clipy2) { - cputs(w->widget.icon.title); - } - -#if CTK_CONF_ICON_BITMAPS - if(w->widget.icon.bitmap != NULL) { - iconnum = vnc_out_add_icon((struct ctk_icon *)w); - textcolor(iconnum | (focus << 6)); - gotoxy(xpos, ypos); - cputc(0x80); - cputc(0x81); - cputc(0x82); - cputc(0x83); - ++ypos; - gotoxy(xpos, ypos); - cputc(0x90); - cputc(0x91); - cputc(0x92); - cputc(0x93); - ++ypos; - gotoxy(xpos, ypos); - cputc(0xa0); - cputc(0xa1); - cputc(0xa2); - cputc(0xa3); - ++ypos; - textcolor(0); - /* for(i = 0; i < 3; ++i) { - - if(ypos >= clipy1 && ypos < clipy2) { - cputc(w->widget.icon.textmap[0 + 3 * i]); - cputc(w->widget.icon.textmap[1 + 3 * i]); - cputc(w->widget.icon.textmap[2 + 3 * i]); - } - ++ypos; - }*/ - } -#endif /* CTK_CONF_ICON_BITMAPS */ - - revers(0); - } - break; -#endif /* CTK_CONF_ICONS */ - - default: - break; - } -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a widget on the VNC screen. Called by the CTK module. - * - * \param w The widget to be drawn. - * \param focus The focus of the widget. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - struct ctk_icon *icon; - unsigned char posx, posy, x, len; - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - posx + win->w, - posy + win->h, - clipy1, clipy2, - focus); - - if(w->type != CTK_WIDGET_ICON) { - update_area(posx + w->x, - posy + w->y, w->w + 2, w->h); - } else { - icon = (struct ctk_icon *)w; - - len = strlen(icon->title); - x = posx + w->x; - if(x + len >= sizex) { - x = sizex - len; - } - - update_area(x, posy + w->y, len > 4? len: 4, w->h); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ -} -/*-----------------------------------------------------------------------------------*/ -/** - * Clear a window on the VNC screen. Called by the CTK module. - * - * \param window The window to be cleared. - * \param focus The focus of the window. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - unsigned char i; - unsigned char h; - /* - if(focus & CTK_FOCUS_WINDOW){ - textcolor(WINDOWCOLOR_FOCUS); - } else { - textcolor(WINDOWCOLOR); - }*/ - textcolor(VNC_OUT_WINDOWCOLOR + focus); - - h = window->y + 2 + window->h; - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i < clipy2) { - cclearxy(window->x + 1, i, window->w); - } - } - - update_area(window->x + 1, window->y + 2, window->w, window->h); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_window_contents(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char x1, unsigned char x2, - unsigned char y1, unsigned char y2) -{ - struct ctk_widget *w; - unsigned char wfocus; - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ - -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a window on the VNC screen. Called by the CTK module. - * - * \param window The window to be drawn. - * \param focus The focus of the window. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - * \param draw_borders The flag for border drawing. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_window(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char draw_borders) -{ - unsigned char x, y; - unsigned char h; - unsigned char x1, y1, x2, y2; - unsigned char i; - - - if(window->y + 1 >= clipy2) { - return; - } - - x = window->x; - y = window->y + 1; - x1 = x + 1; - y1 = y + 1; - x2 = x1 + window->w; - y2 = y1 + window->h; - - if(draw_borders) { - - /* Draw window frame. */ - textcolor(VNC_OUT_WINDOWCOLOR + focus); - /* if(focus & CTK_FOCUS_WINDOW) { - textcolor(WINDOWCOLOR_FOCUS); - } else { - textcolor(WINDOWCOLOR); - }*/ - - if(y >= clipy1) { - cputcxy(x, y, CH_ULCORNER); - for(i = wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2; i < x2; ++i) { - cputcxy(i, y, CH_TITLEBAR); - } - cputcxy(x2, y, CH_URCORNER); - } - - h = window->h; - - if(clipy1 > y1) { - if(clipy1 - y1 < h) { - h = clipy1 - y1; - y1 = clipy1; - } else { - h = 0; - } - } - - if(clipy2 < y1 + h) { - if(y1 >= clipy2) { - h = 0; - } else { - h = clipy2 - y1; - } - } - - for(i = y1; i < y1 + h; ++i) { - cputcxy(x, i, CH_WINDOWLBORDER); - cputcxy(x2, i, CH_WINDOWRBORDER); - } - - /* cvlinexy(x, y1, h); - cvlinexy(x2, y1, h); */ - - if(y + window->h >= clipy1 && - y + window->h < clipy2) { - cputcxy(x, y2, CH_LLCORNER); - for(i = x1; i < x2; ++i) { - cputcxy(i, y2, CH_WINDOWLOWERBORDER); - } - /* chlinexy(x1, y2, window->w);*/ - cputcxy(x2, y2, CH_LRCORNER); - } - } - - draw_window_contents(window, focus, clipy1, clipy2, - x1, x2, y + 1, y2); - - update_area(window->x, window->y, window->w + 2, window->h + 2); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a dialog on the VNC screen. Called by the CTK module. - * - * \param dialog The dialog to be drawn. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_dialog(struct ctk_window *dialog) -{ - unsigned char x, y; - unsigned char i; - unsigned char x1, y1, x2, y2; - - /* textcolor(DIALOGCOLOR);*/ - textcolor(VNC_OUT_WINDOWCOLOR + CTK_FOCUS_DIALOG); - - x = dialog->x; - y = dialog->y + 1; - - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - - /* Draw dialog frame. */ - - for(i = y1; i < y1 + dialog->h; ++i) { - cputcxy(x, i, CH_DIALOGLBORDER); - cputcxy(x2, i, CH_DIALOGRBORDER); - } - /* cvlinexy(x, y1, - dialog->h); - cvlinexy(x2, y1, - dialog->h);*/ - - - for(i = x1; i < x2; ++i) { - cputcxy(i, y, CH_DIALOGUPPERBORDER); - cputcxy(i, y2, CH_DIALOGLOWERBORDER); - } - /* chlinexy(x1, y, - dialog->w); - chlinexy(x1, y2, - dialog->w);*/ - - cputcxy(x, y, CH_DIALOG_ULCORNER); - cputcxy(x, y2, CH_DIALOG_LLCORNER); - cputcxy(x2, y, CH_DIALOG_URCORNER); - cputcxy(x2, y2, CH_DIALOG_LRCORNER); - - - /* Clear dialog contents. */ - for(i = y1; i < y2; ++i) { - cclearxy(x1, i, dialog->w); - } - - draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey, - x1, x2, y1, y2); - - update_area(dialog->x, dialog->y, dialog->w + 4, dialog->h + 4); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Clear parts of the VNC desktop. Called by the CTK module. - * - * \param y1 The lower y coordinate bound. - * \param y2 The upped y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - unsigned char i; - - textcolor(VNC_OUT_BACKGROUNDCOLOR); - for(i = y1; i < y2; ++i) { - cclearxy(0, i, sizex); - } - - update_area(0, y1, sizex, y2 - y1); -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Draw one menu on the VNC desktop. - * - * \param m The CTK menu to be drawn. - */ -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(struct ctk_menu *m) -{ - unsigned char x, x2, y; - - textcolor(VNC_OUT_MENUCOLOR); - x = wherex(); - cputs(m->title); - cputc(' '); - x2 = wherex(); - if(x + CTK_CONF_MENUWIDTH > sizex) { - x = sizex - CTK_CONF_MENUWIDTH; - } - - - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - textcolor(VNC_OUT_ACTIVEMENUCOLOR); - revers(0); - } else { - textcolor(VNC_OUT_MENUCOLOR); - } - gotoxy(x, y + 1); - if(m->items[y].title[0] == '-') { - chline(CTK_CONF_MENUWIDTH); - } else { - cputs(m->items[y].title); - } - if(x + CTK_CONF_MENUWIDTH > wherex()) { - cclear(x + CTK_CONF_MENUWIDTH - wherex()); - } - revers(1); - } - - gotoxy(x2, 0); - textcolor(VNC_OUT_MENUCOLOR); - - update_area(x, 0, CTK_CONF_MENUWIDTH, m->nitems + 1); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw the menus on the virtual VNC desktop. Called by the CTK module. - * - * \param menus The CTK menubar. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - - - /* Draw menus */ - textcolor(VNC_OUT_MENUCOLOR); - gotoxy(0, 0); - revers(1); - cputc(' '); - for(m = menus->menus->next; m != NULL; m = m->next) { - if(m != menus->open) { - update_area(wherex(), 0, strlen(m->title) + 1, 1); - cputs(m->title); - cputc(' '); - } else { - draw_menu(m); - } - } - - - if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) { - gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0); - } else { - cclear(sizex - wherex() - - strlen(menus->desktopmenu->title) - 1); - update_area(wherex(), 0, sizex - wherex() - - strlen(menus->desktopmenu->title) - 1, 1); - } - - /* Draw desktopmenu */ - if(menus->desktopmenu != menus->open) { - update_area(wherex(), 0, strlen(menus->desktopmenu->title) + 1, 1); - cputs(menus->desktopmenu->title); - cputc(' '); - } else { - draw_menu(menus->desktopmenu); - } - - revers(0); - - - -} -/*-----------------------------------------------------------------------------------*/ -/** - * Obtain the height of the VNC desktop. Called by the CTK module. - * - * \return The height of the VNC desktop, in characters. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_draw_height(void) -{ - return sizey; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Obtain the height of the VNC desktop. Called by the CTK module. - * - * \return The height of the VNC desktop, in characters. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_draw_width(void) -{ - return sizex; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_xtoc(unsigned short x) -{ - return x / CTK_VNCFONT_WIDTH; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_ytoc(unsigned short y) -{ - return y / CTK_VNCFONT_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Converts between ASCII and the VNC screen character encoding. - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned char -ascii2screen(unsigned char c) -{ - if(c == '|') { - return 0x68; - } - if(c < 0x20) { - return c + 0x60; - } - if(c > 0x20 && c < 0x40) { - return c; - } - if(c >= 0x40 && c < 0x60) { - return c; - } - if(c >= 0x60 && c < 0x80) { - return c - 0x60; - } - if(c >= 0x80) { - return c; - } - - return 32; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draws a character on the virtual VNC screen. Called by the libconio module. - * - * \param c The character to be drawn. - * \param xpos The x position of the character. - * \param ypos The y position of the character. - * \param reversedflag Determines if the character should be reversed or not. - * \param color The color of the character. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_arch_draw_char(char c, - unsigned char xpos, - unsigned char ypos, - unsigned char reversedflag, - unsigned char color) -{ - - vnc_out_update_screen(xpos, ypos, ascii2screen(c), - color); - /* vnc_out_update_screen(xpos, ypos, c | - (reversedflag? 0x80: 0));*/ -} -/*-----------------------------------------------------------------------------------*/ -/** - * Checks the key press input queue to see if there are pending - * keys. Called by the CTK module. - * - * \return Zero if no key presses are in buffer, non-zero if there are - * key presses in input buffer. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_arch_keyavail(void) -{ - return vnc_out_keyavail(); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Retrieves key presses from the VNC client. Called by the CTK - * module. - * - * \return The next key in the input queue. - */ -/*-----------------------------------------------------------------------------------*/ -ctk_arch_key_t -ctk_arch_getkey(void) -{ - return vnc_out_getkey() & 0x7f; -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * The uIP event handler. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_vncserver_appcall(void *state) -{ - static struct vnc_server_state *vs; - - vs = (struct vnc_server_state *)(state); - - if(uip_connected()) { - - /* Since we've just been connected, the state pointer should be - NULL and we need to allocate a new state object. If we have run - out of memory for state objects, we'll have to abort the - connection and return. */ - if(vs == NULL) { - vs = alloc_state(); - if(vs == NULL) { - uip_close(); - return; - } - tcp_markconn(uip_conn, (void *)vs); - } - } else if(uip_closed() || uip_aborted()) { - if(vs != NULL) { - dealloc_state(vs); - } - return; - } - vnc_server_appcall(vs); -} -/*-----------------------------------------------------------------------------------*/ -PROCESS_THREAD(ctk_vncserver_process, ev, data) -{ - int i; - - PROCESS_BEGIN(); - - tcp_listen(UIP_HTONS(5900)); - - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - conns[i].state = VNC_DEALLOCATED; - } - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == tcpip_event) { - ctk_vncserver_appcall(data); - } - } - PROCESS_END(); -} -/*-----------------------------------------------------------------------------------*/ -/** @} */ diff --git a/core/ctk/ctk-vncserver.h b/core/ctk/ctk-vncserver.h deleted file mode 100644 index 1b09a8cb3..000000000 --- a/core/ctk/ctk-vncserver.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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 "ctk" console GUI toolkit for cc65 - * - * - */ -#ifndef __CTK_VNCSERVER_H__ -#define __CTK_VNCSERVER_H__ - -#include "contiki.h" -void ctk_vncserver_init(char *arg); - -PROCESS_NAME(ctk_vncserver_process); - -#endif /* __CTK_VNCSERVER_H__ */ diff --git a/core/ctk/ctk.h b/core/ctk/ctk.h index 150b15edf..5d58a7e56 100644 --- a/core/ctk/ctk.h +++ b/core/ctk/ctk.h @@ -46,8 +46,8 @@ * */ -#ifndef __CTK_H__ -#define __CTK_H__ +#ifndef CTK_H_ +#define CTK_H_ #include "contiki-conf.h" @@ -986,4 +986,4 @@ CCIF extern process_event_t ctk_signal_button_activate, /** @} */ /** @} */ /** @} */ -#endif /* __CTK_H__ */ +#endif /* CTK_H_ */ diff --git a/core/ctk/vnc-out.c b/core/ctk/vnc-out.c deleted file mode 100644 index e4ffc10fd..000000000 --- a/core/ctk/vnc-out.c +++ /dev/null @@ -1,977 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels - * 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 uIP TCP/IP stack. - * - * - */ - -#include "contiki-net.h" -#include "ctk/vnc-server.h" -#include "ctk/vnc-out.h" -#include "ctk/ctk-vncfont.h" - -#include "ctk/ctk-mouse.h" - -#include "lib/libconio.h" - -#ifdef WITH_AVR -#include -#else -#define memcpy_P memcpy -#endif /* WITH_AVR */ - -#define CHARS_WIDTH LIBCONIO_CONF_SCREEN_WIDTH -#define CHARS_HEIGHT LIBCONIO_CONF_SCREEN_HEIGHT - -#define SCREEN_X 10 -#define SCREEN_Y 8 - -#define SCREEN_WIDTH (CHARS_WIDTH * CTK_VNCFONT_WIDTH + 2 * SCREEN_X) /*420*/ -#define SCREEN_HEIGHT (CHARS_HEIGHT * CTK_VNCFONT_HEIGHT + 2 * SCREEN_Y) /*300*/ -#define BORDER_COLOR 0x00 -#define SCREEN_COLOR 0x00 /*0xc0*/ - -#ifndef CH_HOME -#define CH_HOME 0x50 -#endif - -#ifndef CH_TAB -#define CH_TAB 0x09 -#endif - - -#define BGR(b,g,r) (((b) << 6) | (g) << 3 | (r)) - - -static const uint8_t menucolor[] = { - BGR(3,7,7), /* Background. */ - BGR(2,6,6), /* Anti-alias font color. */ - BGR(0,0,0), /* Font color. */ -}; - - -static const uint8_t activemenucolor[] = { - BGR(0,0,0), /* Background. */ - BGR(2,5,5), /* Anti-alias font color. */ - BGR(3,7,7), /* Font color. */ -}; - -#define W BGR(3,7,7) -#define B BGR(0,0,0) -#define G0 BGR(0,2,2) -#define G1 BGR(1,2,2) -#define G2 BGR(1,3,3) -#define G3 BGR(2,4,4) -#define G4 BGR(2,5,5) -#define G5 BGR(2,6,6) - -#define BG BGR(3,4,4) - -static const unsigned char backgroundcolor[] = {BG}; - -static const unsigned char wincol[] = - {BGR(2,5,5),BGR(2,2,2),BGR(0,1,1),G2,G3,G4}; - /* {BGR(2,5,5),BGR(2,2,2),BGR(0,1,1),BGR(1,0,0),BGR(2,0,0),BGR(2,1,1)}; */ -static const unsigned char wincol_f[] = - {BGR(3,7,7),BGR(1,2,2),BGR(0,1,1),G4,G5,W}; - /* {BGR(3,7,7),BGR(1,2,2),BGR(0,1,1),BGR(2,0,0),BGR(3,2,2),BGR(3,4,4)}; */ -static const unsigned char wincol_d[] = - {BGR(3,7,7),BGR(1,5,5),BGR(0,0,0),BGR(2,0,0),BGR(3,2,2),BGR(3,4,4)}; - -static const unsigned char sepcol[] = - {BGR(2,5,5),BGR(2,6,6),BGR(3,6,6)}; -static const unsigned char sepcol_f[] = - {BGR(3,7,7),BGR(3,5,5),BGR(2,5,5)}; -static const unsigned char sepcol_d[] = - {BGR(3,7,7),BGR(1,5,7),BGR(0,0,0)}; - -static const unsigned char labcol[] = - {BGR(2,5,5),BGR(1,3,3),BGR(0,1,1)}; -static const unsigned char labcol_f[] = - {BGR(3,7,7),BGR(3,6,6),BGR(0,0,0)}; -static const unsigned char labcol_d[] = - {BGR(3,7,7),BGR(3,6,6),BGR(0,0,0)}; - - -static const unsigned char butcol[] = - {BGR(2,4,4),BGR(1,3,3),BGR(0,1,1),BGR(2,4,4),BGR(2,4,4),BGR(2,4,4), - BGR(2,5,5),BGR(2,5,5)}; -static const unsigned char butcol_w[] = - {BGR(2,4,4),BGR(1,3,3),BGR(0,1,1),BGR(2,4,4),BGR(2,4,4),BGR(2,4,4), - BGR(2,5,5),BGR(2,5,5)}; -static const unsigned char butcol_f[] = - {G5,G4,B,BGR(3,5,5),BGR(3,6,6),BGR(3,7,7), - BGR(3,6,6),BGR(2,5,5)}; -static const unsigned char butcol_fw[] = - {BGR(3,7,7),BGR(3,6,6),BGR(0,0,0),BGR(1,3,3),BGR(2,7,7),BGR(3,7,7), - BGR(3,6,6),BGR(3,7,7)}; -static const unsigned char butcol_d[] = - {BGR(2,3,3),BGR(2,5,5),BGR(3,6,6),BGR(1,3,4),BGR(1,5,6),BGR(2,6,7), - BGR(3,7,7),BGR(2,5,5)}; -static const unsigned char butcol_dw[] = - {BGR(0,0,0),BGR(2,5,5),BGR(3,7,7),BGR(1,3,4),BGR(1,5,6),BGR(2,6,7), - BGR(3,7,7),BGR(2,5,5)}; - - -static const unsigned char hlcol[] = - {BGR(2,5,5),BGR(1,3,3),BGR(1,0,0)}; -static const unsigned char hlcol_w[] = - {BGR(2,5,5),BGR(1,3,3),BGR(1,0,0)}; -static const unsigned char hlcol_f[] = - {BGR(3,7,7),BGR(3,5,5),BGR(3,0,0)}; -static const unsigned char hlcol_fw[] = - {BGR(3,7,7),BGR(3,6,7),BGR(3,7,7)}; -static const unsigned char hlcol_d[] = - {BGR(3,7,7),BGR(3,5,5),BGR(2,0,0)}; -static const unsigned char hlcol_dw[] = - {BGR(3,7,7),BGR(1,5,5),BGR(0,0,0)}; - -static const unsigned char iconcol[] = - {BG,G4,W,B,G1}; -static const unsigned char iconcol_w[] = - {BGR(0,1,1),BGR(1,3,3),BGR(3,7,7), B,W}; - - - -static const uint8_t * const colortheme[] = - { - backgroundcolor, - - /* Window colors */ - wincol, wincol, wincol_f, wincol_f, wincol_d, wincol_d, - - /* Separator colors. */ - sepcol, sepcol, sepcol_f, sepcol_f, sepcol_d, sepcol_d, - - /* Label colors. */ - labcol, labcol, labcol_f, labcol_f, labcol_d, labcol_d, - - /* Button colors. */ - butcol, butcol_w, butcol_f, butcol_fw, butcol_d, butcol_dw, - - /* Hyperlink colors. */ - hlcol, hlcol_w, hlcol_f, hlcol_fw, hlcol_d, hlcol_dw, - - /* Textentry colors. */ - butcol, butcol_w, butcol_f, butcol_fw, butcol_d, butcol_dw, - - /* Icon colors */ - iconcol, iconcol_w, iconcol, iconcol_w, iconcol, iconcol_w, - - /* Menu colors. */ - menucolor, activemenucolor, activemenucolor - }; - - -static int mouse_x, mouse_y, mouse_button; - -#ifdef CTK_VNCSERVER_CONF_SCREEN -static uint8_t *screen = CTK_VNCSERVER_CONF_SCREEN; -#else -static uint8_t screen[CHARS_WIDTH * CHARS_HEIGHT]; -#endif - -#ifdef CTK_VNCSERVER_CONF_COLORSCREEN -staitc uint8_t *colorscreen = CTK_VNCSERVER_CONF_COLORSCREEN; -#else -static uint8_t colorscreen[CHARS_WIDTH * CHARS_HEIGHT]; -#endif - - -#define PRINTF(x) - -/*-----------------------------------------------------------------------------------*/ -#define MAX_ICONS CTK_VNCSERVER_CONF_MAX_ICONS -struct ctk_icon *icons[MAX_ICONS]; - -unsigned char -vnc_out_add_icon(struct ctk_icon *icon) -{ - uint8_t i; - signed int empty; - - empty = -1; - for(i = 0; i < MAX_ICONS; ++i) { - if(icon == icons[i]) { - return i; - } - if(icons[i] == NULL && empty < 0){ - empty = i; - } - } - - if(empty == -1) { - empty = 0; - } - icons[empty] = icon; - return empty; -} - -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_init(void) -{ - uint16_t i; - for(i = 0; i < CHARS_WIDTH * CHARS_HEIGHT; ++i) { - screen[i] = 0x20; - } -} - -void -vnc_out_update_screen(uint8_t xpos, uint8_t ypos, uint8_t c, uint8_t color) -{ - screen[xpos + ypos * CHARS_WIDTH] = c; - colorscreen[xpos + ypos * CHARS_WIDTH] = color; -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_update_area(struct vnc_server_state *vs, - uint8_t x, uint8_t y, uint8_t w, uint8_t h) -{ - uint8_t x2, y2, ax2, ay2; - register struct vnc_server_update *a, *b; - - PRINTF(("update_area_connection: should update (%d:%d) (%d:%d)\n", - x, y, w, h)); - - /* First check if we already have a full update queued. If so, there - is no need to put this update on the list. If there is a full - update, it is always the first one on the list, so there is no - need to go step the list in search for it. */ - - if(vs->updates_pending != NULL && - vs->updates_pending->type == VNC_SERVER_UPDATE_FULL) { - PRINTF(("Update_area_connecion: full update already queued...\n")); - return; - } - - again: - - /* Check that we don't update the same area twice by going through - the list and search for an update with the same coordinates. */ - for(a = vs->updates_pending; a != NULL; a = a->next) { - if(a->x == x && a->y == y && - a->w == w && a->h == h) { - PRINTF(("Update_area_connecion: found equal area\n")); - return; - } - } - - /* Next we check if this update covers an existing update. If so, we - remove the old update, expand this update so that it covers both - areas to be updated and run through the process again. */ - b = NULL; - for(a = vs->updates_pending; a != NULL; a = a->next) { - x2 = x + w; - y2 = y + h; - - ax2 = a->x + a->w; - ay2 = a->y + a->h; - - /* Test the corners of both updates to see if they are inside the - other area. */ -#define INSIDE(x,y,x1,y1,x2,y2) ((x1) <= (x) && \ - (x2) >= (x) && \ - (y1) <= (y) && \ - (y2) >= (y)) - if(INSIDE(x, y, a->x, a->y, ax2, ay2) || - INSIDE(x, y2, a->x, a->y, ax2, ay2) || - INSIDE(x2, y2, a->x, a->y, ax2, ay2) || - INSIDE(x2, y, a->x, a->y, ax2, ay2) || - INSIDE(a->x, a->y, x, y, x2, y2) || - INSIDE(a->x, ay2, x, y, x2, y2) || - INSIDE(ax2, ay2, x, y, x2, y2) || - INSIDE(ax2, a->y, x, y, x2, y2)) { - - /* Remove the old update from the list. */ - vnc_server_update_remove(vs, a); - - /* Put it on the free list. */ - vnc_server_update_free(vs, a); - - PRINTF(("update_area_connection: inside (%d:%d, %d:%d)\n", - a->x, a->y, ax2, ay2)); - - /* Find the area that covers both updates. */ -#define MIN(a,b) ((a) < (b)? (a): (b)) -#define MAX(a,b) ((a) > (b)? (a): (b)) - x = MIN(a->x, x); - y = MIN(a->y, y); - ax2 = MAX(ax2, x2); - ay2 = MAX(ay2, y2); - w = ax2 - x; - h = ay2 - y; - - /* This should really be done by a recursive call to this - function: update_area_connection(vs, x, y, w, h); but because - some compilers might not be able to optimize away the - recursive call, we do it using a goto instead. */ - PRINTF(("Update_area_connecion: trying larger area (%d:%d) (%d:%d)\n", x, y, w, h)); - goto again; - } - if(b != NULL) { - b = b->next; - } - } - - /* Allocate an update object by pulling it off the free list. If - there are no free objects, we go for a full update instead. */ - - /* a = vs->updates_free;*/ - a = vnc_server_update_alloc(vs); - if(a == NULL) { - PRINTF(("Update_area_connecion: no free updates, doing full\n")); - /* Put all pending updates, except for one, on the free list. Use - the remaining update as a full update. */ - while(vs->updates_pending != NULL) { - a = vs->updates_pending; - vnc_server_update_remove(vs, a); - vnc_server_update_free(vs, a); - } - - a = vnc_server_update_alloc(vs); - a->type = VNC_SERVER_UPDATE_FULL; - vnc_server_update_add(vs, a); - - - } else { - - PRINTF(("Update_area_connecion: allocated update for (%d:%d) (%d:%d)\n", x, y, w, h)); - /* Else, we put the update object at the end of the pending - list. */ - a->type = VNC_SERVER_UPDATE_PARTS; - a->x = x; - a->y = y; - a->w = w; - a->h = h; - vnc_server_update_add(vs, a); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -init_send_screen(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - vs->sendmsg = SEND_SCREEN; - vs->x = vs->y = 0; - vs->x1 = vs->y1 = 0; - vs->x2 = vs->y2 = 0; - vs->w = CHARS_WIDTH; - vs->h = CHARS_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -static void -check_updates(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - - if(vs->state == VNC_RUNNING && - vs->sendmsg == SEND_NONE && - vs->updates_current == NULL) { - if(vs->updates_pending != NULL && - vs->update_requested != 0) { - vs->update_requested = 0; - /* vs->updates_current = vs->updates_pending; - vs->updates_pending = vs->updates_pending->next; - vs->updates_current->next = NULL;*/ - - vs->updates_current = vnc_server_update_dequeue(vs); - - if(vs->updates_current->type == VNC_SERVER_UPDATE_PARTS) { - vs->x = vs->x1 = vs->x2 = vs->updates_current->x; - vs->y = vs->y1 = vs->y2 = vs->updates_current->y; - vs->w = vs->updates_current->w; - vs->h = vs->updates_current->h; - vs->sendmsg = SEND_UPDATE; - - PRINTF(("New update from (%d:%d) (%d:%d) to (%d:%d)\n", - vs->x, vs->y, vs->x1, vs->y1, vs->x + vs->w, - vs->y + vs->h)); - } else if(vs->updates_current->type == VNC_SERVER_UPDATE_FULL) { - init_send_screen(vs); - PRINTF(("New full update\n")); - } - } - } -} -/*-----------------------------------------------------------------------------------*/ -static uint8_t tmp[CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT]; -static void -makechar(CC_REGISTER_ARG char *ptr, uint8_t x, uint8_t y) -{ - uint8_t i, *tmpptr; - register uint8_t *colorscheme; - unsigned char *bitmap; - uint8_t b, b2; - uint8_t xmove, ymove; - unsigned char c, color; - - color = colorscreen[x + y * CHARS_WIDTH]; - c = screen[x + y * CHARS_WIDTH]; - - colorscheme = (uint8_t *)colortheme[color]; - - /* First check if the character is a special icon character. These - are to be interpreted in a special manner: the first character of - the icon (the top left corner) has the highest bit set, but not - bit 6. All other characters have bit 6 set, and also count the - number of positions away from the top left corner. Only the top - left corner contains enough information to identify the icon, all - other chars only contain the number of steps to reach the - identifying icon. */ - if((c & 0x80) != 0) { - xmove = c & 0x0f; - ymove = (c & 0x30) >> 4; - - c = colorscreen[x + y * CHARS_WIDTH]; - - if(icons[c % MAX_ICONS] == NULL) { - c = 0; - } - bitmap = icons[c % MAX_ICONS]->bitmap; - - if(bitmap != NULL) { - bitmap = bitmap + ymove * 8*3; - colorscheme = (uint8_t *)colortheme[VNC_OUT_ICONCOLOR + (c >> 6)]; - switch(xmove) { - case 0: - for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) { - b = bitmap[i]; - *ptr++ = colorscheme[((b >> 7) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 6) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 5) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 4) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 3) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 2) & 0x01) << 2]; - } - break; - case 1: - for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) { - b = bitmap[i]; - b2 = bitmap[i + 8]; - *ptr++ = colorscheme[((b >> 1) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 0) & 0x01) << 2]; - *ptr++ = colorscheme[((b2 >> 7) & 0x01) << 2]; - *ptr++ = colorscheme[((b2 >> 6) & 0x01) << 2]; - *ptr++ = colorscheme[((b2 >> 5) & 0x01) << 2]; - *ptr++ = colorscheme[((b2 >> 4) & 0x01) << 2]; - } - break; - case 2: - for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) { - b = bitmap[i + 8]; - b2 = bitmap[i + 16]; - *ptr++ = colorscheme[((b >> 3) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 2) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 1) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 0) & 0x01) << 2]; - *ptr++ = colorscheme[((b2 >> 7) & 0x01) << 2]; - *ptr++ = colorscheme[((b2 >> 6) & 0x01) << 2]; - } - break; - case 3: - for(i = 0; i < CTK_VNCFONT_HEIGHT; ++i) { - b = bitmap[i + 16]; - *ptr++ = colorscheme[((b >> 5) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 4) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 3) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 2) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 1) & 0x01) << 2]; - *ptr++ = colorscheme[((b >> 0) & 0x01) << 2]; - } - break; - } - } - } else { - memcpy_P(tmp, &ctk_vncfont[c * (CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT)], - CTK_VNCFONT_WIDTH * CTK_VNCFONT_HEIGHT); - - tmpptr = tmp; - - - for(i = 0; i < CTK_VNCFONT_HEIGHT * CTK_VNCFONT_WIDTH; ++i) { - *ptr++ = colorscheme[*tmpptr++]; - } - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_new(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - uint8_t i; - - vs->width = SCREEN_WIDTH; - vs->height = SCREEN_HEIGHT; - vs->x = vs->y = vs->x1 = vs->y1 = vs->x2 = vs->y2 = 0; - vs->w = CHARS_WIDTH; - vs->h = CHARS_HEIGHT; - - /* Initialize the linked list of updates. */ - for(i = 0; i < VNC_SERVER_MAX_UPDATES - 1; ++i) { - vs->updates_pool[i].next = &vs->updates_pool[i + 1]; - } - vs->updates_pool[VNC_SERVER_MAX_UPDATES].next = NULL; - - vs->updates_free = &vs->updates_pool[0]; - vs->updates_pending = vs->updates_current = NULL; -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - register struct rfb_fb_update *umsg; - uint8_t *ptr; - uint16_t len; - uint8_t msglen; - - vs->x = vs->y = 0; - vs->x2 = vs->y2 = 0; - - umsg = (struct rfb_fb_update *)uip_appdata; - - umsg->type = RFB_FB_UPDATE; - umsg->rects = UIP_HTONS(2); - - ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update); - len = sizeof(struct rfb_fb_update); - - msglen = vnc_server_draw_rect(ptr, 0, 0, - UIP_HTONS(SCREEN_WIDTH), - UIP_HTONS(SCREEN_HEIGHT), - BORDER_COLOR); - - - ptr += msglen; - len += msglen; - - msglen = vnc_server_draw_rect(ptr, - UIP_HTONS(SCREEN_X), UIP_HTONS(SCREEN_Y), - UIP_HTONS(SCREEN_WIDTH - SCREEN_X * 2), - UIP_HTONS(SCREEN_HEIGHT - SCREEN_Y * 2), - SCREEN_COLOR); - - uip_send(uip_appdata, len + msglen); - - vs->sendmsg = SENT_BLANK; -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_send_screen(struct vnc_server_state *vs) -{ - vnc_out_send_update(vs); -} -/*-----------------------------------------------------------------------------------*/ -static short tmpbuf[30]; -void -vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - uint8_t x, y, x0; - uint8_t msglen; - uint16_t len, n; - uint8_t *ptr; - struct rfb_fb_update *umsg; - register struct rfb_fb_update_rect_hdr *recthdr; - struct rfb_rre_hdr *rrehdr; - uint8_t c, color, lastcolor; - uint8_t numblanks; - - /* First, check if we need to feed the update function with a new - pending update. */ - check_updates(vs); - - /* PRINTF(("Sending Update from (%d:%d) (%d:%d) to (%d:%d)\n", - vs->x, vs->y, vs->x1, vs->y1, vs->x + vs->w, - vs->y + vs->h));*/ - - umsg = (struct rfb_fb_update *)uip_appdata; - - umsg->type = RFB_FB_UPDATE; - - x0 = vs->x1; - n = 0; - msglen = 0; - ptr = (uint8_t *)umsg + sizeof(struct rfb_fb_update); - len = sizeof(struct rfb_fb_update); - - /* Loop over all characters that are covered by this update. */ - for(y = vs->y1; y < vs->y + vs->h; ++y) { - for(x = x0; x < vs->x + vs->w; ++x) { - - - /* First check if there are any blank space characters, and if - so, find out how many of them there are in a row. Instead of - sending the individual space characters as raw bitmaps, we - can send the entire string of blanks as a single color - rectangle instead. */ - - c = screen[x + y * CHARS_WIDTH]; - numblanks = 0; - lastcolor = color = colorscreen[x + y * CHARS_WIDTH]; - - /* If the character is a blank, we continue reading characters - until we find one that has a different color, or one that is - not a blank. We must keep within the update rectangle, so we - make sure that the "x" variable does not increase beyond the - edge. The "numblanks" variable is used to keep track of how - many blank characters we have found. */ - while(lastcolor == color && - c == 0x20 && - x < vs->x + vs->w) { - ++numblanks; - - - ++x; - lastcolor = color; - color = colorscreen[x + y * CHARS_WIDTH]; - c = screen[x + y * CHARS_WIDTH]; - } - - if(numblanks > 0) { - - /* PRINTF(("Found %d blanks (%d:%d -> %d:%d)\n", - numblanks, x - numblanks, y, x, y));*/ - - /* There were one or more blank characters, so we send out a - single color rectangle with the right width. But first we - make sure that there is enough space in the current TCP - segment to put the rectangle. If there isn't we have to - backtrack the "x" variable to where we found the first - blank character so that the next TCP segment will be able - to update this area instead. */ - - msglen = sizeof(struct rfb_fb_update_rect_hdr) + - /*sizeof(struct rfb_rre_hdr)*/5; - - if(msglen >= uip_mss() - len) { - /* PRINTF(("Not enouch space for blanks (%d, left %d)\n", - msglen, uip_mss() - len));*/ - /* There is not enough space in the segment, so we remember - where we were ... */ - vs->x2 = x - numblanks; - vs->y2 = y; - - /* ... and we break out of the loop. */ - goto loopend; - } - - /* We construct a rectangle with the right width and color. */ - /* recthdr = (struct rfb_fb_update_rect_hdr *)ptr;*/ - recthdr = (struct rfb_fb_update_rect_hdr *)tmpbuf; - rrehdr = (struct rfb_rre_hdr *)((char *)recthdr + - sizeof(struct rfb_fb_update_rect_hdr)); - - /* PRINTF(("Blankign (%d:%d) to (%d:%d)\n", - (x - numblanks) * CTK_VNCFONT_WIDTH, - y * CTK_VNCFONT_HEIGHT, - CTK_VNCFONT_WIDTH * numblanks, - CTK_VNCFONT_HEIGHT));*/ - recthdr->rect.x = uip_htons(SCREEN_X + (x - numblanks) * - CTK_VNCFONT_WIDTH); - recthdr->rect.y = uip_htons(SCREEN_Y + y * CTK_VNCFONT_HEIGHT); - recthdr->rect.w = uip_htons(CTK_VNCFONT_WIDTH * numblanks); - recthdr->rect.h = UIP_HTONS(CTK_VNCFONT_HEIGHT); - recthdr->encoding[0] = - recthdr->encoding[1] = - recthdr->encoding[2] = 0; - recthdr->encoding[3] = RFB_ENC_RRE; - - rrehdr->subrects[0] = - rrehdr->subrects[1] = 0; - rrehdr->bgpixel = colortheme[lastcolor][0]; - - --x; - } else { - - /* So there were no blank characters. */ - - /* PRINTF(("An char at (%d:%d)\n", x, y));*/ - /* First we must make sure that there is enough space in the - outgoing TCP segment. */ - - msglen = sizeof(struct rfb_fb_update_rect_hdr) + - CTK_VNCFONT_HEIGHT * CTK_VNCFONT_WIDTH; - if(msglen >= uip_mss() - len) { - /* PRINTF(("Not enouch space for char (%d, left %d)\n", - msglen, uip_mss() - len));*/ - - /* There is not enough space in the segment, so we remember - where we were ... */ - vs->x2 = x; - vs->y2 = y; - - /* ... and we break out of the loop. */ - goto loopend; - } - - /* PRINTF(("ptr %p\n",ptr);*/ - /* recthdr = (struct rfb_fb_update_rect_hdr *)ptr;*/ - recthdr = (struct rfb_fb_update_rect_hdr *)tmpbuf; - - recthdr->rect.x = uip_htons(SCREEN_X + x * CTK_VNCFONT_WIDTH); - recthdr->rect.y = uip_htons(SCREEN_Y + y * CTK_VNCFONT_HEIGHT); - recthdr->rect.w = UIP_HTONS(CTK_VNCFONT_WIDTH); - recthdr->rect.h = UIP_HTONS(CTK_VNCFONT_HEIGHT); - recthdr->encoding[0] = - recthdr->encoding[1] = - recthdr->encoding[2] = 0; - recthdr->encoding[3] = RFB_ENC_RAW; - - makechar((uint8_t *)recthdr + - sizeof(struct rfb_fb_update_rect_hdr), - x, y); - } - memcpy(ptr, tmpbuf, msglen); - PRINTF(("Msglen %d (%d:%d)\n", msglen, x, y)); - len += msglen; - ptr += msglen; - ++n; - } - x0 = vs->x; - } - - loopend: - - umsg->rects = uip_htons(n); - - if(y == vs->y + vs->h && x == vs->x + vs->w) { - vs->x2 = vs->y2 = 0; - } - - if(n > 0) { - /* printf("Sending %d rects, %d bytes (%p, %p, %p)\n", n, len, - uip_appdata, umsg, ptr);*/ - uip_send(uip_appdata, len); - } - -} -/*-----------------------------------------------------------------------------------*/ -#define NUMKEYS 20 -static char keys[NUMKEYS]; -static int firstkey, lastkey; - - -char -vnc_out_keyavail(void) -{ - return firstkey != lastkey; -} - -char -vnc_out_getkey(void) -{ - char key; - key = keys[firstkey]; - - if(firstkey != lastkey) { - ++firstkey; - if(firstkey >= NUMKEYS) { - firstkey = 0; - } - } - - return key; -} - -void -vnc_out_key_event(struct vnc_server_state *vs) -{ - register struct rfb_key_event *ev; - - ev = (struct rfb_key_event *)uip_appdata; - - if(ev->down != 0) { - if(vs->sendmsg == SEND_NONE) { - vs->sendmsg = SEND_UPDATE; - } - - - if(ev->key[2] == 0 || - (ev->key[2] == 0xff && - (ev->key[3] == CH_HOME || - ev->key[3] == CH_TAB || - ev->key[3] == CH_ESC || - ev->key[3] == CH_DEL || - ev->key[3] == CH_ENTER || - ev->key[3] == CH_CURS_LEFT || - ev->key[3] == CH_CURS_UP || - ev->key[3] == CH_CURS_RIGHT || - ev->key[3] == CH_CURS_DOWN))) { - - keys[lastkey] = ev->key[3]; - ++lastkey; - if(lastkey >= NUMKEYS) { - lastkey = 0; - } - } - } - - check_updates(vs); -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_pointer_event(struct vnc_server_state *vs) -{ - struct rfb_pointer_event *ev; - uint16_t evx, evy; - - ev = (struct rfb_pointer_event *)uip_appdata; - - evx = uip_htons(ev->x); - evy = uip_htons(ev->y); - - if(evx > SCREEN_X && evx < SCREEN_WIDTH - 2 * SCREEN_X && - evy > SCREEN_Y && evy < SCREEN_HEIGHT - 2 * SCREEN_Y) { - - mouse_button = ev->buttonmask & RFB_BUTTON_MASK1; - - mouse_x = evx - SCREEN_X; - mouse_y = evy - SCREEN_Y; - - check_updates(vs); - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_acked(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - if(vs->state != VNC_RUNNING) { - return; - } - if(vs->sendmsg == SENT_BLANK) { - init_send_screen(vs); - } else if(vs->sendmsg == SEND_BLANK) { - /* Do nothing until sendmsg == SENT_BLANK. */ - } else if(vs->sendmsg == SEND_SCREEN) { - /* When the screen has been fully drawn, ->x2 and ->y2 are both - set to 0 to indicate this.*/ - if(vs->x2 == 0 && vs->y2 == 0) { - vs->sendmsg = SEND_NONE; - - /* If there was an updaterequest for the entire screen, we can - clear that flag now. */ - if(vs->updates_current != NULL) { - vnc_server_update_free(vs, vs->updates_current); - vs->updates_current = NULL; - } - check_updates(vs); - } else { - vs->x1 = vs->x2; - vs->y1 = vs->y2; - } - - } else if(vs->sendmsg == SEND_UPDATE) { - if(vs->x2 == 0 && vs->y2 == 0) { - /* So, we have updated the area that we needed. We now check if - there have been any recent full screen update requests. If - so, we need to go to the SEND_SCREEN state. Else, we see if - there were more areas that needed to be updated and if so, - we'll continue with those. */ - - vs->sendmsg = SEND_NONE; - - if(vs->updates_current != NULL) { - vnc_server_update_free(vs, vs->updates_current); - vs->updates_current = NULL; - - } - check_updates(vs); -#if 0 - if(vs->updaterequest == VNC_SERVER_UPDATE_FULL) { - check_updates(vs); - } else { - vs->updatesptr2 = (vs->updatesptr2 + 1) % - VNC_SERVER_MAX_UPDATES; - - /* If there are no more updates to do, we'll go back to the - SEND_NONE state. */ - if(vs->updatesptr2 == vs->updatesptr) { - vs->updatetype = VNC_SERVER_UPDATE_NONE; - } else { - /* Otherwise, we continue to update the next area. */ - vs->updaterequest = VNC_SERVER_UPDATE_PARTS; - check_updates(vs); - } - } -#endif /* 0 */ - } else { - vs->x1 = vs->x2; - vs->y1 = vs->y2; - } - } else { - vs->sendmsg = SEND_NONE; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_out_poll(struct vnc_server_state *vs) -{ - /* PRINTF(("vs->state %d, sendmsg %d, updatetype %d, updatereq %d\n", - vs->state, vs->sendmsg, vs->updatetype, vs->updaterequest);*/ - - if(vs->state == VNC_RUNNING && - vs->sendmsg == SEND_NONE) { - check_updates(vs); - vnc_server_send_data(vs); - } -} -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_MOUSE_SUPPORT -void -ctk_mouse_init(void) -{ - -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_x(void) -{ - return mouse_x; -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_y(void) -{ - return mouse_y; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_button(void) -{ - return mouse_button; -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_hide(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_show(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -#endif /* CTK_CONF_MOUSE_SUPPORT */ diff --git a/core/ctk/vnc-out.h b/core/ctk/vnc-out.h deleted file mode 100644 index e7187ad48..000000000 --- a/core/ctk/vnc-out.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -#ifndef __VNC_OUT_H__ -#define __VNC_OUT_H__ - - -void vnc_out_init(void); -void vnc_out_new(struct vnc_server_state *vs); - -void vnc_out_send_blank(struct vnc_server_state *vs); -void vnc_out_send_screen(struct vnc_server_state *vs); -void vnc_out_send_update(struct vnc_server_state *vs); - -void vnc_out_key_event(struct vnc_server_state *vs); -void vnc_out_pointer_event(struct vnc_server_state *vs); - -void vnc_out_acked(struct vnc_server_state *vs); - -void vnc_out_poll(struct vnc_server_state *vs); - - -void vnc_out_update_screen(uint8_t x, uint8_t y, uint8_t c, uint8_t color); -char vnc_out_getkey(void); -char vnc_out_keyavail(void); - -void vnc_out_update_area(struct vnc_server_state *vs, - uint8_t x, uint8_t y, uint8_t w, uint8_t h); - -#include "ctk/ctk.h" - -unsigned char vnc_out_add_icon(struct ctk_icon *icon); - -#if 1 -#define VNC_OUT_BACKGROUNDCOLOR 0 -#define VNC_OUT_WINDOWCOLOR 1 -#define VNC_OUT_SEPARATORCOLOR 7 /*(VNC_OUT_WINDOWCOLOR + 6)*/ -#define VNC_OUT_LABELCOLOR 13 /*(VNC_OUT_SEPARATORCOLOR + 6)*/ -#define VNC_OUT_BUTTONCOLOR 19 /*(VNC_OUT_LABELCOLOR + 6)*/ -#define VNC_OUT_HYPERLINKCOLOR 25 /*(VNC_OUT_BUTTONCOLOR + 6)*/ -#define VNC_OUT_TEXTENTRYCOLOR 31 /*(VNC_OUT_HYPERLINKCOLOR + 6)*/ -#define VNC_OUT_ICONCOLOR 37 /*(VNC_OUT_TEXTENTRYCOLOR + 6)*/ -#define VNC_OUT_MENUCOLOR 43 /*(VNC_OUT_ICONCOLOR + 6)*/ -#define VNC_OUT_OPENMENUCOLOR 44/*(VNC_OUT_MENUCOLOR + 1)*/ -#define VNC_OUT_ACTIVEMENUCOLOR 45 /*(VNC_OUT_OPENMENUCOLOR + 1) */ -#else -#define VNC_OUT_BACKGROUNDCOLOR 0 -#define VNC_OUT_WINDOWCOLOR 1 -#define VNC_OUT_SEPARATORCOLOR (VNC_OUT_WINDOWCOLOR + 6) -#define VNC_OUT_LABELCOLOR (VNC_OUT_SEPARATORCOLOR + 6) -#define VNC_OUT_BUTTONCOLOR (VNC_OUT_LABELCOLOR + 6) -#define VNC_OUT_HYPERLINKCOLOR (VNC_OUT_BUTTONCOLOR + 6) -#define VNC_OUT_TEXTENTRYCOLOR (VNC_OUT_HYPERLINKCOLOR + 6) -#define VNC_OUT_ICONCOLOR (VNC_OUT_TEXTENTRYCOLOR + 6) -#define VNC_OUT_MENUCOLOR (VNC_OUT_ICONCOLOR + 6) -#define VNC_OUT_OPENMENUCOLOR (VNC_OUT_MENUCOLOR + 1) -#define VNC_OUT_ACTIVEMENUCOLOR (VNC_OUT_OPENMENUCOLOR + 1) - -#endif - -#endif /* __VNC_OUT_H__ */ diff --git a/core/ctk/vnc-server.c b/core/ctk/vnc-server.c deleted file mode 100644 index 40aa1414b..000000000 --- a/core/ctk/vnc-server.c +++ /dev/null @@ -1,486 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -/* A micro implementation of a VNC server. VNC is a protocol for - remote network displays. See http://www.uk.research.att.com/vnc/ - for information about VNC. - - Initialization states: - - VNC_VERSION (send version string) - VNC_AUTH (send auth message) - VNC_INIT (send init message) - - Steady state: - - VNC_RUNNING (send RFB updates, parse incoming messages) - - What kind of message should be sent: - - SEND_NONE (No message) - SEND_BLANK (Blank screen initially) - SEND_SCREEN (Send entire screen, initially) - SEND_UPDATE (Send incremental update) - -*/ - -#include "contiki-net.h" -#include "ctk/vnc-server.h" -#include "ctk/vnc-out.h" - -#include - -/* RFB server initial handshaking string. */ -#define RFB_SERVER_VERSION_STRING rfb_server_version_string - -/* "RFB 003.003" */ -static uint8_t rfb_server_version_string[12] = {82,70,66,32,48,48,51,46,48,48,51,10}; - -/* uVNC */ -static uint8_t uvnc_name[4] = {117,86,78,67}; -#if 1 -#define PRINTF(x) -#else -#define PRINTF(x) printf x -#endif - -/*-----------------------------------------------------------------------------------*/ -uint8_t -vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c) -{ - register struct rfb_fb_update_rect_hdr *recthdr; - struct rfb_rre_hdr *rrehdr; - - recthdr = (struct rfb_fb_update_rect_hdr *)ptr; - rrehdr = (struct rfb_rre_hdr *)(ptr + sizeof(struct rfb_fb_update_rect_hdr)); - - recthdr->rect.x = x; - recthdr->rect.y = y; - recthdr->rect.w = w; - recthdr->rect.h = h; - recthdr->encoding[0] = - recthdr->encoding[1] = - recthdr->encoding[2] = 0; - recthdr->encoding[3] = RFB_ENC_RRE; - - rrehdr->subrects[0] = - rrehdr->subrects[1] = 0; - rrehdr->bgpixel = c; - - return sizeof(struct rfb_fb_update_rect_hdr) + sizeof(struct rfb_rre_hdr); -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_init(void) -{ - vnc_out_init(); -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_send_blank(struct vnc_server_state *vs) -{ - switch(vs->type) { - case 0: - vnc_out_send_blank(vs); - break; - /* case 1: - vnc_stats_send_blank(vs); - break; */ - } -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_send_screen(struct vnc_server_state *vs) -{ - switch(vs->type) { - case 0: - vnc_out_send_screen(vs); - break; - /* case 1: - vnc_stats_send_screen(vs); - break;*/ - } -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_send_update(struct vnc_server_state *vs) -{ - switch(vs->type) { - case 0: - vnc_out_send_update(vs); - break; - /* case 1: - vnc_stats_send_update(vs); - break;*/ - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_send_data(struct vnc_server_state *vs) -{ - register struct rfb_server_init *initmsg; - - switch(vs->state) { - case VNC_VERSION: - uip_send(RFB_SERVER_VERSION_STRING, sizeof(RFB_SERVER_VERSION_STRING)); - break; - case VNC_AUTH: - ((char *)uip_appdata)[0] = 0; - ((char *)uip_appdata)[1] = 0; - ((char *)uip_appdata)[2] = 0; - ((char *)uip_appdata)[3] = RFB_AUTH_NONE; - uip_send(uip_appdata, 4); - break; - case VNC_INIT: - initmsg = (struct rfb_server_init *)uip_appdata; - initmsg->width = uip_htons(vs->width); - initmsg->height = uip_htons(vs->height); - /* BGR233 pixel format. */ - initmsg->format.bps = 8; - initmsg->format.depth = 8; - initmsg->format.endian = 1; - initmsg->format.truecolor = 1; - initmsg->format.red_max = uip_htons(7); - initmsg->format.green_max = uip_htons(7); - initmsg->format.blue_max = uip_htons(3); - initmsg->format.red_shift = 0; - initmsg->format.green_shift = 3; - initmsg->format.blue_shift = 6; - initmsg->namelength[0] = 0; - initmsg->namelength[1] = 0; - initmsg->namelength[2] = 0; - initmsg->namelength[3] = 4; - memcpy(&((char *)uip_appdata)[sizeof(struct rfb_server_init)], uvnc_name, 4); - /* ((char *)uip_appdata)[sizeof(struct rfb_server_init)+0] = 'u'; - ((char *)uip_appdata)[sizeof(struct rfb_server_init)+1] = 'V'; - ((char *)uip_appdata)[sizeof(struct rfb_server_init)+2] = 'N'; - ((char *)uip_appdata)[sizeof(struct rfb_server_init)+3] = 'C';*/ - uip_send(uip_appdata, sizeof(struct rfb_server_init) + 4); - break; - case VNC_RUNNING: - switch(vs->sendmsg) { - case SEND_NONE: - PRINTF(("Sending none\n")); - break; - - case SEND_BLANK: - case SENT_BLANK: - PRINTF(("Sending blank\n")); - vnc_send_blank(vs); - break; - - case SEND_SCREEN: - PRINTF(("Sending screen\n")); - vnc_send_screen(vs); - break; - - case SEND_UPDATE: - PRINTF(("Sending update\n")); - vnc_send_update(vs); - break; - } - break; - - default: - break; - } - -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_key_event(struct vnc_server_state *vs) -{ - switch(vs->type) { - case 0: - vnc_out_key_event(vs); - break; - /* case 1: - vnc_stats_key_event(vs); - break;*/ - } -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_pointer_event(struct vnc_server_state *vs) -{ - switch(vs->type) { - case 0: - vnc_out_pointer_event(vs); - break; - /* case 1: - vnc_stats_pointer_event(vs); - break;*/ - } -} -/*-----------------------------------------------------------------------------------*/ -static uint8_t -vnc_read_data(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - uint8_t *appdata; - uint16_t len; - struct rfb_fb_update_request *req; - /* uint8_t niter;*/ - - len = uip_datalen(); - appdata = (uint8_t *)uip_appdata; - - /* First, check if there is data left to discard since last read. */ - if(vs->readlen > 0) { - appdata += vs->readlen; - if(len > vs->readlen) { - len -= vs->readlen; - vs->readlen = 0; - } else { - vs->readlen -= len; - len = 0; - } - } - - if(vs->readlen != 0) { - return 1; - } - - /* All data read and ignored, parse next message. */ - /* for(niter = 32; niter > 0 && len > 0; --niter) {*/ - while(len > 0) { - switch(vs->state) { - case VNC_VERSION: - case VNC_VERSION2: - PRINTF(("Read in version\n")); - /* Receive and ignore client version string (12 bytes). */ - vs->state = VNC_AUTH; - vs->readlen = 12; - break; - - case VNC_AUTH: - case VNC_AUTH2: - PRINTF(("Read in auth \n")); - /* Read and discard initialization from client (1 byte). */ - vs->readlen = 1; - vs->state = VNC_INIT; - break; - - case VNC_INIT: - case VNC_INIT2: - PRINTF(("Read in init \n")); - vs->readlen = 0; - vs->state = VNC_RUNNING; - - case VNC_RUNNING: - /* Handle all client events. */ - switch(*appdata) { - case RFB_SET_PIXEL_FORMAT: - PRINTF(("Set pixel format\n")); - vs->readlen = sizeof(struct rfb_set_pixel_format); - /* Check if client runs with BGR233 format. If not, abort the - connection. */ - /* XXX: not implemented yet. */ - break; - - case RFB_FIX_COLORMAP_ENTRIES: - PRINTF(("Fix colormap entries\n")); - return 0; - - case RFB_SET_ENCODINGS: - PRINTF(("Set encodings\n")); - vs->readlen = sizeof(struct rfb_set_encoding); - vs->readlen += uip_htons(((struct rfb_set_encoding *)appdata)->encodings) * 4; - /* Make sure that client supports the encodings we use. */ - /* XXX: not implemented yet. */ - break; - - case RFB_FB_UPDATE_REQ: - PRINTF(("Update request\n")); - vs->update_requested = 1; - vs->readlen = sizeof(struct rfb_fb_update_request); - /* blank the screen initially */ - req = (struct rfb_fb_update_request *)appdata; - if(req->incremental == 0) { - /* vs->sendmsg = SEND_BLANK;*/ - vnc_out_update_area(vs, 0, 0, vs->w, vs->h); - } - break; - - case RFB_KEY_EVENT: - vs->readlen = sizeof(struct rfb_key_event); - vnc_key_event(vs); - break; - - case RFB_POINTER_EVENT: - vs->readlen = sizeof(struct rfb_pointer_event); - vnc_pointer_event(vs); - break; - - case RFB_CLIENT_CUT_TEXT: - PRINTF(("Client cut text\n")); - - if(((struct rfb_client_cut_text *)appdata)->len[0] != 0 || - ((struct rfb_client_cut_text *)appdata)->len[1] != 0) { - return 0; - - } - vs->readlen = sizeof(struct rfb_client_cut_text) + - (((struct rfb_client_cut_text *)appdata)->len[2] << 8) + - ((struct rfb_client_cut_text *)appdata)->len[3]; - /* return 0;*/ - break; - - default: - PRINTF(("Unknown message %d\n", *appdata)); - return 0; - } - break; - - default: - return 0; - } - - if(vs->readlen > 0) { - if(len > vs->readlen) { - len -= vs->readlen; - appdata += vs->readlen; - vs->readlen = 0; - } else { - vs->readlen -= len; - len = 0; - } - } else { - /* Lost data. */ - break; - } - - } - - /* if(vs->readlen > 0) { - printf("More data %d\n", vs->readlen); - }*/ - - /* uip_appdata = appdata;*/ - - return 1; -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_new(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - vs->counter = 0; - vs->readlen = 0; - vs->sendmsg = SEND_NONE; - vs->update_requested = 1; - switch(vs->type) { - case 0: - vnc_out_new(vs); - break; - /* case 1: - vnc_stats_new(vs); - break;*/ - } -} -/*-----------------------------------------------------------------------------------*/ -static void -vnc_acked(CC_REGISTER_ARG struct vnc_server_state *vs) -{ - switch(vs->state) { - case VNC_VERSION: - vs->state = VNC_VERSION2; - break; - - case VNC_AUTH: - vs->state = VNC_AUTH2; - break; - - case VNC_INIT: - vs->state = VNC_INIT2; - break; - - case VNC_RUNNING: - switch(vs->type) { - case 0: - vnc_out_acked(vs); - break; - /* case 1: - vnc_stats_acked(vs); - break;*/ - } - break; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_appcall(struct vnc_server_state *vs) -{ - - vs->type = uip_htons(uip_conn->lport) - 5900; - - if(uip_connected()) { - vnc_new(vs); - vs->state = VNC_VERSION; - vnc_server_send_data(vs); - return; - } - if(uip_acked()) { - PRINTF(("Acked\n")); - vnc_acked(vs); - } - - if(uip_newdata()) { - PRINTF(("Newdata\n")); - vs->counter = 0; - if(vnc_read_data(vs) == 0) { - uip_abort(); - return; - } - } - - if(uip_rexmit()) { - PRINTF(("Rexmit\n")); - } - - - if(uip_newdata() || - uip_rexmit() || - uip_acked()) { - vnc_server_send_data(vs); - } else if(uip_poll()) { - ++vs->counter; - /* Abort connection after about 20 seconds of inactivity. */ - if(vs->counter >= 40) { - uip_abort(); - return; - } - - vnc_out_poll(vs); - } - -} -/*-----------------------------------------------------------------------------------*/ diff --git a/core/ctk/vnc-server.h b/core/ctk/vnc-server.h deleted file mode 100644 index 1e0d6d24a..000000000 --- a/core/ctk/vnc-server.h +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -#ifndef __VNC_SERVER_H__ -#define __VNC_SERVER_H__ - - -/*struct vnc_server_updatearea { - uint8_t active; - uint8_t x, y; - uint8_t w, h; - };*/ - -struct vnc_server_update { - struct vnc_server_update *next; - -#define VNC_SERVER_UPDATE_NONE 0 -#define VNC_SERVER_UPDATE_PARTS 1 -#define VNC_SERVER_UPDATE_FULL 2 - - uint8_t type; - - uint8_t x, y; - uint8_t w, h; -}; - -struct vnc_server_state { - uint16_t counter; - uint8_t type; - uint8_t state; - uint16_t height, width; - - uint8_t update_requested; - - /* Variables used when sending screen updates. */ - uint8_t x, y, x1, y1, x2, y2; - uint8_t w, h; - - - - uint16_t readlen; - uint8_t sendmsg; - uint8_t button; - - - struct vnc_server_update *updates_current; - struct vnc_server_update *updates_pending; - struct vnc_server_update *updates_free; - -#define VNC_SERVER_MAX_UPDATES 8 - struct vnc_server_update updates_pool[VNC_SERVER_MAX_UPDATES]; - -}; - -struct vnc_server_update * - vnc_server_update_alloc(struct vnc_server_state *vs); -void vnc_server_update_free(struct vnc_server_state *vs, - struct vnc_server_update *a); -void vnc_server_update_remove(struct vnc_server_state *vs, - struct vnc_server_update *a); - -void vnc_server_update_add(struct vnc_server_state *vs, - struct vnc_server_update *a); -struct vnc_server_update * - vnc_server_update_dequeue(struct vnc_server_state *vs); - - - - -void vnc_server_init(void); -void vnc_server_appcall(struct vnc_server_state *state); - - -extern struct vnc_server_state *vs; - -enum { - VNC_DEALLOCATED, - VNC_VERSION, - VNC_VERSION2, - VNC_AUTH, - VNC_AUTH2, - VNC_INIT, - VNC_INIT2, - VNC_RUNNING -}; - -/* Sendmsg */ -enum { - SEND_NONE, - SEND_BLANK, - SENT_BLANK, - SEND_SCREEN, - SEND_UPDATE -}; - - -/* Definitions of the RFB (Remote Frame Buffer) protocol - structures and constants. */ - -#include "contiki-net.h" - -void vnc_server_send_data(struct vnc_server_state *vs); -uint8_t vnc_server_draw_rect(uint8_t *ptr, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t c); - - -/* Generic rectangle - x, y coordinates, width and height. */ -struct rfb_rect { - uint16_t x; - uint16_t y; - uint16_t w; - uint16_t h; -}; - -/* Pixel format definition. */ -struct rfb_pixel_format { - uint8_t bps; /* Bits per pixel: 8, 16 or 32. */ - uint8_t depth; /* Color depth: 8-32 */ - uint8_t endian; /* 1 - big endian (motorola), 0 - little endian - (x86) */ - uint8_t truecolor; /* 1 - true color is used, 0 - true color is not used. */ - - /* The following fields are only used if true color is used. */ - uint16_t red_max, green_max, blue_max; - uint8_t red_shift, green_shift, blue_shift; - uint8_t pad1; - uint16_t pad2; -}; - - -/* RFB authentication constants. */ - -#define RFB_AUTH_FAILED 0 -#define RFB_AUTH_NONE 1 -#define RFB_AUTH_VNC 2 - -#define RFB_VNC_AUTH_OK 0 -#define RFB_VNC_AUTH_FAILED 1 -#define RFB_VNC_AUTH_TOOMANY 2 - -/* RFB message types. */ - -/* From server to client: */ -#define RFB_FB_UPDATE 0 -#define RFB_SET_COLORMAP_ENTRIES 1 -#define RFB_BELL 2 -#define RFB_SERVER_CUT_TEXT 3 - -/* From client to server. */ -#define RFB_SET_PIXEL_FORMAT 0 -#define RFB_FIX_COLORMAP_ENTRIES 1 -#define RFB_SET_ENCODINGS 2 -#define RFB_FB_UPDATE_REQ 3 -#define RFB_KEY_EVENT 4 -#define RFB_POINTER_EVENT 5 -#define RFB_CLIENT_CUT_TEXT 6 - -/* Encoding types. */ -#define RFB_ENC_RAW 0 -#define RFB_ENC_COPYRECT 1 -#define RFB_ENC_RRE 2 -#define RFB_ENC_CORRE 3 -#define RFB_ENC_HEXTILE 4 - -/* Message definitions. */ - -/* Server to client messages. */ - -struct rfb_server_init { - uint16_t width; - uint16_t height; - struct rfb_pixel_format format; - uint8_t namelength[4]; - /* Followed by name. */ -}; - -struct rfb_fb_update { - uint8_t type; - uint8_t pad; - uint16_t rects; /* Number of rectanges (struct rfb_fb_update_rect_hdr + - data) that follows. */ -}; - -struct rfb_fb_update_rect_hdr { - struct rfb_rect rect; - uint8_t encoding[4]; -}; - -struct rfb_copy_rect { - uint16_t srcx; - uint16_t srcy; -}; - -struct rfb_rre_hdr { - uint16_t subrects[2]; /* Number of subrectangles (struct - rfb_rre_subrect) to follow. */ - uint8_t bgpixel; -}; - -struct rfb_rre_subrect { - uint8_t pixel; - struct rfb_rect rect; -}; - -struct rfb_corre_rect { - uint8_t x; - uint8_t y; - uint8_t w; - uint8_t h; -}; - -/* Client to server messages. */ - -struct rfb_set_pixel_format { - uint8_t type; - uint8_t pad; - uint16_t pad2; - struct rfb_pixel_format format; -}; - -struct rfb_fix_colormap_entries { - uint8_t type; - uint8_t pad; - uint16_t firstcolor; - uint16_t colors; -}; - -struct rfb_set_encoding { - uint8_t type; - uint8_t pad; - uint16_t encodings; -}; - -struct rfb_fb_update_request { - uint8_t type; - uint8_t incremental; - uint16_t x; - uint16_t y; - uint16_t w; - uint16_t h; -}; - -struct rfb_key_event { - uint8_t type; - uint8_t down; - uint16_t pad; - uint8_t key[4]; -}; - -#define RFB_BUTTON_MASK1 1 -#define RFB_BUTTON_MASK2 2 -#define RFB_BUTTON_MASK3 4 -struct rfb_pointer_event { - uint8_t type; - uint8_t buttonmask; - uint16_t x; - uint16_t y; -}; - -struct rfb_client_cut_text { - uint8_t type; - uint8_t pad[3]; - uint8_t len[4]; -}; - -#endif /* __VNC_SERVER_H__ */ diff --git a/core/dev/battery-sensor.h b/core/dev/battery-sensor.h index 606e83e0e..3f65928de 100644 --- a/core/dev/battery-sensor.h +++ b/core/dev/battery-sensor.h @@ -35,8 +35,8 @@ * $Revision: 1.1 $ */ -#ifndef __BATTERY_SENSOR_H__ -#define __BATTERY_SENSOR_H__ +#ifndef BATTERY_SENSOR_H_ +#define BATTERY_SENSOR_H_ #include "lib/sensors.h" @@ -44,4 +44,4 @@ extern const struct sensors_sensor battery_sensor; #define BATTERY_SENSOR "Battery" -#endif /* __BATTERY_SENSOR_H__ */ +#endif /* BATTERY_SENSOR_H_ */ diff --git a/core/dev/button-sensor.h b/core/dev/button-sensor.h index 8154ade1c..b05d80db9 100644 --- a/core/dev/button-sensor.h +++ b/core/dev/button-sensor.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __BUTTON_SENSOR_H__ -#define __BUTTON_SENSOR_H__ +#ifndef BUTTON_SENSOR_H_ +#define BUTTON_SENSOR_H_ #include "lib/sensors.h" @@ -38,4 +38,4 @@ extern const struct sensors_sensor button_sensor; #define BUTTON_SENSOR "Button" -#endif /* __BUTTON_SENSOR_H__ */ +#endif /* BUTTON_SENSOR_H_ */ diff --git a/core/dev/cc2420-aes.h b/core/dev/cc2420-aes.h index bf9098086..df54f97d2 100644 --- a/core/dev/cc2420-aes.h +++ b/core/dev/cc2420-aes.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __CC2420_AES_H__ -#define __CC2420_AES_H__ +#ifndef CC2420_AES_H_ +#define CC2420_AES_H_ /** * \brief Setup an AES key @@ -72,4 +72,4 @@ void cc2420_aes_set_key(const uint8_t *key, int index); void cc2420_aes_cipher(uint8_t *data, int len, int key_index); -#endif /* __CC2420_AES_H__ */ +#endif /* CC2420_AES_H_ */ diff --git a/core/dev/cc2420.h b/core/dev/cc2420.h index 57ee01ed4..9fd09d88b 100644 --- a/core/dev/cc2420.h +++ b/core/dev/cc2420.h @@ -38,8 +38,8 @@ * Joakim Eriksson */ -#ifndef __CC2420_H__ -#define __CC2420_H__ +#ifndef CC2420_H_ +#define CC2420_H_ #include "contiki.h" #include "dev/spi.h" @@ -200,4 +200,4 @@ void cc2420_set_cca_threshold(int value); CC2420_SPI_DISABLE(); \ } while (0) -#endif /* __CC2420_H__ */ +#endif /* CC2420_H_ */ diff --git a/core/dev/cc2520.h b/core/dev/cc2520.h index 234329d82..032b32b8d 100644 --- a/core/dev/cc2520.h +++ b/core/dev/cc2520.h @@ -37,8 +37,8 @@ * Joakim Eriksson */ -#ifndef __CC2520_H__ -#define __CC2520_H__ +#ifndef CC2520_H_ +#define CC2520_H_ #include "contiki.h" #include "dev/spi.h" @@ -195,4 +195,4 @@ void cc2520_set_cca_threshold(int value); CC2520_SPI_DISABLE(); \ } while (0) -#endif /* __CC2520_H__ */ +#endif /* CC2520_H_ */ diff --git a/core/dev/eeprom.h b/core/dev/eeprom.h index 4a1ff0c8b..8ff90ff1c 100644 --- a/core/dev/eeprom.h +++ b/core/dev/eeprom.h @@ -51,8 +51,8 @@ */ -#ifndef __EEPROM_H__ -#define __EEPROM_H__ +#ifndef EEPROM_H_ +#define EEPROM_H_ typedef unsigned short eeprom_addr_t; @@ -111,7 +111,7 @@ void eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size); void eeprom_init(void); -#endif /* __EEPROM_H__ */ +#endif /* EEPROM_H_ */ /** @} */ /** @} */ diff --git a/core/dev/leds.h b/core/dev/leds.h index 4b4ced6c8..82132e9a9 100644 --- a/core/dev/leds.h +++ b/core/dev/leds.h @@ -44,8 +44,8 @@ * @{ */ -#ifndef __LEDS_H__ -#define __LEDS_H__ +#ifndef LEDS_H_ +#define LEDS_H_ /* Allow platform to override LED numbering */ #include "contiki-conf.h" @@ -92,4 +92,4 @@ void leds_arch_init(void); unsigned char leds_arch_get(void); void leds_arch_set(unsigned char leds); -#endif /* __LEDS_H__ */ +#endif /* LEDS_H_ */ diff --git a/core/dev/radio-sensor.h b/core/dev/radio-sensor.h index 488d97533..601f129cf 100644 --- a/core/dev/radio-sensor.h +++ b/core/dev/radio-sensor.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __RADIO_SENSOR_H__ -#define __RADIO_SENSOR_H__ +#ifndef RADIO_SENSOR_H_ +#define RADIO_SENSOR_H_ #include "lib/sensors.h" @@ -43,4 +43,4 @@ extern const struct sensors_sensor radio_sensor; extern unsigned int radio_sensor_signal; -#endif /* __RADIO_SENSOR_H__ */ +#endif /* RADIO_SENSOR_H_ */ diff --git a/core/dev/radio.h b/core/dev/radio.h index faa1e40d6..69eee756e 100644 --- a/core/dev/radio.h +++ b/core/dev/radio.h @@ -51,8 +51,8 @@ * Adam Dunkels */ -#ifndef __RADIO_H__ -#define __RADIO_H__ +#ifndef RADIO_H_ +#define RADIO_H_ /** * The structure of a device driver for a radio in Contiki. @@ -98,7 +98,7 @@ enum { RADIO_TX_NOACK, }; -#endif /* __RADIO_H__ */ +#endif /* RADIO_H_ */ /** @} */ diff --git a/core/dev/serial-line.h b/core/dev/serial-line.h index 0ddb34755..4d4cec346 100644 --- a/core/dev/serial-line.h +++ b/core/dev/serial-line.h @@ -36,8 +36,8 @@ * Adam Dunkels * */ -#ifndef __SERIAL_LINE_H__ -#define __SERIAL_LINE_H__ +#ifndef SERIAL_LINE_H_ +#define SERIAL_LINE_H_ #include "contiki.h" @@ -73,4 +73,4 @@ void serial_line_init(void); PROCESS_NAME(serial_line_process); -#endif /* __SERIAL_LINE_H__ */ +#endif /* SERIAL_LINE_H_ */ diff --git a/core/dev/sht11-sensor.h b/core/dev/sht11-sensor.h index 30442369d..7395a49fd 100644 --- a/core/dev/sht11-sensor.h +++ b/core/dev/sht11-sensor.h @@ -36,8 +36,8 @@ * $Revision: 1.2 $ */ -#ifndef __SHT11_SENSOR_H__ -#define __SHT11_SENSOR_H__ +#ifndef SHT11_SENSOR_H_ +#define SHT11_SENSOR_H_ #include "lib/sensors.h" @@ -48,4 +48,4 @@ extern const struct sensors_sensor sht11_sensor; #define SHT11_SENSOR_BATTERY_INDICATOR 2 -#endif /* __SHT11-SENSOR_H__ */ +#endif /* SHT11-SENSOR_H_ */ diff --git a/core/dev/slip.h b/core/dev/slip.h index 756611c2c..ddc8c7e74 100644 --- a/core/dev/slip.h +++ b/core/dev/slip.h @@ -31,8 +31,8 @@ * */ -#ifndef __SLIP_H__ -#define __SLIP_H__ +#ifndef SLIP_H_ +#define SLIP_H_ #include "contiki.h" @@ -83,4 +83,4 @@ void slip_set_input_callback(void (*callback)(void)); void slip_arch_init(unsigned long ubr); void slip_arch_writeb(unsigned char c); -#endif /* __SLIP_H__ */ +#endif /* SLIP_H_ */ diff --git a/core/dev/spi.h b/core/dev/spi.h index 189178e16..a36be1ca7 100644 --- a/core/dev/spi.h +++ b/core/dev/spi.h @@ -36,8 +36,8 @@ * Niclas Finne */ -#ifndef __SPI_H__ -#define __SPI_H__ +#ifndef SPI_H_ +#define SPI_H_ /* Define macros to use for checking SPI transmission status depending on if it is possible to wait for TX buffer ready. This is possible @@ -88,4 +88,4 @@ void spi_init(void); } while(0); -#endif /* __SPI_H__ */ +#endif /* SPI_H_ */ diff --git a/core/dev/watchdog.h b/core/dev/watchdog.h index b0281a1d7..3985239aa 100644 --- a/core/dev/watchdog.h +++ b/core/dev/watchdog.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __WATCHDOG_H__ -#define __WATCHDOG_H__ +#ifndef WATCHDOG_H_ +#define WATCHDOG_H_ void watchdog_init(void); void watchdog_start(void); @@ -39,4 +39,4 @@ void watchdog_stop(void); void watchdog_reboot(void); -#endif /* __WATCHDOG_H__ */ +#endif /* WATCHDOG_H_ */ diff --git a/core/lib/checkpoint.c b/core/lib/checkpoint.c deleted file mode 100644 index 479d1b860..000000000 --- a/core/lib/checkpoint.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Checkpoint library. - * \author - * Fredrik Osterlind - */ - -#include "lib/checkpoint.h" - -/*---------------------------------------------------------------------------*/ -void -checkpoint_init(void) -{ - checkpoint_arch_init(); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_checkpoint(int fd) -{ - checkpoint_arch_checkpoint(fd); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_rollback(int fd) -{ - checkpoint_arch_rollback(fd); -} diff --git a/core/lib/checkpoint.h b/core/lib/checkpoint.h deleted file mode 100644 index 4a8164536..000000000 --- a/core/lib/checkpoint.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Checkpoint library header. - * \author - * Fredrik Osterlind - */ - -#ifndef CHECKPOINT_H -#define CHECKPOINT_H - -#include "contiki.h" - -void checkpoint_init(void); - -void checkpoint_checkpoint(int fd); - -void checkpoint_rollback(int fd); - -void checkpoint_arch_init(void); - -void checkpoint_arch_checkpoint(int fd); - -void checkpoint_arch_rollback(int fd); - -int checkpoint_arch_size(); - -#endif /* CHECKPOINT_H */ diff --git a/core/lib/crc16.h b/core/lib/crc16.h index 72010c706..ad1f785c8 100644 --- a/core/lib/crc16.h +++ b/core/lib/crc16.h @@ -51,8 +51,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __CRC16_H__ -#define __CRC16_H__ +#ifndef CRC16_H_ +#define CRC16_H_ /** * \brief Update an accumulated CRC16 checksum with one byte. @@ -89,7 +89,7 @@ unsigned short crc16_add(unsigned char b, unsigned short crc); unsigned short crc16_data(const unsigned char *data, int datalen, unsigned short acc); -#endif /* __CRC16_H__ */ +#endif /* CRC16_H_ */ /** @} */ /** @} */ diff --git a/core/lib/ctk-filedialog.h b/core/lib/ctk-filedialog.h index 796f39f6d..9c66c88d4 100644 --- a/core/lib/ctk-filedialog.h +++ b/core/lib/ctk-filedialog.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __CTK_FILEDIALOG_H__ -#define __CTK_FILEDIALOG_H__ +#ifndef CTK_FILEDIALOG_H_ +#define CTK_FILEDIALOG_H_ #include "contiki.h" @@ -47,4 +47,4 @@ void ctk_filedialog_open(CC_REGISTER_ARG struct ctk_filedialog_state *s, char ctk_filedialog_eventhandler(struct ctk_filedialog_state *s, process_event_t ev, process_data_t data); -#endif /* __CTK_FILEDIALOG_H__ */ +#endif /* CTK_FILEDIALOG_H_ */ diff --git a/core/lib/ctk-textentry-checkbox.h b/core/lib/ctk-textentry-checkbox.h index 5bf133adc..3c326b598 100644 --- a/core/lib/ctk-textentry-checkbox.h +++ b/core/lib/ctk-textentry-checkbox.h @@ -31,10 +31,10 @@ * * */ -#ifndef __CTK_TEXTENTRY_CHECKBOX_H__ -#define __CTK_TEXTENTRY_CHECKBOX_H__ +#ifndef CTK_TEXTENTRY_CHECKBOX_H_ +#define CTK_TEXTENTRY_CHECKBOX_H_ unsigned char ctk_textentry_checkbox_input(ctk_arch_key_t c, struct ctk_textentry *t); -#endif /* __CTK_TEXTENTRY_CHECKBOX_H__ */ +#endif /* CTK_TEXTENTRY_CHECKBOX_H_ */ diff --git a/core/lib/ctk-textentry-cmdline.h b/core/lib/ctk-textentry-cmdline.h index 6a904b3fa..8f74156c1 100644 --- a/core/lib/ctk-textentry-cmdline.h +++ b/core/lib/ctk-textentry-cmdline.h @@ -31,12 +31,12 @@ * * */ -#ifndef __CTK_TEXTENTRY_CMDLINE_H__ -#define __CTK_TEXTENTRY_CMDLINE_H__ +#ifndef CTK_TEXTENTRY_CMDLINE_H_ +#define CTK_TEXTENTRY_CMDLINE_H_ #include "ctk/ctk.h" unsigned char ctk_textentry_cmdline_input(ctk_arch_key_t c, struct ctk_textentry *t); -#endif /* __CTK_TEXTENTRY_CMDLINE_H__ */ +#endif /* CTK_TEXTENTRY_CMDLINE_H_ */ diff --git a/core/lib/ctk-textentry-multiline.h b/core/lib/ctk-textentry-multiline.h index 2a2ba825a..49342c019 100644 --- a/core/lib/ctk-textentry-multiline.h +++ b/core/lib/ctk-textentry-multiline.h @@ -31,10 +31,10 @@ * * */ -#ifndef __CTK_TEXTENTRY_MULTILINE_H__ -#define __CTK_TEXTENTRY_MULTILINE_H__ +#ifndef CTK_TEXTENTRY_MULTILINE_H_ +#define CTK_TEXTENTRY_MULTILINE_H_ unsigned char ctk_textentry_multiline_input(ctk_arch_key_t c, struct ctk_textentry *t); -#endif /* __CTK_TEXTENTRY_MULTILINE_H__ */ +#endif /* CTK_TEXTENTRY_MULTILINE_H_ */ diff --git a/core/lib/gcr.h b/core/lib/gcr.h index 69139619f..10c36550d 100644 --- a/core/lib/gcr.h +++ b/core/lib/gcr.h @@ -35,8 +35,8 @@ * $Revision: 1.1 $ */ -#ifndef __GCR_H__ -#define __GCR_H__ +#ifndef GCR_H_ +#define GCR_H_ void gcr_init(); unsigned char gcr_finished(); @@ -48,4 +48,4 @@ unsigned char gcr_get_encoded(unsigned char *raw_data); unsigned char gcr_get_decoded(unsigned char *raw_data); unsigned char gcr_valid(); -#endif /* __GCR_H__ */ +#endif /* GCR_H_ */ diff --git a/core/lib/libconio.h b/core/lib/libconio.h index b60260472..b9810f778 100644 --- a/core/lib/libconio.h +++ b/core/lib/libconio.h @@ -32,8 +32,8 @@ * */ -#ifndef __LIBCONIO_H__ -#define __LIBCONIO_H__ +#ifndef LIBCONIO_H_ +#define LIBCONIO_H_ /* This function must be implemented specifically for the architecture: */ @@ -81,4 +81,4 @@ void textcolor(unsigned char c); -#endif /* __LIBCONIO_H__ */ +#endif /* LIBCONIO_H_ */ diff --git a/core/lib/list.h b/core/lib/list.h index cd305efed..48e51401e 100644 --- a/core/lib/list.h +++ b/core/lib/list.h @@ -65,8 +65,8 @@ * Author: Adam Dunkels * */ -#ifndef __LIST_H__ -#define __LIST_H__ +#ifndef LIST_H_ +#define LIST_H_ #define LIST_CONCAT2(s1, s2) s1##s2 #define LIST_CONCAT(s1, s2) LIST_CONCAT2(s1, s2) @@ -153,7 +153,7 @@ void list_insert(list_t list, void *previtem, void *newitem); void * list_item_next(void *item); -#endif /* __LIST_H__ */ +#endif /* LIST_H_ */ /** @} */ /** @} */ diff --git a/core/lib/me.h b/core/lib/me.h index a1440fc34..44abcee61 100644 --- a/core/lib/me.h +++ b/core/lib/me.h @@ -61,15 +61,15 @@ * */ -#ifndef __ME_H__ -#define __ME_H__ +#ifndef ME_H_ +#define ME_H_ unsigned char me_valid(unsigned char m); unsigned short me_encode(unsigned char c); unsigned char me_decode16(unsigned short m); unsigned char me_decode8(unsigned char m); -#endif /* __ME_H__ */ +#endif /* ME_H_ */ /** @} */ /** @} */ diff --git a/core/lib/me_tabs.h b/core/lib/me_tabs.h index 35acae698..0566aa0ad 100644 --- a/core/lib/me_tabs.h +++ b/core/lib/me_tabs.h @@ -29,12 +29,12 @@ * This file is part of the Contiki operating system. * */ -#ifndef __ME_TABS_H__ -#define __ME_TABS_H__ +#ifndef ME_TABS_H_ +#define ME_TABS_H_ extern const unsigned short me_encode_tab[256]; extern const unsigned char me_decode_tab[256]; extern const unsigned char me_valid_tab[256]; -#endif /* __ME_TABS_H__ */ +#endif /* ME_TABS_H_ */ diff --git a/core/lib/memb.h b/core/lib/memb.h index fc8c3bd7c..f5e654cc1 100644 --- a/core/lib/memb.h +++ b/core/lib/memb.h @@ -60,8 +60,8 @@ * */ -#ifndef __MEMB_H__ -#define __MEMB_H__ +#ifndef MEMB_H_ +#define MEMB_H_ #include "sys/cc.h" @@ -134,4 +134,4 @@ int memb_inmemb(struct memb *m, void *ptr); /** @} */ /** @} */ -#endif /* __MEMB_H__ */ +#endif /* MEMB_H_ */ diff --git a/core/lib/mmem.h b/core/lib/mmem.h index 24a54f513..e075f585b 100644 --- a/core/lib/mmem.h +++ b/core/lib/mmem.h @@ -56,8 +56,8 @@ * */ -#ifndef __MMEM_H__ -#define __MMEM_H__ +#ifndef MMEM_H_ +#define MMEM_H_ /*---------------------------------------------------------------------------*/ /** @@ -87,7 +87,7 @@ int mmem_alloc(struct mmem *m, unsigned int size); void mmem_free(struct mmem *); void mmem_init(void); -#endif /* __MMEM_H__ */ +#endif /* MMEM_H_ */ /** @} */ /** @} */ diff --git a/core/lib/petsciiconv.h b/core/lib/petsciiconv.h index 4d9e51779..87e9c916d 100644 --- a/core/lib/petsciiconv.h +++ b/core/lib/petsciiconv.h @@ -46,8 +46,8 @@ * * */ -#ifndef __PETSCIICONV_H__ -#define __PETSCIICONV_H__ +#ifndef PETSCIICONV_H_ +#define PETSCIICONV_H_ #ifdef WITH_PETSCII @@ -75,4 +75,4 @@ void petsciiconv_topetscii(char *buf, unsigned int len); #endif /* WITH_PETSCII */ -#endif /* __PETSCIICONV_H__ */ +#endif /* PETSCIICONV_H_ */ diff --git a/core/lib/print-stats.h b/core/lib/print-stats.h index 5996b7359..32ef3205e 100644 --- a/core/lib/print-stats.h +++ b/core/lib/print-stats.h @@ -37,9 +37,9 @@ * Adam Dunkels */ -#ifndef __PRINT_STATS_H__ -#define __PRINT_STATS_H__ +#ifndef PRINT_STATS_H_ +#define PRINT_STATS_H_ void print_stats(void); -#endif /* __PRINT_STATS_H__ */ +#endif /* PRINT_STATS_H_ */ diff --git a/core/lib/random.h b/core/lib/random.h index 1428c6fd7..cb206e23b 100644 --- a/core/lib/random.h +++ b/core/lib/random.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __RANDOM_H__ -#define __RANDOM_H__ +#ifndef RANDOM_H_ +#define RANDOM_H_ /* * Initialize the pseudo-random generator. @@ -49,4 +49,4 @@ unsigned short random_rand(void); /* Since random_rand casts to unsigned short, we'll use this maxmimum */ #define RANDOM_RAND_MAX 65535U -#endif /* __RANDOM_H__ */ +#endif /* RANDOM_H_ */ diff --git a/core/lib/ringbuf.h b/core/lib/ringbuf.h index 876d18412..390000524 100644 --- a/core/lib/ringbuf.h +++ b/core/lib/ringbuf.h @@ -50,8 +50,8 @@ * Adam Dunkels */ -#ifndef __RINGBUF_H__ -#define __RINGBUF_H__ +#ifndef RINGBUF_H_ +#define RINGBUF_H_ #include "contiki-conf.h" @@ -128,4 +128,4 @@ int ringbuf_size(struct ringbuf *r); */ int ringbuf_elements(struct ringbuf *r); -#endif /* __RINGBUF_H__ */ +#endif /* RINGBUF_H_ */ diff --git a/core/lib/sensors.h b/core/lib/sensors.h index 80d0103a7..11b9fba17 100644 --- a/core/lib/sensors.h +++ b/core/lib/sensors.h @@ -30,8 +30,8 @@ * */ -#ifndef __SENSORS_H__ -#define __SENSORS_H__ +#ifndef SENSORS_H_ +#define SENSORS_H_ #include "contiki.h" @@ -69,4 +69,4 @@ extern process_event_t sensors_event; PROCESS_NAME(sensors_process); -#endif /* __SENSORS_H__ */ +#endif /* SENSORS_H_ */ diff --git a/core/lib/settings.h b/core/lib/settings.h index c35a88743..79350c54d 100644 --- a/core/lib/settings.h +++ b/core/lib/settings.h @@ -30,8 +30,8 @@ * */ -#ifndef __CONTIKI_SETTINGS_H__ -#define __CONTIKI_SETTINGS_H__ +#ifndef CONTIKI_SETTINGS_H_ +#define CONTIKI_SETTINGS_H_ /** @file settings.h * @brief Settings Manager @@ -366,4 +366,4 @@ settings_set_uint64(settings_key_t key, uint64_t value) #endif /* !SETTINGS_CONF_SKIP_CONVENIENCE_FUNCS */ -#endif /* !defined(__CONTIKI_SETTINGS_H__) */ +#endif /* !defined(CONTIKI_SETTINGS_H_) */ diff --git a/core/lib/trickle-timer.h b/core/lib/trickle-timer.h index dedee3301..b1cf765bc 100644 --- a/core/lib/trickle-timer.h +++ b/core/lib/trickle-timer.h @@ -68,8 +68,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __TRICKLE_TIMER_H__ -#define __TRICKLE_TIMER_H__ +#ifndef TRICKLE_TIMER_H_ +#define TRICKLE_TIMER_H_ #include "contiki-conf.h" #include "sys/ctimer.h" @@ -509,6 +509,6 @@ void trickle_timer_inconsistency(struct trickle_timer *tt); /** @} */ -#endif /* __TRICKLE_TIMER_H__ */ +#endif /* TRICKLE_TIMER_H_ */ /** @} */ /** @} */ diff --git a/core/loader/dlloader.h b/core/loader/dlloader.h index 580caf4e5..9161c6263 100644 --- a/core/loader/dlloader.h +++ b/core/loader/dlloader.h @@ -29,9 +29,9 @@ * This file is part of the Contiki operating system. * */ -#ifndef __DLLOADER_H__ -#define __DLLOADER_H__ +#ifndef DLLOADER_H_ +#define DLLOADER_H_ int dlloader_load(char *name, char *arg); -#endif /* __SOLOADR_H__ */ +#endif /* SOLOADR_H_ */ diff --git a/core/loader/elfloader-arch.h b/core/loader/elfloader-arch.h index 2d1b54122..020b30a54 100644 --- a/core/loader/elfloader-arch.h +++ b/core/loader/elfloader-arch.h @@ -62,8 +62,8 @@ * */ -#ifndef __ELFLOADER_ARCH_H__ -#define __ELFLOADER_ARCH_H__ +#ifndef ELFLOADER_ARCH_H_ +#define ELFLOADER_ARCH_H_ #include "loader/elfloader.h" @@ -133,7 +133,7 @@ void elfloader_arch_relocate(int fd, unsigned int sectionoffset, */ void elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char *mem); -#endif /* __ELFLOADER_ARCH_H__ */ +#endif /* ELFLOADER_ARCH_H_ */ /** @} */ /** @} */ diff --git a/core/loader/elfloader.h b/core/loader/elfloader.h index 3df4914a7..6c144c271 100644 --- a/core/loader/elfloader.h +++ b/core/loader/elfloader.h @@ -71,8 +71,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __ELFLOADER_H__ -#define __ELFLOADER_H__ +#ifndef ELFLOADER_H_ +#define ELFLOADER_H_ #include "cfs/cfs.h" @@ -187,7 +187,7 @@ struct elf32_rela { }; -#endif /* __ELFLOADER_H__ */ +#endif /* ELFLOADER_H_ */ /** @} */ /** @} */ diff --git a/core/loader/elfloader_compat.h b/core/loader/elfloader_compat.h index ad334d22f..c707cd8cc 100644 --- a/core/loader/elfloader_compat.h +++ b/core/loader/elfloader_compat.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __ELFLOADER_H__ -#define __ELFLOADER_H__ +#ifndef ELFLOADER_H_ +#define ELFLOADER_H_ #define ELFLOADER_OK 0 #define ELFLOADER_BAD_ELF_HEADER 1 @@ -51,4 +51,4 @@ extern struct process *elfloader_loaded_process; extern void (*elfloader_fini)(void); extern char elfloader_unknown[30]; -#endif /* __ELFLOADER_H__ */ +#endif /* ELFLOADER_H_ */ diff --git a/core/loader/symbols-def.h b/core/loader/symbols-def.h index 3dd076273..1037501af 100644 --- a/core/loader/symbols-def.h +++ b/core/loader/symbols-def.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __SYMBOLS_DEF_H__ -#define __SYMBOLS_DEF_H__ +#ifndef SYMBOLS_DEF_H_ +#define SYMBOLS_DEF_H_ struct symbols { const char *name; @@ -41,4 +41,4 @@ extern const int symbols_nelts; extern const struct symbols symbols[/* symbols_nelts */]; -#endif /* __SYMBOLS_DEF_H__ */ +#endif /* SYMBOLS_DEF_H_ */ diff --git a/core/loader/symbols.h b/core/loader/symbols.h index bfb0897ed..7e3fa4164 100644 --- a/core/loader/symbols.h +++ b/core/loader/symbols.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __SYMBOLS_H__ -#define __SYMBOLS_H__ +#ifndef SYMBOLS_H_ +#define SYMBOLS_H_ struct symbols { const char *name; @@ -41,4 +41,4 @@ extern const int symbols_nelts; extern const struct symbols symbols[/* symbols_nelts */]; -#endif /* __SYMBOLS_H__ */ +#endif /* SYMBOLS_H_ */ diff --git a/core/loader/symtab.h b/core/loader/symtab.h index 9f89b2b8e..29cbe9a06 100644 --- a/core/loader/symtab.h +++ b/core/loader/symtab.h @@ -29,9 +29,9 @@ * This file is part of the Contiki operating system. * */ -#ifndef __SYMTAB_H__ -#define __SYMTAB_H__ +#ifndef SYMTAB_H_ +#define SYMTAB_H_ void *symtab_lookup(const char *name); -#endif /* __SYMTAB_H__ */ +#endif /* SYMTAB_H_ */ diff --git a/core/net/Makefile.uip b/core/net/Makefile.uip index 6c02d6016..29b5de528 100644 --- a/core/net/Makefile.uip +++ b/core/net/Makefile.uip @@ -1,6 +1,5 @@ NET = \ dhcpc.c \ -hc.c \ nbr-table.c \ netstack.c \ packetbuf.c \ diff --git a/core/net/dhcpc.h b/core/net/dhcpc.h index 4f8bf51a0..aaa7e10b8 100644 --- a/core/net/dhcpc.h +++ b/core/net/dhcpc.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __DHCPC_H__ -#define __DHCPC_H__ +#ifndef DHCPC_H_ +#define DHCPC_H_ struct dhcpc_state { struct pt pt; @@ -59,4 +59,4 @@ void dhcpc_appcall(process_event_t ev, void *data); void dhcpc_configured(const struct dhcpc_state *s); void dhcpc_unconfigured(const struct dhcpc_state *s); -#endif /* __DHCPC_H__ */ +#endif /* DHCPC_H_ */ diff --git a/core/net/hc.c b/core/net/hc.c deleted file mode 100644 index d193c7e7e..000000000 --- a/core/net/hc.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * TCP/IP header compression implementation - * \author Adam Dunkels - * - */ - -#include "net/hc.h" - -#include "net/uip.h" - -#include - -#define FLAGS_COMPRESSED 0x8000 -#define FLAGS_BROADCASTDATA 0x4000 - -struct hc_hdr { - uint16_t flagsport; - uip_ipaddr_t srcipaddr; -}; - -struct udpip_hdr { - /* IP header. */ - uint8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - uint16_t ipchksum; - uip_ipaddr_t srcipaddr, destipaddr; - - /* UDP header. */ - uint16_t srcport, - destport; - uint16_t udplen; - uint16_t udpchksum; -}; - -#include - -/*---------------------------------------------------------------------------*/ -/** - * Initialize the header compression module. - */ -/*---------------------------------------------------------------------------*/ -void -hc_init(void) -{ - -} -/*---------------------------------------------------------------------------*/ -/** - * Compress a header - * - * This function compresses the TCP/IP headers in a buffer and - * should be called just before sending out data on the network. A - * pointer to the compressed header is returned, and len is - * adjusted. - * - * If the header could not be compressed, the function does nothing - * and returns a NULL pointer. - * - * \return A pointer to the start of the compressed header or NULL if - * the header could not be compressed. - */ -/*---------------------------------------------------------------------------*/ -int -hc_compress(uint8_t *buf, int len) -{ - struct hc_hdr *hdr; - struct udpip_hdr *uhdr; - - hdr = (struct hc_hdr *)buf; - uhdr = (struct udpip_hdr *)buf; - - /* Check the original TCP/IP header to see if it matches our - pattern, and compress if it does. */ - - if(uhdr->vhl == 0x45 && /* Only IPv4 without - options. */ - uhdr->len[0] == 0x00 && /* Only packets < 256 - bytes long. */ - uhdr->ipoffset[0] == 0x00 && /* No fragmented IP - packets. */ - uhdr->ipoffset[1] == 0x00 && /* No fragmented IP - packets. */ - uhdr->proto == UIP_PROTO_UDP && /* Only UDP packets. */ - uip_ipaddr_cmp(&uhdr->destipaddr, &uip_broadcast_addr) && /* Only - link-local broadcast - packets. */ - uhdr->destport == uhdr->srcport && /* Only packets with - the same destination - and source port - number. */ - (uhdr->destport & UIP_HTONS(0xc000)) == 0) { /* Only packets with the two - highest bits in the port - number equal to zero. */ - - hdr->flagsport = uip_htons( - FLAGS_COMPRESSED | /* Compressed header. */ - FLAGS_BROADCASTDATA | /* Broadcast data. */ - (uip_htons(uhdr->destport) & 0x3fff)); - uip_ipaddr_copy(&hdr->srcipaddr, &uhdr->srcipaddr); - - /* Move the packet data to the end of the compressed header. */ - memcpy((char *)hdr + HC_HLEN, - &buf[UIP_IPUDPH_LEN], - len - UIP_IPUDPH_LEN); - - /* Return the new packet length. */ - return len - (UIP_IPUDPH_LEN - HC_HLEN); - } - - /* No compression possible, return NULL pointer. */ - return len; - -} -/*---------------------------------------------------------------------------*/ -/** - * Inflate (decompress) a header - * - * This function should be called to inflate a possibly compressed - * packet header just after a packet has been received from the - * network. The function will copy the packet data so that the - * original header fits and adjusts uip_len. - * - */ -/*---------------------------------------------------------------------------*/ -int -hc_inflate(uint8_t *buf, int len) -{ - struct udpip_hdr *uhdr; - struct hc_hdr *hdr; - - hdr = (struct hc_hdr *)buf; - - /* First, check if the header in buf is compressed or not. */ - if((hdr->flagsport & UIP_HTONS(FLAGS_COMPRESSED)) != 0 && - (hdr->flagsport & UIP_HTONS(FLAGS_BROADCASTDATA)) != 0) { - - /* Move packet data in memory to make room for the uncompressed header. */ - memmove(&buf[UIP_IPUDPH_LEN - HC_HLEN], - buf, len); - uhdr = (struct udpip_hdr *)buf; - hdr = (struct hc_hdr *)&buf[UIP_IPUDPH_LEN - HC_HLEN]; - - uip_ipaddr_copy(&uhdr->srcipaddr, &hdr->srcipaddr); - uhdr->srcport = hdr->flagsport & UIP_HTONS(0x3fff); - uhdr->destport = hdr->flagsport & UIP_HTONS(0x3fff); - - uhdr->udplen = len; - - len += UIP_IPUDPH_LEN - HC_HLEN; - - - uhdr->vhl = 0x45; - uhdr->tos = 0; - uhdr->len[0] = 0; - uhdr->len[1] = len; - uhdr->ipid[0] = uhdr->ipid[1] = 0xAD; - uhdr->ipoffset[0] = uhdr->ipoffset[1] = 0; - uhdr->ttl = 2; - uhdr->proto = UIP_PROTO_UDP; - uip_ipaddr_copy(&uhdr->destipaddr, &uip_broadcast_addr); - uhdr->udpchksum = 0; - - uhdr->ipchksum = 0; - uhdr->ipchksum = ~(uip_ipchksum()); - - } - - return len; -} -/*---------------------------------------------------------------------------*/ diff --git a/core/net/hc.h b/core/net/hc.h deleted file mode 100644 index 21e5e8428..000000000 --- a/core/net/hc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -/** - * \file - * TCP/IP header compression header file. - * \author Adam Dunkels - * - */ - -#ifndef __HC_H__ -#define __HC_H__ - -#include "net/uip.h" - -void hc_init(void); -int hc_compress(uint8_t *buf, int len); -int hc_inflate(uint8_t *buf, int len); - -#define HC_HLEN 6 - -#endif /* __HC_H__ */ diff --git a/core/net/mac/Makefile.mac b/core/net/mac/Makefile.mac index 91cff524e..1d80a7fa3 100644 --- a/core/net/mac/Makefile.mac +++ b/core/net/mac/Makefile.mac @@ -1,2 +1,2 @@ CONTIKI_SOURCEFILES += cxmac.c xmac.c nullmac.c lpp.c frame802154.c sicslowmac.c nullrdc.c nullrdc-noframer.c mac.c -CONTIKI_SOURCEFILES += framer-nullmac.c framer-802154.c csma.c contikimac.c phase.c +CONTIKI_SOURCEFILES += framer-nullmac.c framer-802154.c csma.c contikimac.c phase.c mac-sequence.c diff --git a/core/net/mac/contikimac.c b/core/net/mac/contikimac.c index 66faafa5f..626a9daca 100644 --- a/core/net/mac/contikimac.c +++ b/core/net/mac/contikimac.c @@ -44,6 +44,7 @@ #include "dev/radio.h" #include "dev/watchdog.h" #include "lib/random.h" +#include "net/mac/mac-sequence.h" #include "net/mac/contikimac.h" #include "net/netstack.h" #include "net/rime.h" @@ -263,18 +264,6 @@ static struct compower_activity current_packet; #define MIN(a, b) ((a) < (b)? (a) : (b)) #endif /* MIN */ -struct seqno { - rimeaddr_t sender; - uint8_t seqno; -}; - -#ifdef NETSTACK_CONF_MAC_SEQNO_HISTORY -#define MAX_SEQNOS NETSTACK_CONF_MAC_SEQNO_HISTORY -#else /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ -#define MAX_SEQNOS 16 -#endif /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ -static struct seqno received_seqnos[MAX_SEQNOS]; - #if CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT static struct timer broadcast_rate_timer; static int broadcast_rate_counter; @@ -980,27 +969,13 @@ input_packet(void) ctimer_stop(&ct); } - /* Check for duplicate packet by comparing the sequence number - of the incoming packet with the last few ones we saw. */ - { - int i; - for(i = 0; i < MAX_SEQNOS; ++i) { - if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno && - rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), - &received_seqnos[i].sender)) { - /* Drop the packet. */ - /* printf("Drop duplicate ContikiMAC layer packet\n");*/ - return; - } - } - for(i = MAX_SEQNOS - 1; i > 0; --i) { - memcpy(&received_seqnos[i], &received_seqnos[i - 1], - sizeof(struct seqno)); - } - received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); - rimeaddr_copy(&received_seqnos[0].sender, - packetbuf_addr(PACKETBUF_ADDR_SENDER)); + /* Check for duplicate packet. */ + if(mac_sequence_is_duplicate()) { + /* Drop the packet. */ + /* printf("Drop duplicate ContikiMAC layer packet\n");*/ + return; } + mac_sequence_register_seqno(); #if CONTIKIMAC_CONF_COMPOWER /* Accumulate the power consumption for the packet reception. */ diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index 66528e542..b75a812ca 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -306,9 +306,16 @@ send_packet(mac_callback_t sent, void *ptr) { struct rdc_buf_list *q; struct neighbor_queue *n; + static uint8_t initialized = 0; static uint16_t seqno; const rimeaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); + if(!initialized) { + initialized = 1; + /* Initialize the sequence number to a random value as per 802.15.4. */ + seqno = random_rand(); + } + if(seqno == 0) { /* PACKETBUF_ATTR_MAC_SEQNO cannot be zero, due to a pecuilarity in framer-802154.c. */ diff --git a/core/net/mac/csma.h b/core/net/mac/csma.h index b069847e9..456b828ce 100644 --- a/core/net/mac/csma.h +++ b/core/net/mac/csma.h @@ -38,8 +38,8 @@ * Adam Dunkels */ -#ifndef __CSMA_H__ -#define __CSMA_H__ +#ifndef CSMA_H_ +#define CSMA_H_ #include "net/mac/mac.h" #include "dev/radio.h" @@ -48,4 +48,4 @@ extern const struct mac_driver csma_driver; const struct mac_driver *csma_init(const struct mac_driver *r); -#endif /* __CSMA_H__ */ +#endif /* CSMA_H_ */ diff --git a/core/net/mac/cxmac.h b/core/net/mac/cxmac.h index 21f157a0a..ea55dece1 100644 --- a/core/net/mac/cxmac.h +++ b/core/net/mac/cxmac.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __CXMAC_H__ -#define __CXMAC_H__ +#ifndef CXMAC_H_ +#define CXMAC_H_ #include "sys/rtimer.h" #include "net/mac/rdc.h" @@ -60,4 +60,4 @@ struct cxmac_config { extern const struct rdc_driver cxmac_driver; -#endif /* __CXMAC_H__ */ +#endif /* CXMAC_H_ */ diff --git a/core/net/mac/framer-802154.h b/core/net/mac/framer-802154.h index 49a2368a8..fe4fced80 100644 --- a/core/net/mac/framer-802154.h +++ b/core/net/mac/framer-802154.h @@ -36,11 +36,11 @@ * Joakim Eriksson */ -#ifndef __FRAMER_802154_H__ -#define __FRAMER_802154_H__ +#ifndef FRAMER_802154_H_ +#define FRAMER_802154_H_ #include "net/mac/framer.h" extern const struct framer framer_802154; -#endif /* __FRAMER_802154_H__ */ +#endif /* FRAMER_802154_H_ */ diff --git a/core/net/mac/framer-nullmac.h b/core/net/mac/framer-nullmac.h index 9936cccac..b745393db 100644 --- a/core/net/mac/framer-nullmac.h +++ b/core/net/mac/framer-nullmac.h @@ -36,11 +36,11 @@ * Joakim Eriksson */ -#ifndef __FRAMER_NULLMAC_H__ -#define __FRAMER_NULLMAC_H__ +#ifndef FRAMER_NULLMAC_H_ +#define FRAMER_NULLMAC_H_ #include "net/mac/framer.h" extern const struct framer framer_nullmac; -#endif /* __FRAMER_NULLMAC_H__ */ +#endif /* FRAMER_NULLMAC_H_ */ diff --git a/core/net/mac/framer.h b/core/net/mac/framer.h index 00594e10d..3204dc0c9 100644 --- a/core/net/mac/framer.h +++ b/core/net/mac/framer.h @@ -38,8 +38,8 @@ * Joakim Eriksson */ -#ifndef __FRAMER_H__ -#define __FRAMER_H__ +#ifndef FRAMER_H_ +#define FRAMER_H_ #define FRAMER_FAILED -1 @@ -50,4 +50,4 @@ struct framer { }; -#endif /* __FRAMER_H__ */ +#endif /* FRAMER_H_ */ diff --git a/core/net/mac/lpp.h b/core/net/mac/lpp.h index 416d224d8..f80541476 100644 --- a/core/net/mac/lpp.h +++ b/core/net/mac/lpp.h @@ -40,12 +40,12 @@ * Adam Dunkels */ -#ifndef __LPP_H__ -#define __LPP_H__ +#ifndef LPP_H_ +#define LPP_H_ #include "net/mac/rdc.h" #include "dev/radio.h" extern const struct rdc_driver lpp_driver; -#endif /* __LPP_H__ */ +#endif /* LPP_H_ */ diff --git a/platform/msb430/apps/test-abc.c b/core/net/mac/mac-sequence.c similarity index 51% rename from platform/msb430/apps/test-abc.c rename to core/net/mac/mac-sequence.c index 5f2f7180a..be646607f 100644 --- a/platform/msb430/apps/test-abc.c +++ b/core/net/mac/mac-sequence.c @@ -1,5 +1,9 @@ /* - * Copyright (c) 2007, Swedish Institute of Computer Science. + * Copyright (c) 2010, Swedish Institute of Computer Science. + * All rights reserved. + * + * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ + * Benoît Thébaudeau * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,71 +36,74 @@ /** * \file - * Testing the abc layer in Rime + * MAC sequence numbers management * \author * Adam Dunkels + * Benoît Thébaudeau */ -#include "contiki.h" +#include + +#include "contiki-net.h" +#include "net/mac/mac-sequence.h" +#include "net/packetbuf.h" #include "net/rime.h" -#include "sys/node-id.h" -#include +struct seqno { + rimeaddr_t sender; + uint8_t seqno; +}; -#ifndef SENDER_ID -#define SENDER_ID 1 -#endif - -#ifndef SEND_INTERVAL -#define SEND_INTERVAL (CLOCK_SECOND * 3) -#endif +#ifdef NETSTACK_CONF_MAC_SEQNO_HISTORY +#define MAX_SEQNOS NETSTACK_CONF_MAC_SEQNO_HISTORY +#else /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ +#define MAX_SEQNOS 16 +#endif /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ +static struct seqno received_seqnos[MAX_SEQNOS]; /*---------------------------------------------------------------------------*/ -PROCESS(test_abc_process, "ABC test"); -AUTOSTART_PROCESSES(&test_abc_process); -/*---------------------------------------------------------------------------*/ -static void -abc_recv(struct abc_conn *c) +int +mac_sequence_is_duplicate(void) { - char *s; int i; - s = packetbuf_dataptr(); - - printf("abc message received '%s'\n", (char *)packetbuf_dataptr()); - printf("message length: %u\n", packetbuf_datalen()); - for (i = 0; i < packetbuf_datalen(); i++) { - printf("0x%x ", s[i]); + /* + * Check for duplicate packet by comparing the sequence number of the incoming + * packet with the last few ones we saw. + */ + for(i = 0; i < MAX_SEQNOS; ++i) { + if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), + &received_seqnos[i].sender)) { + if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno) { + /* Duplicate packet. */ + return 1; + } + break; + } } - printf("\n"); + return 0; } -const static struct abc_callbacks abc_call = {abc_recv}; -static struct abc_conn abc; /*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_abc_process, ev, data) +void +mac_sequence_register_seqno(void) { - static unsigned i; - static struct etimer et; - static int len; - static char buf[32]; + int i, j; - PROCESS_EXITHANDLER(abc_close(&abc);) - - PROCESS_BEGIN(); - - abc_open(&abc, 128, &abc_call); - - while(1) { - etimer_set(&et, SEND_INTERVAL); - PROCESS_WAIT_EVENT(); - if (etimer_expired(&et) && node_id == SENDER_ID) { - len = snprintf(buf, sizeof (buf), "%u", ++i); - printf("Sending packet %d\n", i); - packetbuf_copyfrom(buf, len + 1); - abc_send(&abc); + /* Locate possible previous sequence number for this address. */ + for(i = 0; i < MAX_SEQNOS; ++i) { + if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), + &received_seqnos[i].sender)) { + i++; + break; } } - PROCESS_END(); + /* Keep the last sequence number for each address as per 802.15.4e. */ + for(j = i - 1; j > 0; --j) { + memcpy(&received_seqnos[j], &received_seqnos[j - 1], sizeof(struct seqno)); + } + received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); + rimeaddr_copy(&received_seqnos[0].sender, + packetbuf_addr(PACKETBUF_ADDR_SENDER)); } /*---------------------------------------------------------------------------*/ diff --git a/platform/sentilla-usb/leds-arch.c b/core/net/mac/mac-sequence.h similarity index 62% rename from platform/sentilla-usb/leds-arch.c rename to core/net/mac/mac-sequence.h index 6430f76d6..455160c2d 100644 --- a/platform/sentilla-usb/leds-arch.c +++ b/core/net/mac/mac-sequence.h @@ -2,6 +2,10 @@ * Copyright (c) 2010, Swedish Institute of Computer Science. * All rights reserved. * + * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ + * Benoît Thébaudeau + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -32,38 +36,31 @@ /** * \file - * A leds implementation for the sentilla usb platform + * Header file for MAC sequence numbers management * \author * Adam Dunkels - * Niclas Finne - * Joakim Eriksson + * Benoît Thébaudeau */ -#include "contiki-conf.h" -#include "dev/leds.h" +#ifndef MAC_SEQUENCE_H +#define MAC_SEQUENCE_H -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - LEDS_PxDIR |= (LEDS_CONF_RED | LEDS_CONF_GREEN); - LEDS_PxOUT = (LEDS_CONF_RED | LEDS_CONF_GREEN); -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_arch_get(void) -{ - unsigned char leds; - leds = LEDS_PxOUT; - return ((leds & LEDS_CONF_RED) ? 0 : LEDS_RED) - | ((leds & LEDS_CONF_GREEN) ? 0 : LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(unsigned char leds) -{ - LEDS_PxOUT = (LEDS_PxOUT & ~(LEDS_CONF_RED|LEDS_CONF_GREEN)) - | ((leds & LEDS_RED) ? 0 : LEDS_CONF_RED) - | ((leds & LEDS_GREEN) ? 0 : LEDS_CONF_GREEN); -} -/*---------------------------------------------------------------------------*/ +/** + * \brief Tell whether the packetbuf is a duplicate packet + * \return Non-zero if the packetbuf is a duplicate packet, zero otherwise + * + * This function is used to check for duplicate packet by comparing + * the sequence number of the incoming packet with the last few ones + * we saw, filtering with the Rime address. + */ +int mac_sequence_is_duplicate(void); + +/** + * \brief Register the sequence number of the packetbuf + * + * This function is used to add the sequence number of the incoming + * packet to the history. + */ +void mac_sequence_register_seqno(void); + +#endif /* MAC_SEQUENCE_H */ diff --git a/core/net/mac/mac.h b/core/net/mac/mac.h index 4dcc2c1de..8ab55bddd 100644 --- a/core/net/mac/mac.h +++ b/core/net/mac/mac.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __MAC_H__ -#define __MAC_H__ +#ifndef MAC_H_ +#define MAC_H_ #include "contiki-conf.h" #include "dev/radio.h" @@ -98,4 +98,4 @@ enum { MAC_TX_ERR_FATAL, }; -#endif /* __MAC_H__ */ +#endif /* MAC_H_ */ diff --git a/core/net/mac/nullmac.h b/core/net/mac/nullmac.h index 44820b3f0..6767bfc38 100644 --- a/core/net/mac/nullmac.h +++ b/core/net/mac/nullmac.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __NULLMAC_H__ -#define __NULLMAC_H__ +#ifndef NULLMAC_H_ +#define NULLMAC_H_ #include "net/mac/mac.h" #include "dev/radio.h" @@ -46,4 +46,4 @@ extern const struct mac_driver nullmac_driver; -#endif /* __NULLMAC_H__ */ +#endif /* NULLMAC_H_ */ diff --git a/core/net/mac/nullrdc-noframer.h b/core/net/mac/nullrdc-noframer.h index 8ba2cd458..fd66a37e5 100644 --- a/core/net/mac/nullrdc-noframer.h +++ b/core/net/mac/nullrdc-noframer.h @@ -37,12 +37,12 @@ * Adam Dunkels */ -#ifndef __NULLRDC_NOFRAMER_H__ -#define __NULLRDC_NOFRAMER_H__ +#ifndef NULLRDC_NOFRAMER_H_ +#define NULLRDC_NOFRAMER_H_ #include "net/mac/rdc.h" #include "dev/radio.h" extern const struct rdc_driver nullrdc_noframer_driver; -#endif /* __NULLRDC_NOFRAMER_H__ */ +#endif /* NULLRDC_NOFRAMER_H_ */ diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 6d4117953..d4ffd6833 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -38,6 +38,7 @@ * Niclas Finne */ +#include "net/mac/mac-sequence.h" #include "net/mac/nullrdc.h" #include "net/packetbuf.h" #include "net/queuebuf.h" @@ -107,21 +108,6 @@ #define ACK_LEN 3 -#if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW -struct seqno { - rimeaddr_t sender; - uint8_t seqno; -}; - -#ifdef NETSTACK_CONF_MAC_SEQNO_HISTORY -#define MAX_SEQNOS NETSTACK_CONF_MAC_SEQNO_HISTORY -#else /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ -#define MAX_SEQNOS 8 -#endif /* NETSTACK_CONF_MAC_SEQNO_HISTORY */ - -static struct seqno received_seqnos[MAX_SEQNOS]; -#endif /* NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW */ - /*---------------------------------------------------------------------------*/ static int send_one_packet(mac_callback_t sent, void *ptr) @@ -312,27 +298,14 @@ packet_input(void) int duplicate = 0; #if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW - /* Check for duplicate packet by comparing the sequence number - of the incoming packet with the last few ones we saw. */ - int i; - for(i = 0; i < MAX_SEQNOS; ++i) { - if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno && - rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), - &received_seqnos[i].sender)) { - /* Drop the packet. */ - PRINTF("nullrdc: drop duplicate link layer packet %u\n", - packetbuf_attr(PACKETBUF_ATTR_PACKET_ID)); - duplicate = 1; - } - } - if(!duplicate) { - for(i = MAX_SEQNOS - 1; i > 0; --i) { - memcpy(&received_seqnos[i], &received_seqnos[i - 1], - sizeof(struct seqno)); - } - received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); - rimeaddr_copy(&received_seqnos[0].sender, - packetbuf_addr(PACKETBUF_ADDR_SENDER)); + /* Check for duplicate packet. */ + duplicate = mac_sequence_is_duplicate(); + if(duplicate) { + /* Drop the packet. */ + PRINTF("nullrdc: drop duplicate link layer packet %u\n", + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID)); + } else { + mac_sequence_register_seqno(); } #endif /* NULLRDC_802154_AUTOACK */ diff --git a/core/net/mac/nullrdc.h b/core/net/mac/nullrdc.h index f58cf5b56..48ac1c0f0 100644 --- a/core/net/mac/nullrdc.h +++ b/core/net/mac/nullrdc.h @@ -38,11 +38,11 @@ * Niclas Finne */ -#ifndef __NULLRDC_H__ -#define __NULLRDC_H__ +#ifndef NULLRDC_H_ +#define NULLRDC_H_ #include "net/mac/rdc.h" extern const struct rdc_driver nullrdc_driver; -#endif /* __NULLRDC_H__ */ +#endif /* NULLRDC_H_ */ diff --git a/core/net/mac/rdc.h b/core/net/mac/rdc.h index fe732eac3..9a47605b7 100644 --- a/core/net/mac/rdc.h +++ b/core/net/mac/rdc.h @@ -38,8 +38,8 @@ * Niclas Finne */ -#ifndef __RDC_H__ -#define __RDC_H__ +#ifndef RDC_H_ +#define RDC_H_ #include "contiki-conf.h" #include "net/mac/mac.h" @@ -79,4 +79,4 @@ struct rdc_driver { unsigned short (* channel_check_interval)(void); }; -#endif /* __RDC_H__ */ +#endif /* RDC_H_ */ diff --git a/core/net/mac/sicslowmac.h b/core/net/mac/sicslowmac.h index b96797d70..e7bf1a625 100644 --- a/core/net/mac/sicslowmac.h +++ b/core/net/mac/sicslowmac.h @@ -42,12 +42,12 @@ * Joakim Eriksson */ -#ifndef __SICSLOWMAC_H__ -#define __SICSLOWMAC_H__ +#ifndef SICSLOWMAC_H_ +#define SICSLOWMAC_H_ #include "net/mac/rdc.h" #include "dev/radio.h" extern const struct rdc_driver sicslowmac_driver; -#endif /* __SICSLOWMAC_H__ */ +#endif /* SICSLOWMAC_H_ */ diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index 71027ad69..94dab9734 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -44,6 +44,7 @@ #include "dev/watchdog.h" #include "lib/random.h" #include "net/netstack.h" +#include "net/mac/mac-sequence.h" #include "net/mac/xmac.h" #include "net/rime.h" #include "net/rime/timesynch.h" @@ -219,14 +220,6 @@ static rtimer_clock_t stream_until; #define MIN(a, b) ((a) < (b)? (a) : (b)) #endif /* MIN */ -struct seqno { - rimeaddr_t sender; - uint8_t seqno; -}; - -#define MAX_SEQNOS 8 -static struct seqno received_seqnos[MAX_SEQNOS]; - /*---------------------------------------------------------------------------*/ static void @@ -807,26 +800,12 @@ input_packet(void) asleep. */ off(); - /* Check for duplicate packet by comparing the sequence number - of the incoming packet with the last few ones we saw. */ - { - int i; - for(i = 0; i < MAX_SEQNOS; ++i) { - if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno && - rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER), - &received_seqnos[i].sender)) { - /* Drop the packet. */ - return; - } - } - for(i = MAX_SEQNOS - 1; i > 0; --i) { - memcpy(&received_seqnos[i], &received_seqnos[i - 1], - sizeof(struct seqno)); - } - received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); - rimeaddr_copy(&received_seqnos[0].sender, - packetbuf_addr(PACKETBUF_ADDR_SENDER)); + /* Check for duplicate packet. */ + if(mac_sequence_is_duplicate()) { + /* Drop the packet. */ + return; } + mac_sequence_register_seqno(); #if XMAC_CONF_COMPOWER /* Accumulate the power consumption for the packet reception. */ diff --git a/core/net/mac/xmac.h b/core/net/mac/xmac.h index 8510b9eff..93991c391 100644 --- a/core/net/mac/xmac.h +++ b/core/net/mac/xmac.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __XMAC_H__ -#define __XMAC_H__ +#ifndef XMAC_H_ +#define XMAC_H_ #include "sys/rtimer.h" #include "net/mac/rdc.h" @@ -61,4 +61,4 @@ extern const struct rdc_driver xmac_driver; void xmac_set_announcement_radio_txpower(int txpower); -#endif /* __XMAC_H__ */ +#endif /* XMAC_H_ */ diff --git a/core/net/nbr-table.h b/core/net/nbr-table.h index 763c0d2a5..13130519b 100644 --- a/core/net/nbr-table.h +++ b/core/net/nbr-table.h @@ -32,8 +32,8 @@ * Joris Borms */ -#ifndef _NBR_TABLE_H_ -#define _NBR_TABLE_H_ +#ifndef NBR_TABLE_H_ +#define NBR_TABLE_H_ #include "contiki.h" #include "net/rime/rimeaddr.h" @@ -100,4 +100,4 @@ int nbr_table_unlock(nbr_table_t *table, nbr_table_item_t *item); rimeaddr_t *nbr_table_get_lladdr(nbr_table_t *table, const nbr_table_item_t *item); /** @} */ -#endif /* _NBR_TABLE_H_ */ +#endif /* NBR_TABLE_H_ */ diff --git a/core/net/packetbuf.h b/core/net/packetbuf.h index da16bd5e2..12d7b49d5 100644 --- a/core/net/packetbuf.h +++ b/core/net/packetbuf.h @@ -49,8 +49,8 @@ * Adam Dunkels */ -#ifndef __PACKETBUF_H__ -#define __PACKETBUF_H__ +#ifndef PACKETBUF_H_ +#define PACKETBUF_H_ #include "contiki-conf.h" #include "net/rime/rimeaddr.h" @@ -441,6 +441,6 @@ struct packetbuf_attrlist { uint8_t len; }; -#endif /* __PACKETBUF_H__ */ +#endif /* PACKETBUF_H_ */ /** @} */ /** @} */ diff --git a/core/net/packetqueue.h b/core/net/packetqueue.h index 45ccc980b..941313dc8 100644 --- a/core/net/packetqueue.h +++ b/core/net/packetqueue.h @@ -50,8 +50,8 @@ * Adam Dunkels */ -#ifndef __PACKETQUEUE_H__ -#define __PACKETQUEUE_H__ +#ifndef PACKETQUEUE_H_ +#define PACKETQUEUE_H_ #include "lib/list.h" #include "lib/memb.h" @@ -216,7 +216,7 @@ void *packetqueue_ptr(struct packetqueue_item *i); */ -#endif /* __PACKETQUEUE_H__ */ +#endif /* PACKETQUEUE_H_ */ /** @} */ /** @} */ diff --git a/core/net/psock.h b/core/net/psock.h index 0fb9233cd..07759b03d 100644 --- a/core/net/psock.h +++ b/core/net/psock.h @@ -83,8 +83,8 @@ * */ -#ifndef __PSOCK_H__ -#define __PSOCK_H__ +#ifndef PSOCK_H_ +#define PSOCK_H_ #include "contiki.h" #include "contiki-lib.h" @@ -398,7 +398,7 @@ char psock_newdata(struct psock *s); #define PSOCK_WAIT_THREAD(psock, condition) \ PT_WAIT_THREAD(&((psock)->pt), (condition)) -#endif /* __PSOCK_H__ */ +#endif /* PSOCK_H_ */ /** @} */ /** @} */ diff --git a/core/net/queuebuf.h b/core/net/queuebuf.h index d171ef043..8373753b0 100644 --- a/core/net/queuebuf.h +++ b/core/net/queuebuf.h @@ -50,8 +50,8 @@ * Adam Dunkels */ -#ifndef __QUEUEBUF_H__ -#define __QUEUEBUF_H__ +#ifndef QUEUEBUF_H_ +#define QUEUEBUF_H_ #include "net/packetbuf.h" @@ -108,7 +108,7 @@ packetbuf_attr_t queuebuf_attr(struct queuebuf *b, uint8_t type); void queuebuf_debug_print(void); -#endif /* __QUEUEBUF_H__ */ +#endif /* QUEUEBUF_H_ */ /** @} */ /** @} */ diff --git a/core/net/rawpacket-udp.c b/core/net/rawpacket-udp.c deleted file mode 100644 index 974a4a8f3..000000000 --- a/core/net/rawpacket-udp.c +++ /dev/null @@ -1,71 +0,0 @@ -c/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Implementation of the raw packet API with broadcast UDP packets - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "contiki-net.h" - -#include "net/rawpacket-udp.h" - -#define PORT 8096 - -/*---------------------------------------------------------------------------*/ -void -rawpacket_udp_init(void) -{ - -} -/*---------------------------------------------------------------------------*/ -struct rawpacket_conn * -rawpacket_setup(int id) -{ - return (struct rawpacket_conn *)udp_broadcast_new(UIP_HTONS(PORT + id), NULL); -} -/*---------------------------------------------------------------------------*/ -void -rawpacket_send(struct rawpacket_conn *c, char *data, int datalen) -{ - uip_udp_packet_send((struct uip_udp_conn *)c, data, datalen); -} -/*---------------------------------------------------------------------------*/ -int -rawpacket_received(struct rawpacket_conn *c) -{ - return uip_newdata() && (struct uip_udp_conn *)c == uip_udp_conn; -} -/*---------------------------------------------------------------------------*/ diff --git a/core/net/rawpacket-udp.h b/core/net/rawpacket-udp.h deleted file mode 100644 index e38f350a4..000000000 --- a/core/net/rawpacket-udp.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef __RAWPACKET_UDP_H__ -#define __RAWPACKET_UDP_H__ - -#include "net/rawpacket.h" - -void rawpacket_udp_init(void); - -#endif /* __RAWPACKET_UDP_H__ */ diff --git a/core/net/rawpacket.h b/core/net/rawpacket.h deleted file mode 100644 index 1e30a814f..000000000 --- a/core/net/rawpacket.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the Contiki raw packet API interface - * \author - * Adam Dunkels - */ - -#ifndef __RAWPACKET_H__ -#define __RAWPACKET_H__ - -struct rawpacket_conn; - -struct rawpacket_conn *rawpacket_setup(int id); -void rawpacket_send(struct rawpacket_conn *c, char *data, int datalen); -int rawpacket_received(struct rawpacket_conn *c); - -#endif /* __RAWPACKET_H__ */ diff --git a/core/net/resolv.h b/core/net/resolv.h index 32a866bb9..6ef6d6ef0 100644 --- a/core/net/resolv.h +++ b/core/net/resolv.h @@ -36,8 +36,8 @@ * * */ -#ifndef __RESOLV_H__ -#define __RESOLV_H__ +#ifndef RESOLV_H_ +#define RESOLV_H_ #include "contiki.h" #include "uip.h" @@ -106,4 +106,4 @@ CCIF const char *resolv_get_hostname(void); PROCESS_NAME(resolv_process); -#endif /* __RESOLV_H__ */ +#endif /* RESOLV_H_ */ diff --git a/core/net/rime.h b/core/net/rime.h index 225c0112a..1087f7482 100644 --- a/core/net/rime.h +++ b/core/net/rime.h @@ -42,8 +42,8 @@ * Adam Dunkels */ -#ifndef __RIME_H__ -#define __RIME_H__ +#ifndef RIME_H_ +#define RIME_H_ #include "net/rime/announcement.h" #include "net/rime/collect.h" @@ -109,7 +109,7 @@ enum { RIME_ERR_CONTENTION, RIME_ERR_NOACK, }; -#endif /* __RIME_H__ */ +#endif /* RIME_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/abc.h b/core/net/rime/abc.h index b31a36684..19eebe053 100644 --- a/core/net/rime/abc.h +++ b/core/net/rime/abc.h @@ -54,8 +54,8 @@ * Adam Dunkels */ -#ifndef __ABC_H__ -#define __ABC_H__ +#ifndef ABC_H_ +#define ABC_H_ #include "net/packetbuf.h" #include "net/rime/channel.h" @@ -138,6 +138,6 @@ void abc_input(struct channel *channel); void abc_sent(struct channel *channel, int status, int num_tx); -#endif /* __ABC_H__ */ +#endif /* ABC_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/announcement.h b/core/net/rime/announcement.h index 46b59b651..e9809249a 100644 --- a/core/net/rime/announcement.h +++ b/core/net/rime/announcement.h @@ -63,8 +63,8 @@ * Adam Dunkels */ -#ifndef __ANNOUNCEMENT_H__ -#define __ANNOUNCEMENT_H__ +#ifndef ANNOUNCEMENT_H_ +#define ANNOUNCEMENT_H_ #include "net/rime/rimeaddr.h" @@ -267,7 +267,7 @@ void announcement_register_observer_callback(announcement_observer observer); * @} */ -#endif /* __ANNOUNCE_H__ */ +#endif /* ANNOUNCE_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/broadcast-announcement.h b/core/net/rime/broadcast-announcement.h index 1ec070a19..2e450b348 100644 --- a/core/net/rime/broadcast-announcement.h +++ b/core/net/rime/broadcast-announcement.h @@ -56,8 +56,8 @@ * Adam Dunkels */ -#ifndef __BROADCAST_ANNOUNCEMENT_H__ -#define __BROADCAST_ANNOUNCEMENT_H__ +#ifndef BROADCAST_ANNOUNCEMENT_H_ +#define BROADCAST_ANNOUNCEMENT_H_ void broadcast_announcement_init(uint16_t channel, clock_time_t bump_time, @@ -66,6 +66,6 @@ void broadcast_announcement_init(uint16_t channel, clock_time_t broadcast_announcement_beacon_interval(void); -#endif /* __BROADCAST_ANNOUNCEMENT_H__ */ +#endif /* BROADCAST_ANNOUNCEMENT_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/broadcast.h b/core/net/rime/broadcast.h index 169f8cb02..440564d95 100644 --- a/core/net/rime/broadcast.h +++ b/core/net/rime/broadcast.h @@ -62,8 +62,8 @@ * Adam Dunkels */ -#ifndef __BROADCAST_H__ -#define __BROADCAST_H__ +#ifndef BROADCAST_H_ +#define BROADCAST_H_ #include "net/rime/abc.h" #include "net/rime/rimeaddr.h" @@ -134,6 +134,6 @@ void broadcast_close(struct broadcast_conn *c); */ int broadcast_send(struct broadcast_conn *c); -#endif /* __BROADCAST_H__ */ +#endif /* BROADCAST_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/chameleon-bitopt.h b/core/net/rime/chameleon-bitopt.h index 83968215d..c9747a9b6 100644 --- a/core/net/rime/chameleon-bitopt.h +++ b/core/net/rime/chameleon-bitopt.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __CHAMELEON_BITOPT_H__ -#define __CHAMELEON_BITOPT_H__ +#ifndef CHAMELEON_BITOPT_H_ +#define CHAMELEON_BITOPT_H_ #include "sys/cc.h" extern CC_CONST_FUNCTION struct chameleon_module chameleon_bitopt; -#endif /* __CHAMELEON_BITOPT_H__ */ +#endif /* CHAMELEON_BITOPT_H_ */ diff --git a/core/net/rime/chameleon-raw.h b/core/net/rime/chameleon-raw.h index bcdd14745..214371ac3 100644 --- a/core/net/rime/chameleon-raw.h +++ b/core/net/rime/chameleon-raw.h @@ -37,11 +37,11 @@ * Adam Dunkels */ -#ifndef __CHAMELEON_RAW_H__ -#define __CHAMELEON_RAW_H__ +#ifndef CHAMELEON_RAW_H_ +#define CHAMELEON_RAW_H_ #include "sys/cc.h" extern CC_CONST_FUNCTION struct chameleon_module chameleon_raw; -#endif /* __CHAMELEON_RAW_H__ */ +#endif /* CHAMELEON_RAW_H_ */ diff --git a/core/net/rime/chameleon.h b/core/net/rime/chameleon.h index e63859bf4..145e78a6b 100644 --- a/core/net/rime/chameleon.h +++ b/core/net/rime/chameleon.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __CHAMELEON_H__ -#define __CHAMELEON_H__ +#ifndef CHAMELEON_H_ +#define CHAMELEON_H_ #include "net/rime/channel.h" @@ -54,4 +54,4 @@ int chameleon_hdrsize(const struct packetbuf_attrlist attrlist[]); struct channel *chameleon_parse(void); int chameleon_create(struct channel *c); -#endif /* __CHAMELEON_H__ */ +#endif /* CHAMELEON_H_ */ diff --git a/core/net/rime/channel.h b/core/net/rime/channel.h index f96a8f057..2a1e3e387 100644 --- a/core/net/rime/channel.h +++ b/core/net/rime/channel.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __CHANNEL_H__ -#define __CHANNEL_H__ +#ifndef CHANNEL_H_ +#define CHANNEL_H_ struct channel; @@ -61,4 +61,4 @@ void channel_open(struct channel *c, uint16_t channelno); void channel_close(struct channel *c); void channel_init(void); -#endif /* __CHANNEL_H__ */ +#endif /* CHANNEL_H_ */ diff --git a/core/net/rime/collect-neighbor.h b/core/net/rime/collect-neighbor.h index 1e7175546..cc6d11d49 100644 --- a/core/net/rime/collect-neighbor.h +++ b/core/net/rime/collect-neighbor.h @@ -48,8 +48,8 @@ * Adam Dunkels */ -#ifndef __COLLECT_NEIGHBOR_H__ -#define __COLLECT_NEIGHBOR_H__ +#ifndef COLLECT_NEIGHBOR_H_ +#define COLLECT_NEIGHBOR_H_ #include "net/rime/rimeaddr.h" #include "net/rime/collect-link-estimate.h" @@ -100,6 +100,6 @@ uint16_t collect_neighbor_rtmetric_link_estimate(struct collect_neighbor *n); uint16_t collect_neighbor_rtmetric(struct collect_neighbor *n); -#endif /* __COLLECT_NEIGHBOR_H__ */ +#endif /* COLLECT_NEIGHBOR_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/collect.h b/core/net/rime/collect.h index 3f2fccc1c..6d1ca249c 100644 --- a/core/net/rime/collect.h +++ b/core/net/rime/collect.h @@ -56,8 +56,8 @@ * Adam Dunkels */ -#ifndef __COLLECT_H__ -#define __COLLECT_H__ +#ifndef COLLECT_H_ +#define COLLECT_H_ #include "net/rime/announcement.h" #include "net/rime/runicast.h" @@ -144,6 +144,6 @@ void collect_print_stats(void); #define COLLECT_MAX_DEPTH (COLLECT_LINK_ESTIMATE_UNIT * 64 - 1) -#endif /* __COLLECT_H__ */ +#endif /* COLLECT_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/ipolite.h b/core/net/rime/ipolite.h index ebd1ec1d7..ee5a05bc7 100644 --- a/core/net/rime/ipolite.h +++ b/core/net/rime/ipolite.h @@ -90,8 +90,8 @@ * Adam Dunkels */ -#ifndef __IPOLITE_H__ -#define __IPOLITE_H__ +#ifndef IPOLITE_H_ +#define IPOLITE_H_ #include "sys/ctimer.h" @@ -191,7 +191,7 @@ int ipolite_send(struct ipolite_conn *c, clock_time_t interval, */ void ipolite_cancel(struct ipolite_conn *c); -#endif /* __IPOLITE_H__ */ +#endif /* IPOLITE_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/mesh.h b/core/net/rime/mesh.h index 394e428a5..e80f69235 100644 --- a/core/net/rime/mesh.h +++ b/core/net/rime/mesh.h @@ -58,8 +58,8 @@ * Adam Dunkels */ -#ifndef __MESH_H__ -#define __MESH_H__ +#ifndef MESH_H_ +#define MESH_H_ #include "net/queuebuf.h" #include "net/rime/multihop.h" @@ -141,6 +141,6 @@ int mesh_send(struct mesh_conn *c, const rimeaddr_t *dest); */ int mesh_ready(struct mesh_conn *c); -#endif /* __MESH_H__ */ +#endif /* MESH_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/multihop.h b/core/net/rime/multihop.h index 9fba72328..ccb5d5845 100644 --- a/core/net/rime/multihop.h +++ b/core/net/rime/multihop.h @@ -67,8 +67,8 @@ * Adam Dunkels */ -#ifndef __MULTIHOP_H__ -#define __MULTIHOP_H__ +#ifndef MULTIHOP_H_ +#define MULTIHOP_H_ #include "net/rime/unicast.h" #include "net/rime/rimeaddr.h" @@ -105,6 +105,6 @@ void multihop_close(struct multihop_conn *c); int multihop_send(struct multihop_conn *c, const rimeaddr_t *to); void multihop_resend(struct multihop_conn *c, const rimeaddr_t *nexthop); -#endif /* __MULTIHOP_H__ */ +#endif /* MULTIHOP_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/neighbor-discovery.h b/core/net/rime/neighbor-discovery.h index d4745c1dc..347c01c09 100644 --- a/core/net/rime/neighbor-discovery.h +++ b/core/net/rime/neighbor-discovery.h @@ -56,8 +56,8 @@ * Adam Dunkels */ -#ifndef __NEIGHBOR_DISCOVERY_H__ -#define __NEIGHBOR_DISCOVERY_H__ +#ifndef NEIGHBOR_DISCOVERY_H_ +#define NEIGHBOR_DISCOVERY_H_ #include "net/rime/broadcast.h" #include "sys/ctimer.h" @@ -90,6 +90,6 @@ void neighbor_discovery_set_val(struct neighbor_discovery_conn *c, uint16_t val) void neighbor_discovery_start(struct neighbor_discovery_conn *c, uint16_t val); -#endif /* __NEIGHBOR_DISCOVERY_H__ */ +#endif /* NEIGHBOR_DISCOVERY_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/netflood.h b/core/net/rime/netflood.h index 6bc777f7a..2b1ea65e2 100644 --- a/core/net/rime/netflood.h +++ b/core/net/rime/netflood.h @@ -71,8 +71,8 @@ * Adam Dunkels */ -#ifndef __NETFLOOD_H__ -#define __NETFLOOD_H__ +#ifndef NETFLOOD_H_ +#define NETFLOOD_H_ #include "net/queuebuf.h" #include "net/rime/ipolite.h" @@ -105,6 +105,6 @@ void netflood_close(struct netflood_conn *c); int netflood_send(struct netflood_conn *c, uint8_t seqno); -#endif /* __SIBC_H__ */ +#endif /* SIBC_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/polite-announcement.h b/core/net/rime/polite-announcement.h index 32f7b3663..a79f1c560 100644 --- a/core/net/rime/polite-announcement.h +++ b/core/net/rime/polite-announcement.h @@ -56,13 +56,13 @@ * Adam Dunkels */ -#ifndef __POLITE_ANNOUNCEMENT_H__ -#define __POLITE_ANNOUNCEMENT_H__ +#ifndef POLITE_ANNOUNCEMENT_H_ +#define POLITE_ANNOUNCEMENT_H_ void polite_announcement_init(uint16_t channel, clock_time_t min, clock_time_t max); -#endif /* __POLITE_ANNOUNCEMENT_H__ */ +#endif /* POLITE_ANNOUNCEMENT_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/polite.h b/core/net/rime/polite.h index 286eb1dca..e521c3e6c 100644 --- a/core/net/rime/polite.h +++ b/core/net/rime/polite.h @@ -90,8 +90,8 @@ * Adam Dunkels */ -#ifndef __POLITE_H__ -#define __POLITE_H__ +#ifndef POLITE_H_ +#define POLITE_H_ #include "net/rime/abc.h" #include "net/queuebuf.h" @@ -186,7 +186,7 @@ int polite_send(struct polite_conn *c, clock_time_t interval, uint8_t hdrsize); */ void polite_cancel(struct polite_conn *c); -#endif /* __POLITE_H__ */ +#endif /* POLITE_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/rime-udp.h b/core/net/rime/rime-udp.h index 7c449a1bd..35a446e3b 100644 --- a/core/net/rime/rime-udp.h +++ b/core/net/rime/rime-udp.h @@ -37,12 +37,12 @@ * Nicolas Tsiftes */ -#ifndef __UDPMAC_H__ -#define __UDPMAC_H__ +#ifndef UDPMAC_H_ +#define UDPMAC_H_ #include "net/mac/mac.h" #include "dev/radio.h" extern const struct mac_driver rime_udp_driver; -#endif /* __UDPMAC_H__ */ +#endif /* UDPMAC_H_ */ diff --git a/core/net/rime/rimeaddr.h b/core/net/rime/rimeaddr.h index 962b4389c..3bc39f7dd 100644 --- a/core/net/rime/rimeaddr.h +++ b/core/net/rime/rimeaddr.h @@ -51,8 +51,8 @@ * Adam Dunkels */ -#ifndef __RIMEADDR_H__ -#define __RIMEADDR_H__ +#ifndef RIMEADDR_H_ +#define RIMEADDR_H_ #include "contiki-conf.h" @@ -126,6 +126,6 @@ extern rimeaddr_t rimeaddr_node_addr; */ extern const rimeaddr_t rimeaddr_null; -#endif /* __RIMEADDR_H__ */ +#endif /* RIMEADDR_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/rimestats.h b/core/net/rime/rimestats.h index abdc509de..606ca5d22 100644 --- a/core/net/rime/rimestats.h +++ b/core/net/rime/rimestats.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __RIMESTATS_H__ -#define __RIMESTATS_H__ +#ifndef RIMESTATS_H_ +#define RIMESTATS_H_ struct rimestats { unsigned long tx, rx; @@ -66,4 +66,4 @@ extern struct rimestats rimestats; #define RIMESTATS_GET(x) 0 #endif /* RIMESTATS_CONF_ENABLED */ -#endif /* __RIMESTATS_H__ */ +#endif /* RIMESTATS_H_ */ diff --git a/core/net/rime/rmh.h b/core/net/rime/rmh.h index f23c5ac3a..a1216af33 100644 --- a/core/net/rime/rmh.h +++ b/core/net/rime/rmh.h @@ -62,8 +62,8 @@ * Adam Dunkels */ -#ifndef __RMH_H__ -#define __RMH_H__ +#ifndef RMH_H_ +#define RMH_H_ #include "net/rime/runicast.h" #include "net/rime/rimeaddr.h" @@ -97,6 +97,6 @@ void rmh_close(struct rmh_conn *c); int rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit, uint8_t max_hops); -#endif /* __RMH_H__ */ +#endif /* RMH_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/route-discovery.h b/core/net/rime/route-discovery.h index dd8c7c465..ec8a7814a 100644 --- a/core/net/rime/route-discovery.h +++ b/core/net/rime/route-discovery.h @@ -54,8 +54,8 @@ * Adam Dunkels */ -#ifndef __ROUTE_DISCOVERY_H__ -#define __ROUTE_DISCOVERY_H__ +#ifndef ROUTE_DISCOVERY_H_ +#define ROUTE_DISCOVERY_H_ #include "net/rime/unicast.h" #include "net/rime/netflood.h" @@ -88,6 +88,6 @@ int route_discovery_discover(struct route_discovery_conn *c, const rimeaddr_t *d void route_discovery_close(struct route_discovery_conn *c); -#endif /* __ROUTE_DISCOVERY_H__ */ +#endif /* ROUTE_DISCOVERY_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/route.h b/core/net/rime/route.h index 6e24b872d..caa65ba70 100644 --- a/core/net/rime/route.h +++ b/core/net/rime/route.h @@ -48,8 +48,8 @@ * Adam Dunkels */ -#ifndef __ROUTE_H__ -#define __ROUTE_H__ +#ifndef ROUTE_H_ +#define ROUTE_H_ #include "net/rime/rimeaddr.h" @@ -78,6 +78,6 @@ void route_set_lifetime(int seconds); int route_num(void); struct route_entry *route_get(int num); -#endif /* __ROUTE_H__ */ +#endif /* ROUTE_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/rucb.h b/core/net/rime/rucb.h index f4007e1a2..5dc53bdbd 100644 --- a/core/net/rime/rucb.h +++ b/core/net/rime/rucb.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __RUCB_H__ -#define __RUCB_H__ +#ifndef RUCB_H_ +#define RUCB_H_ #include "net/rime/runicast.h" @@ -76,4 +76,4 @@ void rucb_close(struct rucb_conn *c); int rucb_send(struct rucb_conn *c, const rimeaddr_t *receiver); -#endif /* __RUCB_H__ */ +#endif /* RUCB_H_ */ diff --git a/core/net/rime/rudolph0.h b/core/net/rime/rudolph0.h index ade55f8e3..9b62e4f4f 100644 --- a/core/net/rime/rudolph0.h +++ b/core/net/rime/rudolph0.h @@ -56,8 +56,8 @@ * Adam Dunkels */ -#ifndef __RUDOLPH0_H__ -#define __RUDOLPH0_H__ +#ifndef RUDOLPH0_H_ +#define RUDOLPH0_H_ #include "net/rime/stbroadcast.h" #include "net/rime/polite.h" @@ -116,7 +116,7 @@ void rudolph0_force_restart(struct rudolph0_conn *c); void rudolph0_set_version(struct rudolph0_conn *c, int version); int rudolph0_version(struct rudolph0_conn *c); -#endif /* __RUDOLPH0_H__ */ +#endif /* RUDOLPH0_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/rudolph1.h b/core/net/rime/rudolph1.h index 6276322bd..a9e54ae70 100644 --- a/core/net/rime/rudolph1.h +++ b/core/net/rime/rudolph1.h @@ -56,8 +56,8 @@ * Adam Dunkels */ -#ifndef __RUDOLPH1_H__ -#define __RUDOLPH1_H__ +#ifndef RUDOLPH1_H_ +#define RUDOLPH1_H_ #include "net/rime/trickle.h" #include "net/rime/ipolite.h" @@ -96,6 +96,6 @@ void rudolph1_close(struct rudolph1_conn *c); void rudolph1_send(struct rudolph1_conn *c, clock_time_t send_interval); void rudolph1_stop(struct rudolph1_conn *c); -#endif /* __RUDOLPH1_H__ */ +#endif /* RUDOLPH1_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/rudolph2.h b/core/net/rime/rudolph2.h index 0f88209c4..7307b573d 100644 --- a/core/net/rime/rudolph2.h +++ b/core/net/rime/rudolph2.h @@ -56,8 +56,8 @@ * Adam Dunkels */ -#ifndef __RUDOLPH2_H__ -#define __RUDOLPH2_H__ +#ifndef RUDOLPH2_H_ +#define RUDOLPH2_H_ #include "net/rime/polite.h" #include "sys/ctimer.h" @@ -99,7 +99,7 @@ void rudolph2_stop(struct rudolph2_conn *c); void rudolph2_set_version(struct rudolph2_conn *c, int version); int rudolph2_version(struct rudolph2_conn *c); -#endif /* __RUDOLPH2_H__ */ +#endif /* RUDOLPH2_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/runicast.h b/core/net/rime/runicast.h index 84cc90f02..069e452c8 100644 --- a/core/net/rime/runicast.h +++ b/core/net/rime/runicast.h @@ -75,8 +75,8 @@ * Adam Dunkels */ -#ifndef __RUNICAST_H__ -#define __RUNICAST_H__ +#ifndef RUNICAST_H_ +#define RUNICAST_H_ #include "net/rime/stunicast.h" @@ -112,6 +112,6 @@ int runicast_send(struct runicast_conn *c, const rimeaddr_t *receiver, uint8_t runicast_is_transmitting(struct runicast_conn *c); -#endif /* __RUNICAST_H__ */ +#endif /* RUNICAST_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/stbroadcast.h b/core/net/rime/stbroadcast.h index 8fc24f995..6d7f175ee 100644 --- a/core/net/rime/stbroadcast.h +++ b/core/net/rime/stbroadcast.h @@ -57,8 +57,8 @@ * Adam Dunkels */ -#ifndef __STBROADCAST_H__ -#define __STBROADCAST_H__ +#ifndef STBROADCAST_H_ +#define STBROADCAST_H_ #include "sys/ctimer.h" @@ -147,7 +147,7 @@ void stbroadcast_cancel(struct stbroadcast_conn *c); */ void stbroadcast_set_timer(struct stbroadcast_conn *c, clock_time_t t); -#endif /* __STBROADCAST_H__ */ +#endif /* STBROADCAST_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/stunicast.h b/core/net/rime/stunicast.h index 24a900e9a..8cf3a4aac 100644 --- a/core/net/rime/stunicast.h +++ b/core/net/rime/stunicast.h @@ -69,8 +69,8 @@ * Adam Dunkels */ -#ifndef __STUNICAST_H__ -#define __STUNICAST_H__ +#ifndef STUNICAST_H_ +#define STUNICAST_H_ #include "sys/ctimer.h" #include "net/rime/unicast.h" @@ -107,6 +107,6 @@ void stunicast_set_timer(struct stunicast_conn *c, clock_time_t t); rimeaddr_t *stunicast_receiver(struct stunicast_conn *c); -#endif /* __STUNICAST_H__ */ +#endif /* STUNICAST_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/timesynch.h b/core/net/rime/timesynch.h index f8b12f535..a17af5064 100644 --- a/core/net/rime/timesynch.h +++ b/core/net/rime/timesynch.h @@ -64,8 +64,8 @@ * Adam Dunkels */ -#ifndef __TIMESYNCH_H__ -#define __TIMESYNCH_H__ +#ifndef TIMESYNCH_H_ +#define TIMESYNCH_H_ #include "net/mac/mac.h" #include "sys/rtimer.h" @@ -144,7 +144,7 @@ int timesynch_authority_level(void); */ void timesynch_set_authority_level(int level); -#endif /* __TIMESYNCH_H__ */ +#endif /* TIMESYNCH_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/trickle.h b/core/net/rime/trickle.h index a3430c432..4dc0fdd0f 100644 --- a/core/net/rime/trickle.h +++ b/core/net/rime/trickle.h @@ -54,8 +54,8 @@ * Adam Dunkels */ -#ifndef __TRICKLE_H__ -#define __TRICKLE_H__ +#ifndef TRICKLE_H_ +#define TRICKLE_H_ #include "sys/ctimer.h" @@ -89,6 +89,6 @@ void trickle_close(struct trickle_conn *c); void trickle_send(struct trickle_conn *c); -#endif /* __TRICKLE_H__ */ +#endif /* TRICKLE_H_ */ /** @} */ /** @} */ diff --git a/core/net/rime/unicast.h b/core/net/rime/unicast.h index 1df37b6dd..b2924b97e 100644 --- a/core/net/rime/unicast.h +++ b/core/net/rime/unicast.h @@ -59,8 +59,8 @@ * Adam Dunkels */ -#ifndef __UNICAST_H__ -#define __UNICAST_H__ +#ifndef UNICAST_H_ +#define UNICAST_H_ #include "net/rime/broadcast.h" @@ -85,6 +85,6 @@ void unicast_close(struct unicast_conn *c); int unicast_send(struct unicast_conn *c, const rimeaddr_t *receiver); -#endif /* __UNICAST_H__ */ +#endif /* UNICAST_H_ */ /** @} */ /** @} */ diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index f7d37a6e5..8f228e37b 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -78,10 +78,16 @@ NBR_TABLE(rpl_parent_t, rpl_parents); rpl_instance_t instance_table[RPL_MAX_INSTANCES]; rpl_instance_t *default_instance; /*---------------------------------------------------------------------------*/ +static void +nbr_callback(void *ptr) +{ + rpl_remove_parent(ptr); +} + void rpl_dag_init(void) { - nbr_table_register(rpl_parents, (nbr_table_callback *)rpl_remove_parent); + nbr_table_register(rpl_parents, (nbr_table_callback *)nbr_callback); } /*---------------------------------------------------------------------------*/ rpl_rank_t @@ -178,7 +184,7 @@ nullify_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank) { rpl_parent_t *p; - PRINTF("RPL: Removing parents (minimum rank %u)\n", + PRINTF("RPL: Nullifying parents (minimum rank %u)\n", minimum_rank); p = nbr_table_head(rpl_parents); @@ -541,17 +547,23 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr) * Typically, the parent is added upon receiving a DIO. */ const uip_lladdr_t *lladdr = uip_ds6_nbr_lladdr_from_ipaddr(addr); - PRINTF("RPL: rpl_add_parent lladdr %p\n", lladdr); + PRINTF("RPL: rpl_add_parent lladdr %p ", lladdr); + PRINT6ADDR(addr); + PRINTF("\n"); if(lladdr != NULL) { /* Add parent in rpl_parents */ p = nbr_table_add_lladdr(rpl_parents, (rimeaddr_t *)lladdr); - p->dag = dag; - p->rank = dio->rank; - p->dtsn = dio->dtsn; - p->link_metric = RPL_INIT_LINK_METRIC * RPL_DAG_MC_ETX_DIVISOR; + if(p == NULL) { + PRINTF("RPL: rpl_add_parent p NULL\n"); + } else { + p->dag = dag; + p->rank = dio->rank; + p->dtsn = dio->dtsn; + p->link_metric = RPL_INIT_LINK_METRIC * RPL_DAG_MC_ETX_DIVISOR; #if RPL_DAG_MC != RPL_DAG_MC_NONE - memcpy(&p->mc, &dio->mc, sizeof(p->mc)); + memcpy(&p->mc, &dio->mc, sizeof(p->mc)); #endif /* RPL_DAG_MC != RPL_DAG_MC_NONE */ + } } return p; @@ -689,8 +701,8 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p) return best_dag; } /*---------------------------------------------------------------------------*/ -rpl_parent_t * -rpl_select_parent(rpl_dag_t *dag) +static rpl_parent_t * +best_parent(rpl_dag_t *dag) { rpl_parent_t *p, *best; @@ -708,6 +720,14 @@ rpl_select_parent(rpl_dag_t *dag) p = nbr_table_next(rpl_parents, p); } + return best; +} +/*---------------------------------------------------------------------------*/ +rpl_parent_t * +rpl_select_parent(rpl_dag_t *dag) +{ + rpl_parent_t *best = best_parent(dag); + if(best != NULL) { rpl_set_preferred_parent(dag, best); } @@ -776,9 +796,7 @@ rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent) PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINTF("\n"); - list_remove(dag_src->parents, parent); parent->dag = dag_dst; - list_add(dag_dst->parents, parent); } /*---------------------------------------------------------------------------*/ rpl_dag_t * @@ -1192,7 +1210,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) } else if(dio->rank == INFINITE_RANK && dag->joined) { rpl_reset_dio_timer(instance); } - + /* Prefix Information Option treated to add new prefix */ if(dio->prefix_info.length != 0) { if(dio->prefix_info.flags & UIP_ND6_RA_FLAG_AUTONOMOUS) { @@ -1277,4 +1295,10 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) p->dtsn = dio->dtsn; } /*---------------------------------------------------------------------------*/ +void +rpl_lock_parent(rpl_parent_t *p) +{ + nbr_table_lock(rpl_parents, p); +} +/*---------------------------------------------------------------------------*/ #endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index e2293c8ec..310c056cb 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -69,6 +69,7 @@ rpl_verify_header(int uip_ext_opt_offset) rpl_instance_t *instance; int down; uint8_t sender_closer; + uip_ds6_route_t *route; if(UIP_EXT_HDR_OPT_RPL_BUF->opt_len != RPL_HDR_OPT_LEN) { PRINTF("RPL: Bad header option! (wrong length)\n"); @@ -83,11 +84,11 @@ rpl_verify_header(int uip_ext_opt_offset) } if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_FWD_ERR) { + PRINTF("RPL: Forward error!\n"); /* We should try to repair it by removing the neighbor that caused the packet to be forwareded in the first place. We drop any routes that go through the neighbor that sent the packet to us. */ - uip_ds6_route_t *route; route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr); if(route != NULL) { uip_ds6_route_rm(route); diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 72aaa461b..f1d5a5e04 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -146,7 +146,8 @@ dis_input(void) PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINTF("\n"); - for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { + for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; + instance < end; ++instance) { if(instance->used == 1) { #if RPL_LEAF_ONLY if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) { @@ -578,6 +579,7 @@ dao_input(void) int i; int learned_from; rpl_parent_t *p; + uip_ds6_nbr_t *nbr; prefixlen = 0; @@ -667,6 +669,20 @@ dao_input(void) PRINTF("\n"); rep->state.nopath_received = 1; rep->state.lifetime = DAO_EXPIRATION_TIMEOUT; + + /* We forward the incoming no-path DAO to our parent, if we have + one. */ + if(dag->preferred_parent != NULL && + rpl_get_parent_ipaddr(dag->preferred_parent) != NULL) { + PRINTF("RPL: Forwarding no-path DAO to parent "); + PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent)); + PRINTF("\n"); + uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent), + ICMP6_RPL, RPL_CODE_DAO, buffer_length); + } + if(flags & RPL_DAO_K_FLAG) { + dao_ack_output(instance, &dao_sender_addr, sequence); + } } return; } @@ -700,6 +716,32 @@ dao_input(void) } PRINTF("RPL: adding DAO route\n"); + + if((nbr = uip_ds6_nbr_lookup(&dao_sender_addr)) == NULL) { + if((nbr = uip_ds6_nbr_add(&dao_sender_addr, + (uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER), + 0, NBR_REACHABLE)) != NULL) { + /* set reachable timer */ + stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); + PRINTF("RPL: Neighbor added to neighbor cache "); + PRINT6ADDR(&dao_sender_addr); + PRINTF(", "); + PRINTLLADDR((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); + PRINTF("\n"); + } else { + PRINTF("RPL: Out of Memory, dropping DAO from "); + PRINT6ADDR(&dao_sender_addr); + PRINTF(", "); + PRINTLLADDR((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER)); + PRINTF("\n"); + return; + } + } else { + PRINTF("RPL: Neighbor already in neighbor cache\n"); + } + + rpl_lock_parent(p); + rep = rpl_add_route(dag, &prefix, prefixlen, &dao_sender_addr); if(rep == NULL) { RPL_STAT(rpl_stats.mem_overflows++); @@ -751,6 +793,11 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime) /* Destination Advertisement Object */ + /* If we are in feather mode, we should not send any DAOs */ + if(rpl_get_mode() == RPL_MODE_FEATHER) { + return; + } + if(parent == NULL) { PRINTF("RPL dao_output_target error parent NULL\n"); return; diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index bc307e459..0aaee680e 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -304,11 +304,17 @@ uip_ds6_route_t *rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len, uip_ipaddr_t *next_hop); void rpl_purge_routes(void); +/* Lock a parent in the neighbor cache. */ +void rpl_lock_parent(rpl_parent_t *p); + /* Objective function. */ rpl_of_t *rpl_find_of(rpl_ocp_t); /* Timer functions. */ void rpl_schedule_dao(rpl_instance_t *); +void rpl_schedule_dao_immediately(rpl_instance_t *); +void rpl_cancel_dao(rpl_instance_t *instance); + void rpl_reset_dio_timer(rpl_instance_t *); void rpl_reset_periodic_timer(void); diff --git a/core/net/rpl/rpl-timers.c b/core/net/rpl/rpl-timers.c index 51f440f3f..acc1badf0 100644 --- a/core/net/rpl/rpl-timers.c +++ b/core/net/rpl/rpl-timers.c @@ -194,6 +194,28 @@ rpl_reset_dio_timer(rpl_instance_t *instance) #endif /* RPL_LEAF_ONLY */ } /*---------------------------------------------------------------------------*/ +static void handle_dao_timer(void *ptr); +static void +set_dao_lifetime_timer(rpl_instance_t *instance) +{ + if(rpl_get_mode() == RPL_MODE_FEATHER) { + return; + } + + /* Set up another DAO within half the expiration time, if such a + time has been configured */ + if(instance->lifetime_unit != 0xffff && instance->default_lifetime != 0xff) { + clock_time_t expiration_time; + expiration_time = (clock_time_t)instance->default_lifetime * + (clock_time_t)instance->lifetime_unit * + CLOCK_SECOND / 2; + PRINTF("RPL: Scheduling DAO lifetime timer %u ticks in the future\n", + (unsigned)expiration_time); + ctimer_set(&instance->dao_lifetime_timer, expiration_time, + handle_dao_timer, instance); + } +} +/*---------------------------------------------------------------------------*/ static void handle_dao_timer(void *ptr) { @@ -215,26 +237,60 @@ handle_dao_timer(void *ptr) } else { PRINTF("RPL: No suitable DAO parent\n"); } + ctimer_stop(&instance->dao_timer); + + if(etimer_expired(&instance->dao_lifetime_timer.etimer)) { + set_dao_lifetime_timer(instance); + } } /*---------------------------------------------------------------------------*/ -void -rpl_schedule_dao(rpl_instance_t *instance) +static void +schedule_dao(rpl_instance_t *instance, clock_time_t latency) { clock_time_t expiration_time; + if(rpl_get_mode() == RPL_MODE_FEATHER) { + return; + } + expiration_time = etimer_expiration_time(&instance->dao_timer.etimer); if(!etimer_expired(&instance->dao_timer.etimer)) { PRINTF("RPL: DAO timer already scheduled\n"); } else { - expiration_time = RPL_DAO_LATENCY / 2 + - (random_rand() % (RPL_DAO_LATENCY)); + if(latency != 0) { + expiration_time = latency / 2 + + (random_rand() % (latency)); + } else { + expiration_time = 0; + } PRINTF("RPL: Scheduling DAO timer %u ticks in the future\n", (unsigned)expiration_time); ctimer_set(&instance->dao_timer, expiration_time, handle_dao_timer, instance); + + set_dao_lifetime_timer(instance); } } /*---------------------------------------------------------------------------*/ +void +rpl_schedule_dao(rpl_instance_t *instance) +{ + schedule_dao(instance, RPL_DAO_LATENCY); +} +/*---------------------------------------------------------------------------*/ +void +rpl_schedule_dao_immediately(rpl_instance_t *instance) +{ + schedule_dao(instance, 0); +} +/*---------------------------------------------------------------------------*/ +void +rpl_cancel_dao(rpl_instance_t *instance) +{ + ctimer_stop(&instance->dao_timer); + ctimer_stop(&instance->dao_lifetime_timer); +} +/*---------------------------------------------------------------------------*/ #endif /* UIP_CONF_IPV6 */ diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index 4ff9b1c6a..7e3111d65 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -57,6 +57,47 @@ rpl_stats_t rpl_stats; #endif +static enum rpl_mode mode = RPL_MODE_MESH; +/*---------------------------------------------------------------------------*/ +enum rpl_mode +rpl_get_mode(void) +{ + return mode; +} +/*---------------------------------------------------------------------------*/ +enum rpl_mode +rpl_set_mode(enum rpl_mode m) +{ + enum rpl_mode oldmode = mode; + + /* We need to do different things depending on what mode we are + switching to. */ + if(m == RPL_MODE_MESH) { + + /* If we switcht to mesh mode, we should send out a DAO message to + inform our parent that we now are reachable. Before we do this, + we must set the mode variable, since DAOs will not be send if + we are in feather mode. */ + PRINTF("RPL: switching to mesh mode\n"); + mode = m; + + if(default_instance != NULL) { + rpl_schedule_dao_immediately(default_instance); + } + } else if(m == RPL_MODE_FEATHER) { + + PRINTF("RPL: switching to feather mode\n"); + mode = m; + if(default_instance != NULL) { + rpl_cancel_dao(default_instance); + } + + } else { + mode = m; + } + + return oldmode; +} /*---------------------------------------------------------------------------*/ void rpl_purge_routes(void) diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index b83e140ed..7d2a5ee70 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -45,9 +45,6 @@ #include "net/uip-ds6.h" #include "sys/ctimer.h" -/*---------------------------------------------------------------------------*/ -/* The amount of parents that this node has in a particular DAG. */ -#define RPL_PARENT_COUNT(dag) list_length((dag)->parents) /*---------------------------------------------------------------------------*/ typedef uint16_t rpl_rank_t; typedef uint16_t rpl_ocp_t; @@ -142,7 +139,6 @@ struct rpl_dag { rpl_parent_t *preferred_parent; rpl_rank_t rank; struct rpl_instance *instance; - LIST_STRUCT(parents); rpl_prefix_t prefix_info; }; typedef struct rpl_dag rpl_dag_t; @@ -225,6 +221,7 @@ struct rpl_instance { clock_time_t dio_next_delay; /* delay for completion of dio interval */ struct ctimer dio_timer; struct ctimer dao_timer; + struct ctimer dao_lifetime_timer; }; /*---------------------------------------------------------------------------*/ @@ -247,5 +244,38 @@ uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); uint16_t rpl_get_parent_link_metric(const uip_lladdr_t *addr); void rpl_dag_init(void); + + +/** + * RPL modes + * + * The RPL module can be in either of three modes: mesh mode + * (RPL_MODE_MESH), feater mode (RPL_MODE_FEATHER), and leaf mode + * (RPL_MODE_LEAF). In mesh mode, nodes forward data for other nodes, + * and are reachable by others. In feather mode, nodes can forward + * data for other nodes, but are not reachable themselves. In leaf + * mode, nodes do not forward data for others, but are reachable by + * others. */ +enum rpl_mode { + RPL_MODE_MESH = 0, + RPL_MODE_FEATHER = 1, + RPL_MODE_LEAF = 2, +}; + +/** + * Set the RPL mode + * + * \param mode The new RPL mode + * \retval The previous RPL mode + */ +enum rpl_mode rpl_set_mode(enum rpl_mode mode); + +/** + * Get the RPL mode + * + * \retval The RPL mode + */ +enum rpl_mode rpl_get_mode(void); + /*---------------------------------------------------------------------------*/ #endif /* RPL_H */ diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c index 9fbc9baaa..844064cae 100644 --- a/core/net/sicslowpan.c +++ b/core/net/sicslowpan.c @@ -257,6 +257,8 @@ static struct timer reass_timer; #define sicslowpan_len uip_len #endif /* SICSLOWPAN_CONF_FRAG */ +static int last_rssi; + /*-------------------------------------------------------------------------*/ /* Rime Sniffer support for one single listener to enable powertrace of IP */ /*-------------------------------------------------------------------------*/ @@ -1604,6 +1606,9 @@ input(void) /* The MAC puts the 15.4 payload inside the RIME data buffer */ rime_ptr = packetbuf_dataptr(); + /* Save the RSSI of the incoming packet in case the upper layer will + want to query us for it later. */ + last_rssi = (signed short)packetbuf_attr(PACKETBUF_ATTR_RSSI); #if SICSLOWPAN_CONF_FRAG /* if reassembly timed out, cancel it */ if(timer_expired(&reass_timer)) { @@ -1666,7 +1671,12 @@ input(void) */ #define PRIORITIZE_NEW_PACKETS 1 #if PRIORITIZE_NEW_PACKETS - if(processed_ip_in_len > 0 && first_fragment + + if(!is_fragment) { + /* Prioritize non-fragment packets too. */ + sicslowpan_len = 0; + processed_ip_in_len = 0; + } else if(processed_ip_in_len > 0 && first_fragment && !rimeaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER))) { sicslowpan_len = 0; processed_ip_in_len = 0; @@ -1900,6 +1910,12 @@ sicslowpan_init(void) #endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06 */ } /*--------------------------------------------------------------------*/ +int +sicslowpan_get_last_rssi(void) +{ + return last_rssi; +} +/*--------------------------------------------------------------------*/ const struct network_driver sicslowpan_driver = { "sicslowpan", sicslowpan_init, diff --git a/core/net/sicslowpan.h b/core/net/sicslowpan.h index f4a3bc562..9905fb707 100644 --- a/core/net/sicslowpan.h +++ b/core/net/sicslowpan.h @@ -45,8 +45,8 @@ * \author Julien Abeille */ -#ifndef __SICSLOWPAN_H__ -#define __SICSLOWPAN_H__ +#ifndef SICSLOWPAN_H_ +#define SICSLOWPAN_H_ #include "net/uip.h" #include "net/mac/mac.h" @@ -317,8 +317,9 @@ struct sicslowpan_nh_compressor { }; +int sicslowpan_get_last_rssi(void); extern const struct network_driver sicslowpan_driver; -#endif /* __SICSLOWPAN_H__ */ +#endif /* SICSLOWPAN_H_ */ /** @} */ diff --git a/core/net/slipdev.h b/core/net/slipdev.h index 4026162ee..105461a59 100644 --- a/core/net/slipdev.h +++ b/core/net/slipdev.h @@ -42,8 +42,8 @@ * */ -#ifndef __SLIPDEV_H__ -#define __SLIPDEV_H__ +#ifndef SLIPDEV_H_ +#define SLIPDEV_H_ #include "uip.h" @@ -82,6 +82,6 @@ void slipdev_init(void); uint8_t slipdev_send(void); uint16_t slipdev_poll(void); -#endif /* __SLIPDEV_H__ */ +#endif /* SLIPDEV_H_ */ /** @} */ diff --git a/core/net/tcpip.h b/core/net/tcpip.h index bb4b412b5..1c968f1aa 100644 --- a/core/net/tcpip.h +++ b/core/net/tcpip.h @@ -63,8 +63,8 @@ * Author: Adam Dunkels * */ -#ifndef __TCPIP_H__ -#define __TCPIP_H__ +#ifndef TCPIP_H_ +#define TCPIP_H_ #include "contiki.h" @@ -371,7 +371,7 @@ extern unsigned char tcpip_is_forwarding; PROCESS_NAME(tcpip_process); -#endif /* __TCPIP_H__ */ +#endif /* TCPIP_H_ */ /** @} */ /** @} */ diff --git a/core/net/uaodv-def.h b/core/net/uaodv-def.h index 87592a6cd..520e897da 100644 --- a/core/net/uaodv-def.h +++ b/core/net/uaodv-def.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __UAODV_DEF_H__ -#define __UAODV_DEF_H__ +#ifndef UAODV_DEF_H_ +#define UAODV_DEF_H_ #include "net/uip.h" @@ -142,4 +142,4 @@ struct uaodv_bad_hop_ext { uip_ipaddr_t addrs[1]; }; -#endif /* __UAODV_DEF_H__ */ +#endif /* UAODV_DEF_H_ */ diff --git a/core/net/uaodv-rt.h b/core/net/uaodv-rt.h index cae943fdf..aa5964116 100644 --- a/core/net/uaodv-rt.h +++ b/core/net/uaodv-rt.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __UAODV_RT_H__ -#define __UAODV_RT_H__ +#ifndef UAODV_RT_H_ +#define UAODV_RT_H_ #include "contiki-net.h" @@ -60,4 +60,4 @@ void uaodv_rt_remove(struct uaodv_rt_entry *e); void uaodv_rt_lru(struct uaodv_rt_entry *e); void uaodv_rt_flush_all(void); -#endif /* __UAODV_RT_H__ */ +#endif /* UAODV_RT_H_ */ diff --git a/core/net/uaodv.h b/core/net/uaodv.h index 3b60ffd4f..c10484cdd 100644 --- a/core/net/uaodv.h +++ b/core/net/uaodv.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __UAODV_H__ -#define __UAODV_H__ +#ifndef UAODV_H_ +#define UAODV_H_ #include "contiki.h" #include "uaodv-rt.h" @@ -48,4 +48,4 @@ PROCESS_NAME(uaodv_process); struct uaodv_rt_entry * uaodv_request_route_to(uip_ipaddr_t *host); void uaodv_bad_dest(uip_ipaddr_t *); -#endif /* __UAODV_H__ */ +#endif /* UAODV_H_ */ diff --git a/core/net/uip-ds6-nbr.h b/core/net/uip-ds6-nbr.h index 059162710..4fe190533 100644 --- a/core/net/uip-ds6-nbr.h +++ b/core/net/uip-ds6-nbr.h @@ -43,8 +43,8 @@ * */ -#ifndef __UIP_DS6_NEIGHBOR_H__ -#define __UIP_DS6_NEIGHBOR_H__ +#ifndef UIP_DS6_NEIGHBOR_H_ +#define UIP_DS6_NEIGHBOR_H_ #include "net/uip.h" #include "net/nbr-table.h" @@ -107,4 +107,4 @@ int uip_ds6_nbr_num(void); */ uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void); -#endif /* __UIP_DS6_NEIGHBOR_H__ */ +#endif /* UIP_DS6_NEIGHBOR_H_ */ diff --git a/core/net/uip-ds6-route.c b/core/net/uip-ds6-route.c index 137191f55..5d692eb42 100644 --- a/core/net/uip-ds6-route.c +++ b/core/net/uip-ds6-route.c @@ -46,12 +46,12 @@ so that it will be maintained along with the rest of the neighbor tables in the system. */ NBR_TABLE(struct uip_ds6_route_neighbor_routes, nbr_routes); +MEMB(neighborroutememb, struct uip_ds6_route_neighbor_route, UIP_DS6_ROUTE_NB); /* Each route is repressented by a uip_ds6_route_t structure and memory for each route is allocated from the routememb memory - block. These routes are maintained on lists of route entries that - are attached to each neighbor, via the nbr_routes neighbor - table. */ + block. These routes are maintained on the routelist. */ +LIST(routelist); MEMB(routememb, uip_ds6_route_t, UIP_DS6_ROUTE_NB); /* Default routes are held on the defaultrouterlist and their @@ -82,11 +82,11 @@ assert_nbr_routes_list_sane(void) for(r = uip_ds6_route_head(), count = 0; r != NULL && - count < UIP_DS6_ROUTE_NB; + count < UIP_DS6_ROUTE_NB * 2; r = uip_ds6_route_next(r), count++); - if(count >= UIP_DS6_ROUTE_NB) { + if(count > UIP_DS6_ROUTE_NB) { printf("uip-ds6-route.c: assert_nbr_routes_list_sane route list is in infinite loop\n"); } @@ -140,6 +140,7 @@ void uip_ds6_route_init(void) { memb_init(&routememb); + list_init(routelist); nbr_table_register(nbr_routes, (nbr_table_callback *)rm_routelist_callback); @@ -155,7 +156,8 @@ static uip_lladdr_t * uip_ds6_route_nexthop_lladdr(uip_ds6_route_t *route) { if(route != NULL) { - return (uip_lladdr_t *)nbr_table_get_lladdr(nbr_routes, route->routes); + return (uip_lladdr_t *)nbr_table_get_lladdr(nbr_routes, + route->neighbor_routes); } else { return NULL; } @@ -174,17 +176,7 @@ uip_ds6_route_nexthop(uip_ds6_route_t *route) uip_ds6_route_t * uip_ds6_route_head(void) { - struct uip_ds6_route_neighbor_routes *routes; - - routes = (struct uip_ds6_route_neighbor_routes *)nbr_table_head(nbr_routes); - if(routes != NULL) { - if(list_head(routes->route_list) == NULL) { - PRINTF("uip_ds6_route_head lead_head(nbr_route_list) is NULL\n"); - } - return list_head(routes->route_list); - } else { - return NULL; - } + return list_head(routelist); } /*---------------------------------------------------------------------------*/ uip_ds6_route_t * @@ -192,18 +184,8 @@ uip_ds6_route_next(uip_ds6_route_t *r) { if(r != NULL) { uip_ds6_route_t *n = list_item_next(r); - if(n != NULL) { - return n; - } else { - struct uip_ds6_route_neighbor_routes *routes; - routes = (struct uip_ds6_route_neighbor_routes *) - nbr_table_next(nbr_routes, r->routes); - if(routes != NULL) { - return list_head(routes->route_list); - } - } + return n; } - return NULL; } /*---------------------------------------------------------------------------*/ @@ -247,6 +229,15 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr) PRINTF("uip-ds6-route: No route found\n"); } + if(found_route != NULL) { + /* If we found a route, we put it at the end of the routeslist + list. The list is ordered by how recently we looked them up: + the least recently used route will be at the start of the + list. */ + list_remove(routelist, found_route); + list_add(routelist, found_route); + } + return found_route; } /*---------------------------------------------------------------------------*/ @@ -255,6 +246,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, uip_ipaddr_t *nexthop) { uip_ds6_route_t *r; + struct uip_ds6_route_neighbor_route *nbrr; #if DEBUG != DEBUG_NONE assert_nbr_routes_list_sane(); @@ -263,8 +255,8 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, /* Get link-layer address of next hop, make sure it is in neighbor table */ const uip_lladdr_t *nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop); if(nexthop_lladdr == NULL) { - PRINTF("uip_ds6_route_add: neighbor link-local address unknown "); - PRINT6ADDR(ipaddr); + PRINTF("uip_ds6_route_add: neighbor link-local address unknown for "); + PRINT6ADDR(nexthop); PRINTF("\n"); return NULL; } @@ -279,7 +271,22 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, PRINTF("\n"); } else { struct uip_ds6_route_neighbor_routes *routes; - /* If there is no routing entry, create one */ + /* If there is no routing entry, create one. We first need to + check if we have room for this route. If not, we remove the + least recently used one we have. */ + + if(uip_ds6_route_num_routes() == UIP_DS6_ROUTE_NB) { + /* Removing the oldest route entry from the route table. The + least recently used route is the first route on the list. */ + uip_ds6_route_t *oldest; + + oldest = uip_ds6_route_head(); + PRINTF("uip_ds6_route_add: dropping route to "); + PRINT6ADDR(&oldest->ipaddr); + PRINTF("\n"); + uip_ds6_route_rm(oldest); + } + /* Every neighbor on our neighbor table holds a struct uip_ds6_route_neighbor_routes which holds a list of routes that @@ -301,9 +308,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, routes = nbr_table_add_lladdr(nbr_routes, (rimeaddr_t *)nexthop_lladdr); if(routes == NULL) { - PRINTF("uip_ds6_route_add: could not allocate a neighbor table entri for new route to "); - PRINT6ADDR(ipaddr); - PRINTF(", dropping it\n"); + /* This should not happen, as we explicitly deallocated one + route table entry above. */ + PRINTF("uip_ds6_route_add: could not allocate neighbor table entry\n"); return NULL; } LIST_STRUCT_INIT(routes, route_list); @@ -313,19 +320,30 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, r = memb_alloc(&routememb); if(r == NULL) { - PRINTF("uip_ds6_route_add: could not allocate memory for new route to "); - PRINT6ADDR(ipaddr); - PRINTF(", dropping it\n"); + /* This should not happen, as we explicitly deallocated one + route table entry above. */ + PRINTF("uip_ds6_route_add: could not allocate route\n"); return NULL; } + list_add(routelist, r); + nbrr = memb_alloc(&neighborroutememb); + if(nbrr == NULL) { + /* This should not happen, as we explicitly deallocated one + route table entry above. */ + PRINTF("uip_ds6_route_add: could not allocate neighbor route list entry\n"); + memb_free(&routememb, r); + return NULL; + } + + nbrr->route = r; /* Add the route to this neighbor */ - list_add(routes->route_list, r); + list_add(routes->route_list, nbrr); + r->neighbor_routes = routes; num_routes++; PRINTF("uip_ds6_route_add num %d\n", num_routes); - r->routes = routes; } uip_ipaddr_copy(&(r->ipaddr), ipaddr); @@ -356,23 +374,38 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, void uip_ds6_route_rm(uip_ds6_route_t *route) { + struct uip_ds6_route_neighbor_route *neighbor_route; #if DEBUG != DEBUG_NONE assert_nbr_routes_list_sane(); #endif /* DEBUG != DEBUG_NONE */ - if(route != NULL && route->routes != NULL) { + if(route != NULL && route->neighbor_routes != NULL) { PRINTF("uip_ds6_route_rm: removing route: "); PRINT6ADDR(&route->ipaddr); PRINTF("\n"); - list_remove(route->routes->route_list, route); - if(list_head(route->routes->route_list) == NULL) { + /* Remove the neighbor from the route list */ + list_remove(routelist, route); + + /* Find the corresponding neighbor_route and remove it. */ + for(neighbor_route = list_head(route->neighbor_routes->route_list); + neighbor_route != NULL && neighbor_route->route != route; + neighbor_route = list_item_next(neighbor_route)); + + if(neighbor_route == NULL) { + PRINTF("uip_ds6_route_rm: neighbor_route was NULL for "); + uip_debug_ipaddr_print(&route->ipaddr); + PRINTF("\n"); + } + list_remove(route->neighbor_routes->route_list, neighbor_route); + if(list_head(route->neighbor_routes->route_list) == NULL) { /* If this was the only route using this neighbor, remove the neibhor from the table */ PRINTF("uip_ds6_route_rm: removing neighbor too\n"); - nbr_table_remove(nbr_routes, route->routes->route_list); + nbr_table_remove(nbr_routes, route->neighbor_routes->route_list); } memb_free(&routememb, route); + memb_free(&neighborroutememb, neighbor_route); num_routes--; @@ -417,10 +450,10 @@ rm_routelist(struct uip_ds6_route_neighbor_routes *routes) #endif /* DEBUG != DEBUG_NONE */ PRINTF("uip_ds6_route_rm_routelist\n"); if(routes != NULL && routes->route_list != NULL) { - uip_ds6_route_t *r; + struct uip_ds6_route_neighbor_route *r; r = list_head(routes->route_list); while(r != NULL) { - uip_ds6_route_rm(r); + uip_ds6_route_rm(r->route); r = list_head(routes->route_list); } nbr_table_remove(nbr_routes, routes); diff --git a/core/net/uip-ds6-route.h b/core/net/uip-ds6-route.h index 2a3741da7..9603d6cde 100644 --- a/core/net/uip-ds6-route.h +++ b/core/net/uip-ds6-route.h @@ -107,7 +107,7 @@ typedef struct uip_ds6_route { routes field point to the uip_ds6_route_neighbor_routes that belong to the neighbor table entry that this routing table entry uses. */ - struct uip_ds6_route_neighbor_routes *routes; + struct uip_ds6_route_neighbor_routes *neighbor_routes; uip_ipaddr_t ipaddr; #ifdef UIP_DS6_ROUTE_STATE_TYPE UIP_DS6_ROUTE_STATE_TYPE state; @@ -115,7 +115,12 @@ typedef struct uip_ds6_route { uint8_t length; } uip_ds6_route_t; - +/** \brief A neighbor route list entry, used on the + uip_ds6_route->neighbor_routes->route_list list. */ +struct uip_ds6_route_neighbor_route { + struct uip_ds6_route_neighbor_route *next; + struct uip_ds6_route *route; +}; /** \brief An entry in the default router list */ typedef struct uip_ds6_defrt { diff --git a/core/net/uip-ds6.h b/core/net/uip-ds6.h index 1d6c2e759..93dcd6868 100644 --- a/core/net/uip-ds6.h +++ b/core/net/uip-ds6.h @@ -39,8 +39,8 @@ * */ -#ifndef __UIP_DS6_H__ -#define __UIP_DS6_H__ +#ifndef UIP_DS6_H_ +#define UIP_DS6_H_ #include "net/uip.h" #include "sys/stimer.h" @@ -337,4 +337,4 @@ uint32_t uip_ds6_compute_reachable_time(void); /** \brief compute random reachab /** @} */ /** @} */ -#endif /* __UIP_DS6_H__ */ +#endif /* UIP_DS6_H_ */ diff --git a/core/net/uip-fw-drv.h b/core/net/uip-fw-drv.h index ecc5f54e7..478022016 100644 --- a/core/net/uip-fw-drv.h +++ b/core/net/uip-fw-drv.h @@ -31,12 +31,12 @@ * Author: Adam Dunkels * */ -#ifndef __UIP_FW_DRV_H__ -#define __UIP_FW_DRV_H__ +#ifndef UIP_FW_DRV_H_ +#define UIP_FW_DRV_H_ #include "contiki.h" #include "net/uip-fw.h" PROCESS_NAME(uip_fw_process); -#endif /* __UIP_FW_DRV_H__ */ +#endif /* UIP_FW_DRV_H_ */ diff --git a/core/net/uip-fw.h b/core/net/uip-fw.h index a77adf761..d662651b9 100644 --- a/core/net/uip-fw.h +++ b/core/net/uip-fw.h @@ -42,8 +42,8 @@ * Author: Adam Dunkels * */ -#ifndef __UIP_FW_H__ -#define __UIP_FW_H__ +#ifndef UIP_FW_H_ +#define UIP_FW_H_ #include "net/uip.h" @@ -170,6 +170,6 @@ void uip_fw_periodic(void); #define UIP_FW_DROPPED 5 -#endif /* __UIP_FW_H__ */ +#endif /* UIP_FW_H_ */ /** @} */ diff --git a/core/net/uip-icmp6.h b/core/net/uip-icmp6.h index ca4b576bf..add6d7053 100644 --- a/core/net/uip-icmp6.h +++ b/core/net/uip-icmp6.h @@ -43,8 +43,8 @@ */ -#ifndef __ICMP6_H__ -#define __ICMP6_H__ +#ifndef ICMP6_H_ +#define ICMP6_H_ #include "net/uip.h" @@ -135,6 +135,6 @@ uip_icmp6_send(uip_ipaddr_t *dest, int type, int code, int payload_len); /** @} */ -#endif /*__ICMP6_H__*/ +#endif /*ICMP6_H_*/ /** @} */ diff --git a/core/net/uip-nd6.h b/core/net/uip-nd6.h index b4b97889f..de6412899 100644 --- a/core/net/uip-nd6.h +++ b/core/net/uip-nd6.h @@ -42,8 +42,8 @@ * */ -#ifndef __UIP_ND6_H__ -#define __UIP_ND6_H__ +#ifndef UIP_ND6_H_ +#define UIP_ND6_H_ #include "net/uip.h" #include "sys/stimer.h" @@ -562,6 +562,6 @@ uip_appserver_addr_get(uip_ipaddr_t *ipaddr); * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * */ -#endif /* __UIP_ND6_H__ */ +#endif /* UIP_ND6_H_ */ /** @} */ diff --git a/core/net/uip-neighbor.h b/core/net/uip-neighbor.h index 7fa7b4a35..5825f962d 100644 --- a/core/net/uip-neighbor.h +++ b/core/net/uip-neighbor.h @@ -38,8 +38,8 @@ * Adam Dunkels */ -#ifndef __UIP_NEIGHBOR_H__ -#define __UIP_NEIGHBOR_H__ +#ifndef UIP_NEIGHBOR_H_ +#define UIP_NEIGHBOR_H_ #include "net/uip.h" @@ -57,4 +57,4 @@ void uip_neighbor_update(uip_ipaddr_t *ipaddr); struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t *ipaddr); void uip_neighbor_periodic(void); -#endif /* __UIP-NEIGHBOR_H__ */ +#endif /* UIP-NEIGHBOR_H_ */ diff --git a/core/net/uip-over-mesh.c b/core/net/uip-over-mesh.c index cf204ee27..f4a1a74f1 100644 --- a/core/net/uip-over-mesh.c +++ b/core/net/uip-over-mesh.c @@ -39,7 +39,6 @@ #include -#include "net/hc.h" #include "net/uip-fw.h" #include "net/uip-over-mesh.h" #include "net/rime/route-discovery.h" @@ -105,7 +104,6 @@ recv_data(struct unicast_conn *c, const rimeaddr_t *from) } } - /* uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len);*/ PRINTF("uip-over-mesh: %d.%d: recv_data with len %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], uip_len); @@ -255,7 +253,6 @@ uip_over_mesh_send(void) receiver.u8[0], receiver.u8[1], uip_len); - /* uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len);*/ packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); diff --git a/core/net/uip-over-mesh.h b/core/net/uip-over-mesh.h index 248d75c45..332b7784c 100644 --- a/core/net/uip-over-mesh.h +++ b/core/net/uip-over-mesh.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __UIP_OVER_MESH_H__ -#define __UIP_OVER_MESH_H__ +#ifndef UIP_OVER_MESH_H_ +#define UIP_OVER_MESH_H_ #include "net/uip.h" #include "net/uip-fw.h" @@ -53,4 +53,4 @@ void uip_over_mesh_set_net(uip_ipaddr_t *addr, uip_ipaddr_t *mask); void uip_over_mesh_make_announced_gateway(void); -#endif /* __UIP-OVER-MESH_H__ */ +#endif /* UIP-OVER-MESH_H_ */ diff --git a/core/net/uip-split.h b/core/net/uip-split.h index 2cea7203f..49f55fba6 100644 --- a/core/net/uip-split.h +++ b/core/net/uip-split.h @@ -68,8 +68,8 @@ * */ -#ifndef __UIP_SPLIT_H__ -#define __UIP_SPLIT_H__ +#ifndef UIP_SPLIT_H_ +#define UIP_SPLIT_H_ /** * Handle outgoing packets. @@ -89,7 +89,7 @@ */ void uip_split_output(void); -#endif /* __UIP_SPLIT_H__ */ +#endif /* UIP_SPLIT_H_ */ /** @} */ /** @} */ diff --git a/core/net/uip-udp-packet.h b/core/net/uip-udp-packet.h index 70a4a0fc3..294919f6e 100644 --- a/core/net/uip-udp-packet.h +++ b/core/net/uip-udp-packet.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __UIP_UDP_PACKET_H__ -#define __UIP_UDP_PACKET_H__ +#ifndef UIP_UDP_PACKET_H_ +#define UIP_UDP_PACKET_H_ #include "net/uip.h" @@ -46,4 +46,4 @@ void uip_udp_packet_send(struct uip_udp_conn *c, const void *data, int len); void uip_udp_packet_sendto(struct uip_udp_conn *c, const void *data, int len, const uip_ipaddr_t *toaddr, uint16_t toport); -#endif /* __UIP_UDP_PACKET_H__ */ +#endif /* UIP_UDP_PACKET_H_ */ diff --git a/core/net/uip.h b/core/net/uip.h index dc25e2f1f..c4df7cff0 100644 --- a/core/net/uip.h +++ b/core/net/uip.h @@ -50,8 +50,8 @@ * */ -#ifndef __UIP_H__ -#define __UIP_H__ +#ifndef UIP_H_ +#define UIP_H_ #include "net/uipopt.h" @@ -2193,7 +2193,7 @@ uint16_t uip_udpchksum(void); uint16_t uip_icmp6chksum(void); -#endif /* __UIP_H__ */ +#endif /* UIP_H_ */ /** @} */ diff --git a/core/net/uip6.c b/core/net/uip6.c index e79486ff1..aa1ac4a2e 100644 --- a/core/net/uip6.c +++ b/core/net/uip6.c @@ -1460,7 +1460,6 @@ uip_process(uint8_t flag) remove_ext_hdr(); PRINTF("Receiving UDP packet\n"); - UIP_STAT(++uip_stat.udp.recv); /* UDP processing is really just a hack. We don't do anything to the UDP/IP headers, but let the UDP application do all the hard diff --git a/core/net/uip_arch.h b/core/net/uip_arch.h index b035ee3ef..bdef2b512 100644 --- a/core/net/uip_arch.h +++ b/core/net/uip_arch.h @@ -57,8 +57,8 @@ * */ -#ifndef __UIP_ARCH_H__ -#define __UIP_ARCH_H__ +#ifndef UIP_ARCH_H_ +#define UIP_ARCH_H_ #include "net/uip.h" @@ -134,4 +134,4 @@ uint16_t uip_udpchksum(void); /** @} */ /** @} */ -#endif /* __UIP_ARCH_H__ */ +#endif /* UIP_ARCH_H_ */ diff --git a/core/net/uip_arp.h b/core/net/uip_arp.h index 1eb810448..604a34370 100644 --- a/core/net/uip_arp.h +++ b/core/net/uip_arp.h @@ -48,8 +48,8 @@ * */ -#ifndef __UIP_ARP_H__ -#define __UIP_ARP_H__ +#ifndef UIP_ARP_H_ +#define UIP_ARP_H_ #include "net/uip.h" @@ -139,5 +139,5 @@ void uip_arp_timer(void); /** @} */ -#endif /* __UIP_ARP_H__ */ +#endif /* UIP_ARP_H_ */ /** @} */ diff --git a/core/net/uiplib.h b/core/net/uiplib.h index de446de59..9c40bdc1c 100644 --- a/core/net/uiplib.h +++ b/core/net/uiplib.h @@ -39,8 +39,8 @@ * * */ -#ifndef __UIPLIB_H__ -#define __UIPLIB_H__ +#ifndef UIPLIB_H_ +#define UIPLIB_H_ #include "net/uip.h" @@ -76,4 +76,4 @@ CCIF int uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *addr); CCIF int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *addr); /** @} */ -#endif /* __UIPLIB_H__ */ +#endif /* UIPLIB_H_ */ diff --git a/core/net/uipopt.h b/core/net/uipopt.h index 7c9939003..39a49a55f 100644 --- a/core/net/uipopt.h +++ b/core/net/uipopt.h @@ -61,8 +61,8 @@ * */ -#ifndef __UIPOPT_H__ -#define __UIPOPT_H__ +#ifndef UIPOPT_H_ +#define UIPOPT_H_ #ifndef UIP_LITTLE_ENDIAN #define UIP_LITTLE_ENDIAN 3412 @@ -672,6 +672,6 @@ void uip_log(char *msg); */ /** @} */ -#endif /* __UIPOPT_H__ */ +#endif /* UIPOPT_H_ */ /** @} */ /** @} */ diff --git a/core/sys/arg.h b/core/sys/arg.h index df1ceb67d..6c2d0eb19 100644 --- a/core/sys/arg.h +++ b/core/sys/arg.h @@ -31,12 +31,12 @@ * * */ -#ifndef __ARG_H__ -#define __ARG_H__ +#ifndef ARG_H_ +#define ARG_H_ void arg_init(void); char *arg_alloc(char size); void arg_free(char *arg); -#endif /* __ARG_H__ */ +#endif /* ARG_H_ */ diff --git a/core/sys/autostart.h b/core/sys/autostart.h index 46c3333b8..a88dbd6b6 100644 --- a/core/sys/autostart.h +++ b/core/sys/autostart.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __AUTOSTART_H__ -#define __AUTOSTART_H__ +#ifndef AUTOSTART_H_ +#define AUTOSTART_H_ #include "sys/process.h" @@ -59,4 +59,4 @@ CLIF extern struct process * const autostart_processes[]; void autostart_start(struct process * const processes[]); void autostart_exit(struct process * const processes[]); -#endif /* __AUTOSTART_H__ */ +#endif /* AUTOSTART_H_ */ diff --git a/core/sys/cc.h b/core/sys/cc.h index f4a6105a1..2fd9c2208 100644 --- a/core/sys/cc.h +++ b/core/sys/cc.h @@ -41,8 +41,8 @@ * * */ -#ifndef __CC_H__ -#define __CC_H__ +#ifndef CC_H_ +#define CC_H_ #include "contiki-conf.h" @@ -136,4 +136,4 @@ */ #define CC_CONCAT(s1, s2) CC_CONCAT2(s1, s2) -#endif /* __CC_H__ */ +#endif /* CC_H_ */ diff --git a/core/sys/clock.h b/core/sys/clock.h index 986f6ae33..bbf5988ee 100644 --- a/core/sys/clock.h +++ b/core/sys/clock.h @@ -65,8 +65,8 @@ * Author: Adam Dunkels * */ -#ifndef __CLOCK_H__ -#define __CLOCK_H__ +#ifndef CLOCK_H_ +#define CLOCK_H_ #include "contiki-conf.h" @@ -139,7 +139,7 @@ int clock_fine_max(void); unsigned short clock_fine(void); void clock_delay(unsigned int delay); -#endif /* __CLOCK_H__ */ +#endif /* CLOCK_H_ */ /** @} */ /** @} */ diff --git a/core/sys/compower.h b/core/sys/compower.h index 60866f660..202065eb3 100644 --- a/core/sys/compower.h +++ b/core/sys/compower.h @@ -51,8 +51,8 @@ * Adam Dunkels */ -#ifndef __COMPOWER_H__ -#define __COMPOWER_H__ +#ifndef COMPOWER_H_ +#define COMPOWER_H_ /** * \brief An activity record that contains power consumption information for a specific communication activity. @@ -129,7 +129,7 @@ void compower_attrconv(struct compower_activity *a); */ void compower_accumulate_attrs(struct compower_activity *a); -#endif /* __COMPOWER_H__ */ +#endif /* COMPOWER_H_ */ /** @} */ /** @} */ diff --git a/core/sys/ctimer.h b/core/sys/ctimer.h index bc7bf2f98..27311ddfb 100644 --- a/core/sys/ctimer.h +++ b/core/sys/ctimer.h @@ -51,8 +51,8 @@ * Adam Dunkels */ -#ifndef __CTIMER_H__ -#define __CTIMER_H__ +#ifndef CTIMER_H_ +#define CTIMER_H_ #include "sys/etimer.h" @@ -143,6 +143,6 @@ int ctimer_expired(struct ctimer *c); */ void ctimer_init(void); -#endif /* __CTIMER_H__ */ +#endif /* CTIMER_H_ */ /** @} */ /** @} */ diff --git a/core/sys/dsc.h b/core/sys/dsc.h index 75ba4d9a9..5c3994741 100644 --- a/core/sys/dsc.h +++ b/core/sys/dsc.h @@ -58,8 +58,8 @@ * * */ -#ifndef __DSC_H__ -#define __DSC_H__ +#ifndef DSC_H_ +#define DSC_H_ #include "ctk/ctk.h" @@ -137,4 +137,4 @@ struct dsc { /** @} */ -#endif /* _DSC_H__ */ +#endif /*DSC_H__ */ diff --git a/core/sys/energest.h b/core/sys/energest.h index 70b46ab6c..6d43aaa11 100644 --- a/core/sys/energest.h +++ b/core/sys/energest.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __ENERGEST_H__ -#define __ENERGEST_H__ +#ifndef ENERGEST_H_ +#define ENERGEST_H_ #include "sys/rtimer.h" @@ -126,4 +126,4 @@ extern energest_t energest_leveldevice_current_leveltime[ENERGEST_CONF_LEVELDEVI #define ENERGEST_OFF_LEVEL(type,level) do { } while(0) #endif /* ENERGEST_CONF_ON */ -#endif /* __ENERGEST_H__ */ +#endif /* ENERGEST_H_ */ diff --git a/core/sys/etimer.h b/core/sys/etimer.h index f46e24c13..10452dc2a 100644 --- a/core/sys/etimer.h +++ b/core/sys/etimer.h @@ -59,8 +59,8 @@ * Author: Adam Dunkels * */ -#ifndef __ETIMER_H__ -#define __ETIMER_H__ +#ifndef ETIMER_H_ +#define ETIMER_H_ #include "sys/timer.h" #include "sys/process.h" @@ -236,6 +236,6 @@ clock_time_t etimer_next_expiration_time(void); /** @} */ PROCESS_NAME(etimer_process); -#endif /* __ETIMER_H__ */ +#endif /* ETIMER_H_ */ /** @} */ /** @} */ diff --git a/core/sys/lc-addrlabels.h b/core/sys/lc-addrlabels.h index b7f7028e4..fc86f92ce 100644 --- a/core/sys/lc-addrlabels.h +++ b/core/sys/lc-addrlabels.h @@ -56,8 +56,8 @@ * implementation. */ -#ifndef __LC_ADDRLABELS_H__ -#define __LC_ADDRLABELS_H__ +#ifndef LC_ADDRLABELS_H_ +#define LC_ADDRLABELS_H_ /** \hideinitializer */ typedef void * lc_t; @@ -77,5 +77,5 @@ typedef void * lc_t; #define LC_END(s) -#endif /* __LC_ADDRLABELS_H__ */ +#endif /* LC_ADDRLABELS_H_ */ /** @} */ diff --git a/core/sys/lc-switch.h b/core/sys/lc-switch.h index 6ffb6c763..8fcef3449 100644 --- a/core/sys/lc-switch.h +++ b/core/sys/lc-switch.h @@ -53,8 +53,8 @@ * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html */ -#ifndef __LC_SWITCH_H__ -#define __LC_SWITCH_H__ +#ifndef LC_SWITCH_H_ +#define LC_SWITCH_H_ /* WARNING! lc implementation using switch() does not work if an LC_SET() is done within another switch() statement! */ @@ -70,6 +70,6 @@ typedef unsigned short lc_t; #define LC_END(s) } -#endif /* __LC_SWITCH_H__ */ +#endif /* LC_SWITCH_H_ */ /** @} */ diff --git a/core/sys/lc.h b/core/sys/lc.h index 2da0e4a9e..3f57d879c 100644 --- a/core/sys/lc.h +++ b/core/sys/lc.h @@ -115,8 +115,8 @@ */ #endif /* DOXYGEN */ -#ifndef __LC_H__ -#define __LC_H__ +#ifndef LC_H_ +#define LC_H_ #ifdef LC_CONF_INCLUDE #include LC_CONF_INCLUDE @@ -124,7 +124,7 @@ #include "sys/lc-switch.h" #endif /* LC_CONF_INCLUDE */ -#endif /* __LC_H__ */ +#endif /* LC_H_ */ /** @} */ /** @} */ diff --git a/core/sys/loader.h b/core/sys/loader.h index 3b8656636..e54629aff 100644 --- a/core/sys/loader.h +++ b/core/sys/loader.h @@ -51,8 +51,8 @@ * * */ -#ifndef __LOADER_H__ -#define __LOADER_H__ +#ifndef LOADER_H_ +#define LOADER_H_ /* Errors that the LOADER_LOAD() function may return: */ @@ -125,7 +125,7 @@ #define LOADER_UNLOAD_DSC(dsc) #endif /* LOADER_UNLOAD */ -#endif /* __LOADER_H__ */ +#endif /* LOADER_H_ */ /** @} */ /** @} */ diff --git a/core/sys/log.h b/core/sys/log.h index 93aecb765..c6bc24737 100644 --- a/core/sys/log.h +++ b/core/sys/log.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __LOG_H__ -#define __LOG_H__ +#ifndef LOG_H_ +#define LOG_H_ #include "contiki-conf.h" @@ -42,4 +42,4 @@ void log_message(const char *part1, const char *part2); #define log_message(p1, p2) #endif /* LOG_CONF_ENABLED */ -#endif /* __LOG_H__ */ +#endif /* LOG_H_ */ diff --git a/core/sys/mt.h b/core/sys/mt.h index 4d53fff4a..0e67dee0d 100644 --- a/core/sys/mt.h +++ b/core/sys/mt.h @@ -79,8 +79,8 @@ * Adam Dunkels * */ -#ifndef __MT_H__ -#define __MT_H__ +#ifndef MT_H_ +#define MT_H_ #include "contiki.h" @@ -267,4 +267,4 @@ void mt_stop(struct mt_thread *thread); /** @} */ /** @} */ -#endif /* __MT_H__ */ +#endif /* MT_H_ */ diff --git a/core/sys/node-id.h b/core/sys/node-id.h index f0435228a..0b6ebe6b1 100644 --- a/core/sys/node-id.h +++ b/core/sys/node-id.h @@ -32,12 +32,12 @@ * */ -#ifndef __NODE_ID_H__ -#define __NODE_ID_H__ +#ifndef NODE_ID_H_ +#define NODE_ID_H_ void node_id_restore(void); void node_id_burn(unsigned short node_id); extern unsigned short node_id; -#endif /* __NODE_ID_H__ */ +#endif /* NODE_ID_H_ */ diff --git a/core/sys/process.h b/core/sys/process.h index 63fa75e14..7063ee024 100644 --- a/core/sys/process.h +++ b/core/sys/process.h @@ -50,8 +50,8 @@ * Adam Dunkels * */ -#ifndef __PROCESS_H__ -#define __PROCESS_H__ +#ifndef PROCESS_H_ +#define PROCESS_H_ #include "sys/pt.h" #include "sys/cc.h" @@ -525,7 +525,7 @@ CCIF extern struct process *process_list; #define PROCESS_LIST() process_list -#endif /* __PROCESS_H__ */ +#endif /* PROCESS_H_ */ /** @} */ /** @} */ diff --git a/core/sys/procinit.h b/core/sys/procinit.h index 134b8d7d6..5e65a6de6 100644 --- a/core/sys/procinit.h +++ b/core/sys/procinit.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __PROCINIT_H__ -#define __PROCINIT_H__ +#ifndef PROCINIT_H_ +#define PROCINIT_H_ #include "sys/process.h" @@ -41,4 +41,4 @@ const struct process *procinit[] = {__VA_ARGS__, NULL} void procinit_init(void); -#endif /* __PROCINIT_H__ */ +#endif /* PROCINIT_H_ */ diff --git a/core/sys/pt-sem.h b/core/sys/pt-sem.h index 3f8a4f9e9..75d66452a 100644 --- a/core/sys/pt-sem.h +++ b/core/sys/pt-sem.h @@ -156,8 +156,8 @@ PT_THREAD(driver_thread(struct pt *pt)) * */ -#ifndef __PT_SEM_H__ -#define __PT_SEM_H__ +#ifndef PT_SEM_H_ +#define PT_SEM_H_ #include "sys/pt.h" @@ -220,7 +220,7 @@ struct pt_sem { */ #define PT_SEM_SIGNAL(pt, s) ++(s)->count -#endif /* __PT_SEM_H__ */ +#endif /* PT_SEM_H_ */ /** @} */ /** @} */ diff --git a/core/sys/pt.h b/core/sys/pt.h index 9433a1086..c9549119e 100644 --- a/core/sys/pt.h +++ b/core/sys/pt.h @@ -45,8 +45,8 @@ * */ -#ifndef __PT_H__ -#define __PT_H__ +#ifndef PT_H_ +#define PT_H_ #include "sys/lc.h" @@ -317,6 +317,6 @@ struct pt { /** @} */ -#endif /* __PT_H__ */ +#endif /* PT_H_ */ /** @} */ diff --git a/core/sys/rtimer.h b/core/sys/rtimer.h index 113dc7ded..7f393947d 100644 --- a/core/sys/rtimer.h +++ b/core/sys/rtimer.h @@ -49,8 +49,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __RTIMER_H__ -#define __RTIMER_H__ +#ifndef RTIMER_H_ +#define RTIMER_H_ #include "contiki-conf.h" @@ -150,7 +150,7 @@ void rtimer_arch_schedule(rtimer_clock_t t); #define RTIMER_SECOND RTIMER_ARCH_SECOND -#endif /* __RTIMER_H__ */ +#endif /* RTIMER_H_ */ /** @} */ /** @} */ diff --git a/core/sys/stimer.h b/core/sys/stimer.h index 16711e604..3615fc58c 100644 --- a/core/sys/stimer.h +++ b/core/sys/stimer.h @@ -65,8 +65,8 @@ * Author: Adam Dunkels , Nicolas Tsiftes * */ -#ifndef __STIMER_H__ -#define __STIMER_H__ +#ifndef STIMER_H_ +#define STIMER_H_ #include "sys/clock.h" @@ -91,7 +91,7 @@ unsigned long stimer_remaining(struct stimer *t); unsigned long stimer_elapsed(struct stimer *t); -#endif /* __STIMER_H__ */ +#endif /* STIMER_H_ */ /** @} */ /** @} */ diff --git a/core/sys/subprocess.h b/core/sys/subprocess.h index 9f2761810..d7b3760a4 100644 --- a/core/sys/subprocess.h +++ b/core/sys/subprocess.h @@ -49,8 +49,8 @@ * Adam Dunkels */ -#ifndef __SUBPROCESS_H__ -#define __SUBPROCESS_H__ +#ifndef SUBPROCESS_H_ +#define SUBPROCESS_H_ #define SUBPROCESS_BEGIN(strname) \ { \ @@ -66,4 +66,4 @@ } \ } -#endif /* __SUBPROCESS_H__ */ +#endif /* SUBPROCESS_H_ */ diff --git a/core/sys/timer.h b/core/sys/timer.h index 3bfdfa81f..06a25524c 100644 --- a/core/sys/timer.h +++ b/core/sys/timer.h @@ -70,8 +70,8 @@ * Author: Adam Dunkels * */ -#ifndef __TIMER_H__ -#define __TIMER_H__ +#ifndef TIMER_H_ +#define TIMER_H_ #include "sys/clock.h" @@ -95,7 +95,7 @@ CCIF int timer_expired(struct timer *t); clock_time_t timer_remaining(struct timer *t); -#endif /* __TIMER_H__ */ +#endif /* TIMER_H_ */ /** @} */ /** @} */ diff --git a/cpu/6502/6502def.h b/cpu/6502/6502def.h index e0adc70df..6ff6c2ad2 100644 --- a/cpu/6502/6502def.h +++ b/cpu/6502/6502def.h @@ -32,8 +32,8 @@ * */ -#ifndef __6502DEF_H__ -#define __6502DEF_H__ +#ifndef S502DEF_H_ +#define S502DEF_H_ #include #include @@ -160,4 +160,4 @@ typedef unsigned short uip_stats_t; #define cfs_remove remove #endif /* WITH_PFS */ -#endif /* __6502DEF_H__ */ +#endif /* S502DEF_H_ */ diff --git a/cpu/6502/lib/config.h b/cpu/6502/lib/config.h index 4abc9f22d..8f7f971be 100644 --- a/cpu/6502/lib/config.h +++ b/cpu/6502/lib/config.h @@ -32,9 +32,9 @@ * */ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ +#ifndef CONFIG_H_ +#define CONFIG_H_ struct ethernet_config * CC_FASTCALL config_read(char *filename); -#endif /* __CONFIG_H__ */ +#endif /* CONFIG_H_ */ diff --git a/cpu/6502/lib/error.h b/cpu/6502/lib/error.h index 5f4ef04b7..7a11a4fbf 100644 --- a/cpu/6502/lib/error.h +++ b/cpu/6502/lib/error.h @@ -32,9 +32,9 @@ * */ -#ifndef __ERROR_H__ -#define __ERROR_H__ +#ifndef ERROR_H_ +#define ERROR_H_ void error_exit(void); -#endif /* __ERROR_H__ */ +#endif /* ERROR_H_ */ diff --git a/cpu/6502/lib/pfs.h b/cpu/6502/lib/pfs.h index a47e6d1d0..25c62e8bf 100644 --- a/cpu/6502/lib/pfs.h +++ b/cpu/6502/lib/pfs.h @@ -32,8 +32,8 @@ * */ -#ifndef __PFS_H__ -#define __PFS_H__ +#ifndef PFS_H_ +#define PFS_H_ int __fastcall__ pfs_open(const char* name, int flags); void __fastcall__ pfs_close(int fd); @@ -42,4 +42,4 @@ int __fastcall__ pfs_write(int fd, void* buf, unsigned int len); int __fastcall__ pfs_seek(int fd, int offset, int whence); int __fastcall__ pfs_remove(const char *name); -#endif /* __PFS_H__ */ +#endif /* PFS_H_ */ diff --git a/cpu/6502/lib/unload.h b/cpu/6502/lib/unload.h index 9dcfbda15..d70a7b706 100644 --- a/cpu/6502/lib/unload.h +++ b/cpu/6502/lib/unload.h @@ -32,11 +32,11 @@ * */ -#ifndef __UNLOAD_H__ -#define __UNLOAD_H__ +#ifndef UNLOAD_H_ +#define UNLOAD_H_ #define LOADER_UNLOAD unload void unload(void); -#endif /* __UNLOAD_H__ */ +#endif /* UNLOAD_H_ */ diff --git a/cpu/6502/net/ethernet-drv.h b/cpu/6502/net/ethernet-drv.h index abc5c8776..6a238a9dc 100644 --- a/cpu/6502/net/ethernet-drv.h +++ b/cpu/6502/net/ethernet-drv.h @@ -30,8 +30,8 @@ * */ -#ifndef __ETHERNET_DRV_H__ -#define __ETHERNET_DRV_H__ +#ifndef ETHERNET_DRV_H_ +#define ETHERNET_DRV_H_ #include "contiki.h" @@ -44,4 +44,4 @@ PROCESS_NAME(ethernet_process); uint8_t ethernet_output(void); -#endif /* __ETHERNET_DRV_H__ */ +#endif /* ETHERNET_DRV_H_ */ diff --git a/cpu/6502/net/ethernet.h b/cpu/6502/net/ethernet.h index 6d6e5f84d..d99f06451 100644 --- a/cpu/6502/net/ethernet.h +++ b/cpu/6502/net/ethernet.h @@ -32,12 +32,12 @@ * */ -#ifndef __ETHERNET_H__ -#define __ETHERNET_H__ +#ifndef ETHERNET_H_ +#define ETHERNET_H_ void CC_FASTCALL ethernet_init(struct ethernet_config *config); uint16_t ethernet_poll(void); void ethernet_send(void); void ethernet_exit(void); -#endif /* __ETHERNET_H__ */ +#endif /* ETHERNET_H_ */ diff --git a/cpu/6502/sys/lc.h b/cpu/6502/sys/lc.h index fc894b531..b0c3e1941 100644 --- a/cpu/6502/sys/lc.h +++ b/cpu/6502/sys/lc.h @@ -35,8 +35,8 @@ within a function. */ -#ifndef __LC_H__ -#define __LC_H__ +#ifndef LC_H_ +#define LC_H_ typedef void * lc_t; @@ -48,4 +48,4 @@ void __fastcall__ lc_resume(lc_t *lc); #define LC_INIT(lc) (lc) = NULL #define LC_END(lc) -#endif /* __LC_H__ */ +#endif /* LC_H_ */ diff --git a/cpu/6502/sys/mtarch.h b/cpu/6502/sys/mtarch.h index 8656a4eb7..4e3b90574 100644 --- a/cpu/6502/sys/mtarch.h +++ b/cpu/6502/sys/mtarch.h @@ -32,8 +32,8 @@ * */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ #define MTARCH_CPUSTACKSIZE 256 #define MTARCH_CSTACKSIZE 256 @@ -46,4 +46,4 @@ struct mtarch_thread { unsigned char zp [MTARCH_ZPSIZE]; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/6502/sys/rtimer-arch.h b/cpu/6502/sys/rtimer-arch.h index 03e1db418..351e6ad30 100644 --- a/cpu/6502/sys/rtimer-arch.h +++ b/cpu/6502/sys/rtimer-arch.h @@ -30,8 +30,8 @@ * */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "contiki-conf.h" @@ -39,4 +39,4 @@ #define rtimer_arch_now() clock_time() -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/arm/at91sam7s/debug-uart.h b/cpu/arm/at91sam7s/debug-uart.h index dba6b9962..c322de89e 100644 --- a/cpu/arm/at91sam7s/debug-uart.h +++ b/cpu/arm/at91sam7s/debug-uart.h @@ -1,5 +1,5 @@ -#ifndef __DEBUG_UART_H__1V2039076V__ -#define __DEBUG_UART_H__1V2039076V__ +#ifndef DEBUG_UART_H_1V2039076V__ +#define DEBUG_UART_H_1V2039076V__ void @@ -30,4 +30,4 @@ dbg_blocking_putchar(const char ch); void dbg_drain(); -#endif /* __DEBUG_UART_H__1V2039076V__ */ +#endif /* DEBUG_UART_H_1V2039076V__ */ diff --git a/cpu/arm/at91sam7s/io.h b/cpu/arm/at91sam7s/io.h index e6e9b6d9c..b08ff144b 100644 --- a/cpu/arm/at91sam7s/io.h +++ b/cpu/arm/at91sam7s/io.h @@ -1,5 +1,5 @@ -#ifndef __IO_H__7UTLUP9AG6__ -#define __IO_H__7UTLUP9AG6__ +#ifndef IO_H_7UTLUP9AG6__ +#define IO_H_7UTLUP9AG6__ #include @@ -12,4 +12,4 @@ int splhigh(void); void splx(int saved); -#endif /* __IO_H__7UTLUP9AG6__ */ +#endif /* IO_H_7UTLUP9AG6__ */ diff --git a/cpu/arm/at91sam7s/loader/codeprop-otf.h b/cpu/arm/at91sam7s/loader/codeprop-otf.h index 14965b734..e2ba71b06 100644 --- a/cpu/arm/at91sam7s/loader/codeprop-otf.h +++ b/cpu/arm/at91sam7s/loader/codeprop-otf.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __CODEPROP_H__ -#define __CODEPROP_H__ +#ifndef CODEPROP_H_ +#define CODEPROP_H_ #include "contiki.h" @@ -48,4 +48,4 @@ extern struct elfloader_output *codeprop_output; extern char *codeprop_filesystem; -#endif /* __CODEPROP_H__ */ +#endif /* CODEPROP_H_ */ diff --git a/cpu/arm/at91sam7s/loader/elfloader-arch-otf.h b/cpu/arm/at91sam7s/loader/elfloader-arch-otf.h index d44695099..9fe8a77ae 100644 --- a/cpu/arm/at91sam7s/loader/elfloader-arch-otf.h +++ b/cpu/arm/at91sam7s/loader/elfloader-arch-otf.h @@ -63,8 +63,8 @@ * */ -#ifndef __ELFLOADER_ARCH_H__ -#define __ELFLOADER_ARCH_H__ +#ifndef ELFLOADER_ARCH_H_ +#define ELFLOADER_ARCH_H_ #include "elfloader-otf.h" @@ -94,7 +94,7 @@ int elfloader_arch_relocate(int input_fd, char *sectionaddr, struct elf32_rela *rela, char *addr); -#endif /* __ELFLOADER_ARCH_H__ */ +#endif /* ELFLOADER_ARCH_H_ */ /** @} */ /** @} */ diff --git a/cpu/arm/at91sam7s/loader/elfloader-otf.h b/cpu/arm/at91sam7s/loader/elfloader-otf.h index 91dc94b9b..d3c06c091 100644 --- a/cpu/arm/at91sam7s/loader/elfloader-otf.h +++ b/cpu/arm/at91sam7s/loader/elfloader-otf.h @@ -74,8 +74,8 @@ * */ -#ifndef __ELFLOADER_H__ -#define __ELFLOADER_H__ +#ifndef ELFLOADER_H_ +#define ELFLOADER_H_ #include "cfs/cfs.h" @@ -308,7 +308,7 @@ struct elf32_rela { }; -#endif /* __ELFLOADER_H__ */ +#endif /* ELFLOADER_H_ */ /** @} */ /** @} */ diff --git a/cpu/arm/at91sam7s/loader/ram-segments.h b/cpu/arm/at91sam7s/loader/ram-segments.h index 6f3936dfa..e5aa3c93f 100644 --- a/cpu/arm/at91sam7s/loader/ram-segments.h +++ b/cpu/arm/at91sam7s/loader/ram-segments.h @@ -1,6 +1,6 @@ -#ifndef __RAM_SEGMENTS_H__8EDB9N09UD__ -#define __RAM_SEGMENTS_H__8EDB9N09UD__ +#ifndef RAM_SEGMENTS_H_8EDB9N09UD__ +#define RAM_SEGMENTS_H_8EDB9N09UD__ PROCESS_NAME(ram_segments_cleanup_process); -#endif /* __RAM_SEGMENTS_H__8EDB9N09UD__ */ +#endif /* RAM_SEGMENTS_H_8EDB9N09UD__ */ diff --git a/cpu/arm/at91sam7s/rtimer-arch-interrupt.h b/cpu/arm/at91sam7s/rtimer-arch-interrupt.h index 1ba91aed7..97ea3671d 100644 --- a/cpu/arm/at91sam7s/rtimer-arch-interrupt.h +++ b/cpu/arm/at91sam7s/rtimer-arch-interrupt.h @@ -1,6 +1,6 @@ -#ifndef __RTIMER_ARCH_INTERRUPT_H__P0PXG70757__ -#define __RTIMER_ARCH_INTERRUPT_H__P0PXG70757__ +#ifndef RTIMER_ARCH_INTERRUPT_H_P0PXG70757__ +#define RTIMER_ARCH_INTERRUPT_H_P0PXG70757__ void rtimer_interrupt (void); -#endif /* __RTIMER_ARCH_INTERRUPT_H__P0PXG70757__ */ +#endif /* RTIMER_ARCH_INTERRUPT_H_P0PXG70757__ */ diff --git a/cpu/arm/at91sam7s/rtimer-arch.h b/cpu/arm/at91sam7s/rtimer-arch.h index e096a3a89..bacf656e7 100644 --- a/cpu/arm/at91sam7s/rtimer-arch.h +++ b/cpu/arm/at91sam7s/rtimer-arch.h @@ -5,8 +5,8 @@ * Simon Berg */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "sys/rtimer.h" @@ -19,4 +19,4 @@ void rtimer_arch_set(rtimer_clock_t t); rtimer_clock_t rtimer_arch_now(void); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/arm/at91sam7s/sys-interrupt.h b/cpu/arm/at91sam7s/sys-interrupt.h index 433db4a0f..738d336b1 100644 --- a/cpu/arm/at91sam7s/sys-interrupt.h +++ b/cpu/arm/at91sam7s/sys-interrupt.h @@ -1,5 +1,5 @@ -#ifndef __SYS_INTERRUPT_H__QIHZ66NP8K__ -#define __SYS_INTERRUPT_H__QIHZ66NP8K__ +#ifndef SYS_INTERRUPT_H_QIHZ66NP8K__ +#define SYS_INTERRUPT_H_QIHZ66NP8K__ /* Returns true if it handled an activbe interrupt */ @@ -28,4 +28,4 @@ sys_interrupt_prepend_handler(SystemInterruptHandler *handler); void sys_interrupt_remove_handler(SystemInterruptHandler *handler); -#endif /* __SYS_INTERRUPT_H__QIHZ66NP8K__ */ +#endif /* SYS_INTERRUPT_H_QIHZ66NP8K__ */ diff --git a/cpu/arm/at91sam7s/usb-interrupt.h b/cpu/arm/at91sam7s/usb-interrupt.h index aad1c434e..c805de01e 100644 --- a/cpu/arm/at91sam7s/usb-interrupt.h +++ b/cpu/arm/at91sam7s/usb-interrupt.h @@ -1,5 +1,5 @@ -#ifndef __USB_INTERRUPT_H__0HRIPZ5SIA__ -#define __USB_INTERRUPT_H__0HRIPZ5SIA__ +#ifndef USB_INTERRUPT_H_0HRIPZ5SIA__ +#define USB_INTERRUPT_H_0HRIPZ5SIA__ void usb_int (void); @@ -18,4 +18,4 @@ usb_arch_suspend_int(); void usb_arch_resume_int(); -#endif /* __USB_INTERRUPT_H__0HRIPZ5SIA__ */ +#endif /* USB_INTERRUPT_H_0HRIPZ5SIA__ */ diff --git a/cpu/arm/common/SD-card/config.h b/cpu/arm/common/SD-card/config.h index 0e09e88fe..d942669ce 100644 --- a/cpu/arm/common/SD-card/config.h +++ b/cpu/arm/common/SD-card/config.h @@ -1,5 +1,5 @@ -#ifndef __EFSL_CONFIG_H__ -#define __EFSL_CONFIG_H__ +#ifndef EFSL_CONFIG_H_ +#define EFSL_CONFIG_H_ /* Close enough */ #define HW_ENDPOINT_LPC2000_SD diff --git a/cpu/arm/common/SD-card/efs-sdcard.h b/cpu/arm/common/SD-card/efs-sdcard.h index ffc4968ba..d4659abf0 100644 --- a/cpu/arm/common/SD-card/efs-sdcard.h +++ b/cpu/arm/common/SD-card/efs-sdcard.h @@ -1,5 +1,5 @@ -#ifndef __SDCARD_H__KJBBKS6O57__ -#define __SDCARD_H__KJBBKS6O57__ +#ifndef SDCARD_H_KJBBKS6O57__ +#define SDCARD_H_KJBBKS6O57__ #include #include @@ -24,4 +24,4 @@ extern process_event_t sdcard_removed_event; void sdcard_event_process(struct process *p); -#endif /* __SDCARD_H__KJBBKS6O57__ */ +#endif /* SDCARD_H_KJBBKS6O57__ */ diff --git a/cpu/arm/common/SD-card/efsl_spi.h b/cpu/arm/common/SD-card/efsl_spi.h index 6989c81aa..f51b088ca 100644 --- a/cpu/arm/common/SD-card/efsl_spi.h +++ b/cpu/arm/common/SD-card/efsl_spi.h @@ -1,5 +1,5 @@ -#ifndef __EFSL_SPI_H__6B6MX40N68__ -#define __EFSL_SPI_H__6B6MX40N68__ +#ifndef EFSL_SPI_H_6B6MX40N68__ +#define EFSL_SPI_H_6B6MX40N68__ #include @@ -18,4 +18,4 @@ void if_spiSetSpeed(euint8 speed); euint8 if_spiSend(hwInterface *iface, euint8 outgoing); -#endif /* __EFSL_SPI_H__6B6MX40N68__ */ +#endif /* EFSL_SPI_H_6B6MX40N68__ */ diff --git a/cpu/arm/common/SD-card/sdcard.h b/cpu/arm/common/SD-card/sdcard.h index fcca1461d..1f8a88bde 100644 --- a/cpu/arm/common/SD-card/sdcard.h +++ b/cpu/arm/common/SD-card/sdcard.h @@ -1,5 +1,5 @@ -#ifndef __SDCARD_H__KJBBKS6O57__ -#define __SDCARD_H__KJBBKS6O57__ +#ifndef SDCARD_H_KJBBKS6O57__ +#define SDCARD_H_KJBBKS6O57__ #include @@ -19,4 +19,4 @@ extern process_event_t sdcard_removed_event; void sdcard_event_process(struct process *p); -#endif /* __SDCARD_H__KJBBKS6O57__ */ +#endif /* SDCARD_H_KJBBKS6O57__ */ diff --git a/cpu/arm/common/dbg-io/strformat.h b/cpu/arm/common/dbg-io/strformat.h index d953c3e1e..c32eed670 100644 --- a/cpu/arm/common/dbg-io/strformat.h +++ b/cpu/arm/common/dbg-io/strformat.h @@ -1,5 +1,5 @@ -#ifndef __STRFORMAT_H__ -#define __STRFORMAT_H__ +#ifndef STRFORMAT_H_ +#define STRFORMAT_H_ #include @@ -22,4 +22,4 @@ int format_str(const StrFormatContext *ctxt, const char *format, ...) int format_str_v(const StrFormatContext *ctxt, const char *format, va_list ap); -#endif /* __STRFORMAT_H__ */ +#endif /* STRFORMAT_H_ */ diff --git a/cpu/arm/common/usb/cdc-acm/cdc-acm.h b/cpu/arm/common/usb/cdc-acm/cdc-acm.h index 4a85dc208..f4bb9b388 100644 --- a/cpu/arm/common/usb/cdc-acm/cdc-acm.h +++ b/cpu/arm/common/usb/cdc-acm/cdc-acm.h @@ -1,7 +1,7 @@ -#ifndef __CDC_ACM_H__UFV6K50827__ -#define __CDC_ACM_H__UFV6K50827__ +#ifndef CDC_ACM_H_UFV6K50827__ +#define CDC_ACM_H_UFV6K50827__ void usb_cdc_acm_setup(); -#endif /* __CDC_ACM_H__UFV6K50827__ */ +#endif /* CDC_ACM_H_UFV6K50827__ */ diff --git a/cpu/arm/common/usb/cdc-acm/cdc.h b/cpu/arm/common/usb/cdc-acm/cdc.h index 2d57abc2b..7636dfdcc 100644 --- a/cpu/arm/common/usb/cdc-acm/cdc.h +++ b/cpu/arm/common/usb/cdc-acm/cdc.h @@ -1,5 +1,5 @@ -#ifndef __CDC_H__K1Q26ESJOC__ -#define __CDC_H__K1Q26ESJOC__ +#ifndef CDC_H_K1Q26ESJOC__ +#define CDC_H_K1Q26ESJOC__ #include /* Communication Class */ /* Class code */ @@ -211,4 +211,4 @@ struct usb_cdc_line_coding Uchar bDataBits; } BYTE_ALIGNED; -#endif /* __CDC_H__K1Q26ESJOC__ */ +#endif /* CDC_H_K1Q26ESJOC__ */ diff --git a/cpu/arm/common/usb/cdc-eth/cdc-eth.h b/cpu/arm/common/usb/cdc-eth/cdc-eth.h index bfdb4202a..3e8cfb458 100644 --- a/cpu/arm/common/usb/cdc-eth/cdc-eth.h +++ b/cpu/arm/common/usb/cdc-eth/cdc-eth.h @@ -1,5 +1,5 @@ -#ifndef __CDC_ETH_H__NUI0ULFC7C__ -#define __CDC_ETH_H__NUI0ULFC7C__ +#ifndef CDC_ETH_H_NUI0ULFC7C__ +#define CDC_ETH_H_NUI0ULFC7C__ #include @@ -10,4 +10,4 @@ usb_cdc_eth_set_ifaddr(uip_ipaddr_t *addr); void usb_cdc_eth_setup(); -#endif /* __CDC_ETH_H__NUI0ULFC7C__ */ +#endif /* CDC_ETH_H_NUI0ULFC7C__ */ diff --git a/cpu/arm/common/usb/cdc-eth/dhcps.h b/cpu/arm/common/usb/cdc-eth/dhcps.h index d8de26d3a..a893b4459 100644 --- a/cpu/arm/common/usb/cdc-eth/dhcps.h +++ b/cpu/arm/common/usb/cdc-eth/dhcps.h @@ -1,5 +1,5 @@ -#ifndef __DHCPS_H__6M2XYUGNTK__ -#define __DHCPS_H__6M2XYUGNTK__ +#ifndef DHCPS_H_6M2XYUGNTK__ +#define DHCPS_H_6M2XYUGNTK__ #include "contiki-net.h" #include @@ -44,4 +44,4 @@ struct dhcps_config **/ void dhcps_init(const struct dhcps_config *conf); -#endif /* __DHCPS_H__6M2XYUGNTK__ */ +#endif /* DHCPS_H_6M2XYUGNTK__ */ diff --git a/cpu/arm/common/usb/descriptors.h b/cpu/arm/common/usb/descriptors.h index 30808f744..f54184395 100644 --- a/cpu/arm/common/usb/descriptors.h +++ b/cpu/arm/common/usb/descriptors.h @@ -1,5 +1,5 @@ -#ifndef __DESCRIPTORS_H__RPFUB8O7OV__ -#define __DESCRIPTORS_H__RPFUB8O7OV__ +#ifndef DESCRIPTORS_H_RPFUB8O7OV__ +#define DESCRIPTORS_H_RPFUB8O7OV__ #ifndef STRUCTGEN #include "usb.h" @@ -7,4 +7,4 @@ extern const struct usb_st_device_descriptor device_descriptor; extern const struct usb_st_configuration_descriptor const *configuration_head; -#endif /* __DESCRIPTORS_H__RPFUB8O7OV__ */ +#endif /* DESCRIPTORS_H_RPFUB8O7OV__ */ diff --git a/cpu/arm/common/usb/msc/rbc_const.h b/cpu/arm/common/usb/msc/rbc_const.h index 08f69b50f..3e9afb99a 100644 --- a/cpu/arm/common/usb/msc/rbc_const.h +++ b/cpu/arm/common/usb/msc/rbc_const.h @@ -1,5 +1,5 @@ -#ifndef __RBC_CONST_H__7YXZF39S33__ -#define __RBC_CONST_H__7YXZF39S33__ +#ifndef RBC_CONST_H_7YXZF39S33__ +#define RBC_CONST_H_7YXZF39S33__ #include @@ -63,4 +63,4 @@ #define SCSI_WRITE_FUA 0x08 -#endif /* __RBC_CONST_H__7YXZF39S33__ */ +#endif /* RBC_CONST_H_7YXZF39S33__ */ diff --git a/cpu/arm/common/usb/msc/rbc_struct.h b/cpu/arm/common/usb/msc/rbc_struct.h index fdf0334f0..73c296fc9 100644 --- a/cpu/arm/common/usb/msc/rbc_struct.h +++ b/cpu/arm/common/usb/msc/rbc_struct.h @@ -1,5 +1,5 @@ -#ifndef __RBC_STRUCT_H__10L0HKARRV__ -#define __RBC_STRUCT_H__10L0HKARRV__ +#ifndef RBC_STRUCT_H_10L0HKARRV__ +#define RBC_STRUCT_H_10L0HKARRV__ #include @@ -55,4 +55,4 @@ struct rbc_write_cmd } CC_BYTE_ALIGNED; -#endif /* __RBC_STRUCT_H__10L0HKARRV__ */ +#endif /* RBC_STRUCT_H_10L0HKARRV__ */ diff --git a/cpu/arm/common/usb/msc/scsi_command.h b/cpu/arm/common/usb/msc/scsi_command.h index b8d84e5cd..c475c3f63 100644 --- a/cpu/arm/common/usb/msc/scsi_command.h +++ b/cpu/arm/common/usb/msc/scsi_command.h @@ -1,5 +1,5 @@ -#ifndef __SCSI_COMMAND_H__SR3ALQCZSH__ -#define __SCSI_COMMAND_H__SR3ALQCZSH__ +#ifndef SCSI_COMMAND_H_SR3ALQCZSH__ +#define SCSI_COMMAND_H_SR3ALQCZSH__ #define SCSI_CMD_CHANGE_DEFINITION 0x40 #define SCSI_CMD_COMPARE 0x39 @@ -67,4 +67,4 @@ -#endif /* __SCSI_COMMAND_H__SR3ALQCZSH__ */ +#endif /* SCSI_COMMAND_H_SR3ALQCZSH__ */ diff --git a/cpu/arm/common/usb/msc/spc2_struct.h b/cpu/arm/common/usb/msc/spc2_struct.h index d09a54715..dcd51bb0a 100644 --- a/cpu/arm/common/usb/msc/spc2_struct.h +++ b/cpu/arm/common/usb/msc/spc2_struct.h @@ -1,5 +1,5 @@ -#ifndef __SPC2_STRUCT_H__6R1KTJP0NJ__ -#define __SPC2_STRUCT_H__6R1KTJP0NJ__ +#ifndef SPC2_STRUCT_H_6R1KTJP0NJ__ +#define SPC2_STRUCT_H_6R1KTJP0NJ__ typedef uint8_t uint40_bytes[5]; typedef uint8_t uint32_bytes[4]; @@ -136,4 +136,4 @@ struct spc2_mode_page uint8_t page_length; } CC_BYTE_ALIGNED; -#endif /* __SPC2_STRUCT_H__6R1KTJP0NJ__ */ +#endif /* SPC2_STRUCT_H_6R1KTJP0NJ__ */ diff --git a/cpu/arm/common/usb/msc/usb-msc-bulk.h b/cpu/arm/common/usb/msc/usb-msc-bulk.h index 68f05c654..6ac8e7372 100644 --- a/cpu/arm/common/usb/msc/usb-msc-bulk.h +++ b/cpu/arm/common/usb/msc/usb-msc-bulk.h @@ -1,5 +1,5 @@ -#ifndef __USB_MSC_BULK_H__SHSP6ONHDJ__ -#define __USB_MSC_BULK_H__SHSP6ONHDJ__ +#ifndef USB_MSC_BULK_H_SHSP6ONHDJ__ +#define USB_MSC_BULK_H_SHSP6ONHDJ__ #include #include @@ -100,4 +100,4 @@ usb_msc_receive_data_buf_flags(uint8_t *data, unsigned int len, -#endif /* __USB_MSC_BULK_H__SHSP6ONHDJ__ */ +#endif /* USB_MSC_BULK_H_SHSP6ONHDJ__ */ diff --git a/cpu/arm/common/usb/usb-api.h b/cpu/arm/common/usb/usb-api.h index 9286879f9..9ad3563e8 100644 --- a/cpu/arm/common/usb/usb-api.h +++ b/cpu/arm/common/usb/usb-api.h @@ -1,5 +1,5 @@ -#ifndef __USB_API_H__SYN81IFYBN__ -#define __USB_API_H__SYN81IFYBN__ +#ifndef USB_API_H_SYN81IFYBN__ +#define USB_API_H_SYN81IFYBN__ #include @@ -142,4 +142,4 @@ usb_get_ep_events(uint8_t addr); unsigned int usb_get_current_configuration(void); -#endif /* __USB_API_H__SYN81IFYBN__ */ +#endif /* USB_API_H_SYN81IFYBN__ */ diff --git a/cpu/arm/common/usb/usb-arch.h b/cpu/arm/common/usb/usb-arch.h index d0969c004..61fe5ca35 100644 --- a/cpu/arm/common/usb/usb-arch.h +++ b/cpu/arm/common/usb/usb-arch.h @@ -1,5 +1,5 @@ -#ifndef __USB_ARCH_H__0Z52ZDP0H6__ -#define __USB_ARCH_H__0Z52ZDP0H6__ +#ifndef USB_ARCH_H_0Z52ZDP0H6__ +#define USB_ARCH_H_0Z52ZDP0H6__ #include #include @@ -89,4 +89,4 @@ usb_arch_get_global_events(void); int usb_arch_send_pending(uint8_t ep_addr); -#endif /* __USB_ARCH_H__0Z52ZDP0H6__ */ +#endif /* USB_ARCH_H_0Z52ZDP0H6__ */ diff --git a/cpu/arm/common/usb/usb-core.h b/cpu/arm/common/usb/usb-core.h index 9baf5ab0e..d35b064dd 100644 --- a/cpu/arm/common/usb/usb-core.h +++ b/cpu/arm/common/usb/usb-core.h @@ -1,5 +1,5 @@ -#ifndef __USB_CORE_H__YIKJDA7S1X__ -#define __USB_CORE_H__YIKJDA7S1X__ +#ifndef USB_CORE_H_YIKJDA7S1X__ +#define USB_CORE_H_YIKJDA7S1X__ #include @@ -20,4 +20,4 @@ void usb_get_ctrl_data(uint8_t *data, unsigned int length, usb_ctrl_data_callback cb); -#endif /* __USB_CORE_H__YIKJDA7S1X__ */ +#endif /* USB_CORE_H_YIKJDA7S1X__ */ diff --git a/cpu/arm/common/usb/usb.h b/cpu/arm/common/usb/usb.h index 86dc3419a..a1d7dfb78 100644 --- a/cpu/arm/common/usb/usb.h +++ b/cpu/arm/common/usb/usb.h @@ -1,5 +1,5 @@ -#ifndef __USB_H__6PFTDPIMZM__ -#define __USB_H__6PFTDPIMZM__ +#ifndef USB_H_6PFTDPIMZM__ +#define USB_H_6PFTDPIMZM__ #include /* Adapted from usb_kbd_enum.h in c5131-usb-kbd-light-1_0_2 package from @@ -182,4 +182,4 @@ struct usb_st_language_descriptor Uint16 wlangid[1]; /* language id */ } BYTE_ALIGNED; -#endif /* __USB_H__6PFTDPIMZM__ */ +#endif /* USB_H_6PFTDPIMZM__ */ diff --git a/cpu/arm/stm32f103/debug-uart.h b/cpu/arm/stm32f103/debug-uart.h index 628e99e8f..0bd1d4f42 100644 --- a/cpu/arm/stm32f103/debug-uart.h +++ b/cpu/arm/stm32f103/debug-uart.h @@ -1,5 +1,5 @@ -#ifndef __DEBUG_UART_H__1V2039076V__ -#define __DEBUG_UART_H__1V2039076V__ +#ifndef DEBUG_UART_H_1V2039076V__ +#define DEBUG_UART_H_1V2039076V__ #ifndef dbg_setup_uart #define dbg_setup_uart dbg_setup_uart_default @@ -24,4 +24,4 @@ dbg_blocking_putchar(const char ch); void dbg_drain(); -#endif /* __DEBUG_UART_H__1V2039076V__ */ +#endif /* DEBUG_UART_H_1V2039076V__ */ diff --git a/cpu/arm/stm32f103/gpio.h b/cpu/arm/stm32f103/gpio.h index 3469e8015..5e0bed6c7 100644 --- a/cpu/arm/stm32f103/gpio.h +++ b/cpu/arm/stm32f103/gpio.h @@ -1,5 +1,5 @@ -#ifndef __GPIO_H__LK7NAD1HN8__ -#define __GPIO_H__LK7NAD1HN8__ +#ifndef GPIO_H_LK7NAD1HN8__ +#define GPIO_H_LK7NAD1HN8__ #include #define _GPIO_INPUT_ANALOG(h,l) 0 @@ -126,4 +126,4 @@ MODIFY_REG(AFIO->MAPR, AFIO_MAPR_SWJ_CFG | mask, AFIO_MAPR_SWJ_CFG_VALUE | value -#endif /* __GPIO_H__LK7NAD1HN8__ */ +#endif /* GPIO_H_LK7NAD1HN8__ */ diff --git a/cpu/arm/stm32f103/nvic.h b/cpu/arm/stm32f103/nvic.h index cb32440e5..153292d18 100644 --- a/cpu/arm/stm32f103/nvic.h +++ b/cpu/arm/stm32f103/nvic.h @@ -1,5 +1,5 @@ -#ifndef __NVIC_H__LE94F5JS4D__ -#define __NVIC_H__LE94F5JS4D__ +#ifndef NVIC_H_LE94F5JS4D__ +#define NVIC_H_LE94F5JS4D__ #include #include @@ -13,4 +13,4 @@ MODIFY_REG(NVIC->IPR[(i)/4], 0xf<<(((i)&3)*8), (p)<<(((i)&3)*8)) #define NVIC_SET_SYSTICK_PRI(p) MODIFY_REG(SCB->SHPR[2], 0xf<<24, (p)<<24) -#endif /* __NVIC_H__LE94F5JS4D__ */ +#endif /* NVIC_H_LE94F5JS4D__ */ diff --git a/cpu/arm/stm32f103/rtimer-arch.h b/cpu/arm/stm32f103/rtimer-arch.h index cbd95b4e2..7b3d348ad 100644 --- a/cpu/arm/stm32f103/rtimer-arch.h +++ b/cpu/arm/stm32f103/rtimer-arch.h @@ -5,8 +5,8 @@ * Simon Berg */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "sys/rtimer.h" @@ -16,4 +16,4 @@ void rtimer_arch_set(rtimer_clock_t t); rtimer_clock_t rtimer_arch_now(void); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/avr/bootloader.h b/cpu/avr/bootloader.h index 1765f5634..e84e48240 100644 --- a/cpu/avr/bootloader.h +++ b/cpu/avr/bootloader.h @@ -1,5 +1,5 @@ -#ifndef __AVR_BOOTLOADER_H__ -#define __AVR_BOOTLOADER_H__ +#ifndef AVR_BOOTLOADER_H_ +#define AVR_BOOTLOADER_H_ #include #include diff --git a/cpu/avr/dev/compiler.h b/cpu/avr/dev/compiler.h index 5625752e8..48d6194ed 100644 --- a/cpu/avr/dev/compiler.h +++ b/cpu/avr/dev/compiler.h @@ -1,5 +1,5 @@ -#ifndef __COMPILER_H__ -#define __COMPILER_H__ +#ifndef COMPILER_H_ +#define COMPILER_H_ #ifdef __IMAGECRAFT__ @@ -36,4 +36,4 @@ -#endif /* __COMPILER_H__ */ +#endif /* COMPILER_H_ */ diff --git a/cpu/avr/dev/debug.h b/cpu/avr/dev/debug.h index ec38942b1..2a190dad6 100644 --- a/cpu/avr/dev/debug.h +++ b/cpu/avr/dev/debug.h @@ -1,5 +1,5 @@ -#ifndef __DEBUG_H__ -#define __DEBUG_H__ +#ifndef DEBUG_H_ +#define DEBUG_H_ #if 0 #define debug_print(x) @@ -17,4 +17,4 @@ void debug_print16(unsigned short v); -#endif /* __DEBUG_H__ */ +#endif /* DEBUG_H_ */ diff --git a/cpu/avr/dev/flash.h b/cpu/avr/dev/flash.h index 9e084d250..279c11bd2 100644 --- a/cpu/avr/dev/flash.h +++ b/cpu/avr/dev/flash.h @@ -1,8 +1,8 @@ -#ifndef __FLASH_H__ -#define __FLASH_H__ +#ifndef FLASH_H_ +#define FLASH_H_ #include void flash_write_page(uint32_t page, uint8_t *buf); -#endif /* __FLASH_H__ */ +#endif /* FLASH_H_ */ diff --git a/cpu/avr/dev/rs232.h b/cpu/avr/dev/rs232.h index c1b1de415..08a3d4f9f 100644 --- a/cpu/avr/dev/rs232.h +++ b/cpu/avr/dev/rs232.h @@ -33,8 +33,8 @@ * */ -#ifndef __RS232_H__ -#define __RS232_H__ +#ifndef RS232_H_ +#define RS232_H_ #include #include "contiki-conf.h" @@ -155,4 +155,4 @@ rs232_send(uint8_t port, unsigned char c); void rs232_redirect_stdout (uint8_t port); -#endif /* __RS232_H__ */ +#endif /* RS232_H_ */ diff --git a/cpu/avr/dev/usb/compiler.h b/cpu/avr/dev/usb/compiler.h index e60828eb3..aaa9f1ede 100644 --- a/cpu/avr/dev/usb/compiler.h +++ b/cpu/avr/dev/usb/compiler.h @@ -44,8 +44,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -#ifndef _COMPILER_H_ -#define _COMPILER_H_ +#ifndef COMPILER_H_ +#define COMPILER_H_ /*_____ I N C L U D E S ____________________________________________________*/ @@ -347,5 +347,5 @@ typedef char r_uart_ptchar; #define Disable_interrupt() cli() #endif -#endif /* _COMPILER_H_ */ +#endif /*COMPILER_H_ */ diff --git a/cpu/avr/dev/usb/conf_usb.h b/cpu/avr/dev/usb/conf_usb.h index d98930a4d..913d3aae6 100644 --- a/cpu/avr/dev/usb/conf_usb.h +++ b/cpu/avr/dev/usb/conf_usb.h @@ -40,8 +40,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _CONF_USB_H_ -#define _CONF_USB_H_ +#ifndef CONF_USB_H_ +#define CONF_USB_H_ @@ -153,4 +153,4 @@ extern void suspend_action(void); /** @} */ -#endif // _CONF_USB_H_ +#endif //CONF_USB_H_ diff --git a/cpu/avr/dev/usb/config.h b/cpu/avr/dev/usb/config.h index 2848208b0..aa6d81ba4 100644 --- a/cpu/avr/dev/usb/config.h +++ b/cpu/avr/dev/usb/config.h @@ -49,8 +49,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _CONFIG_H_ -#define _CONFIG_H_ +#ifndef CONFIG_H_ +#define CONFIG_H_ /** @addtogroup usb @@ -109,5 +109,5 @@ /** @} */ -#endif // _CONFIG_H_ +#endif //CONFIG_H_ diff --git a/cpu/avr/dev/usb/rndis/cdc_ecm.h b/cpu/avr/dev/usb/rndis/cdc_ecm.h index 2f620f7ae..d61276504 100644 --- a/cpu/avr/dev/usb/rndis/cdc_ecm.h +++ b/cpu/avr/dev/usb/rndis/cdc_ecm.h @@ -1,6 +1,6 @@ -#ifndef __CDC_ECM_H__ -#define __CDC_ECM_H__ +#ifndef CDC_ECM_H_ +#define CDC_ECM_H_ #include "contiki.h" #include @@ -15,4 +15,4 @@ extern void cdc_ecm_set_ethernet_packet_filter(void); extern void cdc_ecm_configure_endpoints(); extern void cdc_ecm_set_active(uint8_t value); -#endif // __CDC_ECM_H__ \ No newline at end of file +#endif // CDC_ECM_H_ \ No newline at end of file diff --git a/cpu/avr/dev/usb/rndis/cdc_eem.h b/cpu/avr/dev/usb/rndis/cdc_eem.h index 1f7c8ae49..81ee8b9bf 100644 --- a/cpu/avr/dev/usb/rndis/cdc_eem.h +++ b/cpu/avr/dev/usb/rndis/cdc_eem.h @@ -1,6 +1,6 @@ -#ifndef __CDC_EEM_H__ -#define __CDC_EEM_H__ +#ifndef CDC_EEM_H_ +#define CDC_EEM_H_ #include "contiki.h" #include @@ -9,4 +9,4 @@ extern void cdc_eem_process(void); extern uint8_t eem_send(uint8_t * senddata, uint16_t sendlen, uint8_t led); extern void cdc_eem_configure_endpoints(); -#endif // __CDC_EEM_H__ +#endif // CDC_EEM_H_ diff --git a/cpu/avr/dev/usb/rndis/rndis_task.h b/cpu/avr/dev/usb/rndis/rndis_task.h index a39b3651a..28148f1da 100644 --- a/cpu/avr/dev/usb/rndis/rndis_task.h +++ b/cpu/avr/dev/usb/rndis/rndis_task.h @@ -40,8 +40,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _RNDIS_TASK_H_ -#define _RNDIS_TASK_H_ +#ifndef RNDIS_TASK_H_ +#define RNDIS_TASK_H_ /** \addtogroup RNDIS @@ -121,5 +121,5 @@ PROCESS_NAME(usb_eth_process); /** @} */ -#endif /* _RNDIS_TASK_H_ */ +#endif /*RNDIS_TASK_H_ */ diff --git a/cpu/avr/dev/usb/serial/uart_usb_lib.h b/cpu/avr/dev/usb/serial/uart_usb_lib.h index 9d12e604c..f99a509fe 100644 --- a/cpu/avr/dev/usb/serial/uart_usb_lib.h +++ b/cpu/avr/dev/usb/serial/uart_usb_lib.h @@ -40,8 +40,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _UART_USB_LIB_H_ -#define _UART_USB_LIB_H_ +#ifndef UART_USB_LIB_H_ +#define UART_USB_LIB_H_ /** \addtogroup cdctask @@ -85,6 +85,6 @@ extern void uart_usb_configure_endpoints(); /** @} **/ -#endif /* _UART_USB_LIB_H_ */ +#endif /*UART_USB_LIB_H_ */ diff --git a/cpu/avr/dev/usb/storage/avr_flash.h b/cpu/avr/dev/usb/storage/avr_flash.h index a9a6474a6..7ab4015ad 100644 --- a/cpu/avr/dev/usb/storage/avr_flash.h +++ b/cpu/avr/dev/usb/storage/avr_flash.h @@ -44,8 +44,8 @@ @{ */ -#ifndef _DFMEM_H_ -#define _DFMEM_H_ +#ifndef DFMEM_H_ +#define DFMEM_H_ #include "conf_access.h" #include "ctrl_status.h" @@ -132,6 +132,6 @@ Ctrl_status avrf_usb_write( void ); -#endif // _DFMEM_H_ +#endif //DFMEM_H_ /** @} */ diff --git a/cpu/avr/dev/usb/storage/conf_access.h b/cpu/avr/dev/usb/storage/conf_access.h index afc38b814..5904327b4 100644 --- a/cpu/avr/dev/usb/storage/conf_access.h +++ b/cpu/avr/dev/usb/storage/conf_access.h @@ -45,8 +45,8 @@ @{ */ -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ +#ifndef CONF_ACCESS_H_ +#define CONF_ACCESS_H_ // Active the Logical Unit @@ -192,6 +192,6 @@ #define GLOBAL_WR_PROTECT DISABLED // To manage a global write protection -#endif //! _CONF_ACCESS_H_ +#endif //!CONF_ACCESS_H_ /** @} */ diff --git a/cpu/avr/dev/usb/storage/ctrl_access.h b/cpu/avr/dev/usb/storage/ctrl_access.h index a201a5342..878d9850c 100644 --- a/cpu/avr/dev/usb/storage/ctrl_access.h +++ b/cpu/avr/dev/usb/storage/ctrl_access.h @@ -52,8 +52,8 @@ @{ */ -#ifndef _MEM_CTRL_H_ -#define _MEM_CTRL_H_ +#ifndef MEM_CTRL_H_ +#define MEM_CTRL_H_ #include "storage/conf_access.h" #include "storage/ctrl_status.h" @@ -153,5 +153,5 @@ Ctrl_status ram_2_memory( U8 lun , const U32 _MEM_TYPE_SLOW_ *addr , U8 _MEM_ #endif // (ACCESS_STREAM == ENABLED) //-------------------------------------------------------------------------- -#endif // _MEM_CTRL_H_ +#endif //MEM_CTRL_H_ /**@}*/ diff --git a/cpu/avr/dev/usb/storage/ctrl_status.h b/cpu/avr/dev/usb/storage/ctrl_status.h index c79ca549a..969076c86 100644 --- a/cpu/avr/dev/usb/storage/ctrl_status.h +++ b/cpu/avr/dev/usb/storage/ctrl_status.h @@ -52,8 +52,8 @@ @{ */ -#ifndef _CTRL_STATUS_H_ -#define _CTRL_STATUS_H_ +#ifndef CTRL_STATUS_H_ +#define CTRL_STATUS_H_ //_____ D E F I N I T I O N S ______________________________________________ @@ -66,5 +66,5 @@ typedef enum , CTRL_BUSY =(FAIL+2) // Not initialize } Ctrl_status; -#endif // _CTRL_STATUS_H_ +#endif //CTRL_STATUS_H_ /** @} */ diff --git a/cpu/avr/dev/usb/storage/scsi_decoder.h b/cpu/avr/dev/usb/storage/scsi_decoder.h index e0c90a177..65d5b70a2 100644 --- a/cpu/avr/dev/usb/storage/scsi_decoder.h +++ b/cpu/avr/dev/usb/storage/scsi_decoder.h @@ -44,8 +44,8 @@ \addtogroup usbstorage @{ */ -#ifndef _SCSI_DECODER_H_ -#define _SCSI_DECODER_H_ +#ifndef SCSI_DECODER_H_ +#define SCSI_DECODER_H_ //_____ I N C L U D E S ____________________________________________________ @@ -334,5 +334,5 @@ void sbc_lun_status_is_not_present(void); void sbc_lun_status_is_fail(void); void sbc_lun_status_is_protected(void); -#endif /* _SCSI_DECODER_H_ */ +#endif /*SCSI_DECODER_H_ */ /** @} */ diff --git a/cpu/avr/dev/usb/storage/storage_task.h b/cpu/avr/dev/usb/storage/storage_task.h index 0e1a0250a..d1e1b07de 100644 --- a/cpu/avr/dev/usb/storage/storage_task.h +++ b/cpu/avr/dev/usb/storage/storage_task.h @@ -45,8 +45,8 @@ \defgroup usbstorage USB Mass Storage Task @{ */ -#ifndef _STORAGE_TASK_H_ -#define _STORAGE_TASK_H_ +#ifndef STORAGE_TASK_H_ +#define STORAGE_TASK_H_ //_____ I N C L U D E S ____________________________________________________ @@ -65,5 +65,5 @@ void sof_action(void); PROCESS_NAME(storage_process); -#endif /* _STORAGE_TASK_H_ */ +#endif /*STORAGE_TASK_H_ */ /** @} */ diff --git a/cpu/avr/dev/usb/usb_descriptors.h b/cpu/avr/dev/usb/usb_descriptors.h index f5648ebf7..0976c9d42 100644 --- a/cpu/avr/dev/usb/usb_descriptors.h +++ b/cpu/avr/dev/usb/usb_descriptors.h @@ -48,8 +48,8 @@ @{ */ -#ifndef _USB_USERCONFIG_H_ -#define _USB_USERCONFIG_H_ +#ifndef USB_USERCONFIG_H_ +#define USB_USERCONFIG_H_ //_____ I N C L U D E S ____________________________________________________ @@ -543,6 +543,6 @@ U8 Usb_get_dev_desc_length(void); PGM_VOID_P Usb_get_conf_desc_pointer(U8 index) ; U8 Usb_get_conf_desc_length(U8 index); -#endif // _USB_USERCONFIG_H_ +#endif //USB_USERCONFIG_H_ /** @} */ diff --git a/cpu/avr/dev/usb/usb_drv.h b/cpu/avr/dev/usb/usb_drv.h index 63abcdbf3..fd4b45883 100644 --- a/cpu/avr/dev/usb/usb_drv.h +++ b/cpu/avr/dev/usb/usb_drv.h @@ -40,8 +40,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _USB_DRV_H_ -#define _USB_DRV_H_ +#ifndef USB_DRV_H_ +#define USB_DRV_H_ #include "compiler.h" @@ -936,6 +936,6 @@ U8 usb_endpoint_wait_for_IN_ready(); #define usb_endpoint_wait_for_read_enabled usb_endpoint_wait_for_write_enabled -#endif // _USB_DRV_H_ +#endif //USB_DRV_H_ /** @} */ diff --git a/cpu/avr/dev/usb/usb_specific_request.h b/cpu/avr/dev/usb/usb_specific_request.h index cbbecf327..b0c1ab752 100644 --- a/cpu/avr/dev/usb/usb_specific_request.h +++ b/cpu/avr/dev/usb/usb_specific_request.h @@ -41,8 +41,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _USB_SPECIFIC_REQUEST_H_ -#define _USB_SPECIFIC_REQUEST_H_ +#ifndef USB_SPECIFIC_REQUEST_H_ +#define USB_SPECIFIC_REQUEST_H_ /*_____ I N C L U D E S ____________________________________________________*/ @@ -86,5 +86,5 @@ extern usb_mode_t usb_mode; // ____ T Y P E D E F I N I T I O N _______________________________________ -#endif // _USB_SPECIFIC_REQUEST_H_ +#endif //USB_SPECIFIC_REQUEST_H_ diff --git a/cpu/avr/dev/usb/usb_standard_request.h b/cpu/avr/dev/usb/usb_standard_request.h index ef60a4aa3..e5e56ae8e 100644 --- a/cpu/avr/dev/usb/usb_standard_request.h +++ b/cpu/avr/dev/usb/usb_standard_request.h @@ -46,8 +46,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _USB_ENUM_H_ -#define _USB_ENUM_H_ +#ifndef USB_ENUM_H_ +#define USB_ENUM_H_ //_____ I N C L U D E S ____________________________________________________ @@ -84,5 +84,5 @@ void usb_process_request( void); extern U8 usb_configuration_nb; -#endif // _USB_ENUM_H_ +#endif //USB_ENUM_H_ diff --git a/cpu/avr/dev/usb/usb_task.h b/cpu/avr/dev/usb/usb_task.h index 9fefac73d..26dd01541 100644 --- a/cpu/avr/dev/usb/usb_task.h +++ b/cpu/avr/dev/usb/usb_task.h @@ -57,8 +57,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _USB_TASK_H_ -#define _USB_TASK_H_ +#ifndef USB_TASK_H_ +#define USB_TASK_H_ /** \ingroup usbstick @@ -191,6 +191,6 @@ void usb_device_task (void); //! @} -#endif /* _USB_TASK_H_ */ +#endif /*USB_TASK_H_ */ /** @} */ diff --git a/cpu/avr/mtarch.h b/cpu/avr/mtarch.h index a311667b2..5cc25d87e 100644 --- a/cpu/avr/mtarch.h +++ b/cpu/avr/mtarch.h @@ -39,8 +39,8 @@ * */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ #include "contiki-conf.h" @@ -55,5 +55,5 @@ struct mtarch_thread { unsigned char *sp; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/avr/radio/ieee-manager/ieee-15-4-manager.h b/cpu/avr/radio/ieee-manager/ieee-15-4-manager.h index ba5705ae0..24bd8ce9c 100644 --- a/cpu/avr/radio/ieee-manager/ieee-15-4-manager.h +++ b/cpu/avr/radio/ieee-manager/ieee-15-4-manager.h @@ -46,8 +46,8 @@ * */ -#ifndef __IEEEMANAGER_H__ -#define __IEEEMANAGER_H__ +#ifndef IEEEMANAGER_H_ +#define IEEEMANAGER_H_ /** \brief The interface structure for the 802.15.4 quasi-MAC. */ typedef struct ieee_15_4_manager{ @@ -110,5 +110,5 @@ typedef struct ieee_15_4_manager{ void ieee_15_4_init(struct ieee_15_4_manager *pieee_15_4_manager); -#endif /* __IEEEMANAGER_H__ */ +#endif /* IEEEMANAGER_H_ */ /** \} */ diff --git a/cpu/avr/radio/mac/sicslowmac.h b/cpu/avr/radio/mac/sicslowmac.h index 9edb0f393..c6d3fb97b 100644 --- a/cpu/avr/radio/mac/sicslowmac.h +++ b/cpu/avr/radio/mac/sicslowmac.h @@ -44,8 +44,8 @@ \addtogroup rf230mac */ -#ifndef __SICSLOWMAC_H__ -#define __SICSLOWMAC_H__ +#ifndef SICSLOWMAC_H_ +#define SICSLOWMAC_H_ #include #include @@ -91,4 +91,4 @@ void byte_reverse(uint8_t * bytes, uint8_t num); struct mac_driver * sicslowmac_get_driver(void); parsed_frame_t * sicslowmac_get_frame(void); -#endif /* __SICSLOWMAC_H__ */ +#endif /* SICSLOWMAC_H_ */ diff --git a/cpu/avr/rtimer-arch.h b/cpu/avr/rtimer-arch.h index cf726b383..aad1b3b62 100644 --- a/cpu/avr/rtimer-arch.h +++ b/cpu/avr/rtimer-arch.h @@ -30,8 +30,8 @@ * */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include @@ -68,4 +68,4 @@ #endif void rtimer_arch_sleep(rtimer_clock_t howlong); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/cc2430/8051def.h b/cpu/cc2430/8051def.h index fe82ce9de..6d89a1fb2 100644 --- a/cpu/cc2430/8051def.h +++ b/cpu/cc2430/8051def.h @@ -9,8 +9,8 @@ * (recent updates for the sensinode/cc2430 port) */ -#ifndef __8051_DEF_H__ -#define __8051_DEF_H__ +#ifndef E051_DEF_H_ +#define E051_DEF_H_ #include @@ -110,4 +110,4 @@ typedef unsigned short clock_time_t; #define uip_ipaddr_copy(dest, src) \ memcpy(dest, src, sizeof(*dest)) -#endif /* __8051_DEF_H__ */ +#endif /* E051_DEF_H_ */ diff --git a/cpu/cc2430/dev/bus.h b/cpu/cc2430/dev/bus.h index 88cffdf94..aa15cf0bd 100644 --- a/cpu/cc2430/dev/bus.h +++ b/cpu/cc2430/dev/bus.h @@ -38,8 +38,8 @@ */ -#ifndef __BUS_H__ -#define __BUS_H__ +#ifndef BUS_H_ +#define BUS_H_ #include "cc2430_sfr.h" #include "8051def.h" @@ -50,4 +50,4 @@ void bus_init(void); void clock_ISR( void ) __interrupt (ST_VECTOR); -#endif /* __BUS_H__ */ +#endif /* BUS_H_ */ diff --git a/cpu/cc2430/dev/cc2430_rf.h b/cpu/cc2430/dev/cc2430_rf.h index f9ec32566..83527d4ba 100644 --- a/cpu/cc2430/dev/cc2430_rf.h +++ b/cpu/cc2430/dev/cc2430_rf.h @@ -5,8 +5,8 @@ * Zach Shelby */ -#ifndef __CC2430_RF_H__ -#define __CC2430_RF_H__ +#ifndef CC2430_RF_H_ +#define CC2430_RF_H_ #include "contiki.h" #include "dev/radio.h" @@ -88,4 +88,4 @@ extern void cc2430_rf_error_ISR(void) __interrupt(RFERR_VECTOR); void rf_dma_callback_isr(void); #endif -#endif /* __CC2430_RF_H__ */ +#endif /* CC2430_RF_H_ */ diff --git a/cpu/cc2430/dev/hwconf.h b/cpu/cc2430/dev/hwconf.h index 1063bf1a8..6d1fad135 100644 --- a/cpu/cc2430/dev/hwconf.h +++ b/cpu/cc2430/dev/hwconf.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __HWCONF_H__ -#define __HWCONF_H__ +#ifndef HWCONF_H_ +#define HWCONF_H_ #include "sys/cc.h" @@ -145,4 +145,4 @@ static CC_INLINE void name##_IRQ_FLAG_OFF() { \ P2IFG = 0; \ } -#endif /* __HWCONF_H__ */ +#endif /* HWCONF_H_ */ diff --git a/cpu/cc2430/dev/lpm.h b/cpu/cc2430/dev/lpm.h index 4a8f14710..eb1522834 100644 --- a/cpu/cc2430/dev/lpm.h +++ b/cpu/cc2430/dev/lpm.h @@ -39,8 +39,8 @@ * \author * George Oikonomou - */ -#ifndef __LPM_H__ -#define __LPM_H__ +#ifndef LPM_H_ +#define LPM_H_ #include "contiki-conf.h" @@ -54,4 +54,4 @@ #define LPM_MODE LPM_MODE_IDLE #endif /* LPM_CONF_MODE */ -#endif /* __LPM_H__ */ +#endif /* LPM_H_ */ diff --git a/cpu/cc2430/mtarch.h b/cpu/cc2430/mtarch.h index 381737888..9542270a1 100644 --- a/cpu/cc2430/mtarch.h +++ b/cpu/cc2430/mtarch.h @@ -39,11 +39,11 @@ * \author * George Oikonomou - */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { unsigned char *sp; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/cc2430/rtimer-arch.h b/cpu/cc2430/rtimer-arch.h index a29f1bae5..f007cff91 100644 --- a/cpu/cc2430/rtimer-arch.h +++ b/cpu/cc2430/rtimer-arch.h @@ -43,8 +43,8 @@ * (rtimer-arch implementation for cc2430) */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "contiki-conf.h" #include "cc2430_sfr.h" @@ -59,4 +59,4 @@ void cc2430_timer_1_ISR(void) __interrupt(T1_VECTOR); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/cc2538/dev/cc2538-rf.c b/cpu/cc2538/dev/cc2538-rf.c index 625a41f6a..226d8be9f 100644 --- a/cpu/cc2538/dev/cc2538-rf.c +++ b/cpu/cc2538/dev/cc2538-rf.c @@ -186,6 +186,31 @@ cc2538_rf_set_addr(uint16_t pan) REG(RFCORE_FFSM_SHORT_ADDR1) = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 2]; } /*---------------------------------------------------------------------------*/ +int +cc2538_rf_read_rssi(void) +{ + int rssi; + + /* If we are off, turn on first */ + if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) == 0) { + rf_flags |= WAS_OFF; + on(); + } + + /* Wait on RSSI_VALID */ + while((REG(RFCORE_XREG_RSSISTAT) & RFCORE_XREG_RSSISTAT_RSSI_VALID) == 0); + + rssi = ((int8_t)REG(RFCORE_XREG_RSSI)) - RSSI_OFFSET; + + /* If we were off, turn back off */ + if((rf_flags & WAS_OFF) == WAS_OFF) { + rf_flags &= ~WAS_OFF; + off(); + } + + return rssi; +} +/*---------------------------------------------------------------------------*/ /* Netstack API radio driver functions */ /*---------------------------------------------------------------------------*/ static int @@ -720,5 +745,14 @@ cc2538_rf_err_isr(void) ENERGEST_OFF(ENERGEST_TYPE_IRQ); } /*---------------------------------------------------------------------------*/ - +void +cc2538_rf_set_promiscous_mode(char p) +{ + if(p) { + REG(RFCORE_XREG_FRMFILT0) &= ~RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN; + } else { + REG(RFCORE_XREG_FRMFILT0) |= RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN; + } +} +/*---------------------------------------------------------------------------*/ /** @} */ diff --git a/cpu/cc2538/dev/cc2538-rf.h b/cpu/cc2538/dev/cc2538-rf.h index e6f420fe6..75b4ca3e4 100644 --- a/cpu/cc2538/dev/cc2538-rf.h +++ b/cpu/cc2538/dev/cc2538-rf.h @@ -144,7 +144,7 @@ int8_t cc2538_rf_channel_set(uint8_t channel); * \brief Get the current operating channel * \return Returns a value in [11,26] representing the current channel */ -uint8_t cc2538_rf_channel_get(); +uint8_t cc2538_rf_channel_get(void); /** * \brief Sets RF TX power @@ -167,6 +167,27 @@ uint8_t cc2538_rf_power_set(uint8_t new_power); * are thus simply copied over from there. */ void cc2538_rf_set_addr(uint16_t pan); + +/** + * \brief Reads the current signal strength (RSSI) + * \return The current RSSI + * + * This function reads the current RSSI on the currently configured + * channel. + */ +int cc2538_rf_read_rssi(void); + +/** + * \brief Turn promiscous mode on or off + * \param p If promiscous mode should be on (1) or off (0) + * + * This function turns promiscous mode on or off. In promiscous mode, + * every received frame is returned from the RF core. In + * non-promiscous mode, only broadcast frames or frames with our + * address as the receive address are returned from the RF core. + */ +void cc2538_rf_set_promiscous_mode(char p); + /*---------------------------------------------------------------------------*/ #endif /* CC2538_RF_H__ */ diff --git a/cpu/cc2538/mtarch.h b/cpu/cc2538/mtarch.h index 4f696669d..121150d14 100644 --- a/cpu/cc2538/mtarch.h +++ b/cpu/cc2538/mtarch.h @@ -38,11 +38,11 @@ * \author * George Oikonomou - */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { unsigned char *sp; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/cc253x/8051def.h b/cpu/cc253x/8051def.h index 2e1d92fd2..03dfc810e 100644 --- a/cpu/cc253x/8051def.h +++ b/cpu/cc253x/8051def.h @@ -9,8 +9,8 @@ * (updates for the cc2530 ports) */ -#ifndef __8051_DEF_H__ -#define __8051_DEF_H__ +#ifndef E051_DEF_H_ +#define E051_DEF_H_ #include @@ -115,4 +115,4 @@ typedef unsigned short clock_time_t; #define uip_ipaddr_copy(dest, src) \ memcpy(dest, src, sizeof(*dest)) -#endif /* __8051_DEF_H__ */ +#endif /* E051_DEF_H_ */ diff --git a/cpu/cc253x/cc253x.h b/cpu/cc253x/cc253x.h index 68bc3a293..4ed93aae7 100644 --- a/cpu/cc253x/cc253x.h +++ b/cpu/cc253x/cc253x.h @@ -42,8 +42,8 @@ * George Oikonomou - */ -#ifndef __CC253X_H__ -#define __CC253X_H__ +#ifndef CC253X_H_ +#define CC253X_H_ /*---------------------------------------------------------------------------*/ /* Compiler Abstraction */ @@ -670,4 +670,4 @@ SFRX(X_P2DIR, 0x70FF); /* Port 2 direction */ SFRX(X_INFOPAGE, 0x7800); /* Start of Information Page */ SFRX(X_IEEE_ADDR, 0x780C); /* Start of unique IEEE Address */ -#endif /* __CC253X_H__ */ +#endif /* CC253X_H_ */ diff --git a/cpu/cc253x/dev/cc2530-rf.h b/cpu/cc253x/dev/cc2530-rf.h index 9d84603d4..f5722db5f 100644 --- a/cpu/cc253x/dev/cc2530-rf.h +++ b/cpu/cc253x/dev/cc2530-rf.h @@ -36,8 +36,8 @@ * \author * George Oikonomou - */ -#ifndef __CC2530_RF_H__ -#define __CC2530_RF_H__ +#ifndef CC2530_RF_H_ +#define CC2530_RF_H_ #include "contiki.h" #include "dev/radio.h" @@ -125,4 +125,4 @@ int8_t cc2530_rf_channel_set(uint8_t channel); uint8_t cc2530_rf_power_set(uint8_t new_power); void cc2530_rf_set_addr(uint16_t pan); /*---------------------------------------------------------------------------*/ -#endif /* __CC2530_RF_H__ */ +#endif /* CC2530_RF_H_ */ diff --git a/cpu/cc253x/dev/clock-isr.h b/cpu/cc253x/dev/clock-isr.h index 005ac38c6..10ea71cb0 100644 --- a/cpu/cc253x/dev/clock-isr.h +++ b/cpu/cc253x/dev/clock-isr.h @@ -35,12 +35,12 @@ * \author * George Oikonomou - */ -#ifndef __CLOCK_ISR_H__ -#define __CLOCK_ISR_H__ +#ifndef CLOCK_ISR_H_ +#define CLOCK_ISR_H_ #include "contiki-conf.h" #include "cc253x.h" void clock_isr(void) __interrupt(ST_VECTOR); -#endif /* __CLOCK_ISR_H__ */ +#endif /* CLOCK_ISR_H_ */ diff --git a/cpu/cc253x/dev/lpm.h b/cpu/cc253x/dev/lpm.h index 4a8f14710..eb1522834 100644 --- a/cpu/cc253x/dev/lpm.h +++ b/cpu/cc253x/dev/lpm.h @@ -39,8 +39,8 @@ * \author * George Oikonomou - */ -#ifndef __LPM_H__ -#define __LPM_H__ +#ifndef LPM_H_ +#define LPM_H_ #include "contiki-conf.h" @@ -54,4 +54,4 @@ #define LPM_MODE LPM_MODE_IDLE #endif /* LPM_CONF_MODE */ -#endif /* __LPM_H__ */ +#endif /* LPM_H_ */ diff --git a/cpu/cc253x/dev/port.h b/cpu/cc253x/dev/port.h index 6fc69d10c..bc0acbfa1 100644 --- a/cpu/cc253x/dev/port.h +++ b/cpu/cc253x/dev/port.h @@ -142,4 +142,4 @@ #define PORT1_0_IRQ_EDGE_R_X() do { PICTL &= ~PICTL_P1ICONL; } while(0) /*---------------------------------------------------------------------------*/ -#endif /* __PORT_H__ */ +#endif /* PORT_H_ */ diff --git a/cpu/cc253x/dev/port2.h b/cpu/cc253x/dev/port2.h index 10f9774ec..cdc87a732 100644 --- a/cpu/cc253x/dev/port2.h +++ b/cpu/cc253x/dev/port2.h @@ -28,8 +28,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __CC253x_P2_INTR_H__ -#define __CC253x_P2_INTR_H__ +#ifndef CC253x_P2_INTR_H_ +#define CC253x_P2_INTR_H_ #include "contiki.h" diff --git a/cpu/cc253x/mtarch.h b/cpu/cc253x/mtarch.h index 2272d7a5b..cbbb095c5 100644 --- a/cpu/cc253x/mtarch.h +++ b/cpu/cc253x/mtarch.h @@ -39,11 +39,11 @@ * \author * George Oikonomou - */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { unsigned char *sp; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/cc253x/rtimer-arch.h b/cpu/cc253x/rtimer-arch.h index 548628c58..69e27420d 100644 --- a/cpu/cc253x/rtimer-arch.h +++ b/cpu/cc253x/rtimer-arch.h @@ -41,8 +41,8 @@ * (rtimer-arch implementation for cc2430 and then cc253x) */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "contiki-conf.h" #include "cc253x.h" @@ -57,4 +57,4 @@ void rtimer_isr(void) __interrupt(T1_VECTOR); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/cc253x/soc.h b/cpu/cc253x/soc.h index bcf858ba0..59ec336fc 100644 --- a/cpu/cc253x/soc.h +++ b/cpu/cc253x/soc.h @@ -38,8 +38,8 @@ */ -#ifndef __SOC_H__ -#define __SOC_H__ +#ifndef SOC_H_ +#define SOC_H_ #ifndef CC2530_LAST_FLASH_BANK @@ -61,4 +61,4 @@ void soc_init(); -#endif /* __SOC_H__ */ +#endif /* SOC_H_ */ diff --git a/cpu/cc253x/usb/common/cdc-acm/cdc-acm.h b/cpu/cc253x/usb/common/cdc-acm/cdc-acm.h index 43b7f1553..4b084281d 100644 --- a/cpu/cc253x/usb/common/cdc-acm/cdc-acm.h +++ b/cpu/cc253x/usb/common/cdc-acm/cdc-acm.h @@ -1,5 +1,5 @@ -#ifndef __CDC_ACM_H__UFV6K50827__ -#define __CDC_ACM_H__UFV6K50827__ +#ifndef CDC_ACM_H_UFV6K50827__ +#define CDC_ACM_H_UFV6K50827__ #include "cdc.h" #include "contiki.h" @@ -21,4 +21,4 @@ const struct usb_cdc_line_coding *usb_cdc_acm_get_line_coding(void); void usb_cdc_acm_set_event_process(struct process *p); -#endif /* __CDC_ACM_H__UFV6K50827__ */ +#endif /* CDC_ACM_H_UFV6K50827__ */ diff --git a/cpu/cc253x/usb/common/cdc-acm/cdc.h b/cpu/cc253x/usb/common/cdc-acm/cdc.h index d4bd987fc..8995e2f63 100644 --- a/cpu/cc253x/usb/common/cdc-acm/cdc.h +++ b/cpu/cc253x/usb/common/cdc-acm/cdc.h @@ -1,5 +1,5 @@ -#ifndef __CDC_H__K1Q26ESJOC__ -#define __CDC_H__K1Q26ESJOC__ +#ifndef CDC_H_K1Q26ESJOC__ +#define CDC_H_K1Q26ESJOC__ #include "usb.h" /* Communication Class */ /* Class code */ @@ -200,4 +200,4 @@ struct usb_cdc_line_coding { Uchar bDataBits; } BYTE_ALIGNED; -#endif /* __CDC_H__K1Q26ESJOC__ */ +#endif /* CDC_H_K1Q26ESJOC__ */ diff --git a/cpu/cc253x/usb/common/descriptors.h b/cpu/cc253x/usb/common/descriptors.h index 30808f744..f54184395 100644 --- a/cpu/cc253x/usb/common/descriptors.h +++ b/cpu/cc253x/usb/common/descriptors.h @@ -1,5 +1,5 @@ -#ifndef __DESCRIPTORS_H__RPFUB8O7OV__ -#define __DESCRIPTORS_H__RPFUB8O7OV__ +#ifndef DESCRIPTORS_H_RPFUB8O7OV__ +#define DESCRIPTORS_H_RPFUB8O7OV__ #ifndef STRUCTGEN #include "usb.h" @@ -7,4 +7,4 @@ extern const struct usb_st_device_descriptor device_descriptor; extern const struct usb_st_configuration_descriptor const *configuration_head; -#endif /* __DESCRIPTORS_H__RPFUB8O7OV__ */ +#endif /* DESCRIPTORS_H_RPFUB8O7OV__ */ diff --git a/cpu/cc253x/usb/common/usb-api.h b/cpu/cc253x/usb/common/usb-api.h index ac63a2d84..b55cd4a5e 100644 --- a/cpu/cc253x/usb/common/usb-api.h +++ b/cpu/cc253x/usb/common/usb-api.h @@ -1,5 +1,5 @@ -#ifndef __USB_API_H__SYN81IFYBN__ -#define __USB_API_H__SYN81IFYBN__ +#ifndef USB_API_H_SYN81IFYBN__ +#define USB_API_H_SYN81IFYBN__ #include "sys/process.h" @@ -124,4 +124,4 @@ unsigned int usb_get_ep_events(uint8_t addr); unsigned int usb_get_current_configuration(void); -#endif /* __USB_API_H__SYN81IFYBN__ */ +#endif /* USB_API_H_SYN81IFYBN__ */ diff --git a/cpu/cc253x/usb/common/usb-arch.h b/cpu/cc253x/usb/common/usb-arch.h index 37f234ac2..a0f6db160 100644 --- a/cpu/cc253x/usb/common/usb-arch.h +++ b/cpu/cc253x/usb/common/usb-arch.h @@ -1,5 +1,5 @@ -#ifndef __USB_ARCH_H__0Z52ZDP0H6__ -#define __USB_ARCH_H__0Z52ZDP0H6__ +#ifndef USB_ARCH_H_0Z52ZDP0H6__ +#define USB_ARCH_H_0Z52ZDP0H6__ #include "contiki-conf.h" #include "usb-api.h" @@ -74,4 +74,4 @@ unsigned int usb_arch_get_global_events(void); /* Return true if not all data has been sent to the host */ int usb_arch_send_pending(uint8_t ep_addr); -#endif /* __USB_ARCH_H__0Z52ZDP0H6__ */ +#endif /* USB_ARCH_H_0Z52ZDP0H6__ */ diff --git a/cpu/cc253x/usb/common/usb-core.h b/cpu/cc253x/usb/common/usb-core.h index aa925014a..ba6304ca2 100644 --- a/cpu/cc253x/usb/common/usb-core.h +++ b/cpu/cc253x/usb/common/usb-core.h @@ -1,5 +1,5 @@ -#ifndef __USB_CORE_H__YIKJDA7S1X__ -#define __USB_CORE_H__YIKJDA7S1X__ +#ifndef USB_CORE_H_YIKJDA7S1X__ +#define USB_CORE_H_YIKJDA7S1X__ #include @@ -16,4 +16,4 @@ typedef void (*usb_ctrl_data_callback)(uint8_t *data, unsigned int length); void usb_get_ctrl_data(uint8_t *data, unsigned int length, usb_ctrl_data_callback cb); -#endif /* __USB_CORE_H__YIKJDA7S1X__ */ +#endif /* USB_CORE_H_YIKJDA7S1X__ */ diff --git a/cpu/cc253x/usb/common/usb.h b/cpu/cc253x/usb/common/usb.h index 86dc3419a..a1d7dfb78 100644 --- a/cpu/cc253x/usb/common/usb.h +++ b/cpu/cc253x/usb/common/usb.h @@ -1,5 +1,5 @@ -#ifndef __USB_H__6PFTDPIMZM__ -#define __USB_H__6PFTDPIMZM__ +#ifndef USB_H_6PFTDPIMZM__ +#define USB_H_6PFTDPIMZM__ #include /* Adapted from usb_kbd_enum.h in c5131-usb-kbd-light-1_0_2 package from @@ -182,4 +182,4 @@ struct usb_st_language_descriptor Uint16 wlangid[1]; /* language id */ } BYTE_ALIGNED; -#endif /* __USB_H__6PFTDPIMZM__ */ +#endif /* USB_H_6PFTDPIMZM__ */ diff --git a/cpu/mc1322x/Makefile.mc1322x b/cpu/mc1322x/Makefile.mc1322x index d04e3ecf7..40dfd945c 100644 --- a/cpu/mc1322x/Makefile.mc1322x +++ b/cpu/mc1322x/Makefile.mc1322x @@ -34,6 +34,7 @@ AS = $(CROSS)as AR = $(CROSS)ar NM = $(CROSS)nm OBJCOPY = $(CROSS)objcopy +OBJDUMP = $(CROSS)objdump STRIP = $(CROSS)strip PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)} @@ -81,26 +82,32 @@ else endif $(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S | $(OBJECTDIR) - $(CPP) $(CPPFLAGS) $< > $@ + $(TRACE_CC) + $(Q)$(CPP) $(CPPFLAGS) $< > $@ $(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c | $(OBJECTDIR) - $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ %.o: %.c - $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ CUSTOM_RULE_S_TO_OBJECTDIR_O = yes $(OBJECTDIR)/%.o: %.S | $(OBJECTDIR) - $(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@ CUSTOM_RULE_C_TO_CO=yes %.co: %.c - $(CC) $(CFLAGS) -DAUTOSTART_ENABLE $(THUMB_FLAGS) $< -c -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $(THUMB_FLAGS) $< -c -o $@ .PRECIOUS: %.bin %_$(TARGET).bin @@ -114,6 +121,9 @@ CUSTOM_RULE_C_TO_CO=yes @ %.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/mc1322x.lds - $(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a %.lds,$^) $(filter %.a,$^) $(filter %.a,$^) + $(TRACE_CC) + $(Q)$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a %.lds,$^) $(filter %.a,$^) $(filter %.a,$^) +%.lst: %.elf + $(OBJDUMP) -DS $< > $@ diff --git a/cpu/mc1322x/contiki-mc1322x-conf.h b/cpu/mc1322x/contiki-mc1322x-conf.h index b88331413..e6c65df56 100644 --- a/cpu/mc1322x/contiki-mc1322x-conf.h +++ b/cpu/mc1322x/contiki-mc1322x-conf.h @@ -33,8 +33,8 @@ * */ -#ifndef __CONTIKI_MC1322X_CONF_H__ -#define __CONTIKI_MC1322X_CONF_H__ +#ifndef CONTIKI_MC1322X_CONF_H_ +#define CONTIKI_MC1322X_CONF_H_ typedef int32_t s32_t; diff --git a/cpu/mc1322x/debug-uart.h b/cpu/mc1322x/debug-uart.h index 628e99e8f..0bd1d4f42 100644 --- a/cpu/mc1322x/debug-uart.h +++ b/cpu/mc1322x/debug-uart.h @@ -1,5 +1,5 @@ -#ifndef __DEBUG_UART_H__1V2039076V__ -#define __DEBUG_UART_H__1V2039076V__ +#ifndef DEBUG_UART_H_1V2039076V__ +#define DEBUG_UART_H_1V2039076V__ #ifndef dbg_setup_uart #define dbg_setup_uart dbg_setup_uart_default @@ -24,4 +24,4 @@ dbg_blocking_putchar(const char ch); void dbg_drain(); -#endif /* __DEBUG_UART_H__1V2039076V__ */ +#endif /* DEBUG_UART_H_1V2039076V__ */ diff --git a/cpu/mc1322x/lib/include/maca.h b/cpu/mc1322x/lib/include/maca.h index 4c67bf051..5f1083f38 100644 --- a/cpu/mc1322x/lib/include/maca.h +++ b/cpu/mc1322x/lib/include/maca.h @@ -33,8 +33,8 @@ * */ -#ifndef _MACA_H_ -#define _MACA_H_ +#ifndef MACA_H_ +#define MACA_H_ #include #include @@ -529,4 +529,4 @@ enum maca_status_bits { #define MACA_WRITE(reg, src) (reg = src) #define MACA_READ(reg) reg -#endif // _MACA_H_ +#endif //MACA_H_ diff --git a/cpu/mc1322x/mtarch.h b/cpu/mc1322x/mtarch.h index 540e2b8cf..3b181880a 100644 --- a/cpu/mc1322x/mtarch.h +++ b/cpu/mc1322x/mtarch.h @@ -43,8 +43,8 @@ * */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ #include "contiki-conf.h" @@ -59,5 +59,5 @@ struct mtarch_thread { unsigned char *sp; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/mc1322x/rtimer-arch.h b/cpu/mc1322x/rtimer-arch.h index 2e8f4acce..5d52b3422 100644 --- a/cpu/mc1322x/rtimer-arch.h +++ b/cpu/mc1322x/rtimer-arch.h @@ -40,8 +40,8 @@ * Mariano Alvira */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ /* contiki */ #include "sys/rtimer.h" @@ -58,4 +58,4 @@ #define rtimer_arch_now() (CRM->RTC_COUNT) -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/mc1322x/watchdog.c b/cpu/mc1322x/watchdog.c index 7c25f449b..542a68022 100644 --- a/cpu/mc1322x/watchdog.c +++ b/cpu/mc1322x/watchdog.c @@ -34,30 +34,38 @@ */ #include "dev/watchdog.h" +#include +#include /*---------------------------------------------------------------------------*/ void watchdog_init(void) { + cop_timeout_ms(1000); } /*---------------------------------------------------------------------------*/ void watchdog_start(void) { + CRM->COP_CNTLbits.COP_EN = 1; } /*---------------------------------------------------------------------------*/ void watchdog_periodic(void) { + cop_service(); } /*---------------------------------------------------------------------------*/ void watchdog_stop(void) { + CRM->COP_CNTLbits.COP_EN = 0; } /*---------------------------------------------------------------------------*/ void watchdog_reboot(void) { + watchdog_start(); + while(1); } /*---------------------------------------------------------------------------*/ diff --git a/cpu/msp430/dev/flash.h b/cpu/msp430/dev/flash.h index 99986be23..ed142b8a1 100644 --- a/cpu/msp430/dev/flash.h +++ b/cpu/msp430/dev/flash.h @@ -36,8 +36,8 @@ * */ -#ifndef __FLASH_H__ -#define __FLASH_H__ +#ifndef FLASH_H_ +#define FLASH_H_ /** * Setup function to be called before any of the flash programming functions. @@ -74,4 +74,4 @@ void flash_write(unsigned short *addr, unsigned short word); */ void flash_clear(unsigned short *addr); -#endif /* __FLASH_H__ */ +#endif /* FLASH_H_ */ diff --git a/cpu/msp430/dev/hwconf.h b/cpu/msp430/dev/hwconf.h index d30937d73..f58c3cd6b 100644 --- a/cpu/msp430/dev/hwconf.h +++ b/cpu/msp430/dev/hwconf.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __HWCONF_H__ -#define __HWCONF_H__ +#ifndef HWCONF_H_ +#define HWCONF_H_ #include "contiki.h" #include "sys/cc.h" @@ -53,4 +53,4 @@ static CC_INLINE void name##_IRQ_EDGE_SELECTU() {P##port##IES &= ~(1 << bit);}\ static CC_INLINE int name##_CHECK_IRQ() {return P##port##IFG & (1 << bit);} \ static CC_INLINE int name##_IRQ_PORT() {return port;} -#endif /* __HWCONF_H__ */ +#endif /* HWCONF_H_ */ diff --git a/cpu/msp430/dev/lpm.h b/cpu/msp430/dev/lpm.h index 6268d7ada..ccdc08eea 100644 --- a/cpu/msp430/dev/lpm.h +++ b/cpu/msp430/dev/lpm.h @@ -29,8 +29,8 @@ * This file is part of the Contiki operating system. * */ -#ifndef __LPM_H__ -#define __LPM_H__ +#ifndef LPM_H_ +#define LPM_H_ #include "contiki-conf.h" @@ -58,4 +58,4 @@ void lpm_off(void); #define LPM_STATUS_ON 1 -#endif /* __LPM_H__ */ +#endif /* LPM_H_ */ diff --git a/cpu/msp430/dev/uart0.h b/cpu/msp430/dev/uart0.h index 9aef3a583..837906596 100644 --- a/cpu/msp430/dev/uart0.h +++ b/cpu/msp430/dev/uart0.h @@ -37,8 +37,8 @@ * Enric M. Calvo */ -#ifndef __UART0_H__ -#define __UART0_H__ +#ifndef UART0_H_ +#define UART0_H_ #include "contiki.h" @@ -49,4 +49,4 @@ void uart0_writeb(unsigned char c); void uart0_init(unsigned long ubr); uint8_t uart0_active(void); -#endif /* __UART0_H__ */ +#endif /* UART0_H_ */ diff --git a/cpu/msp430/dev/uart1.h b/cpu/msp430/dev/uart1.h index f58764502..90280d4c8 100644 --- a/cpu/msp430/dev/uart1.h +++ b/cpu/msp430/dev/uart1.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __UART1_H__ -#define __UART1_H__ +#ifndef UART1_H_ +#define UART1_H_ #include "contiki.h" @@ -49,4 +49,4 @@ void uart1_writeb(unsigned char c); void uart1_init(unsigned long ubr); uint8_t uart1_active(void); -#endif /* __UART1_H__ */ +#endif /* UART1_H_ */ diff --git a/cpu/msp430/isr_compat.h b/cpu/msp430/isr_compat.h index 5d1a2dcff..5ede95a86 100644 --- a/cpu/msp430/isr_compat.h +++ b/cpu/msp430/isr_compat.h @@ -25,8 +25,8 @@ * */ -#ifndef _ISR_COMPAT_H_ -#define _ISR_COMPAT_H_ +#ifndef ISR_COMPAT_H_ +#define ISR_COMPAT_H_ /* Cross compiler interrupt service routine compatibility definitions */ /* This code currently allows for: diff --git a/cpu/msp430/mtarch.h b/cpu/msp430/mtarch.h index 313c55861..f321bd176 100644 --- a/cpu/msp430/mtarch.h +++ b/cpu/msp430/mtarch.h @@ -28,8 +28,8 @@ * * This file is part of the Contiki operating system. */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ #include "contiki.h" @@ -48,4 +48,4 @@ struct mt_thread; int mtarch_stack_usage(struct mt_thread *t); -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/msp430/rtimer-arch.h b/cpu/msp430/rtimer-arch.h index 2912789e2..446ef99e1 100644 --- a/cpu/msp430/rtimer-arch.h +++ b/cpu/msp430/rtimer-arch.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "sys/rtimer.h" @@ -50,4 +50,4 @@ rtimer_clock_t rtimer_arch_now(void); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/native/mtarch.h b/cpu/native/mtarch.h index e53d52366..d006c1360 100644 --- a/cpu/native/mtarch.h +++ b/cpu/native/mtarch.h @@ -32,11 +32,11 @@ * */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { void *mt_thread; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/native/net/tapdev-drv.h b/cpu/native/net/tapdev-drv.h index 3241fc344..a36cee4a4 100644 --- a/cpu/native/net/tapdev-drv.h +++ b/cpu/native/net/tapdev-drv.h @@ -30,8 +30,8 @@ * */ -#ifndef __TAPDEV_DRV_H__ -#define __TAPDEV_DRV_H__ +#ifndef TAPDEV_DRV_H_ +#define TAPDEV_DRV_H_ #include "contiki.h" @@ -40,4 +40,4 @@ PROCESS_NAME(tapdev_process); uint8_t tapdev_output(void); int tapdev_fd(void); -#endif /* __TAPDEV_DRV_H__ */ +#endif /* TAPDEV_DRV_H_ */ diff --git a/cpu/native/net/tapdev.h b/cpu/native/net/tapdev.h index c18b405ec..8132b6000 100644 --- a/cpu/native/net/tapdev.h +++ b/cpu/native/net/tapdev.h @@ -33,12 +33,12 @@ * */ -#ifndef __TAPDEV_H__ -#define __TAPDEV_H__ +#ifndef TAPDEV_H_ +#define TAPDEV_H_ void tapdev_init(void); uint16_t tapdev_poll(void); void tapdev_send(void); void tapdev_exit(void); -#endif /* __TAPDEV_H__ */ +#endif /* TAPDEV_H_ */ diff --git a/cpu/native/net/tapdev6.h b/cpu/native/net/tapdev6.h index 5fbd2f9bd..8549a9b80 100644 --- a/cpu/native/net/tapdev6.h +++ b/cpu/native/net/tapdev6.h @@ -33,8 +33,8 @@ * * */ -#ifndef __TAPDEV_H__ -#define __TAPDEV_H__ +#ifndef TAPDEV_H_ +#define TAPDEV_H_ #include "contiki-net.h" @@ -43,4 +43,4 @@ uint8_t tapdev_send(const uip_lladdr_t *lladdr); uint16_t tapdev_poll(void); void tapdev_do_send(void); void tapdev_exit(void); //math -#endif /* __TAPDEV_H__ */ +#endif /* TAPDEV_H_ */ diff --git a/cpu/native/net/wpcap-drv.h b/cpu/native/net/wpcap-drv.h index 57587a236..4b57bb48a 100644 --- a/cpu/native/net/wpcap-drv.h +++ b/cpu/native/net/wpcap-drv.h @@ -30,8 +30,8 @@ * */ -#ifndef __WPCAP_DRV_H__ -#define __WPCAP_DRV_H__ +#ifndef WPCAP_DRV_H_ +#define WPCAP_DRV_H_ #include "contiki.h" @@ -39,4 +39,4 @@ PROCESS_NAME(wpcap_process); uint8_t wpcap_output(void); -#endif /* __WPCAP_DRV_H__ */ +#endif /* WPCAP_DRV_H_ */ diff --git a/cpu/native/net/wpcap.h b/cpu/native/net/wpcap.h index 04a8ca0a7..964e6b0fc 100644 --- a/cpu/native/net/wpcap.h +++ b/cpu/native/net/wpcap.h @@ -32,8 +32,8 @@ * */ -#ifndef __WPCAP_H__ -#define __WPCAP_H__ +#ifndef WPCAP_H_ +#define WPCAP_H_ void wpcap_init(void); uint16_t wpcap_poll(void); @@ -46,4 +46,4 @@ void wpcap_send(void); #endif void wpcap_exit(void); -#endif /* __WPCAP_H__ */ +#endif /* WPCAP_H_ */ diff --git a/cpu/native/rtimer-arch.h b/cpu/native/rtimer-arch.h index 32d1547fc..8af0c9903 100644 --- a/cpu/native/rtimer-arch.h +++ b/cpu/native/rtimer-arch.h @@ -37,8 +37,8 @@ * Adam Dunkels */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "contiki-conf.h" @@ -46,4 +46,4 @@ #define rtimer_arch_now() clock_time() -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/cpu/pic32/debug-uart.h b/cpu/pic32/debug-uart.h index 96f503909..b87b8d359 100644 --- a/cpu/pic32/debug-uart.h +++ b/cpu/pic32/debug-uart.h @@ -47,8 +47,8 @@ * \date 2012-03-21 */ -#ifndef __DEBUG_UART_H__ -#define __DEBUG_UART_H__ +#ifndef DEBUG_UART_H_ +#define DEBUG_UART_H_ #include diff --git a/cpu/pic32/lib/pic32_clock.h b/cpu/pic32/lib/pic32_clock.h index 9a3509848..c631178e9 100644 --- a/cpu/pic32/lib/pic32_clock.h +++ b/cpu/pic32/lib/pic32_clock.h @@ -47,8 +47,8 @@ * \date 2012-04-11 */ -#ifndef __INCLUDE_PIC32_CLOCK_H__ -#define __INCLUDE_PIC32_CLOCK_H__ +#ifndef INCLUDE_PIC32_CLOCK_H_ +#define INCLUDE_PIC32_CLOCK_H_ #include @@ -69,6 +69,6 @@ uint32_t pic32_clock_get_peripheral_clock(void); /* Function used to calculate the appropriate brg param to approximate desidered frequency */ uint32_t pic32_clock_calculate_brg(uint32_t mul, uint32_t desired); -#endif /* __INCLUDE_PIC32_CLOCK_H__ */ +#endif /* INCLUDE_PIC32_CLOCK_H_ */ /** @} */ diff --git a/cpu/pic32/lib/pic32_irq.h b/cpu/pic32/lib/pic32_irq.h index d47bed11c..e640a3499 100644 --- a/cpu/pic32/lib/pic32_irq.h +++ b/cpu/pic32/lib/pic32_irq.h @@ -55,8 +55,8 @@ * the 3xx and 4xx families of the pic32mx. */ -#ifndef __INCLUDE_PIC32_IRQ_H__ -#define __INCLUDE_PIC32_IRQ_H__ +#ifndef INCLUDE_PIC32_IRQ_H_ +#define INCLUDE_PIC32_IRQ_H_ #define ASM_DIS_INT \ do { \ @@ -74,6 +74,6 @@ void __attribute__((vector(v), interrupt(ipl7))) isr_##v(void) #define ISR(v) \ void __attribute__((vector(v), interrupt(ipl6))) isr_##v(void) -#endif /* __INCLUDE_PIC32_IRQ_H__ */ +#endif /* INCLUDE_PIC32_IRQ_H_ */ /** @} */ diff --git a/cpu/pic32/lib/pic32_spi.h b/cpu/pic32/lib/pic32_spi.h index cbf6600d2..b8053492e 100644 --- a/cpu/pic32/lib/pic32_spi.h +++ b/cpu/pic32/lib/pic32_spi.h @@ -55,8 +55,8 @@ * the 3xx and 4xx families of the pic32mx. */ -#ifndef __INCLUDE_PIC32_SPI_H__ -#define __INCLUDE_PIC32_SPI_H__ +#ifndef INCLUDE_PIC32_SPI_H_ +#define INCLUDE_PIC32_SPI_H_ #ifdef __USE_SPI__ @@ -109,6 +109,6 @@ SPI_DEF(3A) #endif /* __USE_SPI__ */ -#endif /* __INCLUDE_PIC32_SPI_H__ */ +#endif /* INCLUDE_PIC32_SPI_H_ */ /** @} */ diff --git a/cpu/pic32/lib/pic32_timer.h b/cpu/pic32/lib/pic32_timer.h index 7e44140ef..3027af05f 100644 --- a/cpu/pic32/lib/pic32_timer.h +++ b/cpu/pic32/lib/pic32_timer.h @@ -55,8 +55,8 @@ * the 3xx and 4xx families of the pic32mx. */ -#ifndef __INCLUDE_PIC32_TIMER_H__ -#define __INCLUDE_PIC32_TIMER_H__ +#ifndef INCLUDE_PIC32_TIMER_H_ +#define INCLUDE_PIC32_TIMER_H_ #ifdef __USE_TIMER__ @@ -138,6 +138,6 @@ TIMERN_32_DEF(45) #endif /* __USE_TIMER__ */ -#endif /* __INCLUDE_PIC32_TIMER_H__ */ +#endif /* INCLUDE_PIC32_TIMER_H_ */ /** @} */ diff --git a/cpu/pic32/lib/pic32_uart.h b/cpu/pic32/lib/pic32_uart.h index ec062c138..19c029a8a 100644 --- a/cpu/pic32/lib/pic32_uart.h +++ b/cpu/pic32/lib/pic32_uart.h @@ -55,8 +55,8 @@ * the 3xx and 4xx families of the pic32mx. */ -#ifndef __INCLUDE_PIC32_UART_H__ -#define __INCLUDE_PIC32_UART_H__ +#ifndef INCLUDE_PIC32_UART_H_ +#define INCLUDE_PIC32_UART_H_ #ifdef __USE_UART__ @@ -122,6 +122,6 @@ UART_PORT_DEF(3B) #endif /* __USE_UART__ */ -#endif /* __INCLUDE_PIC32_UART_H__ */ +#endif /* INCLUDE_PIC32_UART_H_ */ /** @} */ diff --git a/cpu/pic32/mtarch.h b/cpu/pic32/mtarch.h index 433af7ee1..02e660a5f 100644 --- a/cpu/pic32/mtarch.h +++ b/cpu/pic32/mtarch.h @@ -47,13 +47,13 @@ * \date 2012-03-23 */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { short mt_thread; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ /** @} */ diff --git a/cpu/pic32/pic32.h b/cpu/pic32/pic32.h index f11d19c80..77a47c92c 100644 --- a/cpu/pic32/pic32.h +++ b/cpu/pic32/pic32.h @@ -47,8 +47,8 @@ * \date 2012-03-23 */ -#ifndef __INCLUDE_PIC32_PIC32_H__ -#define __INCLUDE_PIC32_PIC32_H__ +#ifndef INCLUDE_PIC32_PIC32_H_ +#define INCLUDE_PIC32_PIC32_H_ /* * PIC32MX795F512L - Specific Functions @@ -94,6 +94,6 @@ void pic32_init(void); -#endif /* __INCLUDE_PIC32_PIC32_H__ */ +#endif /* INCLUDE_PIC32_PIC32_H_ */ /** @} */ diff --git a/cpu/pic32/rtimer-arch.h b/cpu/pic32/rtimer-arch.h index 2be3702b5..0b0ad8657 100644 --- a/cpu/pic32/rtimer-arch.h +++ b/cpu/pic32/rtimer-arch.h @@ -47,8 +47,8 @@ * \date 2012-04-11 */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "contiki-conf.h" @@ -58,6 +58,6 @@ rtimer_clock_t rtimer_arch_now(void); #define RTIMER_ARCH_SECOND 312500 -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ /** @} */ diff --git a/cpu/stm32w108/dev/stm32w-radio.h b/cpu/stm32w108/dev/stm32w-radio.h index 7b73f573a..3abd376b4 100644 --- a/cpu/stm32w108/dev/stm32w-radio.h +++ b/cpu/stm32w108/dev/stm32w-radio.h @@ -41,8 +41,8 @@ * Adam Dunkels */ -#ifndef __STM32W_H__ -#define __STM32W_H__ +#ifndef STM32W_H_ +#define STM32W_H_ #include "contiki.h" #include "dev/radio.h" @@ -59,5 +59,5 @@ short last_packet_rssi(); int stm32w_radio_is_on(void); -#endif /* __STM32W_H__ */ +#endif /* STM32W_H_ */ /** @} */ diff --git a/cpu/stm32w108/dev/uart1.h b/cpu/stm32w108/dev/uart1.h index bc684838e..d9711ac6c 100644 --- a/cpu/stm32w108/dev/uart1.h +++ b/cpu/stm32w108/dev/uart1.h @@ -41,8 +41,8 @@ * Adam Dunkels */ -#ifndef __UART1_H__ -#define __UART1_H__ +#ifndef UART1_H_ +#define UART1_H_ #define BAUD2UBR(baud) baud @@ -54,5 +54,5 @@ void uart1_init(unsigned long ubr); /* uint8_t uart1_active(void); */ -#endif /* __UART1_H__ */ +#endif /* UART1_H_ */ /** @} */ diff --git a/cpu/stm32w108/e_stdio/src/mbctype.h b/cpu/stm32w108/e_stdio/src/mbctype.h index 6abcf3db0..2c3e740e9 100644 --- a/cpu/stm32w108/e_stdio/src/mbctype.h +++ b/cpu/stm32w108/e_stdio/src/mbctype.h @@ -1,6 +1,6 @@ -#ifndef _MBCTYPE_H_ +#ifndef MBCTYPE_H_ -#define _MBCTYPE_H_ +#define MBCTYPE_H_ /* escape character used for JIS encoding */ #define ESC_CHAR 0x1b @@ -17,4 +17,4 @@ int _EXFUN(_isjis, (int c)); #define _iseucjp(c) ((c) >= 0xa1 && (c) <= 0xfe) #define _isjis(c) ((c) >= 0x21 && (c) <= 0x7e) -#endif /* _MBCTYPE_H_ */ +#endif /*MBCTYPE_H_ */ diff --git a/cpu/stm32w108/hal/error.h b/cpu/stm32w108/hal/error.h index 68ce42eb6..190b93e17 100644 --- a/cpu/stm32w108/hal/error.h +++ b/cpu/stm32w108/hal/error.h @@ -7,8 +7,8 @@ * */ -#ifndef __ERRORS_H__ -#define __ERRORS_H__ +#ifndef ERRORS_H_ +#define ERRORS_H_ /** * @brief Return type for St functions. @@ -48,7 +48,7 @@ enum { #undef DEFINE_ERROR -#endif // __ERRORS_H__ +#endif // ERRORS_H_ /**@} // End of addtogroup */ diff --git a/cpu/stm32w108/hal/hal.h b/cpu/stm32w108/hal/hal.h index e0161af3a..6050d1080 100644 --- a/cpu/stm32w108/hal/hal.h +++ b/cpu/stm32w108/hal/hal.h @@ -26,8 +26,8 @@ */ -#ifndef __HAL_H__ -#define __HAL_H__ +#ifndef HAL_H_ +#define HAL_H_ // Keep micro first for specifics used by other headers #include "micro/micro-common.h" @@ -38,5 +38,5 @@ #include "hal/micro/cortexm3/uart.h" #include "hal/micro/adc.h" -#endif //__HAL_H__ +#endif //HAL_H_ diff --git a/cpu/stm32w108/hal/micro/adc.h b/cpu/stm32w108/hal/micro/adc.h index c60067cd3..75d2eeeb5 100644 --- a/cpu/stm32w108/hal/micro/adc.h +++ b/cpu/stm32w108/hal/micro/adc.h @@ -31,8 +31,8 @@ * *@{ */ -#ifndef __ADC_H__ -#define __ADC_H__ +#ifndef ADC_H_ +#define ADC_H_ #ifdef CORTEXM3_STM32W108 @@ -314,7 +314,7 @@ boolean halAdcGetRange(void); #include "micro/cortexm3/stm32f103ret/adc.h" #endif /* CORTEXM3_STM32F103 */ -#endif // __ADC_H__ +#endif // ADC_H_ /** @} // END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/button.h b/cpu/stm32w108/hal/micro/button.h index 9dcbf0027..6ef8df7de 100644 --- a/cpu/stm32w108/hal/micro/button.h +++ b/cpu/stm32w108/hal/micro/button.h @@ -4,8 +4,8 @@ * */ -#ifndef _BUTTON_H_ -#define _BUTTON_H_ +#ifndef BUTTON_H_ +#define BUTTON_H_ /* button status */ #define BUTTON_PRESSED 0 @@ -23,6 +23,6 @@ void halInitButton(void); /** @brief Get button status */ uint8_t halGetButtonStatus(HalBoardButton button); -#endif /* _BUTTON_H_ */ +#endif /*BUTTON_H_ */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ diff --git a/cpu/stm32w108/hal/micro/cortexm3/bootloader/fib-bootloader.h b/cpu/stm32w108/hal/micro/cortexm3/bootloader/fib-bootloader.h index b0b631fe0..ef6651795 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/bootloader/fib-bootloader.h +++ b/cpu/stm32w108/hal/micro/cortexm3/bootloader/fib-bootloader.h @@ -4,8 +4,8 @@ * */ -#ifndef __FIB_BOOTLOADER_H__ -#define __FIB_BOOTLOADER_H__ +#ifndef FIB_BOOTLOADER_H_ +#define FIB_BOOTLOADER_H_ //------------------------------------------------------------------------------ // Reset signatures. @@ -53,4 +53,4 @@ FibStatus fibFlashWrite(uint32_t address, uint8_t *data, FibStatus fibFlashErase(FibEraseType eraseType, uint32_t address); -#endif //__FIB_BOOTLOADER_H__ +#endif //FIB_BOOTLOADER_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/compiler/asm.h b/cpu/stm32w108/hal/micro/cortexm3/compiler/asm.h index ccc5de4da..992e4efea 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/compiler/asm.h +++ b/cpu/stm32w108/hal/micro/cortexm3/compiler/asm.h @@ -1,5 +1,5 @@ -#ifndef __ASM_H__ -#define __ASM_H__ +#ifndef ASM_H_ +#define ASM_H_ #ifdef __IAR_SYSTEMS_ASM__ @@ -54,4 +54,4 @@ #endif // __GNUC__ -#endif // __ASM_H__ +#endif // ASM_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/compiler/gnu.h b/cpu/stm32w108/hal/micro/cortexm3/compiler/gnu.h index 158ccb4ba..66fee590c 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/compiler/gnu.h +++ b/cpu/stm32w108/hal/micro/cortexm3/compiler/gnu.h @@ -15,8 +15,8 @@ *@{ */ -#ifndef __GNU_H__ -#define __GNU_H__ +#ifndef GNU_H_ +#define GNU_H_ #include @@ -536,7 +536,7 @@ int abs(int I); #include "hal/micro/generic/compiler/platform-common.h" #undef PLATCOMMONOKTOINCLUDE -#endif // __GNU_H__ +#endif // GNU_H_ /** @} END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/cortexm3/compiler/iar.h b/cpu/stm32w108/hal/micro/cortexm3/compiler/iar.h index 68f0353d4..f9046cd32 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/compiler/iar.h +++ b/cpu/stm32w108/hal/micro/cortexm3/compiler/iar.h @@ -16,8 +16,8 @@ *@{ */ -#ifndef __IAR_H__ -#define __IAR_H__ +#ifndef IAR_H_ +#define IAR_H_ #ifndef __ICCARM__ #error Improper PLATFORM_HEADER @@ -529,7 +529,7 @@ int abs(int I); #include "hal/micro/generic/compiler/platform-common.h" #undef PLATCOMMONOKTOINCLUDE -#endif // __IAR_H__ +#endif // IAR_H_ /** @} END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/cortexm3/flash.h b/cpu/stm32w108/hal/micro/cortexm3/flash.h index 90d6c20c9..3404736f5 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/flash.h +++ b/cpu/stm32w108/hal/micro/cortexm3/flash.h @@ -19,8 +19,8 @@ *@{ */ -#ifndef __FLASH_H__ -#define __FLASH_H__ +#ifndef FLASH_H_ +#define FLASH_H_ #include "memmap.h" @@ -120,7 +120,7 @@ StStatus halInternalCibOptionByteWrite(uint8_t byte, uint8_t data); #endif //DOXYGEN_SHOULD_SKIP_THIS -#endif //__FLASH_H__ +#endif //FLASH_H_ /** @} END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/cortexm3/memmap-fat.h b/cpu/stm32w108/hal/micro/cortexm3/memmap-fat.h index 0587e1fa8..80d741cea 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/memmap-fat.h +++ b/cpu/stm32w108/hal/micro/cortexm3/memmap-fat.h @@ -3,10 +3,10 @@ * * */ -#ifndef __MEMMAP_FAT_H__ -#define __MEMMAP_FAT_H__ +#ifndef MEMMAP_FAT_H_ +#define MEMMAP_FAT_H_ -#ifndef __MEMMAP_TABLES_H__ +#ifndef MEMMAP_TABLES_H_ // if we weren't included via memmap-tables.h, define a dummy type for the BAT typedef void HalBootloaderAddressTableType; #endif @@ -48,4 +48,4 @@ extern const HalFixedAddressTableType halFixedAddressTable; #define FAT_MAJOR_VERSION_MASK (0xFF00) -#endif //__MEMMAP_FAT_H__ +#endif //MEMMAP_FAT_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/memmap.h b/cpu/stm32w108/hal/micro/cortexm3/memmap.h index 4849a4b23..3117696ad 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/memmap.h +++ b/cpu/stm32w108/hal/micro/cortexm3/memmap.h @@ -3,8 +3,8 @@ * * */ -#ifndef __MEMMAP_H__ -#define __MEMMAP_H__ +#ifndef MEMMAP_H_ +#define MEMMAP_H_ // Include the chip specific definitions #ifndef LOADER @@ -62,5 +62,5 @@ typedef struct { // Hal only references the FAT #include "memmap-fat.h" -#endif //__MEMMMAP_H__ +#endif //MEMMMAP_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/mfg-token.h b/cpu/stm32w108/hal/micro/cortexm3/mfg-token.h index b7a14ed20..f05ac216d 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/mfg-token.h +++ b/cpu/stm32w108/hal/micro/cortexm3/mfg-token.h @@ -4,8 +4,8 @@ * */ -#ifndef __MFG_TOKEN_H__ -#define __MFG_TOKEN_H__ +#ifndef MFG_TOKEN_H_ +#define MFG_TOKEN_H_ // The manufacturing tokens live in the Info Blocks, while all other tokens @@ -160,4 +160,4 @@ void halInternalSetMfgTokenData(uint16_t token, void *data, uint8_t len); #endif //DOXYGEN_SHOULD_SKIP_THIS -#endif //__MFG_TOKEN_H__ +#endif //MFG_TOKEN_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/micro-common.h b/cpu/stm32w108/hal/micro/cortexm3/micro-common.h index b7117c123..de555a15b 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/micro-common.h +++ b/cpu/stm32w108/hal/micro/cortexm3/micro-common.h @@ -11,8 +11,8 @@ *@{ */ -#ifndef __STM32W108XX_MICRO_COMMON_H__ -#define __STM32W108XX_MICRO_COMMON_H__ +#ifndef STM32W108XX_MICRO_COMMON_H_ +#define STM32W108XX_MICRO_COMMON_H_ #ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef __STSTATUS_TYPE__ @@ -285,7 +285,7 @@ void halCommonSeedRandom(uint32_t seed); */ uint16_t halCommonGetRandom(void); -#endif //__STM32W108XX_MICRO_COMMON_H__ +#endif //STM32W108XX_MICRO_COMMON_H_ /**@} // END micro group */ diff --git a/cpu/stm32w108/hal/micro/cortexm3/mpu.h b/cpu/stm32w108/hal/micro/cortexm3/mpu.h index 616270e12..840437448 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/mpu.h +++ b/cpu/stm32w108/hal/micro/cortexm3/mpu.h @@ -4,9 +4,9 @@ */ -#ifndef __MPU_H__ -#define __MPU_H__ +#ifndef MPU_H_ +#define MPU_H_ #define BYPASS_MPU(blah) blah -#endif//__MPU_H__ +#endif//MPU_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/nvm-def.h b/cpu/stm32w108/hal/micro/cortexm3/nvm-def.h index 1bf54d8f7..aad7f2ae9 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/nvm-def.h +++ b/cpu/stm32w108/hal/micro/cortexm3/nvm-def.h @@ -29,8 +29,8 @@ *@{ */ -#ifndef __NVM_DEF_H__ -#define __NVM_DEF_H__ +#ifndef NVM_DEF_H_ +#define NVM_DEF_H_ //The bottom 64 bytes of NVM storage is allocated to radio calibration //values. These 64 bytes *must* exist for the radio to function. @@ -49,5 +49,5 @@ /** @} END addtogroup */ -#endif // __NVM_DEF_H__ +#endif // NVM_DEF_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/nvm.h b/cpu/stm32w108/hal/micro/cortexm3/nvm.h index a1f0e3591..8f9bea60d 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/nvm.h +++ b/cpu/stm32w108/hal/micro/cortexm3/nvm.h @@ -170,8 +170,8 @@ */ -#ifndef __NVM_H__ -#define __NVM_H__ +#ifndef NVM_H_ +#define NVM_H_ //Pull in the MFB_ definitions. #include "hal/micro/cortexm3/memmap.h" @@ -275,5 +275,5 @@ StStatus halCommonWriteToNvm(const void *data, uint32_t offset, uint16_t length) /** @} END addtogroup */ -#endif // __NVM_H__ +#endif // NVM_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/stm32w108/board.h b/cpu/stm32w108/hal/micro/cortexm3/stm32w108/board.h index aaf9de78d..1619ee81d 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/stm32w108/board.h +++ b/cpu/stm32w108/hal/micro/cortexm3/stm32w108/board.h @@ -7,8 +7,8 @@ * * */ -#ifndef _BOARD_H_ -#define _BOARD_H_ +#ifndef BOARD_H_ +#define BOARD_H_ /** @addtogroup board * @brief ST board abstraction layer @@ -253,7 +253,7 @@ void halBoardPowerUp(void); */ void halBoardPowerDown(void); -#endif /* _BOARD_H_ */ +#endif /*BOARD_H_ */ /** @} // END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/cortexm3/stm32w108/memmap.h b/cpu/stm32w108/hal/micro/cortexm3/stm32w108/memmap.h index 171eea204..861036a9c 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/stm32w108/memmap.h +++ b/cpu/stm32w108/hal/micro/cortexm3/stm32w108/memmap.h @@ -4,12 +4,12 @@ * */ -#ifndef __MEMMAP_H__ +#ifndef MEMMAP_H_ #error This header should not be included directly, use hal/micro/cortexm3/memmap.h #endif -#ifndef __STM32W108_MEMMAP_H__ -#define __STM32W108_MEMMAP_H__ +#ifndef STM32W108_MEMMAP_H_ +#define STM32W108_MEMMAP_H_ #define RAM_BOTTOM (0x20000000u) #define RAM_SIZE_B (0x2000) @@ -54,4 +54,4 @@ #define PAGE_TO_PROG_ADDR(x) ((((uint32_t)(x)) << 10)|MFB_BOTTOM) -#endif //__STM32W108_MEMMAP_H__ +#endif //STM32W108_MEMMAP_H_ diff --git a/cpu/stm32w108/hal/micro/cortexm3/stm32w108/regs.h b/cpu/stm32w108/hal/micro/cortexm3/stm32w108/regs.h index aab30182a..5c60f682a 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/stm32w108/regs.h +++ b/cpu/stm32w108/hal/micro/cortexm3/stm32w108/regs.h @@ -1,5 +1,5 @@ -#ifndef __REGS_H__ -#define __REGS_H__ 1 +#ifndef REGS_H_ +#define REGS_H_ 1 #define ReadRegister(a) a @@ -11541,4 +11541,4 @@ #define DATA_VENDOR_SIZE (DATA_VENDOR_END - DATA_VENDOR_BASE + 1) -#endif /*__REGS_H__*/ +#endif /*REGS_H_*/ diff --git a/cpu/stm32w108/hal/micro/cortexm3/uart.h b/cpu/stm32w108/hal/micro/cortexm3/uart.h index 2eb45c0af..c15bf051d 100644 --- a/cpu/stm32w108/hal/micro/cortexm3/uart.h +++ b/cpu/stm32w108/hal/micro/cortexm3/uart.h @@ -5,8 +5,8 @@ * */ -#ifndef __UART_MIN_H__ -#define __UART_MIN_H__ +#ifndef UART_MIN_H_ +#define UART_MIN_H_ #ifdef __ICCARM__ #include #endif @@ -69,4 +69,4 @@ int __io_getchar(void); void __io_flush( void ); -#endif //__UART_MIN_H__ +#endif //UART_MIN_H_ diff --git a/cpu/stm32w108/hal/micro/generic/compiler/platform-common.h b/cpu/stm32w108/hal/micro/generic/compiler/platform-common.h index ee56fa6df..92f65625c 100644 --- a/cpu/stm32w108/hal/micro/generic/compiler/platform-common.h +++ b/cpu/stm32w108/hal/micro/generic/compiler/platform-common.h @@ -22,8 +22,8 @@ #error platform-common.h should not be included directly #endif -#ifndef __PLATFORMCOMMON_H__ -#define __PLATFORMCOMMON_H__ +#ifndef PLATFORMCOMMON_H_ +#define PLATFORMCOMMON_H_ //////////////////////////////////////////////////////////////////////////////// // Many of the common definitions must be explicitly enabled by the // particular PLATFORM_HEADER being used @@ -345,7 +345,7 @@ -#endif //__PLATFORMCOMMON_H__ +#endif //PLATFORMCOMMON_H_ /** @} END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/mems-regs.h b/cpu/stm32w108/hal/micro/mems-regs.h index 63c21418d..69acddd2c 100644 --- a/cpu/stm32w108/hal/micro/mems-regs.h +++ b/cpu/stm32w108/hal/micro/mems-regs.h @@ -4,8 +4,8 @@ * */ -#ifndef _MEMS_REGS_H_ -#define _MEMS_REGS_H_ +#ifndef MEMS_REGS_H_ +#define MEMS_REGS_H_ //---Size of MEMs data--- #define MEMS_DATA_SIZE 6 @@ -121,5 +121,5 @@ uint8_t i2c_read_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t *pBuffer, ui //-reg_value is the value of the register to be written---// uint8_t i2c_write_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t reg_value); -#endif /* _MEMS_REGS_H_ */ +#endif /*MEMS_REGS_H_ */ diff --git a/cpu/stm32w108/hal/micro/mems.h b/cpu/stm32w108/hal/micro/mems.h index 9b0649f66..5dc4e53d5 100644 --- a/cpu/stm32w108/hal/micro/mems.h +++ b/cpu/stm32w108/hal/micro/mems.h @@ -5,8 +5,8 @@ * */ -#ifndef _MEMS_H_ -#define _MEMS_H_ +#ifndef MEMS_H_ +#define MEMS_H_ #include "hal/micro/mems-regs.h" @@ -32,5 +32,5 @@ uint8_t mems_Init(void); */ uint8_t mems_GetValue(t_mems_data *mems_data); -#endif /* _MEMS_H_ */ +#endif /*MEMS_H_ */ diff --git a/cpu/stm32w108/hal/micro/micro-common.h b/cpu/stm32w108/hal/micro/micro-common.h index 75ce88cb0..6e43c2be0 100644 --- a/cpu/stm32w108/hal/micro/micro-common.h +++ b/cpu/stm32w108/hal/micro/micro-common.h @@ -12,8 +12,8 @@ *@{ */ -#ifndef __MICRO_COMMON_H__ -#define __MICRO_COMMON_H__ +#ifndef MICRO_COMMON_H_ +#define MICRO_COMMON_H_ #ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef __STSTATUS_TYPE__ @@ -141,7 +141,7 @@ StStatus halBootloaderStart(uint8_t mode, uint8_t channel, uint16_t panId); #include "micro/cortexm3/micro-common.h" #endif -#endif //__MICRO_COMMON_H__ +#endif //MICRO_COMMON_H_ /** @} END micro group */ diff --git a/cpu/stm32w108/hal/micro/system-timer.h b/cpu/stm32w108/hal/micro/system-timer.h index c2df6166e..703a58fa7 100644 --- a/cpu/stm32w108/hal/micro/system-timer.h +++ b/cpu/stm32w108/hal/micro/system-timer.h @@ -29,8 +29,8 @@ *@{ */ -#ifndef __SYSTEM_TIMER_H__ -#define __SYSTEM_TIMER_H__ +#ifndef SYSTEM_TIMER_H_ +#define SYSTEM_TIMER_H_ /** * @brief Initializes the system tick. @@ -72,7 +72,7 @@ uint32_t halCommonGetInt32uMillisecondTick(void); */ uint16_t halCommonGetInt16uQuarterSecondTick(void); -#endif //__SYSTEM_TIMER_H__ +#endif //SYSTEM_TIMER_H_ /**@} //END addtogroup */ diff --git a/cpu/stm32w108/hal/micro/temperature-sensor.h b/cpu/stm32w108/hal/micro/temperature-sensor.h index d012a9bf4..7965e8a0f 100644 --- a/cpu/stm32w108/hal/micro/temperature-sensor.h +++ b/cpu/stm32w108/hal/micro/temperature-sensor.h @@ -4,8 +4,8 @@ * * */ -#ifndef _TEMP_SENSOR_H_ -#define _TEMP_SENSOR_H_ +#ifndef TEMP_SENSOR_H_ +#define TEMP_SENSOR_H_ /* Include --------------------------------------------------------------------*/ #include "hal/micro/adc.h" @@ -23,5 +23,5 @@ void temperatureSensor_Init(void); */ uint32_t temperatureSensor_GetValue(void); -#endif /* _TEMP_SENSOR_H_ */ +#endif /*TEMP_SENSOR_H_ */ diff --git a/cpu/stm32w108/mtarch.h b/cpu/stm32w108/mtarch.h index 91615bda7..49e40f64d 100644 --- a/cpu/stm32w108/mtarch.h +++ b/cpu/stm32w108/mtarch.h @@ -40,12 +40,12 @@ */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { short mt_thread; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ /** @} */ diff --git a/cpu/stm32w108/rtimer-arch.h b/cpu/stm32w108/rtimer-arch.h index 638136d2f..2247df78e 100644 --- a/cpu/stm32w108/rtimer-arch.h +++ b/cpu/stm32w108/rtimer-arch.h @@ -42,8 +42,8 @@ * Salvatore Pitrulli */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #define RTIMER_ARCH_RES_341US 0 #define RTIMER_ARCH_RES_171US 1 @@ -93,5 +93,5 @@ void rtimer_arch_disable_irq(void); void rtimer_arch_enable_irq(void); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ /** @} */ diff --git a/cpu/stm32w108/simplemac/include/phy-library.h b/cpu/stm32w108/simplemac/include/phy-library.h index ca21a83e6..e1d953cce 100644 --- a/cpu/stm32w108/simplemac/include/phy-library.h +++ b/cpu/stm32w108/simplemac/include/phy-library.h @@ -51,7 +51,7 @@ #define MIN_RADIO_POWER -43 // dBm #define MAX_RADIO_POWER 3 // dBm -#ifndef __PHY_H__ +#ifndef PHY_H_ enum { ST_RADIO_POWER_MODE_RX_ON, ST_RADIO_POWER_MODE_OFF @@ -78,7 +78,7 @@ typedef struct { u8 backoffExponentMax; // Backoff exponent for the final CCA attempt(s). boolean appendCrc; // Append CRC to transmitted packets. } RadioTransmitConfig; -#endif// __PHY_H__ +#endif// PHY_H_ #ifndef ST_TYPES_H /** diff --git a/cpu/stm32w108/small-printf/vfieeefp.h b/cpu/stm32w108/small-printf/vfieeefp.h index ead4067f4..7a2d5b627 100644 --- a/cpu/stm32w108/small-printf/vfieeefp.h +++ b/cpu/stm32w108/small-printf/vfieeefp.h @@ -32,8 +32,8 @@ dmg@research.att.com or research!dmg */ -#ifndef __VFIEEEFP_H__ -#define __VFIEEEFP_H__ +#ifndef VFIEEEFP_H_ +#define VFIEEEFP_H_ /* * This header file is a modification of mprec.h that only contains floating @@ -295,5 +295,5 @@ union double_union #endif #endif -#endif /* __VFIEEEFP_H__ */ +#endif /* VFIEEEFP_H_ */ /** @} */ diff --git a/cpu/x86/mtarch.h b/cpu/x86/mtarch.h index a85280e3d..9f982828a 100644 --- a/cpu/x86/mtarch.h +++ b/cpu/x86/mtarch.h @@ -28,8 +28,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ #ifndef MTARCH_STACKSIZE #define MTARCH_STACKSIZE 1024 @@ -45,5 +45,5 @@ struct mt_thread; int mtarch_stack_usage(struct mt_thread *t); -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/cpu/z80/Makefile.z80 b/cpu/z80/Makefile.z80 deleted file mode 100644 index 47a705b47..000000000 --- a/cpu/z80/Makefile.z80 +++ /dev/null @@ -1,83 +0,0 @@ -# -# Makefile for z80/SDCC -# @author Takahide Matsutsuka -# -# $Id: Makefile.z80,v 1.15 2009/12/16 06:47:17 matsutsuka Exp $ -# - -### Compiler definitions -CC = sdcc -LD = link-z80 -AS = as-z80 -AR = sdcclib -OBJCOPY = objcopy -STRIP = strip - -### Custom rules -CUSTOM_RULE_C_TO_OBJECTDIR_O=1 -CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1 -CUSTOM_RULE_LINK=1 - -### Default flags -CFLAGS += --std-c99 -mz80 --opt-code-size -CFLAGS += --peep-file $(CONTIKI_CPU)/z80peephole.def --fverbose-asm -ASFLAGS += -LDFLAGS += -mz80 --out-fmt-ihx --no-std-crt0 -AROPTS = -a - -ifdef CONTIKI_PROJECT - CFLAGS += -DAUTOSTART_ENABLE=1 - CONTIKI_SOURCEFILES += $(CONTIKI_PROJECT).c -endif - -### CPU-dependent cleanup files -CLEAN += *.ihx *.lnk *.sym contiki-$(TARGET).lib *.$(TARGET) - -### CPU-dependent directories -CONTIKI_CPU_DIRS = . dev lib loader - -### CPU-dependent source files -CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \ - libconio_z80.c log-conio.c rs232.c - -CONTIKI_ASMFILES += uip_arch-asm.S crt0.S - -CONTIKI_ASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.o)} - -CONTIKI_CASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_CASMFILES:.cS=.o)} - -CONTIKI_PLATFORM_DIRS = $(PLATFORM_APPDIRS) \ - ${addprefix $(CONTIKI)/platform/$(TARGET)/, $(CONTIKI_TARGET_DIRS)} - -#".cS" suffix means assembler file with #include directive -#so that a developer can use definitions of C-style include file -#in assembler file. Make sure the header file contains only compiler -#directives. (i.e. #define, etc.) -vpath %.cS $(CONTIKI_PLATFORM_DIRS) - -#option -MMD doesn't work well on SDCC as of 2.9.0 -$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(CC) $(CFLAGS) -c $< -o $@ - -ifndef CUSTOM_RULE_CS_TO_OBJECTDIR_O -$(OBJECTDIR)/%.o: %.cS | $(OBJECTDIR) - cp $< $(OBJECTDIR)/$*.c - $(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp - perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S - $(AS) $(ASFLAGS) -o $@ $(OBJECTDIR)/$*.S - rm -f $(OBJECTDIR)/tmp -endif - -#CUSTOM_RULE_ALLOBJS_TO_TARGETLIB -contiki-$(TARGET).lib: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES) $(CONTIKI_CASMOBJECTFILES) - rm -f $@ - for target in $^; do echo $$target >> $@; done - -#CUSTOM_RULE_LINK (workaround for compiling examples) -$(CONTIKI_PROJECT): $(CONTIKI_PROJECT).ihx - mv $(CONTIKI_PROJECT).ihx $(CONTIKI_PROJECT).$(TARGET) - -#CUSTOM_RULE_LINK -%.ihx: contiki-$(TARGET).lib - $(CC) $(LDFLAGS) -o $@ $(OBJECTDIR)/crt0.o -lcontiki-$(TARGET).lib - $(LD) -nf $* diff --git a/cpu/z80/crt0.S b/cpu/z80/crt0.S deleted file mode 100644 index 6c3a18b4b..000000000 --- a/cpu/z80/crt0.S +++ /dev/null @@ -1,55 +0,0 @@ -;;; -;;; -;;; ctt0.S -;;; -;;; \file -;;; C runtime startup routine -;;; -;;; \author -;;; Takahide Matsutsuka -;;; -;;; $Id: crt0.S,v 1.3 2008/07/02 07:13:22 matsutsuka Exp $ -;;; - .module crt0 - .globl _main - - ;; Ordering of segments for the linker. - .area _HOME - .area _CODE - .area _GSINIT - .area _GSFINAL - .area _DATA - .area _DATAFINAL - .area _BSS - .area _HEAP - - .area _CODE -init:: - ;; Clear global variables - ld hl, #_datastart - ld bc, #_dataend -_clear_loop: - ld a, h - sub b - jr nz, _clear_next - ld a, l - sub c - jr z, _clear_exit -_clear_next: - ld (hl), #0 - inc hl - jr _clear_loop -_clear_exit: - ;; Initialize global variables - call gsinit - jp _main - - .area _GSINIT -gsinit:: - - .area _GSFINAL - ret - .area _DATA -_datastart:: - .area _DATAFINAL -_dataend:: diff --git a/cpu/z80/dev/rs232.c b/cpu/z80/dev/rs232.c deleted file mode 100644 index 630069bb8..000000000 --- a/cpu/z80/dev/rs232.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ -/* - * \file - * This is RS-232C process based on polling. - * Note that rs232.c and rs232-slip.c cannot be used at the same time. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" -#include "dev/slip.h" -#include "dev/serial-line.h" -#include "dev/rs232.h" - -PROCESS(rs232_process, "RS-232C polling process"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rs232_process, ev, data) -{ - static struct etimer timer; - char ch; - unsigned char i, stat; - PROCESS_BEGIN(); - - rs232_arch_init(RS232_BAUD_RATE); - etimer_set(&timer, CLOCK_SECOND / 16); - - while(1) { - PROCESS_WAIT_EVENT(); - - if (etimer_expired(&timer)) { - for (i = 0; i < RS232_BUFSIZE; i++) { - ch = rs232_arch_poll(&stat); - if (stat == 0) { - break; - } - /* We have an input data */ - RS232_CALLBACK(ch); - } - etimer_reset(&timer); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/cpu/z80/dev/rs232.h b/cpu/z80/dev/rs232.h deleted file mode 100644 index 15eec0480..000000000 --- a/cpu/z80/dev/rs232.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ -/* - * \file - * This is RS-232C process based on polling. - * \author - * Takahide Matsutsuka - */ - -#ifndef __RS232_H__ -#define __RS232_H__ - -/* - * Implement the following methods for each platform. - */ - -/* - * An architecture-depend implementation of RS-232C initialization. - */ -void rs232_arch_init(unsigned long ubr); - -/* - * An architecture-depend implementation of RS-232C polling. - * @return character, stat == zero if no input. - */ -unsigned char rs232_arch_poll(unsigned char* stat); - -/* - * An architecture-depend implementation of RS-232C writing a byte. - */ -void rs232_arch_writeb(unsigned char ch); - -PROCESS_NAME(rs232_process); - -/* - * if you want to use simple serial communication, - * define RS232_CONF_CALLBACK as serial_input_byte. - * The default is SLIP. - */ -#ifdef RS232_CONF_CALLBACK -#define RS232_CALLBACK RS232_CONF_CALLBACK -#else /* RS232_CONF_CALLBACK */ -#define RS232_CALLBACK slip_input_byte -#endif /* RS232_CONF_CALLBACK */ - -#ifdef RS232_CONF_BUFISZE -#define RS232_BUFSIZE RS232_CONF_BUFISZE -#else /* RS232_CONF_BUFISZE */ -#define RS232_BUFSIZE 64 -#endif /* RS232_CONF_BUFISZE */ - -#ifdef RS232_CONF_BAUD_RATE -#define RS232_BAUD_RATE RS232_CONF_BAUD_RATE -#else /* RS232_CONF_BAUD_RATE */ -#define RS232_BAUD_RATE 9600 -#endif /* RS232_CONF_BAUD_RATE */ - -#endif /* __RS232_H__ */ diff --git a/cpu/z80/lib/libconio_z80.c b/cpu/z80/lib/libconio_z80.c deleted file mode 100644 index a54c1cbc7..000000000 --- a/cpu/z80/lib/libconio_z80.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - /* - * \file - * Arcitecture-depend libconio module, which supposes - * the machine has character VRAM and optional attribute VRAM - * on the main memory. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" -#include "sys/log.h" -#include "libconio.h" -#include "libconio_z80.h" - -/*---------------------------------------------------------------------------*/ -static void scroll() { - unsigned char y; - uint16_t src, dst; - for (y = 0; y < LIBCONIO_CONF_SCREEN_HEIGHT - 1; y++) { - dst = LIBCONIO_VRAM_OFFSET(0, y); - src = LIBCONIO_VRAM_OFFSET(0, y + 1); - memcpy(LIBCONIO_VRAM_CHAR + dst, - LIBCONIO_VRAM_CHAR + src, - LIBCONIO_CONF_SCREEN_WIDTH); -#ifdef LIBCONIO_CONF_ATTRIBUTES_ENABLED - memcpy(LIBCONIO_VRAM_ATTR + dst, - LIBCONIO_VRAM_ATTR + src, - LIBCONIO_CONF_SCREEN_WIDTH); -#endif /* LIBCONIO_CONF_ATTRIBUTES_ENABLED */ - } - dst = LIBCONIO_VRAM_OFFSET(0, LIBCONIO_CONF_SCREEN_HEIGHT - 1); - memset(LIBCONIO_VRAM_CHAR + dst, ' ', - LIBCONIO_CONF_SCREEN_WIDTH); -#ifdef LIBCONIO_CONF_ATTRIBUTES_ENABLED - memset(LIBCONIO_VRAM_ATTR + dst, LIBCONIO_COLOR_NORMAL, - LIBCONIO_CONF_SCREEN_WIDTH); -#endif /* LIBCONIO_CONF_ATTRIBUTES_ENABLED */ - - gotoxy(0, LIBCONIO_CONF_SCREEN_HEIGHT - 1); -} -/*---------------------------------------------------------------------------*/ -/* make sure that the position is inside screen */ -static void adjust(unsigned char *x, unsigned char *y) { - if (*x > LIBCONIO_CONF_SCREEN_WIDTH) { - *y += *x / LIBCONIO_CONF_SCREEN_WIDTH; - *x = *x % LIBCONIO_CONF_SCREEN_WIDTH; - gotoxy(*x, *y); - } -} -/*---------------------------------------------------------------------------*/ -void ctk_arch_draw_char(char c, - unsigned char xpos, - unsigned char ypos, - unsigned char reversed, - unsigned char color) { - uint16_t off; - adjust(&xpos, &ypos); - - off = LIBCONIO_VRAM_OFFSET(xpos, ypos); - if (off >= LIBCONIO_VRAM_OFFSET_MAX) { - scroll(); - off = LIBCONIO_VRAM_OFFSET(0, LIBCONIO_CONF_SCREEN_HEIGHT - 1); - } - *(char *)(LIBCONIO_VRAM_CHAR + off) = c; -#ifdef LIBCONIO_CONF_ATTRIBUTES_ENABLED - *(char *)(LIBCONIO_VRAM_ATTR + off) = reversed ? - LIBCONIO_COLOR_REVERSED : LIBCONIO_COLOR_NORMAL; -#endif /* LIBCONIO_CONF_ATTRIBUTES_ENABLED */ -} -/*---------------------------------------------------------------------------*/ diff --git a/cpu/z80/lib/libconio_z80.h b/cpu/z80/lib/libconio_z80.h deleted file mode 100644 index a3198f27e..000000000 --- a/cpu/z80/lib/libconio_z80.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - /* - * \file - * Arcitecture-depend libconio module, which supposes - * the machine has character VRAM and optional attribute VRAM - * on the main memory. - * \author - * Takahide Matsutsuka - */ - -#ifndef __LIBCONIO_ARCH_H__ -#define __LIBCONIO_ARCH_H__ - -#ifndef LIBCONIO_VRAM_CHAR -#error "must specify vram address for characters!" -#endif /* LIBCONIO_VRAM_CHAR */ - -#ifdef LIBCONIO_CONF_ATTRIBUTES_ENABLED -#ifndef LIBCONIO_VRAM_ATTR -#error "must specify vram address for attributes!" -#endif /* LIBCONIO_VRAM_ATTR */ -#endif /* LIBCONIO_CONF_ATTRIBUTES_ENABLED */ - -#ifndef LIBCONIO_CONF_SCREEN_WIDTH -#define LIBCONIO_CONF_SCREEN_WIDTH 32 -#endif /* LIBCONIO_CONF_SCREEN_WIDTH */ - -#ifndef LIBCONIO_CONF_SCREEN_HEIGHT -#define LIBCONIO_CONF_SCREEN_HEIGHT 16 -#endif /* LIBCONIO_CONF_SCREEN_HEIGHT */ - -#ifndef LIBCONIO_COLOR_REVERSED -#define LIBCONIO_COLOR_REVERSED 0x21 -#endif /* LIBCONIO_COLOR_REVERSED */ - -#ifndef LIBCONIO_COLOR_NORMAL -#define LIBCONIO_COLOR_NORMAL 0x20 -#endif /* LIBCONIO_COLOR_NORMAL */ - -/* - * An offset caluclation logic. - * The default supposes the VRAM is sequential - */ -#ifndef LIBCONIO_VRAM_OFFSET -#define LIBCONIO_VRAM_OFFSET(x, y) (y) * LIBCONIO_CONF_SCREEN_WIDTH + (x) -#endif /* VRAM_OFFSET */ - -/* - * A maximum offset + 1. - * If offset is equal or more than this maximum, the screen will scroll. - */ -#ifndef LIBCONIO_VRAM_OFFSET_MAX -#define LIBCONIO_VRAM_OFFSET_MAX \ - (LIBCONIO_CONF_SCREEN_HEIGHT * LIBCONIO_CONF_SCREEN_WIDTH) -#endif /* VRAM_MAX */ - -#endif /* __LIBCONIO_ARCH_H__ */ diff --git a/cpu/z80/lib/log-conio.c b/cpu/z80/lib/log-conio.c deleted file mode 100644 index 7f404afea..000000000 --- a/cpu/z80/lib/log-conio.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - /* - * \file - * A default implmentation of logging for conio - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" -#include "libconio.h" -#include "log.h" - -#if LOG_CONF_ENABLED -void -log_message(const char *part1, const char *part2) -{ - cputs(part1); - /* line feed */ - gotoxy(0, wherey() + 1); -} -#endif /* LOG_CONF_ENABLED */ diff --git a/cpu/z80/lib/strcasecmp.c b/cpu/z80/lib/strcasecmp.c deleted file mode 100644 index dc0e844b3..000000000 --- a/cpu/z80/lib/strcasecmp.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - /* - * \file - * This complements standard C library of sdcc. - * \author - * Takahide Matsutsuka - */ - -#include -#include "strcasecmp.h" - -int strcasecmp(const char *str1, const char *str2) -{ - while (*str1 != '\0' && tolower(*str1) == tolower(*str2)) { - str1++; - str2++; - } - return tolower(*(unsigned char *)str1) - tolower(*(unsigned char *)str2); -} diff --git a/cpu/z80/lib/strcasecmp.h b/cpu/z80/lib/strcasecmp.h deleted file mode 100644 index 833151b45..000000000 --- a/cpu/z80/lib/strcasecmp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - /* - * \file - * This complements standard C library of sdcc. - * \author - * Takahide Matsutsuka - */ - -#ifndef __STRCASECMP_H__ -#define __STRCASECMP_H__ - -int strcasecmp(const char *str1, const char *str2); - -#endif /*__STRCASECMP_H__*/ diff --git a/cpu/z80/loader/mef.c b/cpu/z80/loader/mef.c deleted file mode 100644 index 2bde4c45f..000000000 --- a/cpu/z80/loader/mef.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * mef.c - * The Micro Executable Format - * \author - * Takahide Matsutsuka - */ - -#ifdef WITH_LOADER_ARCH -#include "contiki.h" -#include "loader/mef.h" - -struct Area areas[MEF_AREA_MAX]; - -void -mef_load(unsigned char* offset) -{ - unsigned char* start = offset; - unsigned char areasize = load_byte(); - uint16_t relocsize; - unsigned int i, j; - uint16_t checksum = 0; - unsigned char* buf; - struct Relocation reloc; - - for (i = 0; i < areasize; i++) { - buf = (unsigned char *) &areas[i]; - for (j = 0; j < sizeof(struct Area); j++) { - *buf++ = load_byte(); - } - } - - for (i = 0; i < areasize; i++) { - for (j = 0; j < areas[i].size; j++) { - *offset = load_byte(); - checksum += *offset; - offset++; - } - if (areas[i].checksum != checksum) { - // Checksum error! - } - } - - // relocation information - relocsize = load_byte(); - relocsize = (load_byte() << 8) + relocsize; - for (i = 0; i < relocsize; i++) { - buf = (unsigned char *) &reloc; - for (j = 0; j < sizeof(struct Relocation); j++) { - *buf++ = load_byte(); - } - mef_reloc(start, &reloc); - } -} - -void -mef_reloc(unsigned char* offset, struct Relocation *reloc) -{ - if (reloc->mode & MEF_RELOC_ABSOLUTE) { - return; - } - offset += reloc->address; - if (reloc->mode & MEF_RELOC_MSB_BYTE) { - *offset = (unsigned char) ((reloc->data + (uint16_t) offset) >> 8); - } else if (reloc->mode & MEF_RELOC_LSB_BYTE) { - *offset = (unsigned char) ((reloc->data + (uint16_t) offset) & 0xff); - } else { /* word */ - *offset++ = (unsigned char) ((reloc->data + (uint16_t) offset) & 0xff); - *offset = (unsigned char) ((reloc->data + (uint16_t) offset) >> 8); - } -} - - -#endif /* WITH_LOADER_ARCH */ diff --git a/cpu/z80/loader/mef.h b/cpu/z80/loader/mef.h deleted file mode 100644 index 1a5866de4..000000000 --- a/cpu/z80/loader/mef.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * mef.h - * The Micro Executable Format - * \author - * Takahide Matsutsuka - */ -/* - * MEF file format: - * [AreaDecls] - * BYTE nAreas (0-15) - * struct AreaSize[nAreas] - * [Data] - * binary* - * [Relocation] - * WORD nRelocs - * struct Relocation[nRelocs] - */ - -#ifndef __MEF_H__ -#define __MEF_H__ - - -/* - * mode - * bit 7: read/write (1) / read only (0) - * bit 3-0: Area index - * checksum - * just a sum of all data of the area - */ -#define MEF_AREA_RW 0x80 -#define MEF_AREA_MAX 0x10 - -struct Area { - unsigned char mode; - uint16_t size; - uint16_t checksum; -}; - -/* - * mode - * bit 7: Absolute (1) / Relative (0) - * bit 6: MSB (1) / LSB (0) (in byte mode) - * bit 5: Byte mode (1) / Word mode (0) - */ -#define MEF_RELOC_ABSOLUTE 0x80 -#define MEF_RELOC_MSB_BYTE 0x60 -#define MEF_RELOC_LSB_BYTE 0x20 - -struct Relocation { - unsigned char mode; - uint16_t address; - uint16_t data; -}; - -unsigned char load_byte(); - -void mef_load(unsigned char* offset); -unsigned char load_byte(); -void mef_reloc(unsigned char* offset, struct Relocation* reloc); - -#endif /* __MEF_H__ */ diff --git a/cpu/z80/mtarch.c b/cpu/z80/mtarch.c deleted file mode 100644 index 50f9959dc..000000000 --- a/cpu/z80/mtarch.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - */ - /* - * \file - * Z80 machine-specific implementation for supporting multithread. - * \author - * Takahide Matsutsuka - */ -#include "sys/mt.h" -#include "mtarch.h" - -/*--------------------------------------------------------------------------*/ -void -mtarch_init(void) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_start(struct mtarch_thread *t, - void (*function)(void *), void *data) -{ - uint16_t i; - - for(i = 0; i < MTARCH_STACKSIZE; i++) { - t->stack[i] = i; - } - - t->sp = &t->stack[MTARCH_STACKSIZE - 1]; - - - /* A parameter for method for thread function. */ - *t->sp = (uint16_t)data; - --t->sp; - - /* This will be a return address of thread function. */ - *t->sp = (uint16_t)mt_exit; - --t->sp; - - /* The thread function, is used as a return address of mtarch_switch. */ - *t->sp = (uint16_t)function; - --t->sp; - - /* - * Space for registers. - * af, bc, de, hl, ix, iy, af', bc', de', hl' - */ - /* - * Z80 stack basis: - * push stores the data AFTER decrementing sp. - * pop reads the data BEFORE incrementing sp. - */ - - t->sp = t->sp - 9; -} -/*--------------------------------------------------------------------------*/ -static struct mtarch_thread *running_thread; -static uint16_t *sptmp; -static void -mtarch_switch() -{ - __asm - di ; disable interrupt - ; normal registers - push af - push bc - push de - push hl - push ix - push iy - - ; back registers - ex af,af' - push af - exx - push bc - push de - push hl - - ; swap between running_thread->sp and SP reg - ; _running_thread in asembler below points running_thread->sp - ; sptmp = sp; - ld (_sptmp),sp - - ; sp = *(running_thread->sp); - ld ix,(_running_thread) - ld l,0(ix) - ld h,1(ix) - ld sp,hl - - ; running_thread->sp = sptmp; - ld hl,(_sptmp) - ld 0(ix),l - ld 1(ix),h - - ; back registers - pop hl - pop de - pop bc - exx - pop af - ex af,af' - - ; normal registers - pop iy - pop ix - pop hl - pop de - pop bc - pop af - ei ; enable interrupt - __endasm; - // here sp indicates the address that point the function -} -/*--------------------------------------------------------------------------*/ -void -mtarch_exec(struct mtarch_thread *t) -{ - running_thread = t; - mtarch_switch(); - running_thread = NULL; -} -/*--------------------------------------------------------------------------*/ -void -mtarch_remove() -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_yield() -{ - if (running_thread == NULL) { - /* ERROR! we have no runnning thread. */ - return; - } - mtarch_switch(); -} -/*--------------------------------------------------------------------------*/ -void mtarch_stop(struct mtarch_thread *thread) -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_pstop() -{ -} -/*--------------------------------------------------------------------------*/ -void -mtarch_pstart() -{ -} -/*--------------------------------------------------------------------------*/ -int -mtarch_stack_usage(struct mtarch_thread *t) -{ - uint16_t i; - for (i = 0; i < MTARCH_STACKSIZE; i++) { - if (t->stack[i] != i) { - return MTARCH_STACKSIZE - i; - } - } - - return 0; -} -/*--------------------------------------------------------------------------*/ diff --git a/cpu/z80/mtarch.h b/cpu/z80/mtarch.h deleted file mode 100644 index f5d2b80b2..000000000 --- a/cpu/z80/mtarch.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - */ - /* - * \file - * Z80 machine-specific difinitions for supporting multithread. - * - * \author - * Takahide Matsutsuka - */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ - -/* Unit of the stack is 2byte wide. */ -#ifndef MTARCH_STACKSIZE -#define MTARCH_STACKSIZE 128 -#endif /* MTARCH_STACKSIZE */ - -struct mtarch_thread { - /* - * On top of the mtarch_thread must be the address for the stack pointer. - * See details at mtarch_switch in mtarch.c - */ - uint16_t *sp; - /* - * Stack is 2-byte wide, so please note that you need 2 * MTARCH_STACKSIZE - * bytes for the stack area for each thread. - */ - uint16_t stack[MTARCH_STACKSIZE]; -}; - -/* - * A function for debugging purpose, placed here by following other implementations. - */ -int mtarch_stack_usage(struct mtarch_thread *t); - -#endif /* __MTARCH_H__ */ - diff --git a/cpu/z80/uip_arch-asm.S b/cpu/z80/uip_arch-asm.S deleted file mode 100644 index e64ddf45a..000000000 --- a/cpu/z80/uip_arch-asm.S +++ /dev/null @@ -1,221 +0,0 @@ -;;; -;;; -;;; uip_arch-asm.S -;;; -;;; \file -;;; Z80 architecture-depend uip module -;;; for calculating checksums -;;; -;;; \author -;;; Takahide Matsutsuka -;;; - .module uip_arch-asm - - ;; export symbols - .globl _uip_add32 - .globl _uip_arch_chksum - .globl _uip_chksum - - ;; import symbols - .globl _uip_acc32 - .globl _uip_buf - - .area _DATA - - .area _GSINIT - - .area _CODE - - ;; --------------------------------- - ;; void uip_add32(uint8_t *op32, uint16_t op16); - ;; Stack; retl reth op32l op32h op16l op16h - ;; ABCDEHL____ - ;; return void - ;; _uip_acc32 = op32 + op16 - ;; --------------------------------- -_uip_add32_start:: -_uip_add32: - ;; HL = #_op32l - ld hl, #2 - add hl, sp - - ;; DE = #(_op32) - ld e, (hl) - inc hl - ld d, (hl) - inc hl - - ;; BC = op16 - ld c, (hl) - inc hl - ld b, (hl) - - ;; HL = #(_op32) + 3 - ld hl, #3 - add hl, de - - ;; DE = #_uip_acc32 + 3 - ld de, #_uip_acc32 + 3 - - ;; uip_acc32[3] = op32[3] + op16l; - ld a, (hl) - add a, c - ld (de), a - - ;; uip_acc32[2] = op32[2] + op16h + carry; - dec hl - dec de - ld a, (hl) - adc a, b - ld (de), a - jr nc, _uip_add32_nocarry1 - - ;; uip_acc32[1] - dec hl - dec de - ld a, (hl) - inc a - ld (de), a - jr nz, _uip_add32_nocarry0 - - ;; uip_acc32[0] - dec hl - dec de - ld a, (hl) - inc a - ld (de), a - ret -_uip_add32_nocarry1: - ;; uip_acc32[1] - dec hl - dec de - ld a, (hl) - ld (de), a - -_uip_add32_nocarry0: - ;; uip_acc32[0] - dec hl - dec de - ld a, (hl) - ld (de), a - ret -_uip_add32_end:: - - ;; --------------------------------- - ;; static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len) - ;; Stack; retl reth suml sumh datal datah lenl lenh - ;; ABCDEHL____ - ;; return HL - ;; --------------------------------- -_uip_arch_chksum_start:: -_uip_arch_chksum: - push ix - ;; IX = #_suml - ld ix, #4 - add ix, sp - ;; BC = sum - ld c, 0(ix) - ld b, 1(ix) - ;; DE = #data - ld e, 2(ix) - ld d, 3(ix) - - ;; (lenl, lenh) <- dataptr + len - 1 (last address) - ;; (len) + DE - 1 -> (len) - ld l, 4(ix) - ld h, 5(ix) - add hl, de - dec hl - ld 4(ix), l - ld 5(ix), h - -_uip_arch_chksum_loop: - ;; compare HL(last address) and DE(dataptr) - ;; HL - DE - ;; if (HL < DE) C,NZ else if (HL = DE) NC,Z=1 otherwise NC,NZ - ;; HL = last address, DE = current pointer - ld l, 4(ix) - ld h, 5(ix) - - ld a, h - sub d - jr nz, _uip_arch_chksum_compared - ld a, l - sub e - ;; if (last address == dataptr) _uip_arch_chksum_loop_exit_add_trailing - jr z, _uip_arch_chksum_loop_exit_add_trailing -_uip_arch_chksum_compared: - ;; if (last address > dataptr) _uip_arch_chksum_loop_exit - jr c, _uip_arch_chksum_loop_exit - ;; bc = dataptr[0],dataptr[1] + bc - ld a, (de) - ld h, a - inc de - ld a, (de) - ld l, a - push hl - add hl, bc - inc de - ld b, h - ld c, l - ;; HL = t - pop hl - ;; BC - HL - ;; if (sumBC < tHL) sum++ - ld a, b - sub h - jr nz, _uip_arch_chksum_compared_t - ld a, c - sub l -_uip_arch_chksum_compared_t: - jr nc, _uip_arch_chksum_nocarry_t - inc bc -_uip_arch_chksum_nocarry_t: - jr _uip_arch_chksum_loop -_uip_arch_chksum_loop_exit_add_trailing: - ;; HL = last address - ;; bc = bc + (last address)<<8 - ld a, b - add a, (hl) - ld b, a - jr nc, _uip_arch_chksum_loop_exit - inc bc -_uip_arch_chksum_loop_exit: - ld l, c - ld h, b - pop ix - ret -_uip_arch_chksum_end:: - - ;; --------------------------------- - ;; uint16_t uip_chksum(void); - ;; Stack; retl reth datal datah lenl lenh - ;; ABCDEHL____ - ;; return HL - ;; return htons(chksum(0, (uint8_t *)data, len)); - ;; --------------------------------- -_uip_chksum_start:: -_uip_chksum: - ld hl, #5 - add hl, sp - ;; HL indicates #_lenh - ld b, #2 -_uip_chksum_loop: - ld d, (hl) - dec hl - ld e, (hl) - dec hl - push de - djnz _uip_chksum_loop - ld bc, #0 - push bc - call _uip_arch_chksum - pop af - pop af - pop af - ;; convert to BIG ENDIAN (htons) - ld a, l - ld l, h - ld h, a - ret -_uip_chksum_end:: diff --git a/cpu/z80/uip_arch.c b/cpu/z80/uip_arch.c deleted file mode 100644 index 31388242c..000000000 --- a/cpu/z80/uip_arch.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - /* - * \file - * Z80 architecture-depend uip module - * for calculating checksums - * \author - * Takahide Matsutsuka - */ - -#include -#include "uip_arch.h" - -static const uint16_t sizeof_uip_ipaddr_t = sizeof(uip_ipaddr_t); -static const uint16_t offset_tcpip_hdr_len = offsetof(struct uip_tcpip_hdr, len); -static const uint16_t offset_tcpip_hdr_srcipaddr = offsetof(struct uip_tcpip_hdr, srcipaddr); - -/*--------------------------------------------------------------------------*/ -static void upper_layer_chksum() { -__asm - ;; --------------------------------- - ;; static uint16_t upper_layer_chksum(uint8_t proto); - ;; Stack; retl reth - ;; @param C proto - ;; ABCDEHL____ - ;; --------------------------------- - ;; HL = BUF = &uip_buf[UIP_LLH_LEN] - ld hl, #_uip_buf - ld de, #UIP_LLH_LEN - add hl, de - push hl - - ;; HL = BUF->len[0] - push ix - ld ix, #_offset_tcpip_hdr_len - ld e, 0(ix) - ld d, 1(ix) - add hl, de - pop ix - - ;; DE = upper layer length - ld d, (hl) - inc hl - ld e, (hl) -#if UIP_CONF_IPV6 -#else - ld a, e - sub a, #UIP_IPH_LEN - ld e, a - jr nc, _upper_layer_chksum_setlen2 - dec d -_upper_layer_chksum_setlen2: -#endif - ;; bc = upper_leyer_len + proto - ld b, d - ld a, e - add a, c - ld c, a - jr nc, _upper_layer_chksum_setlen3 - inc b -_upper_layer_chksum_setlen3: - pop hl ; BUF - push de - push ix - ld ix, #_offset_tcpip_hdr_srcipaddr - ld e, 0(ix) - ld d, 1(ix) - add hl, de - ld e, l - ld d, h - ld ix, #_sizeof_uip_ipaddr_t - ld l, 0(ix) - ld h, 1(ix) - pop ix - sla l - rl h - push hl - push de - push bc - call _uip_arch_chksum ; hl = sum - pop af - pop af - pop af - ;; de is still stacked - - ld b, h - ld c, l - ld hl, #_uip_buf - ld de, #UIP_IPH_LEN - add hl, de -_upper_layer_chksum_call: - ld de, #UIP_LLH_LEN - add hl, de - push hl - push bc - call _uip_arch_chksum - pop af - pop af - pop af - - ld a, h - or a, l - jr nz, _upper_layer_uip_htons - ld hl, #0xffff - jr _upper_layer_ret -_upper_layer_uip_htons: - ld a, l - ld l, h - ld h, a -_upper_layer_ret: -__endasm; -} - -/*--------------------------------------------------------------------------*/ -uint16_t -uip_ipchksum(void) -{ -__asm - ;; --------------------------------- - ;; uint16_t uip_ipchksum(void); - ;; Stack; retl reth - ;; ABCDEHL____ - ;; return HL - ;; --------------------------------- - ld hl, #UIP_IPH_LEN - push hl - ;; HL = BUF = &uip_buf[UIP_LLH_LEN] - ld hl, #_uip_buf - ;; BC = sum = 0 - ld bc, #0 - jp _upper_layer_chksum_call -__endasm; -} - -/*--------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6 -uint16_t -uip_icmp6chksum(void) -{ -__asm - ;; --------------------------------- - ;; uint16_t uip_icmp6chksum(void); - ;; Stack; retl reth - ;; ABCDEHL____ - ;; return HL - ;; --------------------------------- - ld c, #UIP_PROTO_ICMP6 - jp _upper_layer_chksum -__endasm; -} -#endif /* UIP_CONF_IPV6 */ - -/*--------------------------------------------------------------------------*/ -uint16_t -uip_tcpchksum(void) -{ -__asm - ;; --------------------------------- - ;; uint16_t uip_tcpchksum(void); - ;; Stack; retl reth - ;; ABCDEHL____ - ;; return HL - ;; --------------------------------- - ld c, #UIP_PROTO_TCP - jp _upper_layer_chksum -__endasm; -} - -/*--------------------------------------------------------------------------*/ -#if UIP_UDP_CHKSUMS -uint16_t -uip_udpchksum(void) -{ -__asm - ;; --------------------------------- - ;; uint16_t uip_udpchksum(void); - ;; Stack; retl reth - ;; ABCDEHL____ - ;; return HL - ;; --------------------------------- - ld c, #UIP_PROTO_UDP - jp _upper_layer_chksum -__endasm; -} -#endif /* UIP_UDP_CHKSUMS */ -/*--------------------------------------------------------------------------*/ diff --git a/cpu/z80/z80def.h b/cpu/z80/z80def.h deleted file mode 100644 index d39857f93..000000000 --- a/cpu/z80/z80def.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This file contains a set of configuration for using SDCC as a compiler. - * - * \author - * Takahide Matsutsuka - */ - -#ifndef __Z80_DEF_H__ -#define __Z80_DEF_H__ - -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_FASTCALL -#define CC_CONF_VA_ARGS 0 -#define CC_CONF_UNSIGNED_CHAR_BUGS 0 -#define CC_CONF_REGISTER_ARGS 0 - - -/* Generic types. */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -typedef unsigned char u8_t; /* 8 bit type */ -typedef unsigned short u16_t; /* 16 bit type */ -typedef unsigned long u32_t; /* 32 bit type */ -typedef signed long s32_t; /* 32 bit type */ -typedef unsigned short uip_stats_t; -typedef signed long int32_t; /* 32 bit type */ -#ifndef _SIZE_T_DEFINED -#define _SIZE_T_DEFINED -typedef unsigned int size_t; -#endif - -/* Compiler configurations */ -#define CCIF -#define CLIF -#define CC_CONF_CONST_FUNCTION_BUG - -/* - * Enable architecture-depend checksum calculation - * for uIP configuration. - * @see uip_arch.h - * @see uip_arch-asm.S - */ -#define UIP_ARCH_ADD32 1 -#define UIP_ARCH_CHKSUM 1 -#define UIP_ARCH_IPCHKSUM - -#define CC_CONF_ASSIGN_AGGREGATE(dest, src) \ - memcpy(dest, src, sizeof(*dest)) - -#define uip_ipaddr_copy(dest, src) \ - memcpy(dest, src, sizeof(*dest)) - -#define snprintf(a...) - -#endif /* __Z80_DEF_H__ */ diff --git a/cpu/z80/z80peephole.def b/cpu/z80/z80peephole.def deleted file mode 100644 index 8b4ee06e9..000000000 --- a/cpu/z80/z80peephole.def +++ /dev/null @@ -1,183 +0,0 @@ -# -# Customized peep-hole optimizer for z80/SDCC -# @author Takahide Matsutsuka -# -# $Id: z80peephole.def,v 1.1 2009/12/11 14:59:32 matsutsuka Exp $ -# - -replace { - ld hl, %1 - ld (hl), #0x%2 - inc hl - ld (hl), #0x%3 -} by { - ;; (peep) 1 short store - ld hl, #0x%3%2 - ld (%1), hl -} - -replace { - ld hl, %1 + 0 - ld (hl), %2 - ld hl, %1 + 1 - ld (hl), %3 -} by { - ;; (peep) 2 short store - ld hl, %1 - ld (hl), %2 - inc hl - ld (hl), %3 -} - -replace { - sub a, #0x01 - jr Z, %1 -} by { - ;; (peep) 3 decrement optimization - dec a - jr z, %1 -} -replace { - sub a, #0x01 - jr NZ, %1 -} by { - ;; (peep) 4 decrement optimization - dec a - jr nz, %1 -} -replace { - sub a, #0x01 - jp Z, %1 -} by { - ;; (peep) 5 decrement optimization - dec a - jp z, %1 -} -replace { - sub a, #0x01 - jp NZ, %1 -} by { - ;; (peep) 6 decrement optimization - dec a - jp nz, %1 -} - -replace { - push %1 - pop iy - ld a, (iy) - or a, a -} by { - ;; (peep) 7 or optimization - ld a, (%1) - or a, a -} - -replace { - ld iy, %1 - ld a, 0 (iy) -} by { - ;; (peep) 8 iy optimization - ld a, (%1) -} - -replace { - ld iy, %1 - ld 0 (iy), a -} by { - ;; (peep) 9 iy optimization - ld (%1), a -} - -replace { - push %1 - pop iy - ld (iy), %2 -} by { - ;; (peep) 10 iy optimization - ld a, %2 - ld (%1), a -} - -replace { - ld iy, %1 - ld %2,0 (iy) - ld iy, %1 - ld %3,1 (iy) - ld iy, %1 - ld %4,2 (iy) - ld iy, %1 - ld %5,3 (iy) -} by { - ;; (peep) 11 iy optimization - ld iy, %1 - ld %2,0 (iy) - ld %3,1 (iy) - ld %4,2 (iy) - ld %5,3 (iy) -} - -replace { - ld iy, %1 - ld %2,0 (iy) - ld iy, %1 - ld %3,1 (iy) -} by { - ;; (peep) 12 iy optimization - ld iy, %1 - ld %2,0 (iy) - ld %3,1 (iy) -} - -replace { - ld iy, %1 - ld 0 (iy), %2 - ld iy, %1 - ld 1 (iy), %3 - ld iy, %1 - ld 2 (iy), %4 - ld iy, %1 - ld 3 (iy), %5 -} by { - ;; (peep) 13 iy optimization - ld iy, %1 - ld 0 (iy), %2 - ld 1 (iy), %3 - ld 2 (iy), %4 - ld 3 (iy), %5 -} - -replace { - ld iy, %1 - ld 0 (iy), %2 - ld iy, %1 - ld 1 (iy), %3 -} by { - ;; (peep) 14 iy optimization - ld iy, %1 - ld 0 (iy), %2 - ld 1 (iy), %3 -} - -replace { - jp %1 -%2: -} by { - ;; (peep) 15 short jump optimization - jr %1 -%2: -} if labelInRange - -replace { - ld c,%3 (ix) - ld b,%4 (ix) - push bc - pop iy - ld 0 (iy), #0x%6 - ld 1 (iy), #0x%5 -} by { - ;; (peep) 16 store value - ld l, %3 (ix) - ld h, %4 (ix) - ld (hl), #0x%5%6 -} diff --git a/examples/collect/collect-view-shell.c b/examples/collect/collect-view-shell.c index 74e12e487..b6ee159f4 100644 --- a/examples/collect/collect-view-shell.c +++ b/examples/collect/collect-view-shell.c @@ -73,7 +73,6 @@ PROCESS_THREAD(collect_view_shell_process, ev, data) /* shell_base64_init(); */ shell_text_init(); shell_time_init(); - /* shell_checkpoint_init(); */ /* shell_sendtest_init(); */ #if CONTIKI_TARGET_SKY diff --git a/examples/eeprom-test/Makefile b/examples/eeprom-test/Makefile index 0d78a7341..46c909138 100644 --- a/examples/eeprom-test/Makefile +++ b/examples/eeprom-test/Makefile @@ -1,5 +1,6 @@ CONTIKI_PROJECT = eeprom-test all: $(CONTIKI_PROJECT) +TARGET=mbxxx CONTIKI = ../.. include $(CONTIKI)/Makefile.include diff --git a/examples/eeprom-test/eeprom-test.c b/examples/eeprom-test/eeprom-test.c index c20e5d009..b5883eff5 100644 --- a/examples/eeprom-test/eeprom-test.c +++ b/examples/eeprom-test/eeprom-test.c @@ -43,56 +43,114 @@ #include /* For printf() */ +void +print_content() +{ + eeprom_addr_t addr_row = 0, j; + uint8_t i; + uint8_t byte; + + printf("\t"); + for(i = 0; i < 16; i++) + printf("0x%x\t", i); + printf + ("\n-----------------------------------------------------------------------------------------------------------------------------------------\n"); + + for(addr_row = 0; addr_row < EEPROM_SIZE / 16; ++addr_row) { + printf("0x%x\t|", addr_row * 16); + + for(j = 0; j < 16; j++) { + eeprom_read(addr_row * 16 + j, &byte, 1); + printf("0x%x\t", byte); + } + printf("\n"); + } +} + +void +erase_content() +{ + static eeprom_addr_t addr = 0; + + for(addr = 0; addr < EEPROM_SIZE; ++addr) { + eeprom_write(addr, 0, 1); + } +} + /*---------------------------------------------------------------------------*/ PROCESS(eeprom_test_process, "EEPROM Test Process"); AUTOSTART_PROCESSES(&eeprom_test_process); /*---------------------------------------------------------------------------*/ PROCESS_THREAD(eeprom_test_process, ev, data) { - static uint8_t counter = 0; - + static uint8_t counter = 0, error = 0; static eeprom_addr_t addr = 0; + uint8_t byte; + + uint8_t buffer[] = + { 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0xBB, + 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xFF, 0xAA, 0xAA, 0xAA, 0xBB, + 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA, + 0xAA, 0xFF, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, + 0xCC, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xFF + }; PROCESS_BEGIN(); printf("eeprom-test: Size = %d bytes\n", EEPROM_SIZE); - /* Check to see if the EEPROM is empty */ - for(addr = 0; addr < EEPROM_SIZE; ++addr) { - uint8_t byte; + print_content(); + printf("\nErase EEPROM content\n"); + erase_content(); + + print_content(); + + counter = 0; + for(addr = 0; addr < EEPROM_SIZE; ++addr) { + eeprom_write(addr, &counter, 1); + counter += 1; + } + + counter = 0; + for(addr = 0; addr < EEPROM_SIZE; ++addr) { + byte = 0; eeprom_read(addr, &byte, 1); - if(byte != 0xFF) { + if(byte != counter) { + error++; + eeprom_read(addr, &byte, 1); + printf + ("eeprom-test: EEPROM write failure! 0x%x =/= 0x%x at address 0x%x\n", + byte, counter, addr); break; } + counter += 1; } - if(addr == EEPROM_SIZE) { - printf("eeprom-test: EEPROM is empty. Proceding with write test...\n"); - - counter = 0; - for(addr = 0; addr < EEPROM_SIZE; ++addr) { - eeprom_write(addr, &counter, 1); - counter += 1; - } - - counter = 0; - for(addr = 0; addr < EEPROM_SIZE; ++addr) { - uint8_t byte; - - eeprom_read(addr, &byte, 1); - if(byte != counter) { - printf("eeprom-test: EEPROM write failure!\n"); - break; - } - counter += 1; - } - + if(error) + printf("eeprom-test: EEPROM write test FAIL!\n%d errors", error); + else printf("eeprom-test: EEPROM write test success!\n"); - } else { - printf("eeprom-test: EEPROM is NOT empty! Skipping write test.\n"); - } + + print_content(); + + printf("Fill memory with buffer\n"); + + for(addr = 0; addr < EEPROM_SIZE; addr += sizeof(buffer)) { + eeprom_write(addr, ((unsigned char *)buffer), sizeof(buffer)); + } +/* + printf("Write data buffer %d at address 0x0\n", sizeof(buffer)); + eeprom_write(0x0, ((unsigned char *)buffer), sizeof(buffer)); + + printf("Write data buffer %d at address 0x40\n", sizeof(buffer)); + eeprom_write(0x40, ((unsigned char *)buffer), sizeof(buffer)); + + printf("Write data buffer %d at address 0x95\n", sizeof(buffer)); + eeprom_write(0x95, ((unsigned char *)buffer), sizeof(buffer)); +*/ + print_content(); PROCESS_END(); } /*---------------------------------------------------------------------------*/ diff --git a/examples/er-rest-example/Makefile b/examples/er-rest-example/Makefile index 0eac1a4e4..9a72bf63a 100644 --- a/examples/er-rest-example/Makefile +++ b/examples/er-rest-example/Makefile @@ -7,8 +7,6 @@ all: er-example-server er-example-client WITH_COAP=13 -# variable for Makefile.include -WITH_UIP6=1 # for some platforms UIP_CONF_IPV6=1 # IPv6 make config disappeared completely diff --git a/examples/er-rest-example/project-conf.h b/examples/er-rest-example/project-conf.h index 8f6ddd062..128ccd0b2 100644 --- a/examples/er-rest-example/project-conf.h +++ b/examples/er-rest-example/project-conf.h @@ -29,8 +29,8 @@ * */ -#ifndef __PROJECT_ERBIUM_CONF_H__ -#define __PROJECT_ERBIUM_CONF_H__ +#ifndef PROJECT_ERBIUM_CONF_H_ +#define PROJECT_ERBIUM_CONF_H_ /* Some platforms have weird includes. */ #undef IEEE802154_CONF_PANID @@ -85,4 +85,4 @@ #undef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 -#endif /* __PROJECT_ERBIUM_CONF_H__ */ +#endif /* PROJECT_ERBIUM_CONF_H_ */ diff --git a/examples/example-shell/example-shell.c b/examples/example-shell/example-shell.c index 471d63282..97943a308 100644 --- a/examples/example-shell/example-shell.c +++ b/examples/example-shell/example-shell.c @@ -60,7 +60,6 @@ PROCESS_THREAD(example_shell_process, ev, data) shell_base64_init(); shell_blink_init(); - /*shell_checkpoint_init();*/ /*shell_coffee_init();*/ shell_download_init(); /*shell_exec_init();*/ diff --git a/examples/ipv6/json-ws/Makefile b/examples/ipv6/json-ws/Makefile index 12aa155e8..2f1ba6582 100644 --- a/examples/ipv6/json-ws/Makefile +++ b/examples/ipv6/json-ws/Makefile @@ -1,6 +1,5 @@ CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 SMALL=1 diff --git a/examples/ipv6/json-ws/json-ws.h b/examples/ipv6/json-ws/json-ws.h index 7484b06d9..8c9e2a764 100644 --- a/examples/ipv6/json-ws/json-ws.h +++ b/examples/ipv6/json-ws/json-ws.h @@ -38,8 +38,8 @@ * Joel Hoglund */ -#ifndef __JSON_WS_H__ -#define __JSON_WS_H__ +#ifndef JSON_WS_H_ +#define JSON_WS_H_ #include "jsontree.h" @@ -55,4 +55,4 @@ extern struct jsontree_callback json_leds_callback; #endif extern struct jsontree_object cosm_tree; -#endif /* __JSON_WS_H__ */ +#endif /* JSON_WS_H_ */ diff --git a/examples/ipv6/json-ws/project-conf.h b/examples/ipv6/json-ws/project-conf.h index 38e5426a7..51e00b55b 100644 --- a/examples/ipv6/json-ws/project-conf.h +++ b/examples/ipv6/json-ws/project-conf.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef __PROJECT_CONF_H__ -#define __PROJECT_CONF_H__ +#ifndef PROJECT_CONF_H_ +#define PROJECT_CONF_H_ #include "jsontree.h" #define HTTPD_WS_CONF_USER_STATE struct jsontree_context json @@ -74,4 +74,4 @@ #undef WEBSERVER_CONF_CFS_CONNS #define WEBSERVER_CONF_CFS_CONNS 3 -#endif /* __PROJECT_CONF_H__ */ +#endif /* PROJECT_CONF_H_ */ diff --git a/examples/ipv6/native-border-router/Makefile b/examples/ipv6/native-border-router/Makefile index b28c0dc73..191d9c819 100644 --- a/examples/ipv6/native-border-router/Makefile +++ b/examples/ipv6/native-border-router/Makefile @@ -4,7 +4,6 @@ APPS = slip-cmd CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL -DUIP_CONF_IPV6 -DWITH_UIP6 diff --git a/examples/ipv6/native-border-router/border-router-cmds.h b/examples/ipv6/native-border-router/border-router-cmds.h index 38fc92111..6dcef36a0 100644 --- a/examples/ipv6/native-border-router/border-router-cmds.h +++ b/examples/ipv6/native-border-router/border-router-cmds.h @@ -35,8 +35,8 @@ * Joakim Eriksson */ -#ifndef __BORDER_ROUTER_CMDS_H__ -#define __BORDER_ROUTER_CMDS_H__ +#ifndef BORDER_ROUTER_CMDS_H_ +#define BORDER_ROUTER_CMDS_H_ #define CMD_CONTEXT_RADIO 0 #define CMD_CONTEXT_STDIO 1 @@ -45,4 +45,4 @@ extern uint8_t command_context; PROCESS_NAME(border_router_cmd_process); -#endif /* __BORDER_ROUTER_CMDS_H__ */ +#endif /* BORDER_ROUTER_CMDS_H_ */ diff --git a/examples/ipv6/native-border-router/border-router.h b/examples/ipv6/native-border-router/border-router.h index b6a2f2ab2..4677085cc 100644 --- a/examples/ipv6/native-border-router/border-router.h +++ b/examples/ipv6/native-border-router/border-router.h @@ -34,8 +34,8 @@ * Joakim Eriksson */ -#ifndef __BORDER_ROUTER_H__ -#define __BORDER_ROUTER_H__ +#ifndef BORDER_ROUTER_H_ +#define BORDER_ROUTER_H_ #include "contiki.h" #include "net/uip.h" @@ -56,4 +56,4 @@ int slip_init(void); int slip_set_fd(int maxfd, fd_set *rset, fd_set *wset); void slip_handle_fd(fd_set *rset, fd_set *wset); -#endif /* __BORDER_ROUTER_H__ */ +#endif /* BORDER_ROUTER_H_ */ diff --git a/examples/ipv6/native-border-router/httpd-simple.h b/examples/ipv6/native-border-router/httpd-simple.h index 4a2efa30f..a16dbd99e 100644 --- a/examples/ipv6/native-border-router/httpd-simple.h +++ b/examples/ipv6/native-border-router/httpd-simple.h @@ -37,8 +37,8 @@ * Joakim Eriksson */ -#ifndef __HTTPD_SIMPLE_H__ -#define __HTTPD_SIMPLE_H__ +#ifndef HTTPD_SIMPLE_H_ +#define HTTPD_SIMPLE_H_ #include "contiki-net.h" @@ -71,4 +71,4 @@ httpd_simple_script_t httpd_simple_get_script(const char *name); #define SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, strlen(str)) -#endif /* __HTTPD_SIMPLE_H__ */ +#endif /* HTTPD_SIMPLE_H_ */ diff --git a/examples/ipv6/native-border-router/project-conf.h b/examples/ipv6/native-border-router/project-conf.h index 494264b58..4ef217fcb 100644 --- a/examples/ipv6/native-border-router/project-conf.h +++ b/examples/ipv6/native-border-router/project-conf.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef __PROJECT_ROUTER_CONF_H__ -#define __PROJECT_ROUTER_CONF_H__ +#ifndef PROJECT_ROUTER_CONF_H_ +#define PROJECT_ROUTER_CONF_H_ #undef UIP_FALLBACK_INTERFACE #define UIP_FALLBACK_INTERFACE rpl_interface @@ -57,4 +57,4 @@ /* used by wpcap (see /cpu/native/net/wpcap-drv.c) */ #define SELECT_CALLBACK 1 -#endif /* __PROJECT_ROUTER_CONF_H__ */ +#endif /* PROJECT_ROUTER_CONF_H_ */ diff --git a/examples/ipv6/rpl-border-router/Makefile b/examples/ipv6/rpl-border-router/Makefile index 43230a17f..f296b0bb3 100644 --- a/examples/ipv6/rpl-border-router/Makefile +++ b/examples/ipv6/rpl-border-router/Makefile @@ -3,7 +3,6 @@ all: $(CONTIKI_PROJECT) CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL diff --git a/examples/ipv6/rpl-border-router/httpd-simple.h b/examples/ipv6/rpl-border-router/httpd-simple.h index 4a2efa30f..a16dbd99e 100644 --- a/examples/ipv6/rpl-border-router/httpd-simple.h +++ b/examples/ipv6/rpl-border-router/httpd-simple.h @@ -37,8 +37,8 @@ * Joakim Eriksson */ -#ifndef __HTTPD_SIMPLE_H__ -#define __HTTPD_SIMPLE_H__ +#ifndef HTTPD_SIMPLE_H_ +#define HTTPD_SIMPLE_H_ #include "contiki-net.h" @@ -71,4 +71,4 @@ httpd_simple_script_t httpd_simple_get_script(const char *name); #define SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, strlen(str)) -#endif /* __HTTPD_SIMPLE_H__ */ +#endif /* HTTPD_SIMPLE_H_ */ diff --git a/examples/ipv6/rpl-border-router/project-conf.h b/examples/ipv6/rpl-border-router/project-conf.h index e928a759f..9d9116795 100644 --- a/examples/ipv6/rpl-border-router/project-conf.h +++ b/examples/ipv6/rpl-border-router/project-conf.h @@ -28,8 +28,8 @@ * */ -#ifndef __PROJECT_ROUTER_CONF_H__ -#define __PROJECT_ROUTER_CONF_H__ +#ifndef PROJECT_ROUTER_CONF_H_ +#define PROJECT_ROUTER_CONF_H_ #ifndef UIP_FALLBACK_INTERFACE #define UIP_FALLBACK_INTERFACE rpl_interface @@ -51,4 +51,4 @@ #define WEBSERVER_CONF_CFS_CONNS 2 #endif -#endif /* __PROJECT_ROUTER_CONF_H__ */ +#endif /* PROJECT_ROUTER_CONF_H_ */ diff --git a/examples/ipv6/rpl-collect/Makefile b/examples/ipv6/rpl-collect/Makefile index e37b71468..7ed3f6ae1 100644 --- a/examples/ipv6/rpl-collect/Makefile +++ b/examples/ipv6/rpl-collect/Makefile @@ -3,7 +3,6 @@ APPS = powertrace collect-view CONTIKI_PROJECT = udp-sender udp-sink PROJECT_SOURCEFILES += collect-common.c -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL diff --git a/examples/ipv6/rpl-collect/collect-common.h b/examples/ipv6/rpl-collect/collect-common.h index 32019d4cd..2c5eff394 100644 --- a/examples/ipv6/rpl-collect/collect-common.h +++ b/examples/ipv6/rpl-collect/collect-common.h @@ -35,8 +35,8 @@ * Niclas Finne */ -#ifndef __COLLECT_COMMON_H__ -#define __COLLECT_COMMON_H__ +#ifndef COLLECT_COMMON_H_ +#define COLLECT_COMMON_H_ #include "contiki.h" #include "net/rime/rimeaddr.h" @@ -53,4 +53,4 @@ void collect_common_set_send_active(int active); PROCESS_NAME(collect_common_process); -#endif /* __COLLECT_COMMON_H__ */ +#endif /* COLLECT_COMMON_H_ */ diff --git a/examples/ipv6/rpl-collect/udp-sender.c b/examples/ipv6/rpl-collect/udp-sender.c index 75d63e806..cc8ed3bc1 100644 --- a/examples/ipv6/rpl-collect/udp-sender.c +++ b/examples/ipv6/rpl-collect/udp-sender.c @@ -142,7 +142,7 @@ collect_common_send(void) } rtmetric = dag->rank; beacon_interval = (uint16_t) ((2L << dag->instance->dio_intcurrent) / 1000); - num_neighbors = RPL_PARENT_COUNT(dag); + num_neighbors = uip_ds6_nbr_num(); } else { rtmetric = 0; beacon_interval = 0; diff --git a/examples/ipv6/rpl-udp/Makefile b/examples/ipv6/rpl-udp/Makefile index e4ea78e28..6dfe77c47 100644 --- a/examples/ipv6/rpl-udp/Makefile +++ b/examples/ipv6/rpl-udp/Makefile @@ -2,7 +2,6 @@ all: udp-client udp-server APPS=servreg-hack CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL diff --git a/examples/ipv6/simple-udp-rpl/Makefile b/examples/ipv6/simple-udp-rpl/Makefile index 5721b46aa..9cc51e534 100644 --- a/examples/ipv6/simple-udp-rpl/Makefile +++ b/examples/ipv6/simple-udp-rpl/Makefile @@ -2,7 +2,6 @@ all: broadcast-example unicast-sender unicast-receiver APPS=servreg-hack CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL diff --git a/examples/ipv6/sky-websense/Makefile b/examples/ipv6/sky-websense/Makefile index 09d80ce32..21fee6e7c 100644 --- a/examples/ipv6/sky-websense/Makefile +++ b/examples/ipv6/sky-websense/Makefile @@ -2,7 +2,6 @@ all: sky-websense CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL diff --git a/examples/ipv6/sky-websense/project-conf.h b/examples/ipv6/sky-websense/project-conf.h index 9fbc20686..87834d860 100644 --- a/examples/ipv6/sky-websense/project-conf.h +++ b/examples/ipv6/sky-websense/project-conf.h @@ -28,8 +28,8 @@ * */ -#ifndef __PROJECT_RPL_WEB_CONF_H__ -#define __PROJECT_RPL_WEB_CONF_H__ +#ifndef PROJECT_RPL_WEB_CONF_H_ +#define PROJECT_RPL_WEB_CONF_H_ #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 5 @@ -47,4 +47,4 @@ #undef WEBSERVER_CONF_CFS_PATHLEN #define WEBSERVER_CONF_CFS_PATHLEN 80 -#endif /* __PROJECT_RPL_WEB_CONF_H__ */ +#endif /* PROJECT_RPL_WEB_CONF_H_ */ diff --git a/examples/ipv6/sky-websense/wget.h b/examples/ipv6/sky-websense/wget.h index 12e8fbc72..b87f69692 100644 --- a/examples/ipv6/sky-websense/wget.h +++ b/examples/ipv6/sky-websense/wget.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __WGET_H__ -#define __WGET_H__ +#ifndef WGET_H_ +#define WGET_H_ #include "contiki.h" @@ -59,4 +59,4 @@ enum { WGET_CLOSED }; -#endif /* __WGET_H__ */ +#endif /* WGET_H_ */ diff --git a/examples/ipv6/slip-radio/Makefile b/examples/ipv6/slip-radio/Makefile index ff6387136..5456466ab 100644 --- a/examples/ipv6/slip-radio/Makefile +++ b/examples/ipv6/slip-radio/Makefile @@ -8,7 +8,6 @@ endif CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 UIP_CONF_RPL=0 @@ -20,5 +19,11 @@ PROJECT_SOURCEFILES += slip-net.c no-framer.c ifeq ($(TARGET),sky) PROJECT_SOURCEFILES += slip-radio-cc2420.c slip-radio-sky-sensors.c endif +ifeq ($(TARGET),nooliberry) + PROJECT_SOURCEFILES += slip-radio-rf230.c +endif +ifeq ($(TARGET),econotag) + PROJECT_SOURCEFILES += slip-radio-mc1322x.c +endif include $(CONTIKI)/Makefile.include diff --git a/examples/ipv6/slip-radio/project-conf.h b/examples/ipv6/slip-radio/project-conf.h index 89ce426d1..4a2950c59 100644 --- a/examples/ipv6/slip-radio/project-conf.h +++ b/examples/ipv6/slip-radio/project-conf.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef __PROJECT_CONF_H__ -#define __PROJECT_CONF_H__ +#ifndef PROJECT_CONF_H_ +#define PROJECT_CONF_H_ #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 4 @@ -48,6 +48,11 @@ #ifdef CONTIKI_TARGET_SKY #define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_cc2420 #define SLIP_RADIO_CONF_SENSORS slip_radio_sky_sensors +/* add the cmd_handler_rf230 if TARGET_NOOLIBERRY. Other RF230 platforms can be added */ +#elif CONTIKI_TARGET_NOOLIBERRY +#define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_rf230 +#elif CONTIKI_TARGET_ECONOTAG +#define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_mc1322x #else #define CMD_CONF_HANDLERS slip_radio_cmd_handler #endif @@ -73,4 +78,4 @@ #undef UART1_CONF_RX_WITH_DMA #define UART1_CONF_RX_WITH_DMA 1 -#endif /* __PROJECT_CONF_H__ */ +#endif /* PROJECT_CONF_H_ */ diff --git a/platform/msb430/dev/cc1020-uip.c b/examples/ipv6/slip-radio/slip-radio-mc1322x.c similarity index 70% rename from platform/msb430/dev/cc1020-uip.c rename to examples/ipv6/slip-radio/slip-radio-mc1322x.c index 78f18c4e9..da518b11c 100644 --- a/platform/msb430/dev/cc1020-uip.c +++ b/examples/ipv6/slip-radio/slip-radio-mc1322x.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Swedish Institute of Computer Science + * Copyright (c) 2011, Swedish Institute of Computer Science * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,40 +28,34 @@ * * This file is part of the Contiki operating system. * - */ - -/** - * \file - * Chipcon CC1020 glue driver for uIP - * \author - * Nicolas Tsiftes + * Sets up some commands for the MC1322x radio chip. */ #include "contiki.h" -#include "cc1020.h" -#include "cc1020-uip.h" -#include "net/uip.h" -#include "net/hc.h" +#include "mc1322x.h" +#include "cmd.h" +#include -static void -receiver(const struct radio_driver *d) +int +cmd_handler_mc1322x(const uint8_t *data, int len) { - uip_len = cc1020_read(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN); - if(uip_len > 0) { - uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len); - tcpip_input(); + if(data[0] == '!') { + if(data[1] == 'C') { + printf("mc1322x_cmd: setting channel: %d\n", data[2]); + set_channel(data[2]-11); + return 1; + } + } else if(data[0] == '?') { + if(data[1] == 'C') { + uint8_t buf[4]; + printf("mc1322x_cmd: getting channel: %d\n", data[2]); + buf[0] = '!'; + buf[1] = 'C'; + //Not implemented in MACA driver + buf[2] = 0; + cmd_send(buf, 3); + return 1; + } } -} - -void -cc1020_uip_init(void) -{ - cc1020_set_receiver(&receiver); -} - -uint8_t -cc1020_uip_send(void) -{ - uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len); - return cc1020_send(&uip_buf[UIP_LLH_LEN], uip_len); + return 0; } diff --git a/platform/stk501/loadable_prg.c b/examples/ipv6/slip-radio/slip-radio-rf230.c similarity index 63% rename from platform/stk501/loadable_prg.c rename to examples/ipv6/slip-radio/slip-radio-rf230.c index 366101675..1f254386d 100644 --- a/platform/stk501/loadable_prg.c +++ b/examples/ipv6/slip-radio/slip-radio-rf230.c @@ -1,67 +1,72 @@ -/* - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - * - */ - -/** - * \file - * Sample loadable module - * - * \author - * Simon Barner - */ -#include -#include "dev/rs232.h" -#include "contiki.h" - -PROCESS(test_process1, "Test process"); -PROCESS_THREAD(test_process1, ev, data) -{ - static struct etimer etimer; - - PROCESS_BEGIN(); - - rs232_print (RS232_PORT_1, "test_process 1 starting\n"); - - while(1) { - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - rs232_print (RS232_PORT_1, "Tick\n"); - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - rs232_print (RS232_PORT_1, "Tack\n"); - } - - PROCESS_END(); -} - -const struct process *autostart_processes[] = {&test_process1}; +/* + * Copyright (c) 2011, 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. 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 file is part of the Contiki operating system. + * + * Sets up some commands for the RF230 radio. + */ + +#include "contiki.h" +#include "cmd.h" + +#include "radio/rf230/radio.h" +#include "radio/rf230bb/rf230bb.h" + + +#define DEBUG 0 +#if DEBUG +#include +#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) +#define PRINTSHORT(FORMAT,args...) printf_P(PSTR(FORMAT),##args) +#else +#define PRINTF(...) +#define PRINTSHORT(...) +#endif + +int +cmd_handler_rf230(const uint8_t *data, int len) +{ + if(data[0] == '!') { + if(data[1] == 'C') { + PRINTF("CMD: Setting channel: %d\n", data[2]); + rf230_set_channel(data[2]); + return 1; + } + } else if(data[0] == '?') { + if(data[1] == 'C') { + uint8_t buf[4]; + PRINTF("CMD: Getting channel: %d\n", data[2]); + buf[0] = '!'; + buf[1] = 'C'; + buf[2] = rf230_get_channel(); + cmd_send(buf, 3); + return 1; + } + } + return 0; +} diff --git a/examples/ipv6/slip-radio/slip-radio.c b/examples/ipv6/slip-radio/slip-radio.c index a580d1efe..42ec17628 100644 --- a/examples/ipv6/slip-radio/slip-radio.c +++ b/examples/ipv6/slip-radio/slip-radio.c @@ -59,7 +59,15 @@ uint8_t packet_ids[16]; int packet_pos; static int slip_radio_cmd_handler(const uint8_t *data, int len); + +#if CONTIKI_TARGET_NOOLIBERRY +int cmd_handler_rf230(const uint8_t *data, int len); +#elif CONTIKI_TARGET_ECONOTAG +int cmd_handler_mc1322x(const uint8_t *data, int len); +#else /* Leave CC2420 as default */ int cmd_handler_cc2420(const uint8_t *data, int len); +#endif /* CONTIKI_TARGET */ + /*---------------------------------------------------------------------------*/ #ifdef CMD_CONF_HANDLERS CMD_HANDLERS(CMD_CONF_HANDLERS); diff --git a/examples/ipv6/slip-radio/slip-radio.h b/examples/ipv6/slip-radio/slip-radio.h index 8aad5da20..a80e81c4f 100644 --- a/examples/ipv6/slip-radio/slip-radio.h +++ b/examples/ipv6/slip-radio/slip-radio.h @@ -28,8 +28,8 @@ * */ -#ifndef __SLIP_RADIO_H__ -#define __SLIP_RADIO_H__ +#ifndef SLIP_RADIO_H_ +#define SLIP_RADIO_H_ struct slip_radio_sensors { /** Initialize the driver */ @@ -38,4 +38,4 @@ struct slip_radio_sensors { void (* send)(void); }; -#endif /* __SLIP_RADIO_H__ */ +#endif /* SLIP_RADIO_H_ */ diff --git a/examples/mbxxx/mbxxx-websense/Makefile b/examples/mbxxx/mbxxx-websense/Makefile index f59f6251f..a1d4b3af9 100644 --- a/examples/mbxxx/mbxxx-websense/Makefile +++ b/examples/mbxxx/mbxxx-websense/Makefile @@ -2,7 +2,6 @@ all: mbxxx-websense CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 APPS += webserver webbrowser diff --git a/examples/mbxxx/mbxxx-websense/project-conf.h b/examples/mbxxx/mbxxx-websense/project-conf.h index ff0ef145d..c3bee71ea 100644 --- a/examples/mbxxx/mbxxx-websense/project-conf.h +++ b/examples/mbxxx/mbxxx-websense/project-conf.h @@ -28,8 +28,8 @@ * */ -#ifndef __PROJECT_RPL_WEB_CONF_H__ -#define __PROJECT_RPL_WEB_CONF_H__ +#ifndef PROJECT_RPL_WEB_CONF_H_ +#define PROJECT_RPL_WEB_CONF_H_ #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 2 @@ -46,4 +46,4 @@ #undef WITH_SERIAL_LINE_INPUT #define WITH_SERIAL_LINE_INPUT 0 -#endif /* __PROJECT_RPL_WEB_CONF_H__ */ +#endif /* PROJECT_RPL_WEB_CONF_H_ */ diff --git a/examples/mbxxx/udp-ipv6-sleep/udp-client.c b/examples/mbxxx/udp-ipv6-sleep/udp-client.c index 92a0f4caf..5b1511ad5 100644 --- a/examples/mbxxx/udp-ipv6-sleep/udp-client.c +++ b/examples/mbxxx/udp-ipv6-sleep/udp-client.c @@ -166,7 +166,7 @@ PROCESS_THREAD(udp_client_process, ev, data) if(etimer_expired(&wake_timer)){ // if timer hasn't expired do not go in deep sleep, in order to receive a response. printf("Sleeping...\r\n"); halBoardPowerDown();//sensorsPowerDown(); - clock_wait(SLEEP_INTERVAL_SECONDS * 1000); // Put system in deep sleep mode for a while. + sleep_seconds(SLEEP_INTERVAL_SECONDS); // Put system in deep sleep mode for a while. halBoardPowerUp();//sensorsPowerUp(); printf("Awake\r\n"); } diff --git a/examples/mbxxx/webserver-ajax/webserver-ajax-conf.h b/examples/mbxxx/webserver-ajax/webserver-ajax-conf.h index f51049438..8b03c372f 100644 --- a/examples/mbxxx/webserver-ajax/webserver-ajax-conf.h +++ b/examples/mbxxx/webserver-ajax/webserver-ajax-conf.h @@ -1,7 +1,7 @@ -#ifndef __WEBSERVER_AJAX_CONF_H__ -#define __WEBSERVER_AJAX_CONF_H__ +#ifndef WEBSERVER_AJAX_CONF_H_ +#define WEBSERVER_AJAX_CONF_H_ #undef WITH_RIME #define WITH_RIME 1 @@ -21,4 +21,4 @@ #define UIP_CONF_UDP_CHECKSUMS 1 -#endif /* __WEBSERVER_AJAX_CONF_H__ */ +#endif /* WEBSERVER_AJAX_CONF_H_ */ diff --git a/examples/rest-example/Makefile b/examples/rest-example/Makefile index d7d9590b7..bd020537c 100644 --- a/examples/rest-example/Makefile +++ b/examples/rest-example/Makefile @@ -6,7 +6,6 @@ endif CONTIKI=../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 WITH_COAP = 1 diff --git a/examples/rest-example/project-conf.h b/examples/rest-example/project-conf.h index e55e28419..ca93a92ec 100644 --- a/examples/rest-example/project-conf.h +++ b/examples/rest-example/project-conf.h @@ -29,8 +29,8 @@ * */ -#ifndef __PROJECT_RPL_WEB_CONF_H__ -#define __PROJECT_RPL_WEB_CONF_H__ +#ifndef PROJECT_RPL_WEB_CONF_H_ +#define PROJECT_RPL_WEB_CONF_H_ #ifndef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 6 @@ -48,4 +48,4 @@ #define WEBSERVER_CONF_CFS_CONNS 2 #endif -#endif /* __PROJECT_RPL_WEB_CONF_H__ */ +#endif /* PROJECT_RPL_WEB_CONF_H_ */ diff --git a/examples/seedeye/powerswitch/Makefile b/examples/seedeye/powerswitch/Makefile index da5e2d82f..a7b4c9fbe 100644 --- a/examples/seedeye/powerswitch/Makefile +++ b/examples/seedeye/powerswitch/Makefile @@ -7,8 +7,6 @@ all: remotepowerswitch CONTIKI=../../../ CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -# variable for root Makefile.include -WITH_UIP6=1 # for some platforms UIP_CONF_IPV6=1 diff --git a/examples/seedeye/powerswitch/project-conf.h b/examples/seedeye/powerswitch/project-conf.h index 0d0b87eb5..208f6111b 100644 --- a/examples/seedeye/powerswitch/project-conf.h +++ b/examples/seedeye/powerswitch/project-conf.h @@ -29,8 +29,8 @@ * */ -#ifndef __PROJECT_RPL_WEB_CONF_H__ -#define __PROJECT_RPL_WEB_CONF_H__ +#ifndef PROJECT_RPL_WEB_CONF_H_ +#define PROJECT_RPL_WEB_CONF_H_ #define SICSLOWPAN_CONF_FRAG 1 @@ -49,4 +49,4 @@ #define COAP_MAX_OBSERVERS COAP_MAX_OPEN_TRANSACTIONS-1 #endif -#endif /* __PROJECT_RPL_WEB_CONF_H__ */ +#endif /* PROJECT_RPL_WEB_CONF_H_ */ diff --git a/examples/servreg-hack/Makefile b/examples/servreg-hack/Makefile index 23a7a06d8..84e057391 100644 --- a/examples/servreg-hack/Makefile +++ b/examples/servreg-hack/Makefile @@ -1,7 +1,6 @@ CONTIKI_PROJECT = example-servreg-client all: $(CONTIKI_PROJECT) -WITH_UIP6=1 UIP_CONF_IPV6=1 APPS=servreg-hack diff --git a/examples/sky-shell-exec/sky-shell-exec.c b/examples/sky-shell-exec/sky-shell-exec.c index 5580c58f2..f1059f33a 100644 --- a/examples/sky-shell-exec/sky-shell-exec.c +++ b/examples/sky-shell-exec/sky-shell-exec.c @@ -43,8 +43,6 @@ #include "dev/sht11.h" #include "dev/battery-sensor.h" -#include "lib/checkpoint.h" - #include "net/rime/timesynch.h" #include @@ -72,7 +70,6 @@ PROCESS_THREAD(sky_shell_process, ev, data) /*shell_sky_init();*/ shell_text_init(); /*shell_time_init();*/ - /* shell_checkpoint_init();*/ shell_exec_init(); shell_base64_init(); diff --git a/examples/sky-shell/sky-checkpoint.c b/examples/sky-shell/sky-checkpoint.c deleted file mode 100644 index 396972922..000000000 --- a/examples/sky-shell/sky-checkpoint.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2008, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Tmote Sky-specific Contiki shell - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "shell.h" -#include "serial-shell.h" - -#include "net/rime.h" -#include "dev/leds.h" - -#include "lib/checkpoint.h" - -#include "net/rime/timesynch.h" - -#include -#include - -#include -#include - -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "lib/checkpoint.h" - -/*---------------------------------------------------------------------------*/ -PROCESS(sky_shell_process, "Sky Contiki shell"); -AUTOSTART_PROCESSES(&sky_shell_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sky_shell_process, ev, data) -{ - PROCESS_BEGIN(); - - serial_shell_init(); - /*shell_blink_init();*/ - shell_file_init(); - shell_coffee_init(); - /*shell_ps_init();*/ - /*shell_reboot_init();*/ - shell_rime_init(); - /*shell_rime_netcmd_init();*/ - /*shell_rime_ping_init();*/ - /*shell_rime_debug_init();*/ - /*shell_rime_sniff_init();*/ - shell_rime_sendcmd_init(); - shell_download_init(); - /*shell_sky_init();*/ - shell_text_init(); - shell_time_init(); - shell_checkpoint_init(); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/sky-shell/sky-shell.c b/examples/sky-shell/sky-shell.c index 5ccba54fc..7313783ef 100644 --- a/examples/sky-shell/sky-shell.c +++ b/examples/sky-shell/sky-shell.c @@ -71,8 +71,8 @@ PROCESS_THREAD(sky_shell_process, ev, data) shell_blink_init(); /* shell_file_init(); shell_coffee_init();*/ - /* shell_download_init(); - shell_rime_sendcmd_init();*/ + /* shell_download_init();*/ + shell_rime_sendcmd_init(); /* shell_ps_init();*/ shell_reboot_init(); shell_rime_init(); @@ -87,7 +87,6 @@ PROCESS_THREAD(sky_shell_process, ev, data) /* shell_base64_init();*/ shell_text_init(); shell_time_init(); - /* shell_checkpoint_init();*/ /* shell_sendtest_init();*/ shell_collect_view_init(); diff --git a/examples/udp-stream/Makefile b/examples/udp-stream/Makefile index 37185ac8c..e1a1c9855 100644 --- a/examples/udp-stream/Makefile +++ b/examples/udp-stream/Makefile @@ -6,7 +6,6 @@ ifndef TARGET TARGET = sky endif -WITH_UIP6 = 1 UIP_CONF_IPV6 = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" SMALL = 1 diff --git a/examples/udp-stream/project-conf.h b/examples/udp-stream/project-conf.h index d65e2d486..cab313d21 100644 --- a/examples/udp-stream/project-conf.h +++ b/examples/udp-stream/project-conf.h @@ -28,8 +28,8 @@ * */ -#ifndef __PROJECT_H__ -#define __PROJECT_H__ +#ifndef PROJECT_H_ +#define PROJECT_H_ /* Free some code and RAM space */ #define UIP_CONF_TCP 0 @@ -49,4 +49,4 @@ /* Set a large (1 sector) default size for coffee files. */ #define COFFEE_CONF_DYN_SIZE (COFFEE_SECTOR_SIZE - COFFEE_PAGE_SIZE + 1) -#endif /* __PROJECT_H__ */ +#endif /* PROJECT_H_ */ diff --git a/examples/z1/ipv6/z1-websense/Makefile b/examples/z1/ipv6/z1-websense/Makefile index 84d328bed..2f48df333 100644 --- a/examples/z1/ipv6/z1-websense/Makefile +++ b/examples/z1/ipv6/z1-websense/Makefile @@ -2,7 +2,6 @@ all: z1-websense CONTIKI=../../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 SMALL=1 diff --git a/examples/z1/ipv6/z1-websense/project-conf.h b/examples/z1/ipv6/z1-websense/project-conf.h index 72f9fa25c..b0c7166c7 100644 --- a/examples/z1/ipv6/z1-websense/project-conf.h +++ b/examples/z1/ipv6/z1-websense/project-conf.h @@ -28,8 +28,8 @@ * */ -#ifndef __PROJECT_RPL_WEB_CONF_H__ -#define __PROJECT_RPL_WEB_CONF_H__ +#ifndef PROJECT_RPL_WEB_CONF_H_ +#define PROJECT_RPL_WEB_CONF_H_ #undef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 4 @@ -43,4 +43,4 @@ #undef WEBSERVER_CONF_CFS_CONNS #define WEBSERVER_CONF_CFS_CONNS 2 -#endif /* __PROJECT_RPL_WEB_CONF_H__ */ +#endif /* PROJECT_RPL_WEB_CONF_H_ */ diff --git a/examples/z1/ipv6/z1-websense/wget.h b/examples/z1/ipv6/z1-websense/wget.h index 12e8fbc72..b87f69692 100644 --- a/examples/z1/ipv6/z1-websense/wget.h +++ b/examples/z1/ipv6/z1-websense/wget.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __WGET_H__ -#define __WGET_H__ +#ifndef WGET_H_ +#define WGET_H_ #include "contiki.h" @@ -59,4 +59,4 @@ enum { WGET_CLOSED }; -#endif /* __WGET_H__ */ +#endif /* WGET_H_ */ diff --git a/examples/z1/rssi_scanner/project-conf.h b/examples/z1/rssi_scanner/project-conf.h index 3f7a3e541..8560a4171 100644 --- a/examples/z1/rssi_scanner/project-conf.h +++ b/examples/z1/rssi_scanner/project-conf.h @@ -28,8 +28,8 @@ * */ -#ifndef __PROJECT_CONF_H__ -#define __PROJECT_CONF_H__ +#ifndef PROJECT_CONF_H_ +#define PROJECT_CONF_H_ #undef NETSTACK_CONF_MAC #define NETSTACK_CONF_MAC nullmac_driver @@ -43,4 +43,4 @@ #undef NETSTACK_RDC #define NETSTACK_RDC nullrdc_driver -#endif /* __PROJECT_CONF_H__ */ +#endif /* PROJECT_CONF_H_ */ diff --git a/platform/apple2enh/contiki-conf.h b/platform/apple2enh/contiki-conf.h index e0a026fc7..3f96da1aa 100644 --- a/platform/apple2enh/contiki-conf.h +++ b/platform/apple2enh/contiki-conf.h @@ -32,8 +32,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include "6502def.h" @@ -65,4 +65,4 @@ #define WWW_CONF_MAX_INPUTNAMELEN 20 #define WWW_CONF_MAX_INPUTVALUELEN 20 -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/atarixl/contiki-conf.h b/platform/atarixl/contiki-conf.h index 4fe341f89..904f9316c 100644 --- a/platform/atarixl/contiki-conf.h +++ b/platform/atarixl/contiki-conf.h @@ -32,8 +32,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include "6502def.h" @@ -67,4 +67,4 @@ #define WWW_CONF_MAX_INPUTNAMELEN 20 #define WWW_CONF_MAX_INPUTVALUELEN 20 -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cfs.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cfs.h index 868c39d03..b4c47c271 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cfs.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cfs.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CFS_H__ -#define __HTTPD_CFS_H__ +#ifndef HTTPD_CFS_H_ +#define HTTPD_CFS_H_ #include "contiki-net.h" @@ -52,4 +52,4 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#endif /* __HTTPD_CFS_H__ */ +#endif /* HTTPD_CFS_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.h index acd2f6aed..4b23cb6e7 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-cgi.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ +#ifndef HTTPD_CGI_H_ +#define HTTPD_CGI_H_ #include "contiki.h" #include "httpd.h" @@ -57,4 +57,4 @@ void web_set_temp(char *s); void web_set_voltage(char *s); uint8_t httpd_cgi_sprint_ip6(uip_ip6addr_t addr, char * result); -#endif /* __HTTPD_CGI_H__ */ +#endif /* HTTPD_CGI_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h index cf354019e..85e004ca6 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fs.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FS_H__ -#define __HTTPD_FS_H__ +#ifndef HTTPD_FS_H_ +#define HTTPD_FS_H_ #include "contiki-net.h" @@ -83,4 +83,4 @@ uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); #define httpd_fs_getchar(x) pgm_read_byte(x) #endif -#endif /* __HTTPD_FS_H__ */ +#endif /* HTTPD_FS_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h index 16c0ec48e..45bf3caea 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd-fsdata.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FSDATA_H__ -#define __HTTPD_FSDATA_H__ +#ifndef HTTPD_FSDATA_H_ +#define HTTPD_FSDATA_H_ #include "contiki-net.h" @@ -56,4 +56,4 @@ struct httpd_fsdata_file_noconst { #endif /* HTTPD_FS_STATISTICS */ }; -#endif /* __HTTPD_FSDATA_H__ */ +#endif /* HTTPD_FSDATA_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd.h b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd.h index 73842cb0b..3d5df11f2 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/httpd.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/httpd.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_H__ -#define __HTTPD_H__ +#ifndef HTTPD_H_ +#define HTTPD_H_ #include "contiki-net.h" @@ -90,4 +90,4 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#endif /* __HTTPD_H__ */ +#endif /* HTTPD_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-dsc.h b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-dsc.h index c329f41d8..35aee6e7c 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-dsc.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __WEBSERVER_DSC_H__ -#define __WEBSERVER_DSC_H__ +#ifndef WEBSERVER_DSC_H_ +#define WEBSERVER_DSC_H_ #include "sys/dsc.h" DSC_HEADER(webserver_dsc); -#endif /* __WEBSERVER_DSC_H__ */ +#endif /* WEBSERVER_DSC_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.h b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.h index 825dfb96f..940f1a704 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver-nogui.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_NOGUI_H__ -#define __WEBSERVER_NOGUI_H__ +#ifndef WEBSERVER_NOGUI_H_ +#define WEBSERVER_NOGUI_H_ #include "contiki-net.h" @@ -42,4 +42,4 @@ PROCESS_NAME(raven_lcd_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver.h b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver.h index fe9f255a1..c96e7a32c 100644 --- a/platform/avr-atmega128rfa1/apps/raven-webserver/webserver.h +++ b/platform/avr-atmega128rfa1/apps/raven-webserver/webserver.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_H__ -#define __WEBSERVER_H__ +#ifndef WEBSERVER_H_ +#define WEBSERVER_H_ #include "contiki-net.h" @@ -41,4 +41,4 @@ PROCESS_NAME(webserver_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index ad5fc05c7..fb656a5a7 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -38,8 +38,8 @@ * David Kopf */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ /* Platform name, type, and MCU clock rate */ #define PLATFORM_NAME "RFA1" @@ -351,4 +351,4 @@ typedef unsigned short uip_stats_t; #include PROJECT_CONF_H #endif -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/avr-atmega128rfa1/params.h b/platform/avr-atmega128rfa1/params.h index 7a5e8aaae..d1888fe3c 100644 --- a/platform/avr-atmega128rfa1/params.h +++ b/platform/avr-atmega128rfa1/params.h @@ -1,5 +1,5 @@ -#ifndef __PARAMS_H__ -#define __PARAMS_H__ +#ifndef PARAMS_H_ +#define PARAMS_H_ /* PARAMETER_STORAGE = * 0 Hard coded, minmal program and eeprom usage. * 1 Stored in fixed eeprom locations, rewritten from flash if corrupt. @@ -105,4 +105,4 @@ uint16_t params_get_panaddr(void); uint8_t params_get_txpower(void); #endif -#endif /* __PARAMS_H__ */ +#endif /* PARAMS_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cfs.h b/platform/avr-raven/apps/raven-webserver/httpd-cfs.h index 868c39d03..b4c47c271 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cfs.h +++ b/platform/avr-raven/apps/raven-webserver/httpd-cfs.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CFS_H__ -#define __HTTPD_CFS_H__ +#ifndef HTTPD_CFS_H_ +#define HTTPD_CFS_H_ #include "contiki-net.h" @@ -52,4 +52,4 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#endif /* __HTTPD_CFS_H__ */ +#endif /* HTTPD_CFS_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.h b/platform/avr-raven/apps/raven-webserver/httpd-cgi.h index acd2f6aed..4b23cb6e7 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.h +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ +#ifndef HTTPD_CGI_H_ +#define HTTPD_CGI_H_ #include "contiki.h" #include "httpd.h" @@ -57,4 +57,4 @@ void web_set_temp(char *s); void web_set_voltage(char *s); uint8_t httpd_cgi_sprint_ip6(uip_ip6addr_t addr, char * result); -#endif /* __HTTPD_CGI_H__ */ +#endif /* HTTPD_CGI_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fs.h b/platform/avr-raven/apps/raven-webserver/httpd-fs.h index cf354019e..85e004ca6 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fs.h +++ b/platform/avr-raven/apps/raven-webserver/httpd-fs.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FS_H__ -#define __HTTPD_FS_H__ +#ifndef HTTPD_FS_H_ +#define HTTPD_FS_H_ #include "contiki-net.h" @@ -83,4 +83,4 @@ uint16_t httpd_fs_open(const char *name, struct httpd_fs_file *file); #define httpd_fs_getchar(x) pgm_read_byte(x) #endif -#endif /* __HTTPD_FS_H__ */ +#endif /* HTTPD_FS_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h b/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h index 16c0ec48e..45bf3caea 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h +++ b/platform/avr-raven/apps/raven-webserver/httpd-fsdata.h @@ -31,8 +31,8 @@ * Author: Adam Dunkels * */ -#ifndef __HTTPD_FSDATA_H__ -#define __HTTPD_FSDATA_H__ +#ifndef HTTPD_FSDATA_H_ +#define HTTPD_FSDATA_H_ #include "contiki-net.h" @@ -56,4 +56,4 @@ struct httpd_fsdata_file_noconst { #endif /* HTTPD_FS_STATISTICS */ }; -#endif /* __HTTPD_FSDATA_H__ */ +#endif /* HTTPD_FSDATA_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd.h b/platform/avr-raven/apps/raven-webserver/httpd.h index 73842cb0b..3d5df11f2 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd.h +++ b/platform/avr-raven/apps/raven-webserver/httpd.h @@ -31,8 +31,8 @@ * */ -#ifndef __HTTPD_H__ -#define __HTTPD_H__ +#ifndef HTTPD_H_ +#define HTTPD_H_ #include "contiki-net.h" @@ -90,4 +90,4 @@ struct httpd_state { void httpd_init(void); void httpd_appcall(void *state); -#endif /* __HTTPD_H__ */ +#endif /* HTTPD_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/webserver-dsc.h b/platform/avr-raven/apps/raven-webserver/webserver-dsc.h index c329f41d8..35aee6e7c 100644 --- a/platform/avr-raven/apps/raven-webserver/webserver-dsc.h +++ b/platform/avr-raven/apps/raven-webserver/webserver-dsc.h @@ -31,11 +31,11 @@ * * */ -#ifndef __WEBSERVER_DSC_H__ -#define __WEBSERVER_DSC_H__ +#ifndef WEBSERVER_DSC_H_ +#define WEBSERVER_DSC_H_ #include "sys/dsc.h" DSC_HEADER(webserver_dsc); -#endif /* __WEBSERVER_DSC_H__ */ +#endif /* WEBSERVER_DSC_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/webserver-nogui.h b/platform/avr-raven/apps/raven-webserver/webserver-nogui.h index 825dfb96f..940f1a704 100644 --- a/platform/avr-raven/apps/raven-webserver/webserver-nogui.h +++ b/platform/avr-raven/apps/raven-webserver/webserver-nogui.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_NOGUI_H__ -#define __WEBSERVER_NOGUI_H__ +#ifndef WEBSERVER_NOGUI_H_ +#define WEBSERVER_NOGUI_H_ #include "contiki-net.h" @@ -42,4 +42,4 @@ PROCESS_NAME(raven_lcd_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/platform/avr-raven/apps/raven-webserver/webserver.h b/platform/avr-raven/apps/raven-webserver/webserver.h index fe9f255a1..c96e7a32c 100644 --- a/platform/avr-raven/apps/raven-webserver/webserver.h +++ b/platform/avr-raven/apps/raven-webserver/webserver.h @@ -31,8 +31,8 @@ * * */ -#ifndef __WEBSERVER_H__ -#define __WEBSERVER_H__ +#ifndef WEBSERVER_H_ +#define WEBSERVER_H_ #include "contiki-net.h" @@ -41,4 +41,4 @@ PROCESS_NAME(webserver_process); void webserver_log(char *msg); void webserver_log_file(uip_ipaddr_t *requester, char *file); -#endif /* __WEBSERVER_H__ */ +#endif /* WEBSERVER_H_ */ diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index 1ec239c18..ac9490c1c 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -40,8 +40,8 @@ * David Kopf */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ /* Platform name, type, and MCU clock rate */ #define PLATFORM_NAME "Raven" @@ -366,4 +366,4 @@ typedef unsigned short uip_stats_t; #include PROJECT_CONF_H #endif /* PROJECT_CONF_H */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/avr-raven/contiki-raven.h b/platform/avr-raven/contiki-raven.h index eb37e0f26..f812ceede 100644 --- a/platform/avr-raven/contiki-raven.h +++ b/platform/avr-raven/contiki-raven.h @@ -39,8 +39,8 @@ * Simon Barner #include @@ -106,5 +106,5 @@ void adc_deinit(void); int adc_conversion_start(void); int16_t adc_result_get(adc_adj_t adjust); -#endif /* __ADC_H__ */ +#endif /* ADC_H_ */ diff --git a/platform/avr-ravenlcd/key.h b/platform/avr-ravenlcd/key.h index 24285e970..eefeefe6d 100644 --- a/platform/avr-ravenlcd/key.h +++ b/platform/avr-ravenlcd/key.h @@ -38,8 +38,8 @@ * */ -#ifndef __KEY_H__ -#define __KEY_H__ +#ifndef KEY_H_ +#define KEY_H_ #include #include @@ -93,4 +93,4 @@ key_state_t key_state_get(void); uint8_t is_button(void); uint8_t get_button(void); -#endif /* __KEY_H__ */ +#endif /* KEY_H_ */ diff --git a/platform/avr-ravenlcd/lcd.h b/platform/avr-ravenlcd/lcd.h index b14d5827c..a1eaa6a78 100644 --- a/platform/avr-ravenlcd/lcd.h +++ b/platform/avr-ravenlcd/lcd.h @@ -38,8 +38,8 @@ * */ -#ifndef __LCD_H__ -#define __LCD_H__ +#ifndef LCD_H_ +#define LCD_H_ #include #include @@ -347,5 +347,5 @@ void led_on(void); void led_off(void); /** @} */ -#endif /* __LCD_H__ */ +#endif /* LCD_H_ */ diff --git a/platform/avr-ravenlcd/main.h b/platform/avr-ravenlcd/main.h index e41ec464f..74256a500 100644 --- a/platform/avr-ravenlcd/main.h +++ b/platform/avr-ravenlcd/main.h @@ -39,8 +39,8 @@ * */ -#ifndef __MAIN_H__ -#define __MAIN_H__ +#ifndef MAIN_H_ +#define MAIN_H_ /** \name Logical defines */ /** \{ */ @@ -70,4 +70,4 @@ /** \} */ -#endif /* __MAIN_H__ */ +#endif /* MAIN_H_ */ diff --git a/platform/avr-ravenlcd/sleep.h b/platform/avr-ravenlcd/sleep.h index b020338b0..19a10c828 100644 --- a/platform/avr-ravenlcd/sleep.h +++ b/platform/avr-ravenlcd/sleep.h @@ -38,11 +38,11 @@ * */ -#ifndef __SLEEP_H__ -#define __SLEEP_H__ +#ifndef SLEEP_H_ +#define SLEEP_H_ /* Prototypes */ void sleep_now(int howlong); void sleep_wakeup(void); -#endif /* __SLEEP_H__ */ +#endif /* SLEEP_H_ */ diff --git a/platform/avr-ravenlcd/temp.h b/platform/avr-ravenlcd/temp.h index 798de558c..d0d50caa0 100644 --- a/platform/avr-ravenlcd/temp.h +++ b/platform/avr-ravenlcd/temp.h @@ -38,8 +38,8 @@ * */ -#ifndef __TEMP_H__ -#define __TEMP_H__ +#ifndef TEMP_H_ +#define TEMP_H_ #include @@ -90,4 +90,4 @@ void temp_deinit(void); */ int16_t temp_get(temp_unit_t unit); /** \} */ -#endif /* __TEMP_H__ */ +#endif /* TEMP_H_ */ diff --git a/platform/avr-ravenlcd/uart.h b/platform/avr-ravenlcd/uart.h index 060181d66..6024324f6 100644 --- a/platform/avr-ravenlcd/uart.h +++ b/platform/avr-ravenlcd/uart.h @@ -39,8 +39,8 @@ * */ -#ifndef __UART_H__ -#define __UART_H__ 1 +#ifndef UART_H_ +#define UART_H_ 1 #include @@ -75,4 +75,4 @@ void uart_send_byte(uint8_t byte); void uart_serial_send_frame(uint8_t cmd, uint8_t payload_length, uint8_t *payload); void uart_serial_rcv_frame(uint8_t wait_for_it); -#endif /* __UART_H__ */ +#endif /* UART_H_ */ diff --git a/platform/avr-ravenusb/cdc_task.h b/platform/avr-ravenusb/cdc_task.h index 66042b49d..b88a01a60 100644 --- a/platform/avr-ravenusb/cdc_task.h +++ b/platform/avr-ravenusb/cdc_task.h @@ -40,8 +40,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _CDC_TASK_H_ -#define _CDC_TASK_H_ +#ifndef CDC_TASK_H_ +#define CDC_TASK_H_ /** \addtogroup cdctask @@ -70,5 +70,5 @@ PROCESS_NAME(cdc_process); /** @} */ -#endif /* _CDC_TASK_H_ */ +#endif /*CDC_TASK_H_ */ diff --git a/platform/avr-ravenusb/contiki-conf.h b/platform/avr-ravenusb/contiki-conf.h index 459fc58e1..8b0a5d0a3 100644 --- a/platform/avr-ravenusb/contiki-conf.h +++ b/platform/avr-ravenusb/contiki-conf.h @@ -40,8 +40,8 @@ * David Kopf */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ /* ************************************************************************** */ //#pragma mark Basic Configuration @@ -483,4 +483,4 @@ typedef unsigned short uip_stats_t; #define CCIF #define CLIF -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/avr-ravenusb/contiki-raven.h b/platform/avr-ravenusb/contiki-raven.h index d93ae17fc..91a806d61 100644 --- a/platform/avr-ravenusb/contiki-raven.h +++ b/platform/avr-ravenusb/contiki-raven.h @@ -36,8 +36,8 @@ * */ -#ifndef __CONTIKI_RAVEN_H__ -#define __CONTIKI_RAVEN_H__ +#ifndef CONTIKI_RAVEN_H_ +#define CONTIKI_RAVEN_H_ #include "contiki.h" #include "contiki-net.h" @@ -65,4 +65,4 @@ void init_lowlevel(void); void init_net(void); -#endif /* #ifndef __CONTIKI_RAVEN_H__ */ +#endif /* #ifndef CONTIKI_RAVEN_H_ */ diff --git a/platform/avr-ravenusb/rng.h b/platform/avr-ravenusb/rng.h index 4c66d9a72..161953c27 100644 --- a/platform/avr-ravenusb/rng.h +++ b/platform/avr-ravenusb/rng.h @@ -1,5 +1,5 @@ -#ifndef __AVR_RNG_H__ -#define __AVR_RNG_H__ +#ifndef AVR_RNG_H_ +#define AVR_RNG_H_ #include diff --git a/platform/avr-rcb/contiki-conf.h b/platform/avr-rcb/contiki-conf.h index e8170bdd9..a5c1a6118 100644 --- a/platform/avr-rcb/contiki-conf.h +++ b/platform/avr-rcb/contiki-conf.h @@ -39,8 +39,8 @@ * Simon Barner @@ -144,4 +144,4 @@ typedef unsigned long u32_t; typedef unsigned short uip_stats_t; typedef unsigned long off_t; -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/avr-rcb/contiki-rcb.h b/platform/avr-rcb/contiki-rcb.h index eb37e0f26..f812ceede 100644 --- a/platform/avr-rcb/contiki-rcb.h +++ b/platform/avr-rcb/contiki-rcb.h @@ -39,8 +39,8 @@ * Simon Barner */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ /* Platform name, type, and MCU clock rate */ #define PLATFORM_NAME "Zigbit" @@ -179,4 +179,4 @@ typedef unsigned short uip_stats_t; typedef unsigned long off_t; -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/c128/contiki-conf.h b/platform/c128/contiki-conf.h index 56b4d09a8..8aabcca03 100644 --- a/platform/c128/contiki-conf.h +++ b/platform/c128/contiki-conf.h @@ -32,8 +32,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include "6502def.h" @@ -72,4 +72,4 @@ #define WWW_CONF_MAX_NUMPAGEWIDGETS 20 #define WWW_CONF_FORMS 0 -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/c64/contiki-conf.h b/platform/c64/contiki-conf.h index 354d2eaa9..2fddafdc1 100644 --- a/platform/c64/contiki-conf.h +++ b/platform/c64/contiki-conf.h @@ -32,8 +32,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include "6502def.h" @@ -75,4 +75,4 @@ #define WWW_CONF_MAX_INPUTNAMELEN 20 #define WWW_CONF_MAX_INPUTVALUELEN 20 -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/cc2530dk/Makefile.cc2530dk b/platform/cc2530dk/Makefile.cc2530dk index cae4911b5..2ef71e6f3 100644 --- a/platform/cc2530dk/Makefile.cc2530dk +++ b/platform/cc2530dk/Makefile.cc2530dk @@ -20,7 +20,6 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CLEAN += *.cc2530dk ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DUIP_CONF_IPV6=1 CONTIKI_TARGET_SOURCEFILES += viztool.c endif diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index 313fd669f..f5efa0e69 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -1,5 +1,5 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include "8051def.h" #include "sys/cc.h" @@ -280,4 +280,4 @@ #define UIP_CONF_DS6_AADDR_NBU 1 #endif -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/cc2530dk/debug.h b/platform/cc2530dk/debug.h index d72fb006b..94eaa4f51 100644 --- a/platform/cc2530dk/debug.h +++ b/platform/cc2530dk/debug.h @@ -40,8 +40,8 @@ * George Oikonomou - */ -#ifndef __DEBUG_H__ -#define __DEBUG_H__ +#ifndef DEBUG_H_ +#define DEBUG_H_ #include "8051def.h" #include "dev/uart1.h" @@ -52,4 +52,4 @@ void puthex(uint8_t c); void putbin(uint8_t c); void putdec(uint8_t c); -#endif /* __DEBUG_H__ */ +#endif /* DEBUG_H_ */ diff --git a/platform/cc2530dk/dev/adc-sensor.h b/platform/cc2530dk/dev/adc-sensor.h index 45b0a9985..bb6c6580f 100644 --- a/platform/cc2530dk/dev/adc-sensor.h +++ b/platform/cc2530dk/dev/adc-sensor.h @@ -40,8 +40,8 @@ * George Oikonomou - */ -#ifndef __ADC_SENSOR_H__ -#define __ADC_SENSOR_H__ +#ifndef ADC_SENSOR_H_ +#define ADC_SENSOR_H_ #include "cc253x.h" #include "contiki-conf.h" @@ -79,4 +79,4 @@ extern const struct sensors_sensor adc_sensor; #define VDD_SENSOR_ON VDD_SENSOR_CONF_ON #endif /* VDD_SENSOR_CONF_ON */ -#endif /* __ADC_SENSOR_H__ */ +#endif /* ADC_SENSOR_H_ */ diff --git a/platform/cc2530dk/dev/button-sensor.h b/platform/cc2530dk/dev/button-sensor.h index 82cd2ec17..79001e960 100644 --- a/platform/cc2530dk/dev/button-sensor.h +++ b/platform/cc2530dk/dev/button-sensor.h @@ -37,8 +37,8 @@ * George Oikonomou - */ -#ifndef __BUTTON_SENSOR_H__ -#define __BUTTON_SENSOR_H__ +#ifndef BUTTON_SENSOR_H_ +#define BUTTON_SENSOR_H_ #include "contiki-conf.h" #include "lib/sensors.h" @@ -105,4 +105,4 @@ void port_0_isr(void) __interrupt(P0INT_VECTOR); #define BUTTON_IRQ_ON_PRESS(b) PORT_IRQ_EDGE_RISE(BUTTON##b##_PORT, BUTTON##b##_PIN) #define BUTTON_IRQ_ON_RELEASE(b) PORT_IRQ_EDGE_FALL(BUTTON##b##_PORT, BUTTON##b##_PIN) -#endif /* __BUTTON_SENSOR_H__ */ +#endif /* BUTTON_SENSOR_H_ */ diff --git a/platform/cc2530dk/dev/leds-arch.h b/platform/cc2530dk/dev/leds-arch.h index b19d5cf9d..0e0f9b565 100644 --- a/platform/cc2530dk/dev/leds-arch.h +++ b/platform/cc2530dk/dev/leds-arch.h @@ -38,8 +38,8 @@ */ -#ifndef __LEDS_ARCH_H__ -#define __LEDS_ARCH_H__ +#ifndef LEDS_ARCH_H_ +#define LEDS_ARCH_H_ #include "dev/port.h" @@ -50,4 +50,4 @@ #define LED4_DIR_INPUT() PORT_DIR_INPUT(LED4_PORT, LED4_PIN) #define LED4_DIR_OUTPUT() PORT_DIR_OUTPUT(LED4_PORT, LED4_PIN) -#endif /* __LEDS_ARCH_H__ */ +#endif /* LEDS_ARCH_H_ */ diff --git a/platform/cc2530dk/models.h b/platform/cc2530dk/models.h index 23989915c..fe396d9f5 100644 --- a/platform/cc2530dk/models.h +++ b/platform/cc2530dk/models.h @@ -41,8 +41,8 @@ * George Oikonomou - */ -#ifndef __MODELS_H__ -#define __MODELS_H__ +#ifndef MODELS_H_ +#define MODELS_H_ /*---------------------------------------------------------------------------*/ /* LEDs */ @@ -116,4 +116,4 @@ /* Buttons */ /*---------------------------------------------------------------------------*/ -#endif /* __MODELS_H__ */ +#endif /* MODELS_H_ */ diff --git a/platform/cc2538dk/Makefile.cc2538dk b/platform/cc2538dk/Makefile.cc2538dk index 2ca46af7e..b350c2fc2 100644 --- a/platform/cc2538dk/Makefile.cc2538dk +++ b/platform/cc2538dk/Makefile.cc2538dk @@ -22,11 +22,6 @@ ifndef SMALL SMALL = 1 endif -### If the prject's Makefile specified IPv6, the pre-processor needs to know -ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DUIP_CONF_IPV6=1 -endif - ### Define the CPU directory CONTIKI_CPU=$(CONTIKI)/cpu/cc2538 include $(CONTIKI_CPU)/Makefile.cc2538 diff --git a/platform/cooja/contiki-conf.h b/platform/cooja/contiki-conf.h index 217432c18..46341dae4 100644 --- a/platform/cooja/contiki-conf.h +++ b/platform/cooja/contiki-conf.h @@ -30,8 +30,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #define PROFILE_CONF_ON 0 #define ENERGEST_CONF_ON 0 @@ -243,4 +243,4 @@ typedef unsigned long rtimer_clock_t; #include PROJECT_CONF_H #endif /* PROJECT_CONF_H */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/cooja/dev/beep.h b/platform/cooja/dev/beep.h index 31647b9a1..d228fc613 100644 --- a/platform/cooja/dev/beep.h +++ b/platform/cooja/dev/beep.h @@ -28,8 +28,8 @@ * */ -#ifndef __BEEP_H__ -#define __BEEP_H__ +#ifndef BEEP_H_ +#define BEEP_H_ #include "sys/clock.h" @@ -57,4 +57,4 @@ void beep_long(clock_time_t len); void beep_quick(int num); -#endif /* __BEEP_H__ */ +#endif /* BEEP_H_ */ diff --git a/platform/cooja/dev/button-sensor.h b/platform/cooja/dev/button-sensor.h index 11d0cbcbb..1f1fb0fbc 100644 --- a/platform/cooja/dev/button-sensor.h +++ b/platform/cooja/dev/button-sensor.h @@ -28,8 +28,8 @@ * */ -#ifndef __BUTTON_SENSOR_H__ -#define __BUTTON_SENSOR_H__ +#ifndef BUTTON_SENSOR_H_ +#define BUTTON_SENSOR_H_ #include "lib/sensors.h" @@ -37,4 +37,4 @@ extern const struct sensors_sensor button_sensor; #define BUTTON_SENSOR "Button" -#endif /* __BUTTON_SENSOR_H__ */ +#endif /* BUTTON_SENSOR_H_ */ diff --git a/platform/cooja/dev/cooja-radio.h b/platform/cooja/dev/cooja-radio.h index 40873c9cb..b6bfb3aaf 100644 --- a/platform/cooja/dev/cooja-radio.h +++ b/platform/cooja/dev/cooja-radio.h @@ -30,8 +30,8 @@ * */ -#ifndef __COOJA_RADIO_H__ -#define __COOJA_RADIO_H__ +#ifndef COOJA_RADIO_H_ +#define COOJA_RADIO_H_ #include "contiki.h" #include "dev/radio.h" @@ -71,4 +71,4 @@ int radio_LQI(void); -#endif /* __COOJA_RADIO_H__ */ +#endif /* COOJA_RADIO_H_ */ diff --git a/platform/cooja/dev/ip.h b/platform/cooja/dev/ip.h index 8a03223fc..57ff9c046 100644 --- a/platform/cooja/dev/ip.h +++ b/platform/cooja/dev/ip.h @@ -28,7 +28,7 @@ * */ -#ifndef __IP_H__ -#define __IP_H__ +#ifndef IP_H_ +#define IP_H_ -#endif /* __IP_H__ */ +#endif /* IP_H_ */ diff --git a/platform/cooja/dev/moteid.h b/platform/cooja/dev/moteid.h index 95def929a..18aada16d 100644 --- a/platform/cooja/dev/moteid.h +++ b/platform/cooja/dev/moteid.h @@ -28,9 +28,9 @@ * */ -#ifndef __MOTEID_H__ -#define __MOTEID_H__ +#ifndef MOTEID_H_ +#define MOTEID_H_ extern int simMoteID; -#endif /* __MOTEID_H__ */ +#endif /* MOTEID_H_ */ diff --git a/platform/cooja/dev/pir-sensor.h b/platform/cooja/dev/pir-sensor.h index a88fd7849..aa2c1eef4 100644 --- a/platform/cooja/dev/pir-sensor.h +++ b/platform/cooja/dev/pir-sensor.h @@ -28,8 +28,8 @@ * */ -#ifndef __PIR_H__ -#define __PIR_H__ +#ifndef PIR_H_ +#define PIR_H_ #include "lib/sensors.h" @@ -37,4 +37,4 @@ extern const struct sensors_sensor pir_sensor; #define PIR_SENSOR "PIR" -#endif /* __PIR_H__ */ +#endif /* PIR_H_ */ diff --git a/platform/cooja/dev/rs232.h b/platform/cooja/dev/rs232.h index 0c52fc355..aefb5c823 100644 --- a/platform/cooja/dev/rs232.h +++ b/platform/cooja/dev/rs232.h @@ -45,8 +45,8 @@ * \author Adam Dunkels * */ -#ifndef __RS232_H__ -#define __RS232_H__ +#ifndef RS232_H_ +#define RS232_H_ #define RS232_19200 1 @@ -112,6 +112,6 @@ void rs232_print(char *text); */ void rs232_send(char c); -#endif /* __RS232_H__ */ +#endif /* RS232_H_ */ /** @} */ /** @} */ diff --git a/platform/cooja/dev/vib-sensor.h b/platform/cooja/dev/vib-sensor.h index 79acf5dff..bd12097c9 100644 --- a/platform/cooja/dev/vib-sensor.h +++ b/platform/cooja/dev/vib-sensor.h @@ -28,8 +28,8 @@ * */ -#ifndef __VIB_H__ -#define __VIB_H__ +#ifndef VIB_H_ +#define VIB_H_ #include "lib/sensors.h" @@ -37,4 +37,4 @@ extern const struct sensors_sensor vib_sensor; #define VIB_SENSOR "Vibration" -#endif /* __VIB_H__ */ +#endif /* VIB_H_ */ diff --git a/platform/cooja/lib/simEnvChange.h b/platform/cooja/lib/simEnvChange.h index b9f700d71..35189a42d 100644 --- a/platform/cooja/lib/simEnvChange.h +++ b/platform/cooja/lib/simEnvChange.h @@ -28,8 +28,8 @@ * */ -#ifndef __SIMENVCHANGE_H__ -#define __SIMENVCHANGE_H__ +#ifndef SIMENVCHANGE_H_ +#define SIMENVCHANGE_H_ #include "contiki.h" @@ -64,4 +64,4 @@ const struct simInterface *simInterfaces[] = {__VA_ARGS__, NULL}; void doActionsBeforeTick(); void doActionsAfterTick(); -#endif /* __SIMENVCHANGE_H__ */ +#endif /* SIMENVCHANGE_H_ */ diff --git a/platform/cooja/mtarch.h b/platform/cooja/mtarch.h index 04e6817a4..1244f9a4a 100644 --- a/platform/cooja/mtarch.h +++ b/platform/cooja/mtarch.h @@ -30,11 +30,11 @@ * */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ +#ifndef MTARCH_H_ +#define MTARCH_H_ struct mtarch_thread { void *mt_thread; }; -#endif /* __MTARCH_H__ */ +#endif /* MTARCH_H_ */ diff --git a/platform/cooja/net/init-net.h b/platform/cooja/net/init-net.h index 8b67708f0..1f45b30eb 100644 --- a/platform/cooja/net/init-net.h +++ b/platform/cooja/net/init-net.h @@ -32,10 +32,10 @@ * */ -#ifndef __INIT_NET_H__ -#define __INIT_NET_H__ +#ifndef INIT_NET_H_ +#define INIT_NET_H_ void init_net(void); -#endif /* __INIT_NET_H__ */ +#endif /* INIT_NET_H_ */ diff --git a/platform/cooja/net/radio-uip-uaodv.c b/platform/cooja/net/radio-uip-uaodv.c index dd9a606e1..9d29048c5 100644 --- a/platform/cooja/net/radio-uip-uaodv.c +++ b/platform/cooja/net/radio-uip-uaodv.c @@ -31,7 +31,6 @@ */ #include "radio-uip-uaodv.h" -#include "net/hc.h" #include "net/uip.h" #include "net/uaodv.h" #include "net/uaodv-rt.h" diff --git a/platform/cooja/net/radio-uip-uaodv.h b/platform/cooja/net/radio-uip-uaodv.h index c5471365f..e55016608 100644 --- a/platform/cooja/net/radio-uip-uaodv.h +++ b/platform/cooja/net/radio-uip-uaodv.h @@ -30,8 +30,8 @@ * */ -#ifndef __RADIO_UIP_UAODV_H__ -#define __RADIO_UIP_UAODV_H__ +#ifndef RADIO_UIP_UAODV_H_ +#define RADIO_UIP_UAODV_H_ #include "contiki.h" #include "dev/radio.h" @@ -42,4 +42,4 @@ radio_uip_uaodv_init(const struct radio_driver *d); uint8_t radio_uip_uaodv_send(void); -#endif /* __RADIO_UIP_UAODV_H__ */ +#endif /* RADIO_UIP_UAODV_H_ */ diff --git a/platform/cooja/net/uip-driver.c b/platform/cooja/net/uip-driver.c index 7a3d3267d..80ea47893 100644 --- a/platform/cooja/net/uip-driver.c +++ b/platform/cooja/net/uip-driver.c @@ -39,7 +39,6 @@ #include "net/netstack.h" #include "net/uip.h" #include "net/tcpip.h" -#include "net/hc.h" #include "net/packetbuf.h" #include "net/uip-driver.h" #include diff --git a/platform/cooja/net/uip-driver.h b/platform/cooja/net/uip-driver.h index c067f647b..2a9c4b191 100644 --- a/platform/cooja/net/uip-driver.h +++ b/platform/cooja/net/uip-driver.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __UIP_DRIVER_H__ -#define __UIP_DRIVER_H__ +#ifndef UIP_DRIVER_H_ +#define UIP_DRIVER_H_ #include "net/netstack.h" @@ -45,4 +45,4 @@ uint8_t uip_driver_send(void); extern const struct network_driver uip_driver; -#endif /* __UIP_DRIVER_H__ */ +#endif /* UIP_DRIVER_H_ */ diff --git a/platform/cooja/rtimer-arch.h b/platform/cooja/rtimer-arch.h index 65acb3856..616ad4185 100644 --- a/platform/cooja/rtimer-arch.h +++ b/platform/cooja/rtimer-arch.h @@ -30,8 +30,8 @@ * */ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ #include "contiki-conf.h" #include "sys/clock.h" @@ -43,4 +43,4 @@ int rtimer_arch_check(void); int rtimer_arch_pending(void); rtimer_clock_t rtimer_arch_next(void); -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/platform/cooja/sys/cooja_mt.h b/platform/cooja/sys/cooja_mt.h index 7316b41e3..4707b1fff 100644 --- a/platform/cooja/sys/cooja_mt.h +++ b/platform/cooja/sys/cooja_mt.h @@ -35,8 +35,8 @@ * This file is ripped from mt.h of the Contiki Multi-threading library. * Fredrik Osterlind */ -#ifndef __COOJA_MT_H__ -#define __COOJA_MT_H__ +#ifndef COOJA_MT_H_ +#define COOJA_MT_H_ #include "contiki.h" @@ -248,4 +248,4 @@ void cooja_mt_exit(void); /** @} */ /** @} */ -#endif /* __MT_H__ */ +#endif /* MT_H_ */ diff --git a/platform/cooja/sys/cooja_mtarch.h b/platform/cooja/sys/cooja_mtarch.h index f88a20bae..084962e81 100644 --- a/platform/cooja/sys/cooja_mtarch.h +++ b/platform/cooja/sys/cooja_mtarch.h @@ -32,8 +32,8 @@ * This file is ripped from x86/mtarch.h of the Contiki Multi-threading library. * Fredrik Osterlind */ -#ifndef __COOJA_MTARCH_H__ -#define __COOJA_MTARCH_H__ +#ifndef COOJA_MTARCH_H_ +#define COOJA_MTARCH_H_ #ifndef COOJA_MTARCH_STACKSIZE #define COOJA_MTARCH_STACKSIZE 1024 @@ -48,5 +48,5 @@ struct cooja_mt_thread; int cooja_mtarch_stack_usage(struct cooja_mt_thread *t); -#endif /* __COOJA_MTARCH_H__ */ +#endif /* COOJA_MTARCH_H_ */ diff --git a/platform/cooja/sys/node-id.h b/platform/cooja/sys/node-id.h index ccff77a07..a6876bd1f 100644 --- a/platform/cooja/sys/node-id.h +++ b/platform/cooja/sys/node-id.h @@ -29,11 +29,11 @@ * */ -#ifndef __NODE_ID_H__ -#define __NODE_ID_H__ +#ifndef NODE_ID_H_ +#define NODE_ID_H_ #include "dev/moteid.h" #define node_id simMoteID -#endif /* __NODE_ID_H__ */ +#endif /* NODE_ID_H_ */ diff --git a/platform/econotag/contiki-conf.h b/platform/econotag/contiki-conf.h index 3d3019113..5e1675dc4 100644 --- a/platform/econotag/contiki-conf.h +++ b/platform/econotag/contiki-conf.h @@ -45,8 +45,8 @@ * Mariano Alvira */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include @@ -243,4 +243,4 @@ #include PROJECT_CONF_H #endif /* PROJECT_CONF_H */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/esb/Makefile.esb b/platform/esb/Makefile.esb deleted file mode 100644 index 7ec4d4444..000000000 --- a/platform/esb/Makefile.esb +++ /dev/null @@ -1,87 +0,0 @@ -# $Id: Makefile.esb,v 1.15 2010/03/02 22:40:39 nifi Exp $ - -SENSORS = sensors.c irq.c button-sensor.c pir-sensor.c vib-sensor.c \ - sound-sensor.c radio-sensor.c ctsrts-sensor.c battery-sensor.c \ - temperature-sensor.c -ESB = ir.c beep.c ds1629.c tr1001-gcr.c gcr.c \ - esb-sensors.c node-id.c eeprom.c \ - uip-driver.c uip-ipchksum.c -CFS_EEPROM = cfs-eeprom.c -CFS_COFFEE = cfs-coffee.c cfs-coffee-arch.c - -CONTIKI_TARGET_DIRS = . dev apps net loader -ifndef CONTIKI_TARGET_MAIN - CONTIKI_TARGET_MAIN = contiki-esb-main.c -endif - -CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \ - contiki-esb-default-init-lowlevel.c \ - contiki-esb-default-init-apps.c \ - rs232.c rs232-putchar.c fader.c - -ifdef WITH_CODEPROP - CONTIKI_TARGET_DIRS += ../../apps/codeprop - CONTIKI_TARGET_SOURCEFILES += codeprop-tmp.c - WITH_UIP=1 -endif - -ifdef GCC -CFLAGS+=-Os -g -endif - -ifdef IAR -CFLAGS += -D__MSP430F149__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32 -CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR) -endif - - -ifdef WITH_UIP - ifndef WITH_SLIP - WITH_SLIP=1 - endif - CFLAGS += -DWITH_UIP=1 -DWITH_SLIP=${WITH_SLIP} -endif - -ifeq ($(CFS),coffee) - CONTIKI_TARGET_SOURCEFILES += $(CFS_COFFEE) -else - CONTIKI_TARGET_SOURCEFILES += $(CFS_EEPROM) -endif - -include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps - -MCU=msp430f149 -include $(CONTIKI)/cpu/msp430/Makefile.msp430 - -ifdef IAR -LDFLAGSNO += -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f149.xcl" -LDFLAGS += $(LDFLAGSNO) -Felf -yn -endif # IAR - -contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} -# $(AR) rcf $@ $^ - -ifndef BASE_IP -BASE_IP := 172.16.1.1 -endif - -send: $(CONTIKI)/tools/codeprop.c - cc -Wall $^ -o send - -%.send: %.cm send - send $(BASE_IP) $< - -### System dependent Makefile - -ifeq ($(HOST_OS),FreeBSD) - # settings for FreeBSD - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd -else - ifeq ($(HOST_OS),Windows) - # settings for Windows - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win - else - # settings for an arbitary unix-like platform - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix - endif -endif diff --git a/platform/esb/apps/Makefile.apps b/platform/esb/apps/Makefile.apps deleted file mode 100644 index 83e02193a..000000000 --- a/platform/esb/apps/Makefile.apps +++ /dev/null @@ -1,4 +0,0 @@ -burn-nodeid: burn-nodeid.c -helloworld: helloworld.c -radio-test: radio-test.c -radio-sniffer: radio-sniffer.c diff --git a/platform/esb/apps/beeper.c b/platform/esb/apps/beeper.c deleted file mode 100644 index c0e7b9927..000000000 --- a/platform/esb/apps/beeper.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#include "contiki-esb.h" - -PROCESS(beeper_process, "Beeper"); - -AUTOSTART_PROCESSES(&beeper_process); - -static struct etimer etimer; - -static struct pt beeper_pt; - -static -PT_THREAD(beeper_thread(struct pt *pt)) -{ - PT_BEGIN(pt); - - while(1) { - PT_WAIT_UNTIL(pt, etimer_expired(&etimer)); - etimer_reset(&etimer); - leds_invert(LEDS_RED); - beep(); - - PT_WAIT_UNTIL(pt, etimer_expired(&etimer)); - etimer_reset(&etimer); - leds_invert(LEDS_RED); - } - - PT_END(pt); -} - -PROCESS_THREAD(beeper_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&etimer, CLOCK_SECOND / 2); - PT_INIT(&beeper_pt); - - button_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - - beeper_thread(&beeper_pt); - - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_EXIT) { - break; - } else if(ev == sensors_event && - data == &button_sensor) { - leds_invert(LEDS_YELLOW); - } - - } - PROCESS_END(); -} diff --git a/platform/esb/apps/burn-nodeid.c b/platform/esb/apps/burn-nodeid.c deleted file mode 100644 index a157baebd..000000000 --- a/platform/esb/apps/burn-nodeid.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "sys/node-id.h" -#include "contiki.h" -#include "dev/esb-sensors.h" -#include "dev/rs232.h" - -#include - -PROCESS(burn_process, "Burn node id"); -AUTOSTART_PROCESSES(&burn_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(burn_process, ev, data) -{ - PROCESS_BEGIN(); -#if NODEID - printf("Burning node id %d\n", NODEID); - node_id_burn(NODEID); - node_id_restore(); - printf("Restored node id %d\n", node_id); -#else -#error "burn-nodeid must be compiled with nodeid=" - node_id_restore(); - printf("Restored node id %d\n", node_id); -#endif - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void init_net(void) {} -void init_lowlevel(void) {esb_sensors_init(); esb_sensors_on(); rs232_init();} diff --git a/platform/esb/apps/fader.c b/platform/esb/apps/fader.c deleted file mode 100644 index 78e471e9b..000000000 --- a/platform/esb/apps/fader.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include "contiki-esb.h" - -PROCESS(fader_process, "LED fader"); -AUTOSTART_PROCESSES(&fader_process); - -#define ON 1 -#define OFF 0 - -static unsigned char onoroff; -static struct etimer etimer; -static struct pt fade_pt, fade_in_pt, fade_out_pt; -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade_in(struct pt *pt)) -{ - static int delay; - - PT_BEGIN(pt); - - for(delay = 3980; delay > 20; delay -= 20) { - leds_on(LEDS_ALL); - clock_delay(4000 - delay); - leds_off(LEDS_ALL); - clock_delay(delay); - PT_YIELD(pt); - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade_out(struct pt *pt)) -{ - static int delay; - - PT_BEGIN(pt); - - for(delay = 20; delay < 3980; delay += 20) { - leds_on(LEDS_ALL); - clock_delay(4000 - delay); - leds_off(LEDS_ALL); - clock_delay(delay); - PT_YIELD(pt); - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade(struct pt *pt)) -{ - PT_BEGIN(pt); - - PT_SPAWN(pt, &fade_in_pt, fade_in(&fade_in_pt)); - PT_SPAWN(pt, &fade_out_pt, fade_out(&fade_out_pt)); - - etimer_set(&etimer, CLOCK_SECOND * 10); - PT_WAIT_UNTIL(pt, etimer_expired(&etimer)); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(fader_process, ev, data) -{ - PROCESS_BEGIN(); - - PT_INIT(&fade_pt); - PT_INIT(&fade_in_pt); - PT_INIT(&fade_out_pt); - onoroff = ON; - etimer_set(&etimer, CLOCK_SECOND * 32); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_TIMER) { - etimer_reset(&etimer); - PT_INIT(&fade_pt); - process_poll(&fader_process); - } - - if(onoroff == ON && - PT_SCHEDULE(fade(&fade_pt))) { - process_poll(&fader_process); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -fader_on(void) -{ - onoroff = ON; - process_poll(&fader_process); -} -/*---------------------------------------------------------------------------*/ -void -fader_off(void) -{ - onoroff = OFF; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/fader.h b/platform/esb/apps/fader.h deleted file mode 100644 index 95c82dde2..000000000 --- a/platform/esb/apps/fader.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ -#ifndef __FADER_H__ -#define __FADER_H__ - -#include "contiki.h" - -PROCESS_NAME(fader_process); - -void fader_on(void); -void fader_off(void); - -#endif /* __FADER_H__ */ diff --git a/platform/esb/apps/helloworld.c b/platform/esb/apps/helloworld.c deleted file mode 100644 index ffc18a87f..000000000 --- a/platform/esb/apps/helloworld.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Configurable Sensor Network Application - * Architecture for sensor nodes running the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2006/06/18 07:48:48 $ - * $Revision: 1.1 $ - */ - -#include "contiki-esb.h" -#include - -PROCESS(helloworld_process, "Helloworld"); - -AUTOSTART_PROCESSES(&helloworld_process); - -static struct etimer timer; - -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(helloworld_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&timer, CLOCK_SECOND * 2); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - - etimer_reset(&timer); - leds_invert(LEDS_YELLOW); - printf("Hello world!\n"); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/apps/pinger.c b/platform/esb/apps/pinger.c deleted file mode 100644 index 4e6a807d1..000000000 --- a/platform/esb/apps/pinger.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "contiki-esb.h" - -#include - -PROCESS(pinger, "Pinger"); - -static struct uip_udp_conn *conn; - -struct data { - uint8_t dummy_data[20]; - uint16_t id; - uint16_t seqno; - uint8_t pingpong; -#define PING 0 -#define PONG 1 -}; - -static unsigned char pingeron; -static struct etimer etimer; - -static unsigned short sent_seqno, last_seqno; - -#define PORT 9145 - -static int place_id = 0, packet_count = 0; - - -/*---------------------------------------------------------------------------*/ -static void -quit(void) -{ - process_exit(&pinger); - LOADER_UNLOAD(); -} -/*---------------------------------------------------------------------------*/ -static void -udp_appcall(void *arg) -{ - struct data *d; - /* char buf[50];*/ - d = (struct data *)uip_appdata; - - if(uip_newdata()) { - leds_toggle(LEDS_YELLOW); - /* beep();*/ - - /* if(uip_htons(d->seqno) != last_seqno + 1) { - leds_toggle(LEDS_RED); - beep_quick(2); - }*/ - /* last_seqno = uip_htons(d->seqno);*/ - /* uip_udp_send(sizeof(struct data));*/ - /* snprintf(buf, sizeof(buf), "Packet received id %d signal %u\n", - d->id, tr1001_sstrength()); - - rs232_print(buf);*/ - /* if(d->pingpong == PING) { - d->pingpong = PONG; - } else { - d->pingpong = PING; - d->seqno = uip_htons(uip_htons(d->seqno) + 1); - }*/ - /* uip_udp_send(sizeof(struct data)); - timer_restart(&timer);*/ - } else if(uip_poll()) { - if(pingeron && etimer_expired(&etimer) && packet_count > 0) { - --packet_count; - d->id = place_id; - d->pingpong = PING; - d->seqno = uip_htons(sent_seqno); - ++sent_seqno; - uip_udp_send(sizeof(struct data)); - etimer_reset(&etimer); - leds_toggle(LEDS_GREEN); - } - - if(packet_count == 0) { - pingeron = 0; - } - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(config_thread(struct pt *pt, process_event_t ev, process_data_t data)) -{ - static struct etimer pushtimer; - static int counter; - - PT_BEGIN(pt); - - - while(1) { - - PT_WAIT_UNTIL(pt, ev == sensors_event && data == &button_sensor); - - beep(); - - leds_on(LEDS_YELLOW); - - etimer_set(&pushtimer, CLOCK_SECOND); - for(counter = 0; !etimer_expired(&pushtimer); ++counter) { - etimer_restart(&pushtimer); - PT_YIELD_UNTIL(pt, (ev == sensors_event && data == &button_sensor) || - etimer_expired(&pushtimer)); - } - - place_id = counter; - - beep_quick(place_id); - - pingeron = 1; - - packet_count = 20; - - etimer_set(&etimer, CLOCK_SECOND / 2); - - leds_off(LEDS_YELLOW); - - leds_on(LEDS_RED); - PT_WAIT_UNTIL(pt, packet_count == 0); - - pingeron = 0; - leds_off(LEDS_RED); - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(pinger, ev, data) -{ - static struct pt config_pt; - - PROCESS_BEGIN(); - - pingeron = 0; - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - - PT_INIT(&config_pt); - - button_sensor.configure(SENSORS_ACTIVE, 1); - - - while(1) { - - config_thread(&config_pt, ev, data); - - PROCESS_WAIT_EVENT(); - - printf("Event %d\n", ev); - - beep(); - - if(ev == tcpip_event) { - udp_appcall(data); - } - - if(ev == PROCESS_EVENT_TIMER && etimer_expired(&etimer)) { - tcpip_poll_udp(conn); - } - - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/pinger.h b/platform/esb/apps/pinger.h deleted file mode 100644 index 7af1b7440..000000000 --- a/platform/esb/apps/pinger.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __PINGER_H__ -#define __PINGER_H__ - -#include "contiki.h" - -PROCESS_NAME(pinger); - -#endif /* __PINGER_H__ */ diff --git a/platform/esb/apps/radio-sniffer.c b/platform/esb/apps/radio-sniffer.c deleted file mode 100644 index 8bd4b93d1..000000000 --- a/platform/esb/apps/radio-sniffer.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "radio-sniffer.h" -#include "contiki-net.h" -#include "contiki-esb.h" -#include "net/hc.h" -#include "net/tcpdump.h" - -#include -/*---------------------------------------------------------------------------*/ -PROCESS(radio_sniffer_process, "Radio sniffer"); -AUTOSTART_PROCESSES(&radio_sniffer_process); -/*---------------------------------------------------------------------------*/ -static void -sniffer_callback(const struct radio_driver *driver) -{ - static char buf[40]; - static uint8_t packet[UIP_BUFSIZE]; - static int len; - len = driver->read(packet, sizeof(packet)); - if(len > 0) { - leds_blink(); - len = hc_inflate(packet, len); - tcpdump_format(packet, len, buf, sizeof(buf)); - printf("radio-sniffer %d: packet length %d, %s\n", node_id, len, buf); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(radio_sniffer_process, ev, data) -{ - PROCESS_BEGIN(); - - tr1001_init(); - tr1001_driver.set_receive_function(sniffer_callback); - - printf("Radio sniffer started.\n"); - - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -init_net(void) -{ -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/radio-sniffer.h b/platform/esb/apps/radio-sniffer.h deleted file mode 100644 index 93d9adc66..000000000 --- a/platform/esb/apps/radio-sniffer.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef __RADIO_SNIFFER_H__ -#define __RADIO_SNIFFER_H__ - -#include "contiki.h" -PROCESS_NAME(radio_sniffer_process); - -#endif /* __RADIO_SNIFFER_H__ */ diff --git a/platform/esb/apps/radio-test.c b/platform/esb/apps/radio-test.c deleted file mode 100644 index ae03e1bdc..000000000 --- a/platform/esb/apps/radio-test.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2010/10/19 18:29:05 $ - * $Revision: 1.3 $ - * - * Simple application to indicate connectivity between two nodes: - * - * - Red led indicates a packet sent via radio (one packet sent each second) - * - Yellow led indicates that this node can hear the other node but not - * necessary vice versa (unidirectional communication). - * - Green led indicates that both nodes can communicate with each - * other (bidirectional communication) - */ - -#include "contiki-esb.h" -#include - -PROCESS(radio_test_process, "Radio test"); -AUTOSTART_PROCESSES(&radio_test_process); - -#define ON 1 -#define OFF 0 - -#define HEADER "RTST" -#define PACKET_SIZE 20 -#define PORT 2345 - -struct indicator { - int onoff; - int led; - clock_time_t interval; - struct etimer timer; -}; - -/*---------------------------------------------------------------------*/ -static void -set(struct indicator *indicator, int onoff) { - if(indicator->onoff ^ onoff) { - indicator->onoff = onoff; - if(onoff) { - leds_on(indicator->led); - } else { - leds_off(indicator->led); - } - } - if(onoff) { - etimer_set(&indicator->timer, indicator->interval); - } -} -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(radio_test_process, ev, data) -{ - static struct etimer send_timer; - static struct uip_udp_conn *conn; - static struct indicator recv, other, flash; - - PROCESS_BEGIN(); - - /* Initialize the indicators */ - recv.onoff = other.onoff = flash.onoff = OFF; - recv.interval = other.interval = CLOCK_SECOND; - flash.interval = 1; - recv.led = LEDS_YELLOW; - other.led = LEDS_GREEN; - flash.led = LEDS_RED; - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - etimer_set(&send_timer, CLOCK_SECOND); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_TIMER) { - if(data == &send_timer) { - etimer_reset(&send_timer); - tcpip_poll_udp(conn); - - } else if(data == &other.timer) { - set(&other, OFF); - - } else if(data == &recv.timer) { - set(&recv, OFF); - - } else if(data == &flash.timer) { - set(&flash, OFF); - } - - } else if(ev == tcpip_event) { - - if(uip_poll()) { - /* send packet */ - memcpy(uip_appdata, HEADER, sizeof(HEADER)); - ((char *)uip_appdata)[sizeof(HEADER)] = recv.onoff; - /* send arbitrary data to fill the packet size */ - uip_send(uip_appdata, PACKET_SIZE); - - set(&flash, ON); - } - - if(uip_newdata()) { - /* packet received */ - if(uip_datalen() < PACKET_SIZE - || strncmp((char *)uip_appdata, HEADER, sizeof(HEADER))) { - /* invalid message */ - leds_blink(); - - } else { - set(&recv, ON); - set(&other, ((char *)uip_appdata)[sizeof(HEADER)] ? ON : OFF); - - /* synchronize the sending to keep the nodes from sending - simultaneously */ - etimer_set(&send_timer, CLOCK_SECOND); - etimer_adjust(&send_timer, - (int) (CLOCK_SECOND >> 1)); - - beep(); - } - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/apps/sensor-output.c b/platform/esb/apps/sensor-output.c deleted file mode 100644 index 632b604b3..000000000 --- a/platform/esb/apps/sensor-output.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#include "contiki-esb.h" - -#include - -PROCESS(sensor_output_process, "Sensor output"); - -AUTOSTART_PROCESSES(&sensor_output_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sensor_output_process, ev, data) -{ - struct sensors_sensor *s; - - PROCESS_BEGIN(); - - /* Activate some sensors to get sensor events */ - button_sensor.configure(SENSORS_ACTIVE, 1); - pir_sensor.configure(SENSORS_ACTIVE, 1); - vib_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event); - - s = (struct sensors_sensor *)data; - printf("%s %d\n", s->type, s->value(0)); - - if (data == &button_sensor) leds_invert(LEDS_YELLOW); - if (data == &pir_sensor) leds_invert(LEDS_GREEN); - if (data == &vib_sensor) leds_invert(LEDS_RED); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/sensor-output.h b/platform/esb/apps/sensor-output.h deleted file mode 100644 index 5c31d2d62..000000000 --- a/platform/esb/apps/sensor-output.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __SENSOR_OUTPUT_H__ -#define __SENSOR_OUTPUT_H__ - -#include "contiki.h" - -PROCESS_NAME(sensor_output_process); - -#endif /* __SENSOR_OUTPUT_H__ */ diff --git a/platform/esb/apps/test-receiver.c b/platform/esb/apps/test-receiver.c deleted file mode 100644 index 5f315a715..000000000 --- a/platform/esb/apps/test-receiver.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2010/10/19 18:29:05 $ - * $Revision: 1.2 $ - */ - -#include "contiki-esb.h" -#include - -PROCESS(test_receiver_process, "Test - Receiver"); -AUTOSTART_PROCESSES(&test_receiver_process); - -#define PORT 1234 - -PROCESS_THREAD(test_receiver_process, ev, data) -{ - static struct uip_udp_conn *conn; - - PROCESS_BEGIN(); - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event && uip_newdata()); - leds_invert(LEDS_YELLOW); - - /* Make sure the message is null terminated */ - ((char *) uip_appdata)[uip_datalen()] = 0; - printf("RECV: %s\n", (char *) uip_appdata); - - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/apps/test-sender.c b/platform/esb/apps/test-sender.c deleted file mode 100644 index 7881c2704..000000000 --- a/platform/esb/apps/test-sender.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2010/10/19 18:29:05 $ - * $Revision: 1.2 $ - */ - -#include "contiki-esb.h" - -PROCESS(test_sender_process, "Test - Sender"); -AUTOSTART_PROCESSES(&test_sender_process); - -#define PORT 1234 - -PROCESS_THREAD(test_sender_process, ev, data) -{ - static struct etimer timer; - static struct uip_udp_conn *conn; - - PROCESS_BEGIN(); - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - etimer_set(&timer, CLOCK_SECOND * 2); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - etimer_reset(&timer); - - /* Send packet */ - tcpip_poll_udp(conn); - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event && uip_poll()); - leds_invert(LEDS_YELLOW); - uip_send("Hello world", sizeof("Hello world")); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/buildscripts/Makefile.freebsd b/platform/esb/buildscripts/Makefile.freebsd deleted file mode 100644 index 489b4205b..000000000 --- a/platform/esb/buildscripts/Makefile.freebsd +++ /dev/null @@ -1,18 +0,0 @@ -ifndef JTAG - JTAG := $(CONTIKI)/platform/$(TARGET)/buildscripts/jtag/pyjtag/jtag.py -endif - -ifndef JTAG_PORT - JTAG_PORT = /dev/ppi0 -endif - -%.u: %.$(TARGET) - $(JTAG) -l $(JTAG_PORT) -e - $(JTAG) -l $(JTAG_PORT) -D -D -S -R 2048 -p $^ - $(JTAG) -l $(JTAG_PORT) -D -r - -r: - $(JTAG) -l $(JTAG_PORT) -r - -erase: - $(JTAG) -l $(JTAG_PORT) -e diff --git a/platform/esb/buildscripts/Makefile.unix b/platform/esb/buildscripts/Makefile.unix deleted file mode 100644 index 782b49500..000000000 --- a/platform/esb/buildscripts/Makefile.unix +++ /dev/null @@ -1,2 +0,0 @@ -%.u: %.ihex - msp430-jtag -eI $^ diff --git a/platform/esb/buildscripts/Makefile.win b/platform/esb/buildscripts/Makefile.win deleted file mode 100644 index 655a3d81e..000000000 --- a/platform/esb/buildscripts/Makefile.win +++ /dev/null @@ -1,11 +0,0 @@ -%.u: %.ihex -ifdef JTAG_PORT - msp430-jtag -l $(JTAG_PORT) -eI $^ -else - msp430-jtag -eI $^ -endif - -#CW=cw23 - -#%.u: %.ihex -# $(CW) -d f430p $^ diff --git a/platform/esb/buildscripts/jtag/pyjtag/_parjtag.so b/platform/esb/buildscripts/jtag/pyjtag/_parjtag.so deleted file mode 100755 index 76fe1ecba..000000000 Binary files a/platform/esb/buildscripts/jtag/pyjtag/_parjtag.so and /dev/null differ diff --git a/platform/esb/buildscripts/jtag/pyjtag/elf.py b/platform/esb/buildscripts/jtag/pyjtag/elf.py deleted file mode 100644 index 2ab16b1c2..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/elf.py +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/env python -import struct - -# ELF object file reader -# (C) 2003 cliechti@gmx.net -# Python license - -# size alignment -# Elf32_Addr 4 4 Unsigned program address -# Elf32_Half 2 2 Unsigned medium integer -# Elf32_Off 4 4 Unsigned file offset -# Elf32_Sword 4 4 Signed large integer -# Elf32_Word 4 4 Unsigned large integer -# unsignedchar 1 1 Unsigned small integer - -#define EI_NIDENT 16 -#~ typedef struct{ - #~ unsigned char e_ident[EI_NIDENT]; - #~ Elf32_Half e_type; - #~ Elf32_Half e_machine; - #~ Elf32_Word e_version; - #~ Elf32_Addr e_entry; - #~ Elf32_Off e_phoff; - #~ Elf32_Off e_shoff; - #~ Elf32_Word e_flags; - #~ Elf32_Half e_ehsize; - #~ Elf32_Half e_phentsize; - #~ Elf32_Half e_phnum; - #~ Elf32_Half e_shentsize; - #~ Elf32_Half e_shnum; - #~ Elf32_Half e_shstrndx; -#~ } Elf32_Ehdr; - - -#Section Header -#~ typedef struct { - #~ Elf32_Word sh_name; - #~ Elf32_Word sh_type; - #~ Elf32_Word sh_flags; - #~ Elf32_Addr sh_addr; - #~ Elf32_Off sh_offset; - #~ Elf32_Word sh_size; - #~ Elf32_Word sh_link; - #~ Elf32_Word sh_info; - #~ Elf32_Word sh_addralign; - #~ Elf32_Word sh_entsize; -#~ } Elf32_Shdr; - -#~ typedef struct { - #~ Elf32_Word p_type; - #~ Elf32_Off p_offset; - #~ Elf32_Addr p_vaddr; - #~ Elf32_Addr p_paddr; - #~ Elf32_Word p_filesz; - #~ Elf32_Word p_memsz; - #~ Elf32_Word p_flags; - #~ Elf32_Word p_align; -#~ } Elf32_Phdr; - - -class ELFException(Exception): pass - -class ELFSection: - """read and store a section""" - Elf32_Shdr = "= section.sh_addr + section.sh_size) \ - and (not (section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS) \ - or (p.p_offset <= section.sh_offset \ - and (p.p_offset + p.p_filesz >= section.sh_offset + section.sh_size)))): - return section.sh_addr + p.p_paddr - p.p_vaddr - return section.sh_addr - - def getSections(self): - """get sections relevant for the application""" - res = [] - for section in self.sections: - if section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS: - res.append(section) - return res - - def __str__(self): - """pretty print for debug...""" - return "%s(self.e_type=%r, self.e_machine=%r, self.e_version=%r, sections=%r)" % ( - self.__class__.__name__, - self.e_type, self.e_machine, self.e_version, - [section.name for section in self.sections]) - - -if __name__ == '__main__': - print "This is only a module test!" - elf = ELFObject() - elf.fromFile(open("test.elf")) - if elf.e_type != ELFObject.ET_EXEC: - raise Exception("No executable") - print elf - - #~ print repr(elf.getSection('.text').data) - #~ print [(s.name, hex(s.sh_addr)) for s in elf.getSections()] - print "-"*20 - for p in elf.sections: print p - print "-"*20 - for p in elf.getSections(): print p - print "-"*20 - for p in elf.getProgrammableSections(): print p diff --git a/platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py b/platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py deleted file mode 100644 index c917ec975..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -"""Test File generator. -This tool generates a hex file, of given size, ending on address -0xffff. - -USAGE: hen-ihex.py size_in_kilobyte - -The resulting Intel-hex file is output to stdout, use redirection -to save the data to a file. -""" - -#return a string with data in intel hex format -def makeihex(address, data): - out = [] - start = 0 - while start len(data): end = len(data) - out.append(_ihexline(address, [ord(x) for x in data[start:end]])) - start += 16 - address += 16 - out.append(_ihexline(address, [], end=1)) #append no data but an end line - return ''.join(out) - -def _ihexline(address, buffer, end=0): - out = [] - if end: - type = 1 - else: - type = 0 - out.append( ':%02X%04X%02X' % (len(buffer),address&0xffff,type) ) - sum = len(buffer) + ((address>>8)&255) + (address&255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - out.append('%02X' % (b&255) ) - sum += b&255 - out.append('%02X\n' %( (-sum)&255)) - return ''.join(out) - -if __name__ == '__main__': - import struct, sys - if len(sys.argv) != 2: - print __doc__ - sys.exit(1) - - size = int(sys.argv[1]) #in kilo - startadr = 0x10000 - 1024*size - data = ''.join([struct.pack(">H", x) for x in range(startadr, startadr+ 1024*size, 2)]) - print makeihex(startadr, data) diff --git a/platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi b/platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi deleted file mode 100644 index a2cb801b8..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi +++ /dev/null @@ -1,108 +0,0 @@ -Name "install-pyjtag" -OutFile "install-pyjtag.exe" - -!define SF_SELECTED 1 -!define SF_SUBSEC 2 -!define SF_SUBSECEND 4 -!define SF_BOLD 8 -!define SF_RO 16 -!define SF_EXPAND 32 - -!define SECTION_OFF 0xFFFFFFFE - -LicenseText License -LicenseData license.txt - -SetOverwrite on -SetDateSave on - -; The default installation directory -InstallDir $PROGRAMFILES\mspgcc -; Registry key to check for directory (so if you install again, it will -; overwrite the old one automatically) -InstallDirRegKey HKLM SOFTWARE\mspgcc "rootdir" - -; The text to prompt the user to enter a directory -DirText "This will install the pyjtag executables. You can choose the same \ - directory as for the other mspgcc tools." - -; The text to prompt the user to enter a directory -ComponentText "Select which optional things you want installed." - -Section "msp430-jtag (required)" - SectionIn RO - SetOutPath $INSTDIR - - File /r bin - File /oname=license-pyjtag.txt license.txt - File /oname=readme-pyjtag.txt readme.txt - File /oname=bin\jtag.py jtag.py - - ; Write the installation path into the registry - WriteRegStr HKLM SOFTWARE\mspgcc "rootdir" "$INSTDIR" - ; Write the uninstall keys for Windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "DisplayName" "mspgcc pyjtag (remove only)" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "UninstallString" '"$INSTDIR\uninstall-pyjtag.exe"' - WriteUninstaller "uninstall-pyjtag.exe" -SectionEnd - -Section "giveio (needed on Win NT/2k/XP, but NOT on 9x/ME)" - SetOutPath $INSTDIR\bin - File ..\jtag\hardware_access\giveio\giveio.sys - File ..\jtag\hardware_access\giveio\loaddrv.exe - SetOutPath $INSTDIR - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe install giveio $INSTDIR\bin\giveio.sys' - Pop $0 ;return value/error/timeout - IntCmp $0 2 ext_here ;assume its alredy installed - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe start giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe starttype giveio auto' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - WriteRegStr HKLM SOFTWARE\mspgcc "giveio" "started" - Goto ext_ok -ext_err: - DetailPrint "Error while installing and starting giveio" - MessageBox MB_OK|MB_ICONSTOP "Error while installing and starting giveio" - Goto ext_ok -ext_here: - DetailPrint "Installing giveio gave an error, assuming its already installed" -ext_ok: -SectionEnd - -; special uninstall section. -Section "Uninstall" - ; remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" - DeleteRegKey HKLM SOFTWARE\NSIS_Example2 - ; remove files - Delete $INSTDIR\bin\msp430-jtag.exe - Delete $INSTDIR\bin\_parjtag.pyd - Delete $INSTDIR\bin\jtag.py - Delete $INSTDIR\bin\HIL.dll - Delete $INSTDIR\bin\MSP430mspgcc.dll - ;XXX python22.dll is left installed as it is used by pybsl and other tools - Delete $INSTDIR\license-pyjtag.txt - Delete $INSTDIR\readme-pyjtag.txt - ; giveio - ; if it was started by us, stop it - ReadRegStr $0 HKLM SOFTWARE\mspgcc "giveio" - StrCmp $0 '' no_giveio - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe stop giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe remove giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - Goto no_giveio -giveio_err: - DetailPrint "Error while uninstalling giveio service" - MessageBox MB_OK|MB_ICONSTOP "Error while uninstalling giveio service" -no_giveio: - Delete loaddrv.exe - Delete giveio.sys - ; MUST REMOVE UNINSTALLER, too - Delete $INSTDIR\uninstall-pyjtag.exe -SectionEnd diff --git a/platform/esb/buildscripts/jtag/pyjtag/jtag.py b/platform/esb/buildscripts/jtag/pyjtag/jtag.py deleted file mode 100644 index 0cb556a91..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/jtag.py +++ /dev/null @@ -1,604 +0,0 @@ -#!/usr/bin/env python -#Parallel JTAG programmer for the MSP430 embedded proccessor. -# -#(C) 2002 Chris Liechti -#this is distributed under a free software license, see license.txt -# -#Requires Python 2+ and the binary extension _parjtag. - -import sys -import _parjtag - -VERSION = "1.3" - -DEBUG = 0 #disable debug messages by default - - -#frame specific consts -ERASE_MASS = 2 -ERASE_MAIN = 1 -ERASE_SGMT = 0 - -#states -FREERUNNING = 0 -STOPPED = 1 - -#Configurations of the MSP430 driver -VERIFICATION_MODE = 0 #Verify data downloaded to FLASH memories. -RAMSIZE_OPTION = 1 #Change RAM used to download and program flash blocks -DEBUG_OPTION = 2 #Set debug level. Enables debug outputs. - -#enumeration of output formats for uploads -HEX = 0 -INTELHEX = 1 -BINARY = 2 - -#exceptions -class JTAGException(Exception): pass - -#for the use with memread -def hexdump( (adr, memstr) ): - """Print a hex dump of data collected with memread - arg1: tuple with adress, memory - return None""" - count = 0 - ascii = '' - for value in map(ord, memstr): - if not count: print "%04x: " % adr, - print "%02x" % value, - ascii += (32 <= value < 128) and chr(value) or '.' - count += 1 - adr += 1 - if count == 16: - count = 0 - print " ", ascii - ascii = '' - if count < 16: print " "*(16-count), " ", ascii - -def makeihex( (address, data) ): - """work though the data and output lines in inzel hex format. - and end tag is appended""" - start = 0 - while start len(data): end = len(data) - _ihexline(address, [ord(x) for x in data[start:end]]) - start += 16 - address += 16 - _ihexline(address, [], type=1) #append no data but an end line - -def _ihexline(address, buffer, type=0): - """encode one line, output with checksum""" - sys.stdout.write( ':%02X%04X%02X' % (len(buffer), address & 0xffff, type) ) - sum = len(buffer) + ((address >> 8) & 255) + (address & 255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - sys.stdout.write('%02X' % (b & 255)) - sum += b&255 - sys.stdout.write('%02X\n' %( (-sum) & 255)) - - -class Segment: - """store a string with memory contents along with its startaddress""" - def __init__(self, startaddress = 0, data=None): - if data is None: - self.data = '' - else: - self.data = data - self.startaddress = startaddress - - def __getitem__(self, index): - return self.data[index] - - def __len__(self): - return len(self.data) - - def __repr__(self): - return "Segment(startaddress = 0x%04x, data=%r)" % (self.startaddress, self.data) - -class Memory: - """represent memory contents. with functions to load files""" - def __init__(self, filename=None): - self.segments = [] - if filename: - self.filename = filename - self.loadFile(filename) - - def append(self, seg): - self.segments.append(seg) - - def __getitem__(self, index): - return self.segments[index] - - def __len__(self): - return len(self.segments) - - def loadIHex(self, file): - """load data from a (opened) file in Intel-HEX format""" - segmentdata = [] - currentAddr = 0 - startAddr = 0 - lines = file.readlines() - for l in lines: - if not l.strip(): continue #skip empty lines - if l[0] != ':': raise Exception("File Format Error\n") - l = l.strip() #fix CR-LF issues... - length = int(l[1:3],16) - address = int(l[3:7],16) - type = int(l[7:9],16) - check = int(l[-2:],16) - if type == 0x00: - if currentAddr != address: - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = address - segmentdata = [] - for i in range(length): - segmentdata.append( chr(int(l[9+2*i:11+2*i],16)) ) - currentAddr = length + currentAddr - elif type == 0x01: - pass - else: - sys.stderr.write("Ignored unknown field (type 0x%02x) in ihex file.\n" % type) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadTIText(self, file): - """load data from a (opened) file in TI-Text format""" - next = 1 - currentAddr = 0 - startAddr = 0 - segmentdata = [] - #Convert data for MSP430, TXT-File is parsed line by line - while next >= 1: - #Read one line - l = file.readline() - if not l: break #EOF - l = l.strip() - if l[0] == 'q': break - elif l[0] == '@': #if @ => new address => send frame and set new addr. - #create a new segment - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = int(l[1:],16) - segmentdata = [] - else: - for i in l.split(): - segmentdata.append(chr(int(i,16))) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadELF(self, file): - """load data from a (opened) file in ELF object format. - File must be seekable""" - import elf - obj = elf.ELFObject() - obj.fromFile(file) - if obj.e_type != elf.ELFObject.ET_EXEC: - raise Exception("No executable") - for section in obj.getSections(): - if DEBUG: - sys.stderr.write("ELF section %s at 0x%04x %d bytes\n" % (section.name, section.lma, len(section.data))) - if len(section.data): - self.segments.append( Segment(section.lma, section.data) ) - - def loadFile(self, filename): - """fill memory with the contents of a file. file type is determined from extension""" - #TODO: do a contents based detection - if filename[-4:].lower() == '.txt': - self.loadTIText(open(filename, "rb")) - elif filename[-4:].lower() in ('.a43', '.hex'): - self.loadIHex(open(filename, "rb")) - else: - self.loadELF(open(filename, "rb")) - - def getMemrange(self, fromadr, toadr): - """get a range of bytes from the memory. unavailable values are filled with 0xff.""" - res = '' - toadr = toadr + 1 #python indxes are excluding end, so include it - while fromadr < toadr: - for seg in self.segments: - segend = seg.startaddress + len(seg.data) - if seg.startaddress <= fromadr and fromadr < segend: - if toadr > segend: #not all data in segment - catchlength = segend-fromadr - else: - catchlength = toadr-fromadr - res = res + seg.data[fromadr-seg.startaddress : fromadr-seg.startaddress+catchlength] - fromadr = fromadr + catchlength #adjust start - if len(res) >= toadr-fromadr: - break #return res - else: #undefined memory is filled with 0xff - res = res + chr(255) - fromadr = fromadr + 1 #adjust start - return res - -class JTAG: - """wrap the _parjtag extension""" - - def __init__(self): - self.showprogess = 0 - - def connect(self, lpt=None): - """connect to specified or default port""" - if lpt is None: - _parjtag.connect() - else: - _parjtag.connect(lpt) - - def close(self): - """release JTAG""" - _parjtag.release() - - def uploadData(self, startaddress, size): - """upload a datablock""" - if DEBUG > 1: sys.stderr.write("* uploadData()\n") - return _parjtag.memread(startaddress, size) - - def actionMassErase(self): - """Erase the flash memory completely (with mass erase command)""" - sys.stderr.write("Mass Erase...\n") - _parjtag.memerase(ERASE_MASS) - - def actionMainErase(self): - """Erase the MAIN flash memory, leave the INFO mem""" - sys.stderr.write("Erase Main Flash...\n") - _parjtag.memerase(ERASE_MAIN, 0xfffe) - - def makeActionSegmentErase(self, address): - """Selective segment erase""" - class SegmentEraser: - def __init__(self, segaddr): - self.address = segaddr - def __call__(self): - sys.stderr.write("Erase Segment @ 0x%04x...\n" % self.address) - _parjtag.memerase(ERASE_SGMT, self.address) - return SegmentEraser(address) - - def actionEraseCheck(self): - """check the erasure of required flash cells.""" - sys.stderr.write("Erase Check by file ...\n") - if self.data is not None: - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != '\xff'*len(seg.data): raise JTAGException("Erase check failed") - else: - raise JTAGException("cannot do erase check against data with not knowing the actual data") - - def progess_update(self, count, total): - sys.stderr.write("\r%d%%" % (100*count/total)) - - def actionProgram(self): - """program data into flash memory.""" - if self.data is not None: - sys.stderr.write("Program ...\n") - if self.showprogess: - _parjtag.set_flash_callback(self.progess_update) - bytes = 0 - for seg in self.data: - _parjtag.memwrite(seg.startaddress, seg.data) - bytes += len(seg.data) - if self.showprogess: - sys.stderr.write("\r") - sys.stderr.write("%i bytes programmed.\n" % bytes) - else: - raise JTAGException("programming without data not possible") - - def actionVerify(self): - """Verify programmed data""" - if self.data is not None: - sys.stderr.write("Verify ...\n") - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != seg.data: raise JTAGException("Verify failed") - else: - raise JTAGException("verify without data not possible") - - def actionReset(self): - """perform a reset""" - sys.stderr.write("Reset device ...\n") - _parjtag.reset(0, 0) - - def actionRun(self, address): - """start program at specified address""" - raise NotImplementedError - #sys.stderr.write("Load PC with 0x%04x ...\n" % address) - - def funclet(self): - """download and start funclet""" - sys.stderr.write("Download and execute of funclet...\n") - if len(self.data) > 1: - raise JTAGException("don't know how to handle multiple segments in funclets") - _parjtag.funclet(self.data[0].data) - sys.stderr.write("Funclet OK.\n") - -def usage(): - """print some help message""" - sys.stderr.write(""" -USAGE: %s [options] [file] -Version: %s - -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. -""" % (sys.argv[0], VERSION)) - -def main(): - global DEBUG - import getopt - filetype = None - filename = None - reset = 0 - wait = 0 - goaddr = None - jtag = JTAG() - toinit = [] - todo = [] - startaddr = None - size = 2 - outputformat= HEX - lpt = None - funclet = None - ramsize = None - - sys.stderr.write("MSP430 parallel JTAG programmer Version: %s\n" % VERSION) - try: - opts, args = getopt.getopt(sys.argv[1:], - "hl:weEmpvrg:Du:d:s:xbiITfR:S", - ["help", "lpt=", "wait" - "masserase", "erasecheck", "mainerase", "program", - "erase=", "eraseinfo", - "verify", "reset", "go=", "debug", - "upload=", "download=", "size=", "hex", "bin", "ihex", - "intelhex", "titext", "funclet", "ramsize=", "progress"] - ) - except getopt.GetoptError: - # print help information and exit: - usage() - sys.exit(2) - - for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-l", "--lpt"): - lpt = a - elif o in ("-w", "--wait"): - wait = 1 - elif o in ("-e", "--masserase"): - toinit.append(jtag.actionMassErase) #Erase Flash - elif o in ("-E", "--erasecheck"): - toinit.append(jtag.actionEraseCheck) #Erase Check (by file) - elif o in ("-m", "--mainerase"): - toinit.append(jtag.actionMainErase) #Erase main Flash - elif o == "--erase": - try: - seg = int(a, 0) - toinit.append(jtag.makeActionSegmentErase(seg)) - except ValueError: - sys.stderr.write("segment address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o == "--eraseinfo": - toinit.append(jtag.makeActionSegmentErase(0x1000)) - toinit.append(jtag.makeActionSegmentErase(0x1080)) - elif o in ("-p", "--program"): - todo.append(jtag.actionProgram) #Program file - elif o in ("-v", "--verify"): - todo.append(jtag.actionVerify) #Verify file - elif o in ("-r", "--reset"): - reset = 1 - elif o in ("-g", "--go"): - try: - goaddr = int(a, 0) #try to convert decimal - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-D", "--debug"): - DEBUG = DEBUG + 1 - elif o in ("-u", "--upload"): - try: - startaddr = int(a, 0) #try to convert number of any base - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-s", "--size"): - try: - size = int(a, 0) - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - #outut formats - elif o in ("-x", "--hex"): - outputformat = HEX - elif o in ("-b", "--bin"): - outputformat = BINARY - elif o in ("-i", "--ihex"): - outputformat = INTELHEX - #input formats - elif o in ("-I", "--intelhex"): - filetype = 0 - elif o in ("-T", "--titext"): - filetype = 1 - #others - elif o in ("-f", "--funclet"): - funclet = 1 - elif o in ("-R", "--ramsize"): - try: - ramsize = int(a, 0) - except ValueError: - sys.stderr.write("ramsize must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-S", "--progress"): - jtag.showprogess = 1 - - if len(args) == 0: - sys.stderr.write("Use -h for help\n") - elif len(args) == 1: #a filename is given - if not funclet: - if not todo: #if there are no actions yet - todo.extend([ #add some useful actions... - jtag.actionProgram, - ]) - filename = args[0] - else: #number of args is wrong - usage() - sys.exit(2) - - if DEBUG: #debug infos - sys.stderr.write("debug level set to %d\n" % DEBUG) - _parjtag.configure(DEBUG_OPTION, DEBUG) - sys.stderr.write("python version: %s\n" % sys.version) - - - #sanity check of options - if goaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --go is specified!\n") - reset = 0 - - if startaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --upload is specified!\n") - reset = 0 - - #prepare data to download - jtag.data = Memory() #prepare downloaded data - if filetype is not None: #if the filetype is given... - if filename is None: - raise ValueError("no filename but filetype specified") - if filename == '-': #get data from stdin - file = sys.stdin - else: - file = open(filename,"rb") #or from a file - if filetype == 0: #select load function - jtag.data.loadIHex(file) #intel hex - elif filetype == 1: - jtag.data.loadTIText(file) #TI's format - else: - raise ValueError("illegal filetype specified") - else: #no filetype given... - if filename == '-': #for stdin: - jtag.data.loadIHex(sys.stdin) #assume intel hex - elif filename: - jtag.data.loadFile(filename) #autodetect otherwise - - if DEBUG > 5: sys.stderr.write("File: %r\n" % filename) - - try: - jtag.connect(lpt) #try to open port - except IOError: - raise #do not handle here - else: #continue if open was successful - if ramsize is not None: - _parjtag.configure(RAMSIZE_OPTION, ramsize) - #initialization list - if toinit: #erase and erase check - if DEBUG: sys.stderr.write("Preparing device ...\n") - for f in toinit: f() - - #work list - if todo: - if DEBUG > 0: #debug - #show a nice list of sheduled actions - sys.stderr.write("TODO list:\n") - for f in todo: - try: - sys.stderr.write(" %s\n" % f.func_name) - except AttributeError: - sys.stderr.write(" %r\n" % f) - for f in todo: f() #work through todo list - - if reset: #reset device first if desired - jtag.actionReset() - - if funclet is not None: #download and start funclet - jtag.funclet() - - if goaddr is not None: #start user programm at specified address - jtag.actionRun(goaddr) #load PC and execute - - #upload datablock and output - if startaddr is not None: - if goaddr: #if a program was started... - raise NotImplementedError - #TODO: - #sys.stderr.write("Waiting to device for reconnect for upload: ") - data = jtag.uploadData(startaddr, size) #upload data - if outputformat == HEX: #depending on output format - hexdump( (startaddr, data) ) #print a hex display - elif outputformat == INTELHEX: - makeihex( (startaddr, data) ) #ouput a intel-hex file - else: - sys.stdout.write(data) #binary output w/o newline! - wait = 0 #wait makes no sense as after the upload the device is still stopped - - if wait: #wait at the end if desired - sys.stderr.write("Press ...\n") #display a prompt - raw_input() #wait for newline - - _parjtag.reset(1, 1) #reset and release target - #~ jtag.actionReset() - jtag.close() #Release communication port - -if __name__ == '__main__': - try: - main() - except SystemExit: - raise #let pass exit() calls - except KeyboardInterrupt: - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("user abort.\n") #short messy in user mode - sys.exit(1) #set errorlevel for script usage - except Exception, msg: #every Exception is caught and displayed - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("\nAn error occoured:\n%s\n" % msg) #short messy in user mode - sys.exit(1) #set errorlevel for script usage diff --git a/platform/esb/buildscripts/jtag/pyjtag/license.txt b/platform/esb/buildscripts/jtag/pyjtag/license.txt deleted file mode 100644 index 810a2d24c..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/license.txt +++ /dev/null @@ -1,62 +0,0 @@ -Copyright (c) 2001-2002 Chris Liechti - -All Rights Reserved. - -This is the Python license. In short, you can use this product in -commercial and non-commercial applications, modify it, redistribute it. -A notification to the author when you use and/or modify it is welcome. - -TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE -============================================ - -LICENSE AGREEMENT ------------------ - -1. This LICENSE AGREEMENT is between the copyright holder of this -product, and the Individual or Organization ("Licensee") accessing -and otherwise using this product in source or binary form and its -associated documentation. - -2. Subject to the terms and conditions of this License Agreement, -the copyright holder hereby grants Licensee a nonexclusive, -royalty-free, world-wide license to reproduce, analyze, test, -perform and/or display publicly, prepare derivative works, distribute, -and otherwise use this product alone or in any derivative version, -provided, however, that copyright holders License Agreement and -copyright holders notice of copyright are retained in this product -alone or in any derivative version prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates this product or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to this product. - -4. The copyright holder is making this product available to Licensee -on an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS -OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT -LIMITATION, THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY -REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR -ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS PRODUCT WILL -NOT INFRINGE ANY THIRD PARTY RIGHTS. - -5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY -OTHER USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR -CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, -DISTRIBUTING, OR OTHERWISE USING THIS PRODUCT, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY -THEREOF. - -6. This License Agreement will automatically terminate upon a -material breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between the -copyright holder and Licensee. This License Agreement does not grant -permission to use trademarks or trade names from the copyright holder -in a trademark sense to endorse or promote products or services of -Licensee, or any third party. - -8. By copying, installing or otherwise using this product, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. diff --git a/platform/esb/buildscripts/jtag/pyjtag/makefile b/platform/esb/buildscripts/jtag/pyjtag/makefile deleted file mode 100644 index 5482fa2f1..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/makefile +++ /dev/null @@ -1,33 +0,0 @@ - -.PHONY: all FORCE clean windist - -all: windist - -#wrap py to exe and build windows installer -windist: - python setup.py py2exe - rm -r bin - mv dist/jtag/jtag.exe dist/msp430-jtag.exe - mv dist/jtag/* dist/ - rmdir dist/jtag - mv dist bin - rm -r build - - -#generate test files -fill60k.a43: - python gen-ihex.py 60 >$@ -fill48k.a43: - python gen-ihex.py 48 >$@ -fill32k.a43: - python gen-ihex.py 32 >$@ -fill16k.a43: - python gen-ihex.py 16 >$@ -fill8k.a43: - python gen-ihex.py 8 >$@ -fill4k.a43: - python gen-ihex.py 4 >$@ - -#clean up the mess... -clean: - rm -r dist build bin \ No newline at end of file diff --git a/platform/esb/buildscripts/jtag/pyjtag/readme.txt b/platform/esb/buildscripts/jtag/pyjtag/readme.txt deleted file mode 100644 index bdd3da6c2..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/readme.txt +++ /dev/null @@ -1,182 +0,0 @@ -pyJTAG ------- - -Software to talk to the parallel port JTAG PCB as seen with the FET kits. -It is released under a free software license, -see license.txt for more details. - -(C) 2002-2003 Chris Liechti - -Features --------- - -- understands TI-Text and Intel-hex -- download to Flash and/or RAM, erase, verify -- reset device -- load addres into R0/PC and run -- upload a memory block MSP->PC (output as binary data or hex dump) -- written in Python, runs on Win32, Linux, BSD -- use per command line, or in a Python script - -Requirements ------------- -- Linux, BSD, Un*x or Windows PC -- Python 2.0 or newer, 2.2 recomeded -- Parallel JTAG hardware with an MSP430 device connected - -Installation ------------- -Python installations are available from www.python.org. On Windows simply -use the installer. The win32all package has an installer too. These -installations should run fine with the deafults. - -On Linux just Python is needed. On some distributions is Python 1.5.2 -installed per default. You may meed to change the first line in the script -from "python" to "python2". Maybe Python 2.x is in a separate package that -has to be installed. There are rpm and deb binary packages and a source -tarball available through the Python homepage. - -The pyjtag archive can simply be unpacked to a directory, Windows users -can use WinZip or WinRar among others to extract the gzipped tar file. -If you want to run it from everywhere the directory where the file jtag.py -is, should be added to the PATH. -Look at "~/.profile", "/etc/profile" on Linux, "autoexec.bat" on Win9x/ME, -System Properties/Environment in Win2000/NT/XP. - -_parjtag.so/dll from the jtag archive must be copied to the same directory as -jtag.py. On Windows also MSP430mspgcc.dll and HIL.dll must be located in the -same dir or somewhere in the PATH. - -Short introduction ------------------- -This software uses the JTAG hardware that comes with the FET kits. It is -connected to the parallel port. - -The program can be started by typing "python jtag.py" in a console. Often -it works also with just "jtag.py" or "./jtag.py". - -USAGE: jtag.py [options] [file] -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. - - -Examples --------- -These examples assume that you have added the installation directory to -the PATH. Type the full path to jtag.py otherwise and maybe use -"python jtag.py". Depending on installation it may also appear under the -name "msp430-jtag". - -jtag.py -e - Only erase flash. - -jtag.py -eErw 6port.a43 - Erase flash, erase check, download an executable, run it (reset) - and wait. - -jtag.py -mS -R 2048 6port.a43 - Use ramsize option on a device with 2k RAM to speed up - download. Of course any value from 128B up to the maximum - a device has is allowed. - The progress and mainerase options are also activated. - Only erasing the main memory is useful to keep calibration - data in the information memory. - -jtag.py 6port.a43 - Download of an executable to en empty (new or erased) device. - (Note that in new devices some of the first bytes in the - information memory are random data. If data should be - downloaded there, specify -eE.) - -jtag.py --go=0x220 ramtest.a43 - Download a program into RAM and run it, may not work - with all devices. - -jtag.py -f blinking.a43 - Download a program into RAM and run it. It must be - a special format with "startadr", "entrypoint", - "exitpoint" as the first three words in the data - and it must end on "jmp $". See MSP430debug sources - for more info. - -jtag.py -u 0x0c00 -s 1024 - Get a memory dump in HEX, from the bootstrap loader. - or save the binary in a file: - "python jtag.py -u 0x0c00 -s 1024 -b >dump.bin" - or as an intel-hex file: - "python jtag.py -u 0x0c00 -s 1024 -i >dump.a43" - -jtag.py -r - Just start the user program (with a reset). - -cat 6port.a43|jtag.py -e - - Pipe the data from "cat" to jtag.py to erase and program the - flash. (un*x example, don't forget the dash at the end of the - line) - -History -------- -1.0 public release -1.1 fix of verify error -1.2 use the verification during programming -1.3 meinerase, progress options, ihex output - -References ----------- -- Python: http://www.python.org - -- Texas Instruments MSP430 Homepage, links to Datasheets and Application - Notes: http://www.ti.com/sc/msp430 - diff --git a/platform/esb/buildscripts/jtag/pyjtag/setup.py b/platform/esb/buildscripts/jtag/pyjtag/setup.py deleted file mode 100644 index 982b58340..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -# setup.py -from distutils.core import setup -import glob -import py2exe - -setup( - name="msp430-jtag", - scripts=["jtag.py"], - ) \ No newline at end of file diff --git a/platform/esb/cfs-coffee-arch.c b/platform/esb/cfs-coffee-arch.c deleted file mode 100644 index 558f079db..000000000 --- a/platform/esb/cfs-coffee-arch.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2008, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee architecture-dependent functionality for the ESB platform. - * \author - * Nicolas Tsiftes - * Niclas Finne - */ - -#include "cfs-coffee-arch.h" - -static const unsigned char nullb[COFFEE_SECTOR_SIZE < 32 ? COFFEE_SECTOR_SIZE : 32] = {0}; - -void -cfs_coffee_arch_erase(uint16_t sector) -{ - unsigned int i; - for(i = 0; i <= COFFEE_SECTOR_SIZE - sizeof(nullb); i += sizeof(nullb)) { - eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE + i, - (unsigned char *)nullb, sizeof(nullb)); - } - if(i < COFFEE_SECTOR_SIZE) { - eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE + i, - (unsigned char *)nullb, COFFEE_SECTOR_SIZE - i); - - } -} diff --git a/platform/esb/cfs-coffee-arch.h b/platform/esb/cfs-coffee-arch.h deleted file mode 100644 index 7fd0ec604..000000000 --- a/platform/esb/cfs-coffee-arch.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2008, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee architecture-dependent header for the ESB platform. - * \author - * Nicolas Tsiftes - * Niclas Finne - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki-conf.h" -#include "dev/eeprom.h" - -#define COFFEE_SECTOR_SIZE 1024UL -#define COFFEE_PAGE_SIZE 64UL -#define COFFEE_START COFFEE_SECTOR_SIZE -#define COFFEE_SIZE (32 * 1024U - COFFEE_START) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 2 -#define COFFEE_FD_SET_SIZE 2 -#define COFFEE_LOG_TABLE_LIMIT 16 -#define COFFEE_DYN_SIZE 1024 -#define COFFEE_LOG_SIZE 256 - -#define COFFEE_MICRO_LOGS 0 - -#if COFFEE_START < CFS_EEPROM_CONF_OFFSET -#error COFFEE_START must be at least as large as CFS_EEPROM_CONF_OFFSET -#error Change in cfs-coffee-arch.h -#endif /* COFFEE_START < CFS_EEPROM_CONF_OFFSET */ - -#define COFFEE_WRITE(buf, size, offset) \ - eeprom_write(COFFEE_START + (offset), (unsigned char *)(buf), (size)) - -#define COFFEE_READ(buf, size, offset) \ - eeprom_read(COFFEE_START + (offset), (unsigned char *)(buf), (size)) - -#define COFFEE_ERASE(sector) cfs_coffee_arch_erase(sector) - -void cfs_coffee_arch_erase(uint16_t sector); - -typedef int16_t coffee_page_t; - -#endif /* !COFFEE_ARCH_H */ diff --git a/platform/esb/contiki-conf.h b/platform/esb/contiki-conf.h deleted file mode 100644 index ad11e2142..000000000 --- a/platform/esb/contiki-conf.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_HAS_BATTERY 1 - -/* DCO speed resynchronization for more robust UART, etc. */ -#define DCOSYNCH_CONF_ENABLED 1 -#define DCOSYNCH_CONF_PERIOD 30 - -#define SERIAL_LINE_CONF_BUFSIZE 64 - -#define TIMESYNCH_CONF_ENABLED 0 -#define PROFILE_CONF_ON 0 -#define ENERGEST_CONF_ON 1 - -#define HAVE_STDINT_H -#include "msp430def.h" - - -#define PROCESS_CONF_NUMEVENTS 8 -#define PROCESS_CONF_STATS 0 - -/* CPU target speed in Hz */ -#define F_CPU 2457600uL - -/* Our clock resolution, this is the same as Unix HZ. Must be a power - of two (see clock.c for details). */ -#define CLOCK_CONF_SECOND 64UL - -#define NODE_ID_EEPROM_OFFSET 0x0010 /* - 0x0014 */ -#define CFS_EEPROM_CONF_OFFSET 0x0040 - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 - -#define CC_CONF_VA_ARGS 1 - -#define CCIF -#define CLIF - -typedef unsigned long clock_time_t; - -#define LOG_CONF_ENABLED 0 - -#define PACKETBUF_CONF_ATTRS_INLINE 1 -#define NETSTACK_CONF_RADIO tr1001_driver - -#if WITH_UIP -/* Network setup for IPv4 */ - -#define NETSTACK_CONF_NETWORK uip_driver -#define NETSTACK_CONF_MAC nullmac_driver -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_FRAMER framer_nullmac - -#define QUEUEBUF_CONF_NUM 0 -#define QUEUEBUF_CONF_REF_NUM 0 -#define ROUTE_CONF_ENTRIES 0 - -#else /* WITH_UIP */ - -/* Network setup for non-IPv4 (rime). */ - -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_MAC nullmac_driver -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_FRAMER framer_nullmac - -#define QUEUEBUF_CONF_NUM 1 -#define QUEUEBUF_CONF_REF_NUM 1 -#define ROUTE_CONF_ENTRIES 4 - -#endif /* WITH_UIP */ - -/** - * The statistics data type. - * - * This datatype determines how high the statistics counters are able - * to count. - */ -typedef unsigned short uip_stats_t; - -#define UIP_CONF_ICMP_DEST_UNREACH 1 - -#define UIP_CONF_IP_FORWARD 1 -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_BUFFER_SIZE 110 -#define UIP_CONF_RECEIVE_WINDOW (UIP_CONF_BUFFER_SIZE - 40) -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 4 -#define UIP_CONF_UDP_CONNS 3 -#define UIP_CONF_FWCACHE_SIZE 1 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 -#define UIP_CONF_RESOLV_ENTRIES 1 - -#define UIP_CONF_TCP_SPLIT 0 - -#define LOADER_CONF_ARCH "loader/loader-arch.h" - -#define ELFLOADER_CONF_TEXT_IN_ROM 1 -#define ELFLOADER_CONF_DATAMEMORY_SIZE 100 -#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000 - -#define WEBSERVER_CONF_CGI_CONNS 1 - -/* LEDs ports. */ -#define LEDS_PxDIR P2DIR -#define LEDS_PxOUT P2OUT -#define LEDS_CONF_RED 0x01 -#define LEDS_CONF_GREEN 0x02 -#define LEDS_CONF_YELLOW 0x04 - -#ifdef PROJECT_CONF_H -#include PROJECT_CONF_H -#endif /* PROJECT_CONF_H */ - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/esb/contiki-esb-default-init-apps.c b/platform/esb/contiki-esb-default-init-apps.c deleted file mode 100644 index 94ac86ad4..000000000 --- a/platform/esb/contiki-esb-default-init-apps.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -void -init_apps(void) -{ -} diff --git a/platform/esb/contiki-esb-default-init-lowlevel.c b/platform/esb/contiki-esb-default-init-lowlevel.c deleted file mode 100644 index 4a34e5439..000000000 --- a/platform/esb/contiki-esb-default-init-lowlevel.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#include "contiki-esb.h" -#include "dev/esb-sensors.h" - - -void -init_lowlevel(void) -{ - esb_sensors_init(); - esb_sensors_on(); - leds_init(); - rs232_init(); -} diff --git a/platform/esb/contiki-esb-main.c b/platform/esb/contiki-esb-main.c deleted file mode 100644 index 718b99c2a..000000000 --- a/platform/esb/contiki-esb-main.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include -#include - -#include "contiki.h" -#include "contiki-esb.h" - -#include "dev/watchdog.h" -#include "sys/autostart.h" -#include "net/uip-driver.h" -#include "net/netstack.h" - -#if WITH_UIP - -static struct uip_fw_netif tr1001if = - {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, uip_driver_send)}; - -#if WITH_SLIP -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(172,16,0,0, 255,255,255,0, slip_send)}; -#endif /* WITH_SLIP */ - -#endif /* WITH_UIP */ - -#ifdef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_PERIOD DCOSYNCH_CONF_PERIOD -#else -#define DCOSYNCH_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#ifdef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_ENABLED DCOSYNCH_CONF_ENABLED -#else -#define DCOSYNCH_ENABLED 0 -#endif /* DCOSYNCH_CONF_ENABLED */ - -#if DCOSYNCH_ENABLED -static struct timer dco_timer; -#endif /* DCOSYNCH_ENABLED */ - -SENSORS(&button_sensor, &sound_sensor, &vib_sensor, - &pir_sensor, &radio_sensor, &battery_sensor, &ctsrts_sensor, - &temperature_sensor); - -/*---------------------------------------------------------------------------*/ -static void -set_rime_addr(void) -{ - int i; - rimeaddr_t rimeaddr; - - rimeaddr.u8[0] = node_id & 0xff; - rimeaddr.u8[1] = node_id >> 8; - rimeaddr_set_node_addr(&rimeaddr); - - printf("Rime started with address "); - for(i = 0; i < sizeof(rimeaddr.u8) - 1; i++) { - printf("%u.", rimeaddr.u8[i]); - } - printf("%u\n", rimeaddr.u8[i]); -} -/*---------------------------------------------------------------------------*/ -#if WITH_UIP -static void -init_uip_net(void) -{ - uip_ipaddr_t hostaddr; - - uip_init(); - uip_fw_init(); - - process_start(&tcpip_process, NULL); -#if WITH_SLIP - process_start(&slip_process, NULL); - rs232_set_input(slip_input_byte); -#endif /* WITH_SLIP */ - process_start(&uip_fw_process, NULL); - - if (node_id > 0) { - /* node id is set, construct an ip address based on the node id */ - uip_ipaddr(&hostaddr, 172, 16, 1, node_id & 0xff); - uip_sethostaddr(&hostaddr); - } - -#if WITH_SLIP - uip_fw_register(&slipif); -#endif /* WITH_SLIP */ - - uip_fw_default(&tr1001if); -} -#endif /* WITH_UIP */ -/*---------------------------------------------------------------------------*/ -static void -print_processes(struct process * const processes[]) -{ - printf("Starting"); - while(*processes != NULL) { - printf(" '%s'", (*processes)->name); - processes++; - } - /* Needed to force link with putchar */ - putchar('\n'); -} -/*---------------------------------------------------------------------------*/ -static void init_ports_toberemoved() { - ////////// Port 1 //// - P1SEL = 0x00; - P1DIR = 0x81; // Outputs: P10=IRSend, P17=RS232RTS - // Inputs: P11=Light, P12=IRRec, P13=PIR, P14=Vibration, - // P15=Clockalarm, P16=RS232CTS - P1OUT = 0x00; - - ////////// Port 2 //// - P2SEL = 0x00; // No Sels - P2DIR = 0x7F; // Outpus: P20..P23=Leds+Beeper, P24..P26=Poti - // Inputs: P27=Taster - P2OUT = 0x77; - - ////////// Port 3 //// - P3SEL = 0xE0; // Sels for P34..P37 to activate UART, - P3DIR = 0x5F; // Inputs: P30..P33=CON4, P35/P37=RXD Transceiver/RS232 - // OutPuts: P36/P38=TXD Transceiver/RS232 - P3OUT = 0xE0; // Output a Zero on P34(TXD Transceiver) and turn SELECT off when receiving!!! - - ////////// Port 4 //// - P4SEL = 0x00; // CON5 Stecker - P4DIR = 0xFF; - P4OUT = 0x00; - - ////////// Port 5 //// - P5SEL = 0x00; // P50/P51= Clock SDA/SCL, P52/P53/P54=EEPROM SDA/SCL/WP - P5DIR = 0xDA; // P56/P57=Transceiver CNTRL0/1 - P5OUT = 0x0F; - - ////////// Port 6 //// - P6SEL = 0x00; // P60=Microphone, P61=PIR digital (same as P13), P62=PIR analog - P6DIR = 0x00; // P63=extern voltage, P64=battery voltage, P65=Receive power - P6OUT = 0x00; -} -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - msp430_cpu_init(); - - init_ports_toberemoved(); - - init_lowlevel(); - - clock_init(); - - rtimer_init(); - - process_init(); - - random_init(0); - - node_id_restore(); - - process_start(&etimer_process, NULL); - process_start(&sensors_process, NULL); - - ctimer_init(); - - set_rime_addr(); - - printf(CONTIKI_VERSION_STRING " started. "); - if(node_id > 0) { - printf("Node id is set to %u.\n", node_id); - } else { - printf("Node id is not set.\n"); - } - - netstack_init(); - - printf("%s %s, channel check rate %lu Hz\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: - NETSTACK_RDC.channel_check_interval())); - - beep_spinup(); - leds_on(LEDS_RED); - clock_delay(100); - leds_off(LEDS_RED); - -#if !WITH_SLIP - rs232_set_input(serial_line_input_byte); - serial_line_init(); -#endif - -#if WITH_UIP - init_uip_net(); -#endif /* WITH_UIP */ - -#if PROFILE_CONF_ON - profile_init(); -#endif /* PROFILE_CONF_ON */ - -#if ENERGEST_CONF_ON - energest_init(); - ENERGEST_ON(ENERGEST_TYPE_CPU); -#endif /* ENERGEST_CONF_ON */ - - init_apps(); - print_processes(autostart_processes); - autostart_start(autostart_processes); - -#if DCOSYNCH_ENABLED - timer_set(&dco_timer, DCOSYNCH_PERIOD * CLOCK_SECOND); -#endif /* DCOSYNCH_ENABLED */ - - /* - * This is the scheduler loop. - */ - watchdog_start(); - while(1) { - int r; -#if PROFILE_CONF_ON - profile_episode_start(); -#endif /* PROFILE_CONF_ON */ - do { - /* Reset watchdog. */ - watchdog_periodic(); - r = process_run(); - } while(r > 0); -#if PROFILE_CONF_ON - profile_episode_end(); -#endif /* PROFILE_CONF_ON */ - - /* - * Idle processing. - */ - dint(); - if(process_nevents() != 0) { - eint(); - } else { -#if ENERGEST_CONF_ON - static unsigned long irq_energest = 0; -#endif /* ENERGEST_CONF_ON */ - -#if DCOSYNCH_CONF_ENABLED - /* before going down to sleep possibly do some management */ - if(timer_expired(&dco_timer)) { - timer_reset(&dco_timer); - msp430_sync_dco(); - } -#endif /* DCOSYNCH_CONF_ENABLED */ - -#if ENERGEST_CONF_ON - /* Re-enable interrupts and go to sleep atomically. */ - ENERGEST_OFF(ENERGEST_TYPE_CPU); - ENERGEST_ON(ENERGEST_TYPE_LPM); - - /* We only want to measure the processing done in IRQs when we - are asleep, so we discard the processing time done when we - were awake. */ - energest_type_set(ENERGEST_TYPE_IRQ, irq_energest); -#endif /* ENERGEST_CONF_ON */ - - watchdog_stop(); - _BIS_SR(GIE | SCG0 | CPUOFF); /* LPM1 sleep. */ - -#if ENERGEST_CONF_ON - /* We get the current processing time for interrupts that was - done during the LPM and store it for next time around. */ - dint(); - irq_energest = energest_type_time(ENERGEST_TYPE_IRQ); - eint(); - ENERGEST_OFF(ENERGEST_TYPE_LPM); - ENERGEST_ON(ENERGEST_TYPE_CPU); -#endif /* ENERGEST_CONF_ON */ - - watchdog_start(); - } - } -} -/*---------------------------------------------------------------------------*/ -/* char *arg_alloc(char size) {return NULL;} */ -/* void arg_init(void) {} */ -/* void arg_free(char *arg) {} */ -/*---------------------------------------------------------------------------*/ -#if UIP_LOGGING -void -uip_log(char *m) -{ - printf("uIP log: '%s'\n", m); -} -#endif /* UIP_LOGGING */ diff --git a/platform/esb/contiki-esb.h b/platform/esb/contiki-esb.h deleted file mode 100644 index 7f385867c..000000000 --- a/platform/esb/contiki-esb.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __CONTIKI_ESB_H__ -#define __CONTIKI_ESB_H__ - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" - -#include "lib/sensors.h" -#include "dev/hwconf.h" - -#include "dev/lpm.h" - -#include "dev/rs232.h" - -#include "dev/serial-line.h" -#include "dev/slip.h" - -#include "sys/node-id.h" - -#include "dev/vib-sensor.h" -#include "dev/pir-sensor.h" -#include "dev/button-sensor.h" -#include "dev/radio-sensor.h" -#include "dev/sound-sensor.h" -#include "dev/battery-sensor.h" -#include "dev/temperature-sensor.h" -#include "dev/ctsrts-sensor.h" - -#include "dev/beep.h" - -#include "dev/ir.h" - -#include "dev/leds.h" - -#include "sys/node-id.h" - -void msp430_cpu_init(void); -void init_lowlevel(void); -void init_apps(void); - -#endif /* __CONTIKI_ESB_H__ */ diff --git a/platform/esb/core.c b/platform/esb/core.c deleted file mode 100644 index 069edad02..000000000 --- a/platform/esb/core.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#include "contiki-esb.h" -#include "codeprop-tmp.h" -#include -#include - -AUTOSTART_PROCESSES(&codeprop_process); - -int core_dummy_4711(int len) { - char t[1]; - int l = snprintf(t, sizeof(t), "%d", len % 9); - printf("%d\n", l / 2); - return len / 4; -} diff --git a/platform/esb/dev/battery-sensor.c b/platform/esb/dev/battery-sensor.c deleted file mode 100644 index 3a807b98c..000000000 --- a/platform/esb/dev/battery-sensor.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/02/08 00:00:45 $ - * $Revision: 1.6 $ - */ - -#include "contiki.h" -#include "dev/battery-sensor.h" -#include "dev/irq.h" - -const struct sensors_sensor battery_sensor; -static unsigned int battery_value; - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - battery_value = ADC12MEM6; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return ADC12MEM6/*battery_value*/; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - battery_value = 0; - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!irq_adc12_active(6)) { - irq_adc12_activate(6, (INCH_4 + SREF_0), irq); - } - } else { - irq_adc12_deactivate(6); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return irq_adc12_active(6); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(battery_sensor, BATTERY_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/battery-sensor.h b/platform/esb/dev/battery-sensor.h deleted file mode 100644 index 12c8fdc84..000000000 --- a/platform/esb/dev/battery-sensor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2006/06/18 08:07:30 $ - * $Revision: 1.3 $ - */ - -#ifndef __BATTERY_SENSOR_H__ -#define __BATTERY_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor battery_sensor; - -#define BATTERY_SENSOR "Battery" - -#endif /* __BATTERY_SENSOR_H__ */ diff --git a/platform/esb/dev/beep.c b/platform/esb/dev/beep.c deleted file mode 100644 index 80256cc9e..000000000 --- a/platform/esb/dev/beep.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "contiki-esb.h" -#include "sys/clock.h" - -#define ON 1 -#define OFF 0 - -/* - * Flag to indicate if any of these functions should generate a sound - * or not. The function beep_off() is used to change this flag so none - * of the functions will generate sounds and beep_on() to turn sound - * back on. - */ -static char onoroff = ON; - -/* - * BEEPER_BIT is the bit in the io-register that is connected to the actual - * beeper, setting the bit high vill generate a high pitch tone. - */ -#define BEEPER_BIT 0x08 - -/*-----------------------------------------------------------------------------------*/ -void -beep_alarm(int alarmmode, int len) -{ - len = len / 200; - - while(len > 0) { - /* - * Check here if we should beep or not since if we do it outside the - * while loop the call to this function would take muck less time, i.e. - * beep_on()/beep_off() would have side effects that might not be - * predictable. - */ - if(onoroff == ON) { - if((alarmmode == BEEP_ALARM1) && ((len & 7) > 4)) { - P2OUT |= BEEPER_BIT; - } else if((alarmmode == BEEP_ALARM2) && ((len & 15) > 12)) { - P2OUT |= BEEPER_BIT; - } else { - P2OUT &= ~BEEPER_BIT; - } - } - clock_delay(200); - len--; - } - P2OUT &= ~BEEPER_BIT; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_beep(int i) -{ - if(onoroff == ON) { - /* Beep. */ - P2OUT |= BEEPER_BIT; - clock_delay(i); - P2OUT &= ~BEEPER_BIT; - } -} -/*-----------------------------------------------------------------------------------*/ -void -beep(void) -{ - beep_beep(20); -} -/*-----------------------------------------------------------------------------------*/ -void -beep_down(int d) -{ - int i; - for(i = 8; i < d; i += i / 8) { - beep_beep(10); - clock_delay(i); - } -} -/*-----------------------------------------------------------------------------------*/ -void -beep_on(void) -{ - onoroff = ON; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_off(void) -{ - onoroff = OFF; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_spinup(void) -{ - unsigned int i; - - for(i = 10000; i > 80; i -= i / 20) { - beep_beep(2); - clock_delay(i); - } - - for(i = 4980; i > 2000; i -= 20) { - leds_on(LEDS_ALL); - clock_delay(5000 - i); - leds_off(LEDS_ALL); - clock_delay(i); - } - -} -/*-----------------------------------------------------------------------------------*/ -void -beep_quick(int n) -{ - int i; - for(i = 0; i < n; ++i) { - beep_beep(2000); - clock_delay(20000); - } -} -/*-----------------------------------------------------------------------------------*/ -void beep_long(clock_time_t len) { - /* - * Check if the beeper is turned on or off, i.e. if a call should generate - * a noise or not. - */ - if(onoroff == ON) { - /* Turn on the beeper. */ - P2OUT |= BEEPER_BIT; - } - - clock_wait(len); - - if(onoroff == ON) { - /* Turn the beeper off. */ - P2OUT &= ~BEEPER_BIT; - } -} -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/beep.h b/platform/esb/dev/beep.h deleted file mode 100644 index 8f17a7f6c..000000000 --- a/platform/esb/dev/beep.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -/** - * \addtogroup esb - * @{ - */ - -/** - * \defgroup beeper Beeper interface - * @{ - */ - -/** - * \file - * Interface to the beeper. - * \author Adam Dunkels - * - */ - -#ifndef __BEEP_H__ -#define __BEEP_H__ - -#define BEEP_ALARM1 1 -#define BEEP_ALARM2 2 - -#include "sys/clock.h" - -/** - * Beep for a specified time. - * - * This function causes the beeper to beep for the specified time. The - * time is measured in the same units as for the clock_delay() - * function. - * - * \note This function will hang the CPU during the beep. - * - * \note This function will stop any beep that was on previously when this - * function ends. - * - * \note If the beeper is turned off with beep_off() this call will still - * take the same time, though it will be silent. - * - * \param len The length of the beep. - * - */ -void beep_beep(int len); - -/** - * Beep an alarm for a specified time. - * - * This function causes the beeper to beep for the specified time. The - * time is measured in the same units as for the clock_delay() - * function. - * - * \note This function will hang the CPU during the beep. - * - * \note This function will stop any beep that was on previously when this - * function ends. - * - * \note If the beeper is turned off with beep_off() this call will still - * take the same time, though it will be silent. - * - * \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2) - * \param len The length of the beep. - * - */ -void beep_alarm(int alarmmode, int len); - -/** - * Produces a quick click-like beep. - * - * This function produces a short beep that sounds like a click. - * - */ -void beep(void); - -/** - * A beep with a pitch-bend down. - * - * This function produces a pitch-bend sound with deecreasing - * frequency. - * - * \param len The length of the pitch-bend. - * - */ -void beep_down(int len); - -/** - * Turn the beeper on. - * - * This function turns on the beeper. The beeper is turned off with - * the beep_off() function. - */ -void beep_on(void); - -/** - * Turn the beeper off. - * - * This function turns the beeper off after it has been turned on with - * beep_on(). - */ -void beep_off(void); - -/** - * Produce a sound similar to a hard-drive spinup. - * - * This function produces a sound that is intended to be similar to - * the sound a hard-drive makes when it starts. - * - */ -void beep_spinup(void); - -/** - * Beep for a long time (seconds) - * - * This function produces a beep with the specified length and will - * not return until the beep is complete. The length of the beep is - * specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND * - * 2, and a quarter second beep is CLOCK_SECOND / 4. - * - * \note If the beeper is turned off with beep_off() this call will still - * take the same time, though it will be silent. - * - * \param len The length of the beep, measured in units of CLOCK_SECOND - */ -void beep_long(clock_time_t len); - -void beep_quick(int num); - -/** @} */ -/** @} */ - -#endif /* __BEEP_H__ */ diff --git a/platform/esb/dev/button-sensor.c b/platform/esb/dev/button-sensor.c deleted file mode 100644 index ccd62c21f..000000000 --- a/platform/esb/dev/button-sensor.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "dev/button-sensor.h" -#include "dev/hwconf.h" -#include "isr_compat.h" - -const struct sensors_sensor button_sensor; - -static struct timer debouncetimer; - -HWCONF_PIN(BUTTON, 2, 7); -HWCONF_IRQ(BUTTON, 2, 7); - -/*---------------------------------------------------------------------------*/ -ISR(PORT2, irq_p2) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - - if(BUTTON_CHECK_IRQ()) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - LPM4_EXIT; - } - } - P2IFG = 0x00; - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return BUTTON_READ() || !timer_expired(&debouncetimer); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - BUTTON_IRQ_EDGE_SELECTD(); - BUTTON_SELECT(); - BUTTON_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!BUTTON_IRQ_ENABLED()) { - timer_set(&debouncetimer, 0); - BUTTON_ENABLE_IRQ(); - } - } else { - BUTTON_DISABLE_IRQ(); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return BUTTON_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/ctsrts-sensor.c b/platform/esb/dev/ctsrts-sensor.c deleted file mode 100644 index e01afe6e7..000000000 --- a/platform/esb/dev/ctsrts-sensor.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * RTS/CTS (Request to Send/Clear to Send) are the signals used for hardware - * flow control. By setting the RTS line to "ON" the host tells the connected - * device that it is ready to receive data. Hardware flow control is not - * implemented yet. This implementation is just so some application can use - * the pins, it would also be possible for rs232.c to use it for hardware - * handshake but as said, that is not implemented yet. - */ - -#include "dev/ctsrts-sensor.h" -#include "dev/irq.h" -#include "dev/hwconf.h" - -const struct sensors_sensor ctsrts_sensor; - -HWCONF_PIN(RS232RTS, 1, 7); - -#define RS232CTS_IRQ() 6 -HWCONF_PIN(RS232CTS, 1, RS232CTS_IRQ()); -HWCONF_IRQ(RS232CTS, 1, RS232CTS_IRQ()); - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - /* Change the flank triggering for the irq so we will detect next shift. */ - if(RS232CTS_READ()) { - RS232CTS_IRQ_EDGE_SELECTD(); - } else { - RS232CTS_IRQ_EDGE_SELECTU(); - } - sensors_changed(&ctsrts_sensor); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* - * Invert the bit and return. - * This is strange, accordingly to the MSP430 manual section 9.2.1, Input - * Register PxIN the bit should be low when input is low. In RealTerm on - * the PC I set RTS which is coupled to the CTS on the esb and I read a 0. - * Maybe RTS is defined active LOW on the PC? //Kalle - */ - return RS232CTS_READ() ? 0 : 1; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - RS232RTS_SELECT(); - RS232RTS_MAKE_OUTPUT(); - RS232RTS_CLEAR(); - RS232CTS_SELECT(); - RS232CTS_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!RS232CTS_IRQ_ENABLED()) { - - /* - * Check current status on the CTS pin and set IRQ flank so we - * will detect a shift. - */ - if(RS232CTS_READ()) { - RS232CTS_IRQ_EDGE_SELECTD(); - } else { - RS232CTS_IRQ_EDGE_SELECTU(); - } - - irq_port1_activate(RS232CTS_IRQ(), irq); - RS232CTS_ENABLE_IRQ(); - } - } else { - RS232CTS_DISABLE_IRQ(); - irq_port1_deactivate(RS232CTS_IRQ()); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return RS232CTS_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * Indicate to host/client we are NOT ready to receive data. Sets the RTS pin - * to low. - */ -void ctsrts_rts_clear(void) { - RS232RTS_CLEAR(); -} -/*---------------------------------------------------------------------------*/ -/** - * Request host/client to send data. Sets the RTS pin to high. - */ -void ctsrts_rts_set(void) { - RS232RTS_SET(); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(ctsrts_sensor, CTSRTS_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/ctsrts-sensor.h b/platform/esb/dev/ctsrts-sensor.h deleted file mode 100644 index 798d1a69f..000000000 --- a/platform/esb/dev/ctsrts-sensor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * RTS/CTS (Request to Send/Clear to Send) are the signals used for hardware - * flow control. By setting the RTS line to "ON" the host tells the connected - * device that it is ready to receive data. Hardware flow control is not - * implemented yet. This implementation is just so some application can use - * the pins, it would also be possible for rs232.c to use it for hardware - * handshake but that is not implemented yet. - */ -#ifndef __CTSRTS_SENSOR_H__ -#define __CTSRTS_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor ctsrts_sensor; - -#define CTSRTS_SENSOR "CTSRTS" - -/** - * Indicate to host/client we are NOT ready to receive data. Sets the RTS pin - * to low. - */ -void ctsrts_rts_clear(void); - -/** - * Request host/client to send data. Sets the RTS pin to high. - */ -void ctsrts_rts_set(void); - -#endif /* __CTSRTS_SENSOR_H__ */ diff --git a/platform/esb/dev/ds1629.c b/platform/esb/dev/ds1629.c deleted file mode 100644 index ce922ecc4..000000000 --- a/platform/esb/dev/ds1629.c +++ /dev/null @@ -1,228 +0,0 @@ -/* -Copyright 2005, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2005 -*/ - -/** - * Part of the source code from ScatterWeb 2.2 (ScatterWeb.{Data,System}.c) - * released by Freie Universitaet Berlin has been reworked and - * reformatted to fit the Contiki ESB port. - */ - -#include "contiki.h" -#include "dev/ds1629.h" - -#define SDA_HIGH (P5OUT |= 0x01) /* RTC data line high */ -#define SDA_LOW (P5OUT &= 0xFE) /* RTC data line low */ -#define SCL_HIGH (P5OUT |= 0x02) /* RTC clock line high */ -#define SCL_LOW (P5OUT &= 0xFD) /* RTC clock line low */ -#define BUS_READ 0x9F -#define BUS_WRITE 0x9E -#define ACC_CSR 0xAC /* Access Configuration/Control Register */ -#define ACC_CLOCK 0xC0 /* Access Clock Register */ -#define ACC_CLOCK_ALARM 0xC7 /* Access Clock Alarm Register */ -#define ACC_TH 0xA1 /* Access Thermostat Setpoint High */ -#define ACC_TL 0xA2 /* Access Thermostat Setpoint Low */ -#define ACC_CSRAM 0x17 /* Access Clock 32 byte SRAM */ -#define ACC_RT 0xAA /* Access Read Temperatur Register */ -#define CSR_OS1 (0x80) -#define CSR_OS0 (0x40) -#define CSR_A1 (0x20) -#define CSR_A0 (0x10) -#define CSR_CNV (0x04) -#define CSR_POL (0x02) -#define CSR_1SH (0x01) -#define CSR_DEFAULT (CSR_OS1 + CSR_OS0 + CSR_A1 + CSR_CNV + CSR_1SH + CSR_POL) - -/** - * Temperature type (built on a signed int). It's a signed (twos complement) - * fixed point value with 8 bits before comma and 7 bits after. So Bit 15 is - * sign, Bit14-7 is before comma and Bit 6-0 after comma. - * - * @since 2.0 - */ -typedef union { unsigned int u; signed int s; } temp_t; - -/*--------------------------------------------------------------------------*/ -/* Puts the start condition on bus. */ -static void -cl_start(void) -{ - P5DIR |= 0x03; /* ensure: P50(SDA), P51(SCL) output */ - SCL_LOW; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); -} -/*--------------------------------------------------------------------------*/ -/* Puts the stop condition on bus. */ -static void -cl_stop() -{ - SCL_LOW; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); - P5DIR &= ~0x03; -} -/*--------------------------------------------------------------------------*/ -/* Writes a byte on the bus, returns the acknowledge bit. */ -static uint16_t -cl_writeOnBus(uint8_t byte) -{ - uint16_t i, ack; - for(i=0;i<8;i++) { - if(byte & 0x80) SDA_HIGH; else SDA_LOW; - SCL_HIGH; - byte = byte << 1; _NOP(); - SCL_LOW; _NOP(); - } - /* check ack */ - P5DIR &= 0xFE; /* P50(SDA) input */ - SCL_HIGH; - if(P5IN & 0x01) ack = 0; else ack = 1; /* test if ack=0, else error */ - _NOP(); - SCL_LOW; - P5DIR |= 0x01; /* P50(SDA) output */ - return ack; -} -/*--------------------------------------------------------------------------*/ -static uint8_t -cl_readFromBus(uint16_t ack) -{ - uint16_t i; - uint8_t byte = 0; - P5DIR &= 0xFE; /* P50(SDA) input */ - for(i=0;i<8;i++) { - byte = byte << 1; - SCL_HIGH; - if(P5IN & 0x01) byte |= 0x01; else byte &= 0xFE; - SCL_LOW; - } - P5DIR |= 0x01; /* P50(SDA) output */ - if(ack) SDA_LOW; else SDA_HIGH; - SCL_HIGH; - SCL_LOW; - return byte; -} -/*--------------------------------------------------------------------------*/ -static uint16_t -getReg16bit(uint8_t acc, uint16_t bitmask) -{ - uint16_t config = 0; - do cl_start(); - while(!cl_writeOnBus(BUS_WRITE)); - cl_writeOnBus(acc); - cl_start(); - cl_writeOnBus(BUS_READ); - config = cl_readFromBus(1); - config = config << 8; - config += cl_readFromBus(0); - cl_stop(); - config &= bitmask; - _NOP(); - _NOP(); - return config; -} -/*--------------------------------------------------------------------------*/ -/* Only first 8 bit of Configuration Status Register can be set */ -static void -setCSReg(uint8_t setting) -{ - do cl_start(); - while(!cl_writeOnBus(BUS_WRITE)); - cl_writeOnBus(ACC_CSR); - cl_writeOnBus(setting); - cl_stop(); - _NOP(); - _NOP(); - _NOP(); - _NOP(); -} -/*--------------------------------------------------------------------------*/ -static void -System_startConversion(void) -{ - do cl_start(); /* do start until BUS_WRITE is acked */ - while(!cl_writeOnBus(BUS_WRITE)); /* control byte */ - cl_writeOnBus(0xEE); /* start conversion */ - cl_stop(); -} -/*--------------------------------------------------------------------------*/ -/* RTC initialization. Initializes RTC with ::CSR_DEFAULT. */ -static void -initClock(void) -{ - uint8_t csr = getReg16bit(ACC_CSR,0xFF00) >> 8; - if(csr!=CSR_DEFAULT) setCSReg(CSR_DEFAULT); /* if desired config isnt in clock => set it */ - /* IMPORTANT: Ensure quartz is generating 32768 Hz */ - /* (sometimes CH bit gets set when clock is read while reset) */ - do cl_start(); /* Do start until BUS_WRITE is acked. */ - while(!cl_writeOnBus(BUS_WRITE)); /* Send control byte */ - cl_writeOnBus(ACC_CLOCK); /* Send command byte ::ACC_CLOCK. */ - cl_writeOnBus(0x00); /* Send starting address 0x00. */ - cl_writeOnBus(0x00); /* Set CH to 0, tseconds and seconds will also be reset! */ - cl_stop(); /* Stop condition. */ -} -/*--------------------------------------------------------------------------*/ -void -ds1629_init() -{ - initClock(); -} -/*--------------------------------------------------------------------------*/ -void -ds1629_start() -{ - System_startConversion(); -} -/*--------------------------------------------------------------------------*/ -signed int -ds1629_temperature() -{ - temp_t temperature; - - ds1629_start(); - - temperature.u = getReg16bit(ACC_RT,0xFFFF); - return temperature.s; -} diff --git a/platform/esb/dev/ds1629.h b/platform/esb/dev/ds1629.h deleted file mode 100644 index a0120fb7e..000000000 --- a/platform/esb/dev/ds1629.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Configurable Sensor Network Application - * Architecture for sensor nodes running the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-08 - * Updated : $Date: 2006/06/18 07:49:33 $ - * $Revision: 1.1 $ - */ - -#ifndef __DS1629_H__ -#define __DS1629_H__ - -/** - * DS1629 initialization function. - * - * This function should be called at startup to initialize the DS1629 - * and its clock. - */ -void ds1629_init(void); - -/** - * DS1629 start conversion function. - * - * This function should be called before requesting the temperature - * the first time. - */ -void ds1629_start(void); - -/** - * Get the temperature. - * - * This function will return the current temperature as a signed 9 bit - * value in terms of a 0.5 degree Celsius least significant bit. - * - * MSB Sign 2^6 2^5 2^4 2^3 2^2 2^1 2^0 - * LSB 2^-1 0 0 0 0 0 0 0 - */ -signed int ds1629_temperature(void); - -#endif /* __DS1629_H__ */ diff --git a/platform/esb/dev/eeprom.c b/platform/esb/dev/eeprom.c deleted file mode 100644 index fb63f4a9c..000000000 --- a/platform/esb/dev/eeprom.c +++ /dev/null @@ -1,323 +0,0 @@ -/** - * \file - * EEPROM functions. - * \author Adam Dunkels - */ - -/* Copyright (c) 2004 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. - * - * - * Author: Adam Dunkels - * - */ - -/* -Copyright 2003/2004, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universit\x{FFFF}t Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. -Contributors: Thomas Pietsch, Bjoern Lichtblau - -For documentation and questions please use the web site -http://www.scatterweb.net and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2003/2004 -*/ - -#include "contiki.h" -/* #include */ - -#include "dev/eeprom.h" - -/* Temporary switch for the eeprom address. */ -#define EEPROMADDRESS (0x00) /* use 8k EEPROM, future versions will have only one 64k eeprom at this address */ -/*#define EEPROMADDRESS (0x02)*/ /* use 64k EEPROM */ - -/* must be set together with EEPROMADDRESS */ -/*#define EEPROMPAGEMASK (0x1F) */ /* 8k EEPROM, 32b page writes possible */ -#define EEPROMPAGEMASK (0x7F) /* 64k EEPROM, 128b page writes possible */ - - - -/* - * Macros for accessing the clock and data lines. Data is on P56 and - * clock on P57. - */ -#define SDA_HIGH (P5OUT |= 0x04) /**< EEPROM data line high */ -#define SDA_LOW (P5OUT &= 0xFB) /**< EEPROM data line low */ -#define SCL_HIGH (P5OUT |= 0x08) /**< EEPROM clock line high */ -#define SCL_LOW (P5OUT &= 0xF7) /**< EEPROM clock line low */ - - -/*-----------------------------------------------------------------------------------*/ -/** - * \internal \name Basic functions for interfacing the i2c-like EEPROM bus. - */ -/** @{ */ - -/** - * \internal - * Put start condition on the bus. - */ -static void -start(void) -{ - P5DIR |= 0x0C; /* ensure: P52(SDA), P53(SCL) output */ - SCL_LOW; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); -} - -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Put stop condition on the bus. - */ -static void -stop(void) -{ - //P5DIR |= 0x0C; /* ensure: P52(SDA), P53(SCL) output */ - SCL_LOW; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); - P5DIR &= ~0x0C; -} -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Write a byte on the bus, return the acknowledge bit. - */ -static int -write_bus(unsigned char byte) -{ - int i, ack; - - /* Write byte, one bit at a time. Start with the leftmost (most - significant) bit and roll in bits from the right. */ - for(i = 0; i < 8; ++i) { - if(byte & 0x80) { - SDA_HIGH; - } else { - SDA_LOW; - } - _NOP(); - _NOP(); - SCL_HIGH; - _NOP(); - _NOP(); - byte = byte << 1; - SCL_LOW; - _NOP(); - _NOP(); - } - - /* check ack */ - P5DIR &= 0xFB; /* P52(SDA) input */ - SCL_HIGH; - _NOP(); - _NOP(); - if(P5IN & 0x04) { - ack = 0; - } else { - ack = 1; /* test if ack=0, else error */ - } - SCL_LOW; - _NOP(); - _NOP(); - P5DIR |= 0x04; /* P52(SDA) output */ - _NOP(); - _NOP(); - _NOP(); - return ack; -} -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Read one byte from the bus. - * - * \param ack If set, the ackbit after the received byte will be set. - */ -static unsigned char -read_bus(unsigned char ack) -{ - int i; - unsigned char byte = 0; - - P5DIR &= 0xFB; /* P52(SDA) input */ - - for(i = 0; i < 8; ++i) { - byte = byte << 1; - SCL_HIGH; - _NOP(); - _NOP(); - if(P5IN & 0x04) { - byte |= 0x01; - } else { - byte &= 0xFE; - } - _NOP(); - SCL_LOW; - _NOP(); - _NOP(); - } - - P5DIR |= 0x04; /* P52(SDA) output */ - if(ack) { - SDA_LOW; - } else { - SDA_HIGH; - } - _NOP(); - SCL_HIGH; - _NOP(); - SCL_LOW; - _NOP(); - return byte; -} -/** @} */ -/*-----------------------------------------------------------------------------------*/ -/** - * Read bytes from the EEPROM using sequential read. - */ -void -eeprom_read(unsigned short addr, unsigned char *buf, int size) -{ - unsigned int i; - - if(size <= 0) { - return; - } - - do { - /* Wait if the writecycle has not finished. */ - start(); - /* 1010 control, 000 address, 0=write --- but only inits address */ - } while(!write_bus(0xa0 | EEPROMADDRESS)); - - - /* Write address to bus, low byte first. */ - write_bus(addr >> 8); - write_bus(addr & 0xff); - start(); - /* 1010 control, 000 address, 1=read */ - write_bus(0xa1 | EEPROMADDRESS); - - for(i = 0; i < (size - 1); ++i){ - buf[i] = read_bus(1); - } - buf[size - 1] = read_bus(0); - stop(); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Write bytes to EEPROM using sequencial write. - */ -void -eeprom_write(unsigned short addr, unsigned char *buf, - int size) -{ - unsigned int i = 0; - unsigned int curaddr; - - if(size <= 0) { - return; - } - - /* Disable write protection. */ - P5OUT &= 0xEF; - - curaddr = addr; - for(i = 0; i < size; ++i) { - /* If we are writing the first byte or are on a 128b page boundary - we have to start a new write. */ - if(i == 0 || (curaddr & EEPROMPAGEMASK) == 0) { - do { - start(); - /* 1010 control, 000 addresse, 0=write */ - } while(!write_bus(0xa0 | EEPROMADDRESS)); - - /* Write the new address to the bus. */ - if(write_bus(curaddr >> 8) == 0) { - return; - } - if(write_bus(curaddr) == 0) { - return; - } - } - - /* Write byte. */ - if(write_bus(buf[i]) == 0) { - return; - } - - /* If we are writing the last byte totally or of a 128b page - generate a stop condition */ - if(i == size - 1 || (curaddr & EEPROMPAGEMASK) == EEPROMPAGEMASK) { - stop(); - } - - ++curaddr; - } - - /* Enable write protection. */ - P5OUT |= 0x10; -} - -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/esb-sensors.c b/platform/esb/dev/esb-sensors.c deleted file mode 100644 index 01901dec1..000000000 --- a/platform/esb/dev/esb-sensors.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Functions for turning the ESB sensors on or off - * \author - * Adam Dunkels - * - * This file will eventually be changed into a better API. This is - * sufficient for now. - */ - -#include "dev/hwconf.h" -#include "dev/irq.h" -#include "sys/energest.h" - -HWCONF_PIN(SENSORSWITCH, 5, 5); - -/*---------------------------------------------------------------------------*/ -void -esb_sensors_init(void) -{ - SENSORSWITCH_SELECT(); - SENSORSWITCH_MAKE_OUTPUT(); - - irq_init(); -} -/*---------------------------------------------------------------------------*/ -void -esb_sensors_on(void) -{ - SENSORSWITCH_CLEAR(); - ENERGEST_ON(ENERGEST_TYPE_SENSORS); -} -/*---------------------------------------------------------------------------*/ -void -esb_sensors_off(void) -{ - SENSORSWITCH_SET(); - ENERGEST_OFF(ENERGEST_TYPE_SENSORS); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/esb-sensors.h b/platform/esb/dev/esb-sensors.h deleted file mode 100644 index 599fe65a0..000000000 --- a/platform/esb/dev/esb-sensors.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef __ESB_SENSORS_H__ -#define __ESB_SENSORS_H__ - -void esb_sensors_init(void); -void esb_sensors_on(void); -void esb_sensors_off(void); - -#endif /* __ESB_SENSORS_H__ */ diff --git a/platform/esb/dev/ir.c b/platform/esb/dev/ir.c deleted file mode 100644 index 56ac46a27..000000000 --- a/platform/esb/dev/ir.c +++ /dev/null @@ -1,315 +0,0 @@ - - - -/* The software in this file is based on code from FU Berlin. */ - -/* -Copyright 2003/2004, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. -Contributors: Thomas Pietsch, Bjoern Lichtblau - -*/ - -/* \file recir.c - ** \ingroup Firmware - ** \brief Receiving RC5 via IR Receiving Diode. - ** - ** \code - ** RC5: 1780 us bitlength (manchester encoded, so half bitlength of 890 us is important) - ** Transferred packet (2 start + toggle bit + 5 address bits + 6 comand bits)): - ** | S | S | T | A4 | A3 | A2 | A1 | A0 | C5 | C4 | C3 | C2 | C1 | C0 | - ** irdata format: | ? | ? | error | newData | T | A4 | A3 | A2 | A1 | A0 | C5 | C4 | C3 | C2 | C1 | C0 | - ** \endcode - ** - ** - ** See detailed description at http://users.pandora.be/davshomepage/rc5.htm - ** - ** Some common addresses and commands: - ** \code - ** Address: Device: Command: - ** 0 TV1 0...9 Numbers 0...9 (channel select) - ** 1 TV2 12 Standby - ** 5 VCR1 16 Master Volume + - ** 6 VCR2 17 Master Volume - - ** 17 Tuner 18 Brightness + - ** 18 Audio Tape 19 Brightness - - ** 20 CD Player 50 Fast rewind - ** 52 Fast run forward - ** 53 Play - ** 54 Stop - ** 55 Recording - ** \endcode - **/ - -#include "contiki.h" -#include "dev/ir.h" - -#include "dev/leds.h" -#include "dev/beep.h" -#include "isr_compat.h" - -PROCESS(ir_process, "IR receiver"); -process_event_t ir_event_received; -/*---------------------------------------------------------------------------*/ -#define SIR1 (P1OUT |= 0x01) ///< MACRO: Puts IR sending diode high. -#define SIR0 (P1OUT &= 0xFE) ///< MACRO: Puts IR sending diode low. -#define BIT75 3282 ///< 3 quarters of a bit after start, 3282 cyc @ 2,4576Mhz = 1335us. -#define BIT50 2188 ///< Half of bit length, 2188 cyc @ 2,4576Mhz = 890 us. - -/*---------------------------------------------------------------------------*/ -/* Sends a logical one via IR, method is timed for the 2.4576Mhz SMCLK!!! - */ -static volatile void -send1bit(void) -{ - volatile int i; - for(i = 0; i < 34; ++i) { - SIR1; SIR1; SIR1; SIR1; - SIR0; SIR0; SIR0; SIR0; - SIR0; SIR0; SIR0; SIR0; - SIR0; - } -} -/*---------------------------------------------------------------------------*/ -/* Sends a logical 0 via IR, method is timed for the 2.4576Mhz SMCLK!!! - */ -static volatile void -send0bit(void) -{ - volatile int i; - for(i = 0; i < 34; ++i) { - SIR0; SIR0; SIR0; SIR0; - SIR0; SIR0; SIR0; SIR0; - SIR0; SIR0; SIR0; SIR0; - SIR0; - } -} -/*---------------------------------------------------------------------------*/ -/* Sends the lower 12 bits of data via IR, turns interrupt off while - it's sending. - */ -void -ir_send(unsigned short data) -{ - volatile unsigned short mask = 0x2000; - data |= 0xF000; - - dint(); - while(mask != 0){ - if(!(mask & data)){ - send1bit(); - send0bit(); - } else { - send0bit(); - send1bit(); - } - mask /= 2; - } - eint(); -} -/*---------------------------------------------------------------------------*/ -/* Testroutine which repetedly sends two commands. - */ -/*void -ir_test_send(void) -{ - volatile unsigned int i; - send12bits(0xF010); - for(i=0; i<0xFFFF; i++) nop(); - send12bits(0xF011); - for(i=0; i<0xFFFF; i++) nop(); -}*/ -/*---------------------------------------------------------------------------*/ - - -static void setErrorBit(void); -static void clearErrorBit(void); -static void setDataAvailableBit(void); -static void clearDataAvailableBit(void); - - -/// \name Internal variables. -//@{ -static unsigned int ir_pos; ///< current position in frame -static unsigned int recvdata; ///< here a received packet is saved -static unsigned int recvdatabuffer; ///< temporary buffer for receiving -static unsigned char ir_temp; ///< saves the first half of the manchester bit -//@} - -/// \name Public functions. -/// If ::recir_dataAvailable()==1 use the get* functions. -//@{ -unsigned char recir_getCode(void){ return (recvdata & 0x003F); } -unsigned char recir_getAddress(void){ return ((recvdata & 0x07C0) >> 6); } -unsigned char recir_getToggle(void){ return ((recvdata & 0x0800) >> 11); } -unsigned char recir_getError(void){ return ((recvdata & 0x2000) >> 13); } - -uint16_t -ir_data(void) -{ - return recvdata; -} - -uint8_t -ir_poll(void) -{ - if(recvdata & 0x1000) { - clearDataAvailableBit(); - return 1; - } else { - return 0; - } -} - - -///\name Internal functions. -//@{ -static void setErrorBit(void){ recvdata |= 0x2000; } -static void clearErrorBit(void) { recvdata &= 0xDFFF; } -static void setDataAvailableBit(void){ recvdata |= 0x1000; } -static void clearDataAvailableBit(void){ recvdata &= 0xEFFF; } - - -/// Timer B0 interrupt service routine -ISR(TIMERB1, Timer_B1) { - - /*P2OUT = (P2OUT & 0xf7) | (8 - (P2OUT & 0x08));*/ - - if(ir_pos <= 25) { - if(ir_pos % 2) { // odd position - if(ir_temp && !(P1IN & 0x04)) { // 1 - 0 --> write 1 - recvdatabuffer +=1; - recvdatabuffer = recvdatabuffer << 1; - } else if(!ir_temp && (P1IN & 0x04)) { // 0 - 1 --> write 0 - recvdatabuffer = recvdatabuffer << 1; - } else { - setErrorBit(); - if(P1IN & 0x04) { - recvdatabuffer += 1; - } - recvdatabuffer = recvdatabuffer << 1; - } - } else { // even position - ir_temp = P1IN & 0x04; - } - } - - if(ir_pos == 25) { // end reached - recvdatabuffer = recvdatabuffer >> 1; - - if(!recir_getError() && ( (recvdatabuffer & 0x0FFF) != (recvdata & 0x0FFF) ) ){ - recvdata = recvdatabuffer; - setDataAvailableBit(); - } else { - _NOP(); - } - } - - if(ir_pos==27) { - TBCCTL1 &= ~CCIE; - - //GREENOFF; - // temporary debug output - //sendRS232Address(recvdatabuffer); - //if(recir_getError()) sendRS232('E'); - //sendRS232String("\r\n"); - if(!recir_getError()) beep_beep(20); - - // reenable interrupt for falling edge - P1IFG &= ~(0x04); - P1IE |= 0x04; // enable interrupt for recir RC5 - leds_off(LEDS_RED); - } - - ir_pos++; - TBCCR1 += BIT50; // set new interrupt - - TBCCTL1 &= ~CCIFG; -} - - -/** \brief IR Interrupt routine - ** - ** For the falling edge (start of RC5 packet)( mid of first start bit ), IRReceiver is on P12 - ** real interrupt routine, which calls this, is in sensors.c */ -void -ir_irq(void) -{ - if(P1IN & 0x04) return; // high again, just a peak - - ir_pos = 0; - recvdatabuffer = 0; - clearErrorBit(); - - // the first timer interrupt will occur in the mid of the first half of the second start bit - TBCCR1 = TBR + BIT75; // set first TBCCR1 IRQ to 75% of RC5 bitlength - TBCCTL1 &= ~CCIFG; // clear previous compare flag - TBCCTL1 |= CCIE; // CCR0 interrupt enabled, interrupt occurs when timer equals CCR0 - - P1IE &= ~0x04; // disable interrupt for P12 ( ReceiveIR ) - leds_on(LEDS_RED); - //GREENON; -} - -//@} -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(ir_process, ev, data) -{ - PROCESS_BEGIN(); - - // init TIMERB ccr0 to run continouslycreate the 5 ms interval - // ccr1 is used for ir receiving (RC5) - TBCTL = TBSSEL1 + TBCLR; // select SMCLK (2.4576MHz), clear TBR - TBCTL |= MC1; // Start Timer_A in continuous mode - - - P1IES |= 0x04; // Important for IR-RC5 receive to detect the first FALLING edge - - ir_event_received = process_alloc_event(); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_POLL); - - if(ir_poll() == IR_DATA) { - unsigned short irdata; - irdata = ir_data() & 0x7ff; - process_post(PROCESS_BROADCAST, ir_event_received, (process_data_t)irdata); - } - - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/dev/ir.h b/platform/esb/dev/ir.h deleted file mode 100644 index f806c1d55..000000000 --- a/platform/esb/dev/ir.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __IR_H__ -#define __IR_H__ - -#include "contiki.h" -#include "contiki-net.h" - -/** - * Initialize the IR driver. - * - * This function should be called from the main boot-up procedure in - * order to initialize the IR device driver. - * - */ -void ir_init(void); - -void ir_send(unsigned short low12bits); - -uint8_t ir_poll(void); -#define IR_NODATA 0 -#define IR_DATA 1 - -uint16_t ir_data(void); - -void ir_irq(void); - -#define IR_STANDBY 0x0c -#define IR_VOLUME_UP 0x10 -#define IR_VOLUME_DOWN 0x11 -#define IR_VCR_PLAY 0x35 -#define IR_VCR_STOP 0x36 -#define IR_VCR_RECORD 0x37 -#define IR_VCR_REWIND 0x32 -#define IR_VCR_WIND 0x34 - -extern process_event_t ir_event_received; - -PROCESS_NAME(ir_process); - -#endif /* __IR_H__ */ diff --git a/platform/esb/dev/irq.c b/platform/esb/dev/irq.c deleted file mode 100644 index 20823f27b..000000000 --- a/platform/esb/dev/irq.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/irq.h" -#include "dev/lpm.h" -#include "isr_compat.h" - -#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno] - -static int (* adc12_irq[8])(void); -static int (* port1_irq[8])(void); -static unsigned char adcflags; - -/*---------------------------------------------------------------------------*/ -ISR(PORT1, irq_p1) -{ - int i; - ENERGEST_ON(ENERGEST_TYPE_IRQ); - for(i = 0; i < 8; i++) { - if((P1IFG & (1 << i)) && port1_irq[i] != NULL) { - if((port1_irq[i])()) { - LPM4_EXIT; - } - } - } - P1IFG = 0x00; - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -ISR(ADC, irq_adc) -{ - int i; - ENERGEST_ON(ENERGEST_TYPE_IRQ); - for(i = 0; i < 8; i++) { - if(adc12_irq[i] != NULL) { - if((adc12_irq[i])()) { - LPM4_EXIT; - } - } - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -void -irq_init(void) -{ - int i; - adcflags = 0; - for(i = 0; i < 8; i++) { - adc12_irq[i] = NULL; - port1_irq[i] = NULL; - } - /* Setup ADC12, ref., sampling time */ - ADC12CTL0 = REF2_5V | SHT0_10 | SHT1_10 | MSC; - - /* Use sampling timer, repeat-sequence-of-channels */ -/* ADC12CTL1 = SHP | CONSEQ_3 | ADC12DIV_3; */ - ADC12CTL1 = SHP | CONSEQ_3 | ADC12DIV_7; -} -/*---------------------------------------------------------------------------*/ -void -irq_port1_activate(unsigned char irqno, int (* irq)(void)) -{ - if(irqno < 8) { - port1_irq[irqno] = irq; - } -} -/*---------------------------------------------------------------------------*/ -void -irq_port1_deactivate(unsigned char irqno) -{ - if(irqno < 8) { - port1_irq[irqno] = NULL; - } -} -/*---------------------------------------------------------------------------*/ -/* Set lowest ADC to be start in sequence and highest to be interrupt - enabled and set end-of-sequence on the highest active ADC */ -static void -sethilo(void) -{ - int c; - - /* Clear start of sequence */ - ADC12CTL1 &= ~(CSTARTADD_15); - - /* Set new start of sequence to lowest active memory holder */ - for(c = 0; c < 8; c++) { - if(adcflags & (1 << c)) { - ADC12CTL1 |= (c * CSTARTADD_1); - break; - } - } - - /* Clear all interrupts and end-of-sequences */ - ADC12IE = 0; - for(c = 0; c < 8; c++) { - ADC12MCTL_NO(c) &= ~EOS; - } - - /* Set highest interrupt and end-of-sequence. This will generate one - interrupt for each sequence of conversions. */ - for(c = 0; c < 8; c++) { - if(adcflags & (128 >> c)) { - ADC12IE |= 128 >> c; - ADC12MCTL_NO(7 - c) |= EOS; - break; - } - } -} -/*---------------------------------------------------------------------------*/ -void -irq_adc12_activate(unsigned char adcno, unsigned char config, - int (* irq)(void)) -{ - if(adcno >= 8) { - return; - } - /* stop converting */ - ADC12CTL0 &= ~ENC; - /* wait for conversion to stop */ - while(ADC12CTL0 & ADC12BUSY); - ADC12CTL0 &= ~(ADC12ON | REFON); - ADC12IE = 0; - - /* clear any pending interrupts */ - ADC12IFG = 0; - - adcflags |= (1 << adcno); - - ADC12MCTL_NO(adcno) = config; - - sethilo(); - - ADC12CTL0 |= ADC12ON | REFON; - - adc12_irq[adcno] = irq; - - /* Delay */ - clock_delay(20000); - - ADC12CTL0 |= ENC | ADC12SC; -} -/*---------------------------------------------------------------------------*/ -void -irq_adc12_deactivate(unsigned char adcno) -{ - if(adcno >= 8) { - return; - } - /* stop converting */ - ADC12CTL0 &= ~ENC; - /* wait for conversion to stop */ - while(ADC12CTL0 & ADC12BUSY); - ADC12CTL0 &= ~(ADC12ON | REFON); - ADC12IE = 0; - - /* clear any pending interrupts */ - ADC12IFG = 0; - - adcflags &= ~(1 << adcno); - - ADC12MCTL_NO(adcno) = 0; - - sethilo(); - - adc12_irq[adcno] = NULL; - - if(adcflags) { - /* Turn on the ADC12 */ - ADC12CTL0 |= (ADC12ON | REFON); - - /* Delay */ - clock_delay(20000); - - /* Still active. Turn on the conversion. */ - ADC12CTL0 |= ENC | ADC12SC; - } -} -/*---------------------------------------------------------------------------*/ -int -irq_adc12_active(unsigned char adcno) -{ - return adcflags & (1 << adcno) ? 1 : 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/irq.h b/platform/esb/dev/irq.h deleted file mode 100644 index 0f1b94132..000000000 --- a/platform/esb/dev/irq.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __IRQ_H__ -#define __IRQ_H__ - -void irq_init(void); - -void irq_port1_activate(unsigned char irqno, int (* irq)(void)); -void irq_port1_deactivate(unsigned char irqno); - -void irq_adc12_activate(unsigned char adcno, unsigned char config, - int (* irq)(void)); -void irq_adc12_deactivate(unsigned char adcno); - -int irq_adc12_active(unsigned char adcno); - -#endif /* __IRQ_H__ */ diff --git a/platform/esb/dev/pir-sensor.c b/platform/esb/dev/pir-sensor.c deleted file mode 100644 index 1e9b1e977..000000000 --- a/platform/esb/dev/pir-sensor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "dev/pir-sensor.h" -#include "dev/irq.h" -#include "dev/hwconf.h" - -const struct sensors_sensor pir_sensor; - -static unsigned int pir; - -#define PIR_IRQ() 3 -HWCONF_PIN(PIR, 1, PIR_IRQ()); -HWCONF_IRQ(PIR, 1, PIR_IRQ()); - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - ++pir; - sensors_changed(&pir_sensor); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return pir; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - pir = 0; - PIR_SELECT(); - PIR_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!PIR_IRQ_ENABLED()) { - irq_port1_activate(PIR_IRQ(), irq); - PIR_ENABLE_IRQ(); - } - } else { - PIR_DISABLE_IRQ(); - irq_port1_deactivate(PIR_IRQ()); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return PIR_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(pir_sensor, PIR_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/pir-sensor.h b/platform/esb/dev/pir-sensor.h deleted file mode 100644 index fb32e256d..000000000 --- a/platform/esb/dev/pir-sensor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __PIR_SENSOR_H__ -#define __PIR_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor pir_sensor; - -#define PIR_SENSOR "PIR" - -#endif /* __PIR_SENSOR_H__ */ diff --git a/platform/esb/dev/radio-sensor.c b/platform/esb/dev/radio-sensor.c deleted file mode 100644 index 185bd4218..000000000 --- a/platform/esb/dev/radio-sensor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "dev/radio-sensor.h" -#include "dev/irq.h" -#include "dev/tr1001.h" - -const struct sensors_sensor radio_sensor; - -unsigned int radio_sensor_signal; - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - radio_sensor_signal = ADC12MEM5; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - case RADIO_SENSOR_LAST_PACKET: - return tr1001_sstrength(); - case RADIO_SENSOR_LAST_VALUE: - default: - return radio_sensor_signal; - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - /* Initialization of ADC12 done by irq */ - radio_sensor_signal = 0; - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!irq_adc12_active(5)) { - irq_adc12_activate(5, (INCH_5 + SREF_0), irq); - } - } else { - irq_adc12_deactivate(5); - radio_sensor_signal = 0; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return irq_adc12_active(5); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(radio_sensor, RADIO_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/rs232-putchar.c b/platform/esb/dev/rs232-putchar.c deleted file mode 100644 index fae8e9adc..000000000 --- a/platform/esb/dev/rs232-putchar.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "dev/rs232.h" - -int -putchar(int c) -{ - rs232_send(c); - return c; -} diff --git a/platform/esb/dev/rs232.c b/platform/esb/dev/rs232.c deleted file mode 100644 index 8f1ed2ffa..000000000 --- a/platform/esb/dev/rs232.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** \addtogroup esbrs232 - * @{ */ - -/** - * \file - * RS232 communication device driver for the MSP430. - * \author Adam Dunkels - * - * This file contains an RS232 device driver for the MSP430 microcontroller. - * - */ - -#include "contiki.h" -#include - -#include "contiki-esb.h" -#include "isr_compat.h" - -static int (* input_handler)(unsigned char) = NULL; - -/*---------------------------------------------------------------------------*/ -ISR(UART1RX, rs232_rx_usart1) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - /* Check status register for receive errors. - before reading RXBUF since - it clears the error and interrupt flags */ - if(!(URCTL1 & RXERR) && input_handler != NULL) { - - if(input_handler(RXBUF1)) { - LPM4_EXIT; - } - } else { - /* Else read out the char to clear the I-flags, etc. */ - RXBUF1; - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -rs232_init(void) -{ - - /* RS232 */ - UCTL1 = CHAR; /* 8-bit character */ - UTCTL1 = SSEL1; /* UCLK = MCLK */ - - rs232_set_speed(RS232_57600); - - input_handler = NULL; - - ME2 |= (UTXE1 | URXE1); /* Enable USART1 TXD/RXD */ - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ -} -/*---------------------------------------------------------------------------*/ -void -rs232_send(char c) -{ - - ENERGEST_ON(ENERGEST_TYPE_SERIAL); - /* Loop until the transmission buffer is available. */ - while((IFG2 & UTXIFG1) == 0) { - } - - /* Transmit the data. */ - TXBUF1 = c; - ENERGEST_OFF(ENERGEST_TYPE_SERIAL); -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_speed(unsigned char speed) -{ - if(speed == RS232_19200) { - /* Set RS232 to 19200 */ - UBR01 = 0x80; /* 2,457MHz/19200 = 128 -> 0x80 */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x00; /* no modulation */ - } else if(speed == RS232_38400) { - /* Set RS232 to 38400 */ - UBR01 = 0x40; /* 2,457MHz/38400 = 64 -> 0x40 */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x00; /* no modulation */ - } else if(speed == RS232_57600) { - UBR01 = 0x2a; /* 2,457MHz/57600 = 42.7 -> 0x2A */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x5b; /* */ - } else if(speed == RS232_115200) { - UBR01 = 0x15; /* 2,457MHz/115200 = 21.4 -> 0x15 */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x4a; /* */ - } else { - rs232_set_speed(RS232_57600); - } - -} -/*---------------------------------------------------------------------------*/ -void -rs232_print(char *cptr) -{ - while(*cptr != 0) { - rs232_send(*cptr); - ++cptr; - } -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_input(int (*f)(unsigned char)) -{ - input_handler = f; -} -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - rs232_send(c); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/platform/esb/dev/rs232.h b/platform/esb/dev/rs232.h deleted file mode 100644 index 6f7c0383a..000000000 --- a/platform/esb/dev/rs232.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** \addtogroup esb - * @{ */ - -/** - * \defgroup esbrs232 ESB RS232 - * - * @{ - */ - -/** - * \file - * Header file for MSP430 RS232 driver. - * \author Adam Dunkels - * - */ -#ifndef __RS232_H__ -#define __RS232_H__ - - -#define RS232_19200 1 -#define RS232_38400 2 -#define RS232_57600 3 -#define RS232_115200 4 - -/** - * \brief Initialize the RS232 module - * - * This function is called from the boot up code to - * initalize the RS232 module. - */ -void rs232_init(void); - -/** - * \brief Set an input handler for incoming RS232 data - * \param f A pointer to a byte input handler - * - * This function sets the input handler for incoming RS232 - * data. The input handler function is called for every - * incoming data byte. The function is called from the - * RS232 interrupt handler, so care must be taken when - * implementing the input handler to avoid race - * conditions. - * - * The return value of the input handler affects the sleep - * mode of the CPU: if the input handler returns non-zero - * (true), the CPU is awakened to let other processing - * take place. If the input handler returns zero, the CPU - * is kept sleeping. - */ -void rs232_set_input(int (* f)(unsigned char)); - -/** - * \brief Configure the speed of the RS232 hardware - * \param speed The speed - * - * This function configures the speed of the RS232 - * hardware. The allowed parameters are RS232_19200, - * RS232_38400, RS232_57600, and RS232_115200. - */ -void rs232_set_speed(unsigned char speed); - -/** - * \brief Print a text string on RS232 - * \param str A pointer to the string that is to be printed - * - * This function prints a string to RS232. The string must - * be terminated by a null byte. The RS232 module must be - * correctly initalized and configured for this function - * to work. - */ -void rs232_print(char *str); - -/** - * \brief Print a character on RS232 - * \param c The character to be printed - * - * This function prints a character to RS232. The RS232 - * module must be correctly initalized and configured for - * this function to work. - */ -void rs232_send(char c); - -#endif /* __RS232_H__ */ - -/** @} */ -/** @} */ diff --git a/platform/esb/dev/sound-sensor.c b/platform/esb/dev/sound-sensor.c deleted file mode 100644 index 6ac134754..000000000 --- a/platform/esb/dev/sound-sensor.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#include "contiki.h" -#include "dev/sound-sensor.h" -#include "dev/irq.h" -#include - -#define MIC_MIN_SENS 150 -#define SAMPLE 1 - -const struct sensors_sensor sound_sensor; - -static unsigned int sound, micdiff, micmax, avgmax; -static int8_t mode; -static int8_t sample_div; -static int8_t ctr; -static int16_t *sample_buffer; -static int buffer_size; -static int buf_pos; - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - micdiff = micdiff + abs(ADC12MEM4 - sound) - (micdiff >> 3); - sound = ADC12MEM4; - - if(mode == SAMPLE) { - ctr++; - if(ctr >= sample_div) { - ctr = 0; - sample_buffer[buf_pos++] = sound; - if(buf_pos >= buffer_size) { - mode = 0; - sensors_changed(&sound_sensor); - return 1; - } - } - } - -/* if(micdiff > MIC_MIN_SENS) { */ -/* sensors_changed(&sound_sensor); */ -/* } */ - -/* if(micdiff > (avgmax >> 2)) { */ -/* if(micdiff % 10 == 0) beep_beep(10); */ -/* // Subtract a little... */ -/* micdiff = micdiff - (micdiff >> 4); */ -/* } */ - -/* if(micmax < micdiff) { */ -/* micmax = micdiff; */ -/* } */ - -/* if(micdiff > 2000) { */ -/* leds_on(LEDS_GREEN); */ -/* } */ -/* if(micdiff > 3000) { */ -/* leds_on(LEDS_YELLOW); */ -/* } */ -/* if(micdiff > 4000) { */ -/* leds_on(LEDS_RED); */ -/* } */ - - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* try returning the max to see what values we get... */ -/* int mictmp = micmax; */ -/* avgmax = avgmax + micmax - (avgmax >> 3); */ -/* micmax = micdiff; */ -/* return mictmp; */ - return micdiff; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - /* Initialization of ADC12 done by irq */ - mode = 0; - buffer_size = 0; - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!irq_adc12_active(4)) { - sound = micdiff = micmax = 0; - mode = 0; - ctr = 0; - sample_div = 0; - buf_pos = 0; - avgmax = 5000; - irq_adc12_activate(4, (INCH_0 + SREF_0), irq); - } - } else { - irq_adc12_deactivate(4); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - return irq_adc12_active(4); - case SENSORS_READY: - return (mode != SAMPLE) && irq_adc12_active(4); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -sound_sensor_start_sample(void) -{ - if(buffer_size > 0) { - buf_pos = 0; - ctr = 0; - mode = SAMPLE; - } -} -/*---------------------------------------------------------------------------*/ -void -sound_sensor_set_buffer(int16_t *buffer, int buf_size, int divider) -{ - sample_buffer = buffer; - buffer_size = buf_size; - sample_div = divider; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(sound_sensor, SOUND_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/sound-sensor.h b/platform/esb/dev/sound-sensor.h deleted file mode 100644 index 48d4e27cd..000000000 --- a/platform/esb/dev/sound-sensor.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __SOUND_SENSOR_H__ -#define __SOUND_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor sound_sensor; - -#define SOUND_SENSOR "Sound" - -void sound_sensor_start_sample(); -void sound_sensor_set_buffer(int16_t *buffer, int buf_size, int divider); - -#endif /* __SOUND_SENSOR_H__ */ diff --git a/platform/esb/dev/temperature-sensor.c b/platform/esb/dev/temperature-sensor.c deleted file mode 100644 index 9bb1ff532..000000000 --- a/platform/esb/dev/temperature-sensor.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/02/08 00:00:45 $ - * $Revision: 1.3 $ - */ - -#include "dev/temperature-sensor.h" -#include "dev/ds1629.h" - -const struct sensors_sensor temperature_sensor; -static int active; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - unsigned int temp; - signed int t; - - t = ds1629_temperature(); - temp = ((t / 128) * 50); - return temp; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - active = 0; - ds1629_init(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!active) { - active = 1; - ds1629_start(); - } - } else { - active = 0; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return active; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/temperature-sensor.h b/platform/esb/dev/temperature-sensor.h deleted file mode 100644 index 6aa37c42e..000000000 --- a/platform/esb/dev/temperature-sensor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2006/06/18 07:49:33 $ - * $Revision: 1.1 $ - */ - -#ifndef __TEMPERATURE_SENSOR_H__ -#define __TEMPERATURE_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor temperature_sensor; - -#define TEMPERATURE_SENSOR "Temperature" - -#endif /* __TEMPERATURE_SENSOR_H__ */ diff --git a/platform/esb/dev/tr1001-gcr.c b/platform/esb/dev/tr1001-gcr.c deleted file mode 100644 index d751babf2..000000000 --- a/platform/esb/dev/tr1001-gcr.c +++ /dev/null @@ -1,787 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -/** - * \addtogroup esb - * @{ - */ - -/** - * \defgroup tr1001 TR1001 radio tranciever device driver - * @{ - */ - -/** - * \file - * Device driver and packet framing for the RFM-TR1001 radio module. - * \author Adam Dunkels - * - * This file implements a device driver for the RFM-TR1001 radio - * tranciever. - * - */ - -#include "contiki.h" -#include "contiki-esb.h" - -#include "dev/tr1001.h" -#include "dev/radio-sensor.h" -#include "lib/gcr.h" -#include "lib/crc16.h" -#include "net/netstack.h" -#include "net/rime/rimestats.h" -#include "isr_compat.h" - -#include - -#ifdef TR1001_CONF_BEEP_ON_BAD_CRC -#define BEEP_ON_BAD_CRC TR1001_CONF_BEEP_ON_BAD_CRC -#else -#define BEEP_ON_BAD_CRC 1 -#endif /* TR1001_CONF_BEEP_ON_BAD_CRC */ - -#if BEEP_ON_BAD_CRC -#include "dev/beep.h" -#define BEEP_BEEP(t) beep_beep(t) -#else -#define BEEP_BEEP(t) -#endif /* BEEP_ON_BAD_CRC */ - -#define RXSTATE_READY 0 -#define RXSTATE_RECEIVING 1 -#define RXSTATE_FULL 2 - -#define SYNCH1 0x3c -#define SYNCH2 0x03 - -#ifdef TR1001_CONF_BUFFER_SIZE -#define RXBUFSIZE TR1001_CONF_BUFFER_SIZE -#else -#define RXBUFSIZE PACKETBUF_SIZE -#endif /* TR1001_CONF_BUFFER_SIZE */ - -/* - * Pending data to send when using prepare/transmit functions. - */ -static const void *pending_data; - -/* - * The buffer which holds incoming data. - */ -unsigned char tr1001_rxbuf[RXBUFSIZE]; - -/* - * The length of the packet that currently is being received. - */ -static unsigned short tr1001_rxlen = 0; - -/* - * The reception state. - */ -volatile unsigned char tr1001_rxstate = RXSTATE_READY; - -static uint16_t rxcrc, rxcrctmp; - -/* - * The structure of the packet header. - */ -struct tr1001_hdr { - uint8_t len[2]; /**< The 16-bit length of the packet in network byte - order. */ -}; - -/* - * The length of the packet header. - */ -#define TR1001_HDRLEN sizeof(struct tr1001_hdr) - -#define OFF 0 -#define ON 1 -static uint8_t onoroff = OFF; - -#define NUM_SYNCHBYTES 4 - -void tr1001_default_rxhandler(unsigned char c); -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char c)); -static struct pt rxhandler_pt; - -/* - * This timer is used to keep track of when the last byte was received - * over the radio. If the inter-byte time is too large, the packet - * currently being received is discarded and a new packet reception is - * initiated. - */ -static struct timer rxtimer; - -static unsigned short tmp_sstrength, sstrength; -static unsigned short tmp_count; - -#define DEBUG 0 -#if DEBUG -#include -#define LOG(...) printf(__VA_ARGS__) -#else -#define LOG(...) -#endif - -#define GCRLOG(...) /* printf(__VA_ARGS__)*/ - -/*---------------------------------------------------------------------------*/ -PROCESS(tr1001_process, "TR1001 driver"); -/*---------------------------------------------------------------------------*/ - -static int prepare_packet(const void *data, unsigned short len); -static int transmit_packet(unsigned short len); -static int receiving_packet(void); -static int pending_packet(void); -static int channel_clear(void); -static int tr1001_on(void); -static int tr1001_off(void); - -const struct radio_driver tr1001_driver = { - tr1001_init, - prepare_packet, - transmit_packet, - tr1001_send, - tr1001_read, - channel_clear, - receiving_packet, - pending_packet, - tr1001_on, - tr1001_off -}; - -/*---------------------------------------------------------------------------*/ -/* - * Turn on data transmission in On-Off-Keyed mode. - */ -static void -txook(void) -{ - P3SEL = 0xf0; - P5OUT |= 0x40; - P5OUT &= 0x7f; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn on data reception for the radio tranceiver. - */ -static void -rxon(void) -{ - P3SEL = 0xe0; - P5OUT |= 0xc0; - - /* Enable the receiver. */ - ME1 |= URXE0; - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - -} -/*---------------------------------------------------------------------------*/ -/* - * Turn off data reception for the radio tranceiver. - */ -static void -rxoff(void) -{ - P5OUT &= 0x3f; - - /* Disable the receiver. */ - ME1 &= ~URXE0; - - /* Turn off receive interrupt. */ - IE1 &= ~URXIE0; -} -/*---------------------------------------------------------------------------*/ -/* - * Clear the recevie buffer and reset the receiver state. - */ -static void -rxclear(void) -{ - tr1001_rxstate = RXSTATE_READY; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver off. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_off(void) -{ - if(onoroff == OFF) { - return 1; - } - onoroff = OFF; - rxoff(); - rxclear(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver on. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_on(void) -{ - if(onoroff == ON) { - return 1; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - onoroff = ON; - rxon(); - rxclear(); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data over the radio. - * - * \param b The byte to be sent. - */ -static void -send(unsigned char b) -{ - clock_time_t start; - - start = clock_time(); - - /* Wait until the USART0 TX buffer is ready. */ - while((IFG1 & UTXIFG0) == 0) { - /* Wait no more than one second. */ - if((clock_time_t)(clock_time() - start) > (clock_time_t)CLOCK_SECOND) { - break; - } - } - - /* Send the byte. */ - TXBUF0 = b; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data and its logical negation (all bits inverted) - * over the radio. - * - * \param b The byte to be sent. - */ -static void -sendx(unsigned char b) -{ - gcr_encode(b); - GCRLOG("(%02x)", b); - - while(gcr_get_encoded(&b)) { - send(b); - GCRLOG("%02x ", b); - } -} - -static uint16_t -sendx_crc16(unsigned char b, uint16_t crcacc) -{ - gcr_encode(b); - GCRLOG("(%02x)", b); - crcacc = crc16_add(b, crcacc); - while(gcr_get_encoded(&b)) { - send(b); - GCRLOG("C%02x ", b); - } - return crcacc; -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_txpower(unsigned char p) -{ - int i; - - /* Clamp maximum power. */ - if(p > 100) { - p = 100; - } - - /* First, run the potentiometer down to zero so that we know the - start value of the potentiometer. */ - P2OUT &= 0xDF; /* P25 = 0 (down selected) */ - P2OUT &= 0xBF; /* P26 = 0 (chipselect on) */ - for(i = 0; i < 102; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - - /* Now, start to increase the value of the potentiometer until it - reaches the desired value.*/ - - P2OUT |= 0x20; /* P25 = 1 (up selected) */ - for(i = 0; i < p; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - P2OUT |= 0x40; /* P26 = 1 (chipselect off) */ -} -/*---------------------------------------------------------------------------*/ -int -tr1001_init(void) -{ - PT_INIT(&rxhandler_pt); - - onoroff = OFF; - - UCTL0 = CHAR; /* 8-bit character */ - UTCTL0 = SSEL1; /* UCLK = SMCLK */ - - tr1001_set_speed(TR1001_19200); - - ME1 |= UTXE0 + URXE0; /* Enable USART0 TXD/RXD */ - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - - timer_set(&rxtimer, CLOCK_SECOND / 4); - - - tr1001_on(); - tr1001_set_txpower(100); - - /* Reset reception state. */ - rxclear(); - - process_start(&tr1001_process, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -ISR(UART0RX, tr1001_rxhandler) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - tr1001_default_rxhandler_pt(RXBUF0); - if(tr1001_rxstate == RXSTATE_FULL) { - LPM4_EXIT; - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static void -dump_packet(int len) -{ - int i; - for(i = 0; i < len; ++i) { - LOG("%d: 0x%02x\n", i, tr1001_rxbuf[i]); - } -} -#endif /* DEBUG */ -/*---------------------------------------------------------------------------*/ -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char incoming_byte)) -{ - static unsigned char rxtmp, tmppos; - - if(timer_expired(&rxtimer) && tr1001_rxstate != RXSTATE_FULL) { - PT_INIT(&rxhandler_pt); - } - - timer_restart(&rxtimer); - - if(tr1001_rxstate == RXSTATE_RECEIVING) { - unsigned short signal = radio_sensor.value(0); - tmp_sstrength += (signal >> 2); - tmp_count++; - } - - PT_BEGIN(&rxhandler_pt); - - while(1) { - - /* Reset reception state. */ - rxclear(); - - /* Wait until we receive the first syncronization byte. */ - PT_WAIT_UNTIL(&rxhandler_pt, incoming_byte == SYNCH1); - - tr1001_rxstate = RXSTATE_RECEIVING; - - /* Read all incoming syncronization bytes. */ - PT_WAIT_WHILE(&rxhandler_pt, incoming_byte == SYNCH1); - - /* We should receive the second synch byte by now, otherwise we'll - restart the protothread. */ - if(incoming_byte != SYNCH2) { - PT_RESTART(&rxhandler_pt); - } - - /* Start signal strength measurement */ - tmp_sstrength = 0; - tmp_count = 0; - - /* Reset the CRC. */ - rxcrc = 0xffff; - - gcr_init(); - GCRLOG("RECV: "); - - /* Read packet header. */ - for(tmppos = 0; tmppos < TR1001_HDRLEN; ++tmppos) { - - /* Wait for the first byte of the packet to arrive. */ - do { - PT_YIELD(&rxhandler_pt); - GCRLOG("(%02x) ", incoming_byte); - - gcr_decode(incoming_byte); - /* If the incoming byte isn't a valid GCR encoded byte, - we start again from the beginning. */ - if(!gcr_valid()) { - BEEP_BEEP(1000); - LOG("Incorrect GCR in header at byte %d/1 %x\n", tmppos, incoming_byte); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - } while(!gcr_get_decoded(&rxtmp)); - GCRLOG("%02x ", rxtmp); - - tr1001_rxbuf[tmppos] = rxtmp; - /* Calculate the CRC. */ - rxcrc = crc16_add(rxtmp, rxcrc); - } - - /* Since we've got the header, we can grab the length from it. */ - tr1001_rxlen = ((((struct tr1001_hdr *)tr1001_rxbuf)->len[0] << 8) + - ((struct tr1001_hdr *)tr1001_rxbuf)->len[1]); - - /* If the length is longer than we can handle, we'll start from - the beginning. */ - if(tmppos + tr1001_rxlen > sizeof(tr1001_rxbuf)) { - RIMESTATS_ADD(toolong); - PT_RESTART(&rxhandler_pt); - } - - /* Read packet data. */ - for(; tmppos < tr1001_rxlen + TR1001_HDRLEN; ++tmppos) { - - /* Wait for the first byte of the packet to arrive. */ - do { - PT_YIELD(&rxhandler_pt); - GCRLOG("(%02x)", incoming_byte); - - gcr_decode(incoming_byte); - /* If the incoming byte isn't a valid Manchester encoded byte, - we start again from the beinning. */ - if(!gcr_valid()) { - BEEP_BEEP(1000); - LOG("Incorrect GCR 0x%02x at byte %d/1\n", incoming_byte, - tmppos - TR1001_HDRLEN); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - } while(!gcr_get_decoded(&rxtmp)); - - GCRLOG("%02x ", rxtmp); - - tr1001_rxbuf[tmppos] = rxtmp; - /* Calculate the CRC. */ - rxcrc = crc16_add(rxtmp, rxcrc); - } - - /* Read the frame CRC. */ - for(tmppos = 0; tmppos < 2; ++tmppos) { - do { - PT_YIELD(&rxhandler_pt); - GCRLOG("(%02x)", incoming_byte); - - gcr_decode(incoming_byte); - if(!gcr_valid()) { - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - } while(!gcr_get_decoded(&rxtmp)); - GCRLOG("%02x ", rxtmp); - - rxcrctmp = (rxcrctmp << 8) | rxtmp; - } - GCRLOG("\n"); - - if(rxcrctmp == rxcrc) { - /* A full packet has been received and the CRC checks out. We'll - request the driver to take care of the incoming data. */ - - RIMESTATS_ADD(llrx); - process_poll(&tr1001_process); - - /* We'll set the receive state flag to signal that a full frame - is present in the buffer, and we'll wait until the buffer has - been taken care of. */ - tr1001_rxstate = RXSTATE_FULL; - PT_WAIT_UNTIL(&rxhandler_pt, tr1001_rxstate != RXSTATE_FULL); - - } else { - LOG("Incorrect CRC\n"); - BEEP_BEEP(1000); - RIMESTATS_ADD(badcrc); - } - } - PT_END(&rxhandler_pt); -} -/*---------------------------------------------------------------------------*/ -static int -prepare_packet(const void *data, unsigned short len) -{ - pending_data = data; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit_packet(unsigned short len) -{ - int ret = RADIO_TX_ERR; - if(pending_data != NULL) { - ret = tr1001_send(pending_data, len); - pending_data = NULL; - } - return ret; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_send(const void *packet, unsigned short len) -{ - int i; - uint16_t crc16; - - LOG("tr1001_send: sending %d bytes\n", len); - - if(onoroff == ON) { - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - } - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - - /* Prepare the transmission. */ - - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x3ff); - - - /* Check that we don't currently are receiving a packet, and if so - we wait until the reception has been completed. Reception is done - with interrupts so it is OK for us to wait in a while() loop. */ - - while(tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer)) { - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x7ff); - } - - - /* Turn on OOK mode with transmission. */ - txook(); - - /* According to the datasheet, the transmitter must wait for 12 us - in order to settle. Empirical tests show that is it better to - wait for something like 283 us... */ - clock_delay(200); - - - /* Transmit preamble and synch bytes. */ - for(i = 0; i < 20; ++i) { - send(0xaa); - } - /* send(0xaa); - send(0xaa);*/ - send(0xff); - - for(i = 0; i < NUM_SYNCHBYTES; ++i) { - send(SYNCH1); - } - send(SYNCH2); - - crc16 = 0xffff; - - gcr_init(); - - GCRLOG("SEND: "); - - /* Send packet header. */ - crc16 = sendx_crc16(len >> 8, crc16); - crc16 = sendx_crc16(len & 0xff, crc16); - - /* Send packet data. */ - for(i = 0; i < len; ++i) { - crc16 = sendx_crc16(((uint8_t *)packet)[i], crc16); - } - - /* Send CRC */ - sendx(crc16 >> 8); - sendx(crc16 & 0xff); - - /* if not encoding has sent all bytes - let it send another GCR specific */ - if (!gcr_finished()) { - sendx(0); - } - - GCRLOG("\n"); - - /* Send trailing bytes. */ - send(0x33); - send(0xcc); - send(0x33); - send(0xcc); - - /* Turn on (or off) reception again. */ - if(onoroff == ON) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - rxon(); - rxclear(); - } else { - rxoff(); - rxclear(); - } - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - RIMESTATS_ADD(lltx); - - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_read(void *buf, unsigned short bufsize) -{ - unsigned short tmplen; - - if(tr1001_rxstate == RXSTATE_FULL) { - -#if DEBUG - dump_packet(tr1001_rxlen + 2); -#endif /* DEBUG */ - - tmplen = tr1001_rxlen; - - if(tmplen > bufsize) { - LOG("tr1001_read: too large packet: %d/%d bytes\n", tmplen, bufsize); - rxclear(); - RIMESTATS_ADD(toolong); - return -1; - } - - memcpy(buf, &tr1001_rxbuf[TR1001_HDRLEN], tmplen); - - /* header + content + CRC */ - sstrength = (tmp_count ? ((tmp_sstrength / tmp_count) << 2) : 0); - - rxclear(); - - LOG("tr1001_read: got %d bytes\n", tmplen); - - return tmplen; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - return tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer); -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return tr1001_rxstate == RXSTATE_FULL; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - /* TODO add CCA functionality */ - return 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tr1001_process, ev, data) -{ - int len; - PROCESS_BEGIN(); - - /* Reset reception state now that the process is ready to receive data. */ - rxclear(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - packetbuf_clear(); - len = tr1001_read(packetbuf_dataptr(), PACKETBUF_SIZE); - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_RDC.input(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_speed(unsigned char speed) -{ - - if(speed == TR1001_19200) { - /* Set TR1001 to 19200 */ - UBR00 = 0x80; /* 2,457MHz/19200 = 128 -> 0x80 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_38400) { - /* Set TR1001 to 38400 */ - UBR00 = 0x40; /* 2,457MHz/38400 = 64 -> 0x40 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_57600) { - UBR00 = 0x2a; /* 2,457MHz/57600 = 42.7 -> 0x2A */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x5b; /* */ - } else if(speed == TR1001_115200) { - UBR00 = 0x15; /* 2,457MHz/115200 = 21.4 -> 0x15 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x4a; /* */ - } else { - tr1001_set_speed(TR1001_19200); - } -} -/*---------------------------------------------------------------------------*/ -unsigned short -tr1001_sstrength(void) -{ - return sstrength; -} -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/platform/esb/dev/tr1001.c b/platform/esb/dev/tr1001.c deleted file mode 100644 index 5bee9515f..000000000 --- a/platform/esb/dev/tr1001.c +++ /dev/null @@ -1,773 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -/** - * \addtogroup esb - * @{ - */ - -/** - * \defgroup tr1001 TR1001 radio tranciever device driver - * @{ - */ - -/** - * \file - * Device driver and packet framing for the RFM-TR1001 radio module. - * \author Adam Dunkels - * - * This file implements a device driver for the RFM-TR1001 radio - * tranciever. - * - */ - -#include "contiki.h" -#include "contiki-esb.h" - -#include "dev/tr1001.h" -#include "dev/radio-sensor.h" -#include "lib/me.h" -#include "lib/crc16.h" -#include "net/netstack.h" -#include "net/rime/rimestats.h" -#include "isr_compat.h" - -#include - -#ifdef TR1001_CONF_BEEP_ON_BAD_CRC -#define BEEP_ON_BAD_CRC TR1001_CONF_BEEP_ON_BAD_CRC -#else -#define BEEP_ON_BAD_CRC 1 -#endif /* TR1001_CONF_BEEP_ON_BAD_CRC */ - -#if BEEP_ON_BAD_CRC -#include "dev/beep.h" -#define BEEP_BEEP(t) beep_beep(t) -#else -#define BEEP_BEEP(t) -#endif /* BEEP_ON_BAD_CRC */ - -#define RXSTATE_READY 0 -#define RXSTATE_RECEIVING 1 -#define RXSTATE_FULL 2 - -#define SYNCH1 0x3c -#define SYNCH2 0x03 - -#ifdef TR1001_CONF_BUFFER_SIZE -#define RXBUFSIZE TR1001_CONF_BUFFER_SIZE -#else -#define RXBUFSIZE PACKETBUF_SIZE -#endif /* TR1001_CONF_BUFFER_SIZE */ - -/* - * Pending data to send when using prepare/transmit functions. - */ -static const void *pending_data; - -/* - * The buffer which holds incoming data. - */ -unsigned char tr1001_rxbuf[RXBUFSIZE]; - -/* - * The length of the packet that currently is being received. - */ -static unsigned short tr1001_rxlen = 0; - -/* - * The reception state. - */ -volatile unsigned char tr1001_rxstate = RXSTATE_READY; - -static uint16_t rxcrc, rxcrctmp; - -/* - * The structure of the packet header. - */ -struct tr1001_hdr { - uint8_t len[2]; /**< The 16-bit length of the packet in network byte - order. */ -}; - -/* - * The length of the packet header. - */ -#define TR1001_HDRLEN sizeof(struct tr1001_hdr) - -#define OFF 0 -#define ON 1 -static uint8_t onoroff = OFF; - -#define NUM_SYNCHBYTES 4 - -void tr1001_default_rxhandler(unsigned char c); -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char c)); -static struct pt rxhandler_pt; - -/* - * This timer is used to keep track of when the last byte was received - * over the radio. If the inter-byte time is too large, the packet - * currently being received is discarded and a new packet reception is - * initiated. - */ -static struct timer rxtimer; - -static unsigned short tmp_sstrength, sstrength; -static unsigned short tmp_count; - -#define DEBUG 0 -#if DEBUG -#include -#define LOG(...) printf(__VA_ARGS__) -#else -#define LOG(...) -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(tr1001_process, "TR1001 driver"); -/*---------------------------------------------------------------------------*/ - -static int prepare_packet(const void *data, unsigned short len); -static int transmit_packet(unsigned short len); -static int receiving_packet(void); -static int pending_packet(void); -static int channel_clear(void); -static int tr1001_on(void); -static int tr1001_off(void); - -const struct radio_driver tr1001_driver = { - tr1001_init, - prepare_packet, - transmit_packet, - tr1001_send, - tr1001_read, - channel_clear, - receiving_packet, - pending_packet, - tr1001_on, - tr1001_off -}; - -/*---------------------------------------------------------------------------*/ -/* - * Turn on data transmission in On-Off-Keyed mode. - */ -static void -txook(void) -{ - P3SEL = 0xf0; - P5OUT |= 0x40; - P5OUT &= 0x7f; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn on data reception for the radio tranceiver. - */ -static void -rxon(void) -{ - P3SEL = 0xe0; - P5OUT |= 0xc0; - - /* Enable the receiver. */ - ME1 |= URXE0; - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - -} -/*---------------------------------------------------------------------------*/ -/* - * Turn off data reception for the radio tranceiver. - */ -static void -rxoff(void) -{ - P5OUT &= 0x3f; - - /* Disable the receiver. */ - ME1 &= ~URXE0; - - /* Turn off receive interrupt. */ - IE1 &= ~URXIE0; -} -/*---------------------------------------------------------------------------*/ -/* - * Clear the recevie buffer and reset the receiver state. - */ -static void -rxclear(void) -{ - tr1001_rxstate = RXSTATE_READY; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver off. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_off(void) -{ - if(onoroff == OFF) { - return 1; - } - onoroff = OFF; - rxoff(); - rxclear(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver on. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_on(void) -{ - if(onoroff == ON) { - return 1; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - onoroff = ON; - rxon(); - rxclear(); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data over the radio. - * - * \param b The byte to be sent. - */ -static void -send(unsigned char b) -{ - clock_time_t start; - - start = clock_time(); - - /* Wait until the USART0 TX buffer is ready. */ - while((IFG1 & UTXIFG0) == 0) { - /* Wait no more than one second. */ - if((clock_time_t)(clock_time() - start) > (clock_time_t)CLOCK_SECOND) { - break; - } - } - - /* Send the byte. */ - TXBUF0 = b; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data and its logical negation (all bits inverted) - * over the radio. - * - * \param b The byte to be sent. - */ -static void -send2(unsigned char b) -{ - uint16_t m; - m = me_encode(b); - send(m >> 8); - send(m & 0xff); -} -static uint16_t -send2_crc16(unsigned char b, uint16_t crcacc) -{ - uint16_t m; - m = me_encode(b); - send(m >> 8); - send(m & 0xff); - return crc16_add(b, crcacc); -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_txpower(unsigned char p) -{ - int i; - - /* Clamp maximum power. */ - if(p > 100) { - p = 100; - } - - /* First, run the potentiometer down to zero so that we know the - start value of the potentiometer. */ - P2OUT &= 0xDF; /* P25 = 0 (down selected) */ - P2OUT &= 0xBF; /* P26 = 0 (chipselect on) */ - for(i = 0; i < 102; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - - /* Now, start to increase the value of the potentiometer until it - reaches the desired value.*/ - - P2OUT |= 0x20; /* P25 = 1 (up selected) */ - for(i = 0; i < p; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - P2OUT |= 0x40; /* P26 = 1 (chipselect off) */ -} -/*---------------------------------------------------------------------------*/ -int -tr1001_init(void) -{ - PT_INIT(&rxhandler_pt); - - onoroff = OFF; - - UCTL0 = CHAR; /* 8-bit character */ - UTCTL0 = SSEL1; /* UCLK = SMCLK */ - - tr1001_set_speed(TR1001_19200); - - ME1 |= UTXE0 + URXE0; /* Enable USART0 TXD/RXD */ - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - - timer_set(&rxtimer, CLOCK_SECOND / 4); - - - tr1001_on(); - tr1001_set_txpower(100); - - /* Reset reception state. */ - rxclear(); - - process_start(&tr1001_process, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -ISR(UART0RX, tr1001_rxhandler) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - tr1001_default_rxhandler_pt(RXBUF0); - if(tr1001_rxstate == RXSTATE_FULL) { - LPM4_EXIT; - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static void -dump_packet(int len) -{ - int i; - for(i = 0; i < len; ++i) { - LOG("%d: 0x%02x\n", i, tr1001_rxbuf[i]); - } -} -#endif /* DEBUG */ -/*---------------------------------------------------------------------------*/ -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char incoming_byte)) -{ - static unsigned char rxtmp, tmppos; - - if(timer_expired(&rxtimer) && tr1001_rxstate != RXSTATE_FULL) { - PT_INIT(&rxhandler_pt); - } - - timer_restart(&rxtimer); - - if(tr1001_rxstate == RXSTATE_RECEIVING) { - unsigned short signal = radio_sensor.value(0); - tmp_sstrength += (signal >> 2); - tmp_count++; - } - - PT_BEGIN(&rxhandler_pt); - - while(1) { - - /* Reset reception state. */ - rxclear(); - - /* Wait until we receive the first syncronization byte. */ - PT_WAIT_UNTIL(&rxhandler_pt, incoming_byte == SYNCH1); - - tr1001_rxstate = RXSTATE_RECEIVING; - - /* Read all incoming syncronization bytes. */ - PT_WAIT_WHILE(&rxhandler_pt, incoming_byte == SYNCH1); - - /* We should receive the second synch byte by now, otherwise we'll - restart the protothread. */ - if(incoming_byte != SYNCH2) { - PT_RESTART(&rxhandler_pt); - } - - /* Start signal strength measurement */ - tmp_sstrength = 0; - tmp_count = 0; - - /* Reset the CRC. */ - rxcrc = 0xffff; - - /* Read packet header. */ - for(tmppos = 0; tmppos < TR1001_HDRLEN; ++tmppos) { - - /* Wait for the first byte of the packet to arrive. */ - PT_YIELD(&rxhandler_pt); - - /* If the incoming byte isn't a valid Manchester encoded byte, - we start again from the beginning. */ - if(!me_valid(incoming_byte)) { - BEEP_BEEP(1000); - LOG("Incorrect manchester in header at byte %d/1\n", tmppos); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - rxtmp = me_decode8(incoming_byte); - - /* Wait for the next byte to arrive. */ - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - BEEP_BEEP(1000); - LOG("Incorrect manchester in header at byte %d/2\n", tmppos); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - /* Put together the two bytes into a single Manchester decoded - byte. */ - - tr1001_rxbuf[tmppos] = (rxtmp << 4) | me_decode8(incoming_byte); - - /* Calculate the CRC. */ - rxcrc = crc16_add(tr1001_rxbuf[tmppos], rxcrc); - - - } - - /* Since we've got the header, we can grab the length from it. */ - tr1001_rxlen = ((((struct tr1001_hdr *)tr1001_rxbuf)->len[0] << 8) + - ((struct tr1001_hdr *)tr1001_rxbuf)->len[1]); - - /* If the length is longer than we can handle, we'll start from - the beginning. */ - if(tmppos + tr1001_rxlen > sizeof(tr1001_rxbuf)) { - RIMESTATS_ADD(toolong); - PT_RESTART(&rxhandler_pt); - } - - /* Read packet data. */ - for(; tmppos < tr1001_rxlen + TR1001_HDRLEN; ++tmppos) { - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - LOG("Incorrect manchester 0x%02x at byte %d/1\n", incoming_byte, - tmppos - TR1001_HDRLEN); - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - rxtmp = me_decode8(incoming_byte); - - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - LOG("Incorrect manchester at byte %d/2\n", tmppos - TR1001_HDRLEN); - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - tr1001_rxbuf[tmppos] = (rxtmp << 4) | me_decode8(incoming_byte); - rxcrc = crc16_add(tr1001_rxbuf[tmppos], rxcrc); - - } - - /* Read the frame CRC. */ - for(tmppos = 0; tmppos < 4; ++tmppos) { - - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - rxcrctmp = (rxcrctmp << 4) | me_decode8(incoming_byte); - } - - if(rxcrctmp == rxcrc) { - /* A full packet has been received and the CRC checks out. We'll - request the driver to take care of the incoming data. */ - - RIMESTATS_ADD(llrx); - process_poll(&tr1001_process); - - /* We'll set the receive state flag to signal that a full frame - is present in the buffer, and we'll wait until the buffer has - been taken care of. */ - tr1001_rxstate = RXSTATE_FULL; - PT_WAIT_UNTIL(&rxhandler_pt, tr1001_rxstate != RXSTATE_FULL); - - } else { - LOG("Incorrect CRC\n"); - BEEP_BEEP(1000); - RIMESTATS_ADD(badcrc); - } - } - PT_END(&rxhandler_pt); -} -/*---------------------------------------------------------------------------*/ -static int -prepare_packet(const void *data, unsigned short len) -{ - pending_data = data; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit_packet(unsigned short len) -{ - int ret = RADIO_TX_ERR; - if(pending_data != NULL) { - ret = tr1001_send(pending_data, len); - pending_data = NULL; - } - return ret; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_send(const void *packet, unsigned short len) -{ - int i; - uint16_t crc16; - - LOG("tr1001_send: sending %d bytes\n", len); - - if(onoroff == ON) { - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - } - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - - /* Prepare the transmission. */ - - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x3ff); - - - /* Check that we don't currently are receiving a packet, and if so - we wait until the reception has been completed. Reception is done - with interrupts so it is OK for us to wait in a while() loop. */ - - while(tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer)) { - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x7ff); - } - - - /* Turn on OOK mode with transmission. */ - txook(); - - /* According to the datasheet, the transmitter must wait for 12 us - in order to settle. Empirical tests show that is it better to - wait for something like 283 us... */ - clock_delay(200); - - - /* Transmit preamble and synch bytes. */ - for(i = 0; i < 20; ++i) { - send(0xaa); - } - /* send(0xaa); - send(0xaa);*/ - send(0xff); - - for(i = 0; i < NUM_SYNCHBYTES; ++i) { - send(SYNCH1); - } - send(SYNCH2); - - crc16 = 0xffff; - - /* Send packet header. */ - crc16 = send2_crc16(len >> 8, crc16); - crc16 = send2_crc16(len & 0xff, crc16); - - /* Send packet data. */ - for(i = 0; i < len; ++i) { - crc16 = send2_crc16(((uint8_t *)packet)[i], crc16); - } - - /* Send CRC */ - send2(crc16 >> 8); - send2(crc16 & 0xff); - - /* Send trailing bytes. */ - send(0x33); - send(0xcc); - send(0x33); - send(0xcc); - - /* Turn on (or off) reception again. */ - if(onoroff == ON) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - rxon(); - rxclear(); - } else { - rxoff(); - rxclear(); - } - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - RIMESTATS_ADD(lltx); - - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_read(void *buf, unsigned short bufsize) -{ - unsigned short tmplen; - - if(tr1001_rxstate == RXSTATE_FULL) { - -#if DEBUG - dump_packet(tr1001_rxlen + 2); -#endif /* DEBUG */ - - tmplen = tr1001_rxlen; - - if(tmplen > bufsize) { - LOG("tr1001_read: too large packet: %d/%d bytes\n", tmplen, bufsize); - rxclear(); - RIMESTATS_ADD(toolong); - return -1; - } - - memcpy(buf, &tr1001_rxbuf[TR1001_HDRLEN], tmplen); - - /* header + content + CRC */ - sstrength = (tmp_count ? ((tmp_sstrength / tmp_count) << 2) : 0); - - rxclear(); - - LOG("tr1001_read: got %d bytes\n", tmplen); - - return tmplen; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - return tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer); -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return tr1001_rxstate == RXSTATE_FULL; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - /* TODO add CCA functionality */ - return 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tr1001_process, ev, data) -{ - int len; - PROCESS_BEGIN(); - - /* Reset reception state now that the process is ready to receive data. */ - rxclear(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - packetbuf_clear(); - len = tr1001_read(packetbuf_dataptr(), PACKETBUF_SIZE); - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_RDC.input(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_speed(unsigned char speed) -{ - - if(speed == TR1001_19200) { - /* Set TR1001 to 19200 */ - UBR00 = 0x80; /* 2,457MHz/19200 = 128 -> 0x80 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_38400) { - /* Set TR1001 to 38400 */ - UBR00 = 0x40; /* 2,457MHz/38400 = 64 -> 0x40 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_57600) { - UBR00 = 0x2a; /* 2,457MHz/57600 = 42.7 -> 0x2A */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x5b; /* */ - } else if(speed == TR1001_115200) { - UBR00 = 0x15; /* 2,457MHz/115200 = 21.4 -> 0x15 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x4a; /* */ - } else { - tr1001_set_speed(TR1001_19200); - } -} -/*---------------------------------------------------------------------------*/ -unsigned short -tr1001_sstrength(void) -{ - return sstrength; -} -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/platform/esb/dev/tr1001.h b/platform/esb/dev/tr1001.h deleted file mode 100644 index f9421b27e..000000000 --- a/platform/esb/dev/tr1001.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __TR1001_H__ -#define __TR1001_H__ - -#include "contiki-net.h" -#include "dev/radio.h" - -#include "contiki-conf.h" - -/** - * Radio driver for TR1001 - */ -extern const struct radio_driver tr1001_driver; - -/** - * Initialize the radio transceiver. - * - * Turns on reception of bytes and installs the receive interrupt - * handler. - */ -int tr1001_init(void); - -/** - * Set the speed of the TR1001 radio device. - * - * This function sets the speed of the TR1001 radio transceiver. Both - * the sender and the receiver must have the same speed for - * communication to work. - * - * \param speed The speed of the TR1001 radio: TR1001_19200, - * TR1001_38400, TR1001_57600 or TR1001_115200. - * - */ -void tr1001_set_speed(unsigned char s); -#define TR1001_19200 1 -#define TR1001_38400 2 -#define TR1001_57600 3 -#define TR1001_115200 4 - -/** - * Set the transmission power of the transceiver. - * - * The sensor board is equipped with a DS1804 100 position trimmer - * potentiometer which is used to set the transmission input current - * to the radio transceiver chip, thus setting the transmission power - * of the radio transceiver. - * - * This function sets the trimmer potentiometer to a value between 1 - * and 100. - * - * \param p The power of the transceiver, between 1 (lowest) and 100 - * (highest). - */ -void tr1001_set_txpower(unsigned char p); - -/** - * \brief The highest transmission power - */ -#define TR1001_TXPOWER_HIGHEST 100 - -/** - * \brief The lowest transmission power - */ -#define TR1001_TXPOWER_LOWEST 1 - -/** - * Send a packet. - * - * This function causes a packet to be sent out after a small random - * delay, but without doing any MAC layer collision detection or - * back-offs. The packet is sent with a 4 byte header that contains a - * a "type" identifier, an 8-bit packet ID field and the length of the - * packet in network byte order. - * - * This function should normally not be called from user - * programs. Rather, the uIP TCP/IP or Rime stack should be used. - */ -int tr1001_send(const void *packet, unsigned short len); - -/** - * Check if an incoming packet has been received. - * - * This function checks the receive buffer to see if an entire packet - * has been received. The actual reception is handled by an interrupt - * handler. - * - * This function should normally not be called from user - * programs. Rather, the uIP TCP/IP or Rime stack should be used. - * - * \return The length of the received packet, or 0 if no packet has - * been received. - */ -int tr1001_read(void *buf, unsigned short bufsize); - -extern unsigned char tr1001_rxbuf[]; -extern volatile unsigned char tr1001_rxstate; - -/** - * Calculate the signal strength of a received packet. - * - * This function calculates the received signal strength of the last - * received packet. This function typically is called when a packet - * has been received. - */ -unsigned short tr1001_sstrength(void); - -#endif /* __TR1001_H__ */ diff --git a/platform/esb/dev/vib-sensor.c b/platform/esb/dev/vib-sensor.c deleted file mode 100644 index 95a29da60..000000000 --- a/platform/esb/dev/vib-sensor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "dev/vib-sensor.h" -#include "dev/irq.h" -#include "dev/hwconf.h" - -const struct sensors_sensor vib_sensor; - -static unsigned int vib; - -#define VIB_IRQ() 4 -HWCONF_PIN(VIB, 1, VIB_IRQ()); -HWCONF_IRQ(VIB, 1, VIB_IRQ()); - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - ++vib; - sensors_changed(&vib_sensor); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return vib; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - vib = 0; - VIB_SELECT(); - VIB_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!VIB_IRQ_ENABLED()) { - irq_port1_activate(VIB_IRQ(), irq); - VIB_ENABLE_IRQ(); - } - } else { - VIB_DISABLE_IRQ(); - irq_port1_deactivate(VIB_IRQ()); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return VIB_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(vib_sensor, VIB_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/vib-sensor.h b/platform/esb/dev/vib-sensor.h deleted file mode 100644 index 53cf70b56..000000000 --- a/platform/esb/dev/vib-sensor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __VIB_SENSOR_H__ -#define __VIB_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor vib_sensor; - -#define VIB_SENSOR "Vibration" - -#endif /* __VIB_SENSOR_H__ */ diff --git a/platform/esb/doc/doc.txt b/platform/esb/doc/doc.txt deleted file mode 100644 index 9c6e3365c..000000000 --- a/platform/esb/doc/doc.txt +++ /dev/null @@ -1,7 +0,0 @@ -/** - -\defgroup doc Documentation -@{ -*/ - -/** @} */ diff --git a/platform/esb/doc/esb.txt b/platform/esb/doc/esb.txt deleted file mode 100644 index e87ea093e..000000000 --- a/platform/esb/doc/esb.txt +++ /dev/null @@ -1,171 +0,0 @@ -/** \addtogroup platform - * @{ **/ - -/** -\defgroup esb The ESB Embedded Sensor Board - -The ESB (Embedded Sensor Board) is a prototype wireless sensor network -device developed at FU Berlin. - - - -The ESB consists of a Texas Instruments MSP430 low-power -microcontroller with 2k RAM and 60k flash ROM, a TR1001 radio -transceiver, a 32k serial EEPROM, an RS232 port, a JTAG port, a -beeper, and a number of sensors (passive IR, active IR -sender/receiver, vibration/tilt, microphone, temperature). - - -The Contiki/ESB port contains drivers for most of the sensors. The -drivers were mostly adapted from sources from FU Berlin. - -\section esb-getting-started Getting started with Contiki for the ESB platform - -The ESB is equipped with an MSP430 microcontroller. The first step to -getting started with Contiki for the ESB is to install the development -tools for compiling Contiki for the MSP430. - -Windows users, see \ref esb-win-setup. FreeBSD users, see \ref esb-freebsd-setup - -\section esb-win-setup Setting up the Windows environment - -The Contiki development environment under Windows uses the Cygwin -environment. Cygwin is a Linux-like environment for Windows. Cygwin -can be found at http://www.cygwin.com. Click on the icon "Install -Cygwin Now" to the right to get the installation started. - -Choose "Install from Internet" and then specify where you want to -install cygwin (recommended installation path: -C:\\cygwin). Continue with the installation until you are -asked to select packages. Most packages can be left as "Default" but -there is one package that are not installed by default. Install the -following package by clicking at "Default" until it changes to -"Install": - -- Devel - contains things for developers (make, etc). - - - -When cygwin is installed there should be a cygwin icon that starts -up a cygwin bash when clicked on. Whenever it is time to compile and -send programs to the ESB nodes it will be done from a cygwin shell. - -\subsection winintro-installing-editor C programming editor - -If you do not already have a nice programming editor it is a good -idea to download and install one. The Crimson editor is a nice -windows based editor that is both easy to get started with and -fairly powerful. - -Crimson Editor can be found at: -http://www.crimsoneditor.com/ - -The editor is useful both when editing C programs and when -modifying scripts and configuration files. - -\subsection winintro-installing-compiler MSP430 Compiler and tools - -A compiler is needed to compile the programs to the MSP430 -microprocessor that is used on the ESB sensor nodes. Download and -install the GCC toolchain for MSP430 (recommended installation path: -C:\\MSP430\\). - -The GCC toolchain for MSP430 can be found at: -http://sourceforge.net/projects/mspgcc/ - -When the above software is installed you also need to set-up the -PATH so that all of the necessary tools can be reached. In cygwin -this is done by the following line (given that you have installed -at recommended locations): - - -export PATH=\$PATH:/cygdrive/c/MSP430/mspgcc/bin - - -This line can also be added to the .profile startup file in your cygwin -home directory -(C:\\cygwin\\home\\\\\.profile). - -If your home directory is located elsewhere you can find it by -starting cygwin and running \c cd followed by \c pwd. - -\subsection winintro-installing-contiki The Contiki operating system, including examples - -When programming the ESB sensor nodes it is very useful to have an -operating system that takes care of some of the low-level tasks and -also gives you as a programmer APIs for things like events, hardware -and networking. We will use the Contiki operating system developed by -Adam Dunkels, SICS, which is very well suited when programming small -embedded systems. - -The Contiki OS can be found at: -http://www.sics.se/contiki/ - -Unzip the Contiki OS at (for example) C:\\ -and you will get the following directories among others: - -- contiki-2.x/core - the contiki operating system -- contiki-2.x/platform/esb - the contiki operating system drivers, etc for the ESB -- contiki-2.x/examples/esb/ - example applications for the ESB - -\subsection winintro-testing Testing the tools - -Now everything necessary to start developing Contiki-based sensor net -applications should be installed. Start cygwin and change to the -directory contiki-2.x/examples/esb/. Then call make -beeper.esb. - -If you get an error about multiple cygwin dlls when compiling, you -need to delete cygwin1.dll from the MSP430 GCC toolchain -(C:\\MSP430\\bin\\cygwin1.dll). - -Connect a node and turn it on. Upload the test application by calling -make beeper.u. - -\subsection winintro-testing-development Development tools - -- make \ will compile and make a executable file ready -for sending to the ESB nodes. Depending on the \c SPEC it might even -startup the application that sends the executable to the -node. Typically you would write things like "make beeper.u" -to get the file beeper.c compiled, linked and sent out to the -ESB node. - -\subsection winintro-testing-shell Some basic shell commands - -- cd \ change to a specified directory (same as in DOS) -- pwd \ shows your current directory -- ls list the directory -- mkdir \ creates a new directory -- cp \ \ copies a file - -\section esb-freebsd-setup Setting up the FreeBSD environment - -Download the msp430-gcc, msp430-binutils, and -msp430-libc packages from -http://www.sics.se/~adam/contiki/freebsd-packages/. Install the -packages (as root) with pkg_add. - -\section esb-test-compilation Compiling your first Contiki system - -\section esb-burn-node-id Burning node IDs to EEPROM - -The Contiki ESB port comes with a small program, burn-nodeid -that semi-permanently stores a (unique) node ID number in the ESB -EEPROM. When the Contiki ESB port boots up, this node ID is restored -from the EEPROM. To compile and run this program, go into your project -directory and run - -make burn-nodeid.u nodeid=X - -where X is the node ID that will be burned into EEPROM. The -burn-nodeid program stores the node ID in EEPROM, reads it -back, and writes the output to the serial port. - -@{ - -*/ - - -/** @} */ -/** @} */ diff --git a/platform/esb/doc/getting-started.txt b/platform/esb/doc/getting-started.txt deleted file mode 100644 index 39ef619d3..000000000 --- a/platform/esb/doc/getting-started.txt +++ /dev/null @@ -1,18 +0,0 @@ -/** -\addtogroup esb -\section esb-getting-started Getting started with Contiki for the ESB platform - -The ESB is equipped with an MSP430 microcontroller. The first step to -getting started with Contiki for the ESB is to install the development -tools for compiling Contiki for the MSP430. - -For Windows users, see \ref esb-win-setup - - -@{ -*/ - - -/** -@} -*/ diff --git a/platform/esb/doc/quickref.txt b/platform/esb/doc/quickref.txt deleted file mode 100644 index e45689953..000000000 --- a/platform/esb/doc/quickref.txt +++ /dev/null @@ -1,78 +0,0 @@ -/** -\defgroup quickref Function quick reference -@{ - -\section sensors Sensor functions - -Each sensor has a set of functions for controlling it and query it for -its state. Some sensors also generate an events when the sensors -change. A sensor must be activated before it generates events or -relevant values. - -- SENSORS_ACTIVATE(sensor) - activate the sensor -- SENSORS_DEACTIVATE(sensor) - deactivate the sensor -- sensor.value(0) - query the sensor for its last value - -- \ref sensors_event - event sent when a sensor has changed (the data - argument will referer to the actual sensor) - -Example for querying the button: - -- \ref SENSORS_ACTIVATE(button_sensor) - activate the button sensor -- \ref button_sensor.value(0) - the button has been pressed or not - -\subsection quickref-sensors Sensor on the ESB platform - -- \ref battery_sensor - query the battery voltage level -- \ref button_sensor - query the on-board button -- \ref pir_sensor - query the passive IR sensor (motion detector) -- \ref radio_sensor - query the radio signal strength -- \ref sound_sensor - query the microphone -- \ref temperature_sensor - query the temperature sensor -- \ref vib_sensor - query the vibration sensor - -\section quickref-leds LED functions - -- leds_on() - turn LEDs on -- leds_off() - turn LEDs off -- leds_invert() - invert LEDs -- leds_blink() - blink all LEDs - -\section quickref-beeper Beeper functions - -- beep() - click the beeper -- beep_beep() - beep -- beep_down() - pitchbend down beep -- beep_quick() - a number of quick beeps -- beep_spinup() - pitchbend up beep - -\section quickref-timers Timer functions - -Contiki provides a set of timer libraries. Event timers generates an -event when the timer expires and callback timers call a function when -the timer expires. The simple timers on the other hand have to be -actively queried to check when they have expired. - -\subsection quickref-etimer Event timers - -- etimer_expired() - check if an event timer has expired -- etimer_set() - set an event timer -- etimer_reset() - set an expired event timer to the next interval -- etimer_restart() - restart an event timer from the current point in time - -\subsection quickref-ctimer Callback timers - -- ctimer_expired() - check if a callback timer has expired -- ctimer_set() - set a callback timer -- ctimer_reset() - set an expired callback timer to the next interval -- ctimer_restart() - restart a callback timer from the current point in time - -\subsection quickref-timer Simple timers - -- timer_expired() - check if a simple timer has expired -- timer_set() - set a simple timer -- timer_reset() - set a simple event timer to the next interval -- timer_restart() - restart a simple timer from the current point in time - - -*//** @{ */ diff --git a/platform/esb/doc/slipintro.txt b/platform/esb/doc/slipintro.txt deleted file mode 100644 index 1610eceaa..000000000 --- a/platform/esb/doc/slipintro.txt +++ /dev/null @@ -1,127 +0,0 @@ -/** \addtogroup esb -@{ */ -/** -\defgroup slipintro Introduction to Over The Air Reprogramming under Windows -\author Joakim Eriksson, Niclas Finne -@{ - -\section slipintro-intro Introduction - -This is a brief introduction how to program ESB sensor nodes over -radio under Windows. It is assumed that you already have the -environment setup for programming ESB sensor nodes using JTAG cable. - -\section slipintro-configuring Configuring SLIP under Windows XP - -This section describes how to setup a SLIP connection under Windows. A -SLIP connection forwards TCP/IP traffic to/from the sensor nodes and -lets you communicate with them using standard network tools such as -\c ping. - - --# Click start button and choose 'My Computer'. Right-click 'My -Network Places' and choose 'Properties'. - --# Click 'Create a new connection'. - --# Select 'Set up an advanced connection'. - --# Select 'Connect directly to another computer'. - --# Select 'Guest'. - --# Select a name for the slip connection (for example 'ESB'). - --# Select the serial port to use when communicating with the sensor -node. - --# Add the connection by clicking 'Finish'. - --# A connection window will open. Choose 'Properties'. - - --# Click on 'Configure...' and deselect all selected -buttons. Choose the speed 57600 bps. - --# Close the modem configuration window, and go to the 'Options' -tab in the ESB properties. Deselect all except 'Display -progress...'. - --# Go to the 'Networking' tab. Change to 'SLIP: Unix Connection' -and deselect all except the first two items in the connection item -list. - --# Select 'Internet Protocol (TCP/IP)' and click -'Properties'. Enter the IP address '172.16.0.1'. - --# Click 'Advanced' and deselect all checkboxes in the 'Advanced -TCP/IP Settings'. Go to the 'WINS' tab and deselect 'Enable LMHOSTS -lookup' if it is selected. Also select 'Disable NetBIOS over -TCP/IP'. - - - - -\section slipintro-setup Setup ESB for over the air programming - -Make sure you have the latest version of Contiki (older versions of -Contiki might not work with SLIP under Windows). - --# Each node needs an IP address for OTA to work. The node id -is used to construct an IP address for the node. If you specify 2 as -node id, the node will have the IP address 172.16.1.2. Each node -should have its own unique node id. To set the node id move to the -directory 'contiki-2.x/examples/esb' and run -\code -make burn-nodeid.u nodeid=X -\endcode -Use the number 1, 2, 3, etc, as the node id (\c X) for the nodes. This -will give the nodes the IP addresses 172.16.1.1, 172.16.1.2, etc. The -node id only needs to be set once for each node and it will remain -even when new applications are uploaded onto the node. --# You need to compile a core and upload it onto the nodes. All nodes -must run the same core. Move to the directory -'contiki-2.x/examples/esb' and run -\code -make WITH_CODEPROP=1 core -make WITH_CODEPROP=1 core.u -\endcode -to upload the core to your nodes. --# Attach the ESB node to the serial port and make sure it is -turned on. Select your ESB SLIP connection in your 'Network -Connections' and choose 'Connect' (or double click on it). If -everything works Windows should say that you have a new connection. --# Set the IP address for the node by pinging it (it will claim the -IP address of the first ping it hears). Note that the slip interface -has IP address 172.16.0.1 but the node will have the IP address -172.16.1.1. -\code -ping 172.16.1.1 -\endcode - -If everything works the node should click and reply to the pings. - -You also need a program to send the application to connected -nodes. Compile it by running - -\code -make send -\endcode - -\section slipintro-send Send programs over the air - -Contiki applications to be installed via radio are compiled somewhat -different compared to normal applications. - -Make sure you have a node with IP address 172.16.1.1 connected to your -serial port and have SLIP activated. Then compile and send a -testprogram by running - -\code -make beeper.ce -./send 172.16.1.1 beeper.ce -\endcode - -*/ -/** @} */ -/** @} */ diff --git a/platform/esb/loader/loader-arch.h b/platform/esb/loader/loader-arch.h deleted file mode 100644 index 260062d5a..000000000 --- a/platform/esb/loader/loader-arch.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __LOADER_ARCH_H__ -#define __LOADER_ARCH_H__ - -/** - * Load a program from EEPROM. - * - * This function loads a program from EEPROM into the flash ROM (code) and RAM (data). - * - * \param code The address of the first byte of code in the EEPROM. - * - * \param codelen The length of the code. - * - * \param data The address of the first byte of data in the EEPROM. - * - * \param datalen The length of the data. - * - */ -void loader_arch_load(unsigned short startaddr); - -/** - * Unload a program. - * - * This function should not be called directly, but accessed through - * the macro LOADER_UNLOAD(). The function unloads a program from both - * RAM and ROM. - * - * \param codeaddr A pointer to the first byte of program code. - * - * \param dataaddr A pointer to the first byte of program data. - */ -void loader_arch_free(void *codeaddr, void *dataaddr); - -extern void *loader_arch_codeaddr, *loader_arch_dataaddr; - -#ifndef LOADER_UNLOAD -#define LOADER_UNLOAD() loader_arch_free(&loader_arch_codeaddr, &loader_arch_dataaddr) -#endif - -#define LOADER_ARCH_MAGIC 0x373a -#define LOADER_ARCH_VERSION 0x0001 - -#endif /* __LOADER_ARCH_H__ */ diff --git a/platform/esb/net/uip-driver.c b/platform/esb/net/uip-driver.c deleted file mode 100644 index 27dac8703..000000000 --- a/platform/esb/net/uip-driver.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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. - * - */ - -/** - * \file - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/netstack.h" -#include "net/uip.h" -#include "net/tcpip.h" -#include "net/hc.h" -#include "net/packetbuf.h" -#include "net/uip-driver.h" -#include - -/*--------------------------------------------------------------------*/ -static void -init(void) -{ - /* - * Set out output function as the function to be called from uIP to - * send a packet. - */ - tcpip_set_outputfunc(uip_driver_send); -} -/*--------------------------------------------------------------------*/ -static void -input(void) -{ - if(packetbuf_datalen() > 0 && - packetbuf_datalen() <= UIP_BUFSIZE - UIP_LLH_LEN) { - memcpy(&uip_buf[UIP_LLH_LEN], packetbuf_dataptr(), packetbuf_datalen()); - uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], packetbuf_datalen()); - tcpip_input(); - } -} -/*--------------------------------------------------------------------*/ -uint8_t -uip_driver_send(void) -{ - uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len); - packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); - - /* XXX we should provide a callback function that is called when the - packet is sent. For now, we just supply a NULL pointer. */ - NETSTACK_MAC.send(NULL, NULL); - return 1; -} -/*--------------------------------------------------------------------*/ -const struct network_driver uip_driver = { - "uip", - init, - input -}; -/*--------------------------------------------------------------------*/ diff --git a/platform/esb/node-id.c b/platform/esb/node-id.c deleted file mode 100644 index 14dc735d5..000000000 --- a/platform/esb/node-id.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "sys/node-id.h" -#include "contiki-conf.h" -#include "dev/eeprom.h" - -unsigned short node_id = 0; -/*---------------------------------------------------------------------------*/ -void -node_id_restore(void) -{ - unsigned char buf[2]; - eeprom_read(NODE_ID_EEPROM_OFFSET, buf, 2); - if(buf[0] == 0xad && - buf[1] == 0xde) { - eeprom_read(NODE_ID_EEPROM_OFFSET + 2, buf, 2); - node_id = (buf[0] << 8) | buf[1]; - } else { - node_id = 0; - } -} -/*---------------------------------------------------------------------------*/ -void -node_id_burn(unsigned short id) -{ - unsigned char buf[2]; - buf[0] = 0xad; - buf[1] = 0xde; - eeprom_write(NODE_ID_EEPROM_OFFSET, buf, 2); - buf[0] = id >> 8; - buf[1] = id & 0xff; - eeprom_write(NODE_ID_EEPROM_OFFSET + 2, buf, 2); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/exp5438/platform-conf.h b/platform/exp5438/platform-conf.h index bb39d3b32..1e1b24943 100644 --- a/platform/exp5438/platform-conf.h +++ b/platform/exp5438/platform-conf.h @@ -35,8 +35,8 @@ * Joakim Eriksson */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -200,4 +200,4 @@ typedef unsigned long off_t; #define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) #define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/iris/contiki-conf.h b/platform/iris/contiki-conf.h index 7adf62a6d..1f2908532 100644 --- a/platform/iris/contiki-conf.h +++ b/platform/iris/contiki-conf.h @@ -39,8 +39,8 @@ * Kasun Hewage */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #define HAVE_STDINT_H #include "avrdef.h" @@ -194,4 +194,4 @@ typedef unsigned long off_t; #include PROJECT_CONF_H #endif /* PROJECT_CONF_H */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/iris/dev/adc.h b/platform/iris/dev/adc.h index 473290b86..a51b3cebe 100644 --- a/platform/iris/dev/adc.h +++ b/platform/iris/dev/adc.h @@ -30,11 +30,11 @@ * */ -#ifndef __ADC_H__ -#define __ADC_H__ +#ifndef ADC_H_ +#define ADC_H_ void adc_init(); uint16_t get_adc(int channel); -#endif /* __ADC_H__ */ +#endif /* ADC_H_ */ diff --git a/platform/iris/dev/sensors/mts300.h b/platform/iris/dev/sensors/mts300.h index d217e9a23..0e07af034 100644 --- a/platform/iris/dev/sensors/mts300.h +++ b/platform/iris/dev/sensors/mts300.h @@ -38,8 +38,8 @@ * Kasun Hewage */ -#ifndef __MTS300_H__ -#define __MTS300_H__ +#ifndef MTS300_H_ +#define MTS300_H_ #include #include "contiki-conf.h" @@ -106,7 +106,7 @@ uint16_t get_mic(); void mts300_init(); -#endif /* __MTS300_H__ */ +#endif /* MTS300_H_ */ diff --git a/platform/iris/init-net.h b/platform/iris/init-net.h index 8c3711980..066a6d4fd 100644 --- a/platform/iris/init-net.h +++ b/platform/iris/init-net.h @@ -38,9 +38,9 @@ * Kasun Hewage */ -#ifndef __INIT_NET_H__ -#define __INIT_NET_H__ +#ifndef INIT_NET_H_ +#define INIT_NET_H_ void init_net(void); -#endif /* __INIT_NET_H__ */ +#endif /* INIT_NET_H_ */ diff --git a/platform/iris/platform-conf.h b/platform/iris/platform-conf.h index 4f79499bd..48659ddae 100644 --- a/platform/iris/platform-conf.h +++ b/platform/iris/platform-conf.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -131,4 +131,4 @@ void clock_adjust_ticks(clock_time_t howmany); #define CSN 0 -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/jcreate/Makefile.jcreate b/platform/jcreate/Makefile.jcreate deleted file mode 100644 index b9501e97f..000000000 --- a/platform/jcreate/Makefile.jcreate +++ /dev/null @@ -1,17 +0,0 @@ -# Use custom platform configuration -CFLAGS += -DPLATFORM_CONF_H=\"platform-jcreate-conf.h\" - -# Some drivers such as ds2411.c only compile under platform sky -CFLAGS += -DCONTIKI_TARGET_SKY - -CONTIKI_TARGET_SOURCEFILES += contiki-jcreate-platform.c \ - battery-sensor.c radio-sensor.c \ - temperature-sensor.c acc-sensor.c ext-sensor.c - -include $(CONTIKI)/platform/sky/Makefile.common - -ifneq ($(TMOTE_BSL), 1) - ${warning No $(TMOTE_BSL_FILE) command for jcreate found. Please install this command in $(CONTIKI)/tools/sky} -endif - -CONTIKI_TARGET_DIRS += ${addprefix ../sky/,. dev apps} diff --git a/platform/jcreate/contiki-jcreate-platform.c b/platform/jcreate/contiki-jcreate-platform.c deleted file mode 100644 index 8d81ceef6..000000000 --- a/platform/jcreate/contiki-jcreate-platform.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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 file is part of the Contiki operating system. - * - * Author: Niclas Finne , Joakim Eriksson - * - */ - -#include "dev/battery-sensor.h" - -SENSORS(&battery_sensor); - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/platform/jcreate/dev/acc-sensor.c b/platform/jcreate/dev/acc-sensor.c deleted file mode 100644 index bf7de1963..000000000 --- a/platform/jcreate/dev/acc-sensor.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:34:42 $ - * $Revision: 1.2 $ - */ - -#include "contiki.h" -#include "dev/acc-sensor.h" -#include "dev/sky-sensors.h" - -/* Configure ADC12_2 to sample channel 4, 5, 6 and use */ -/* the Vref+ as reference (SREF_1) since it is a stable reference */ -#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5) | (1 << INCH_6)) -#define INPUT_REFERENCE SREF_1 -#define ACC_MEM_X ADC12MEM4 /* Xout */ -#define ACC_MEM_Y ADC12MEM5 /* Yout */ -#define ACC_MEM_Z ADC12MEM6 /* Zout */ - -const struct sensors_sensor acc_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - case ACC_SENSOR_X: - return ACC_MEM_X; - case ACC_SENSOR_Y: - return ACC_MEM_Y; - case ACC_SENSOR_Z: - return ACC_MEM_Z; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - if(type == SENSORS_ACTIVE) { - /* Sleep Mode P2.3 */ - if(c) { - P2OUT |= 0x08; - P2DIR |= 0x08; - } else { - /* Sensor deactivated. Changed to sleep mode. */ - P2OUT &= ~0x08; - } - } else if(type == ACC_SENSOR_SENSITIVITY) { - /* g-Select1 P2.0, g-Select2 P2.1 */ - P2DIR |= 0x03; - P2OUT &= ~0x03; - P2OUT |= c & 0x03; - } - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - if(type == ACC_SENSOR_SENSITIVITY) { - return (P2OUT & P2DIR) & 0x03; - } - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(acc_sensor, ACC_SENSOR, value, configure, status); diff --git a/platform/jcreate/dev/acc-sensor.h b/platform/jcreate/dev/acc-sensor.h deleted file mode 100644 index bf31d1955..000000000 --- a/platform/jcreate/dev/acc-sensor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:34:42 $ - * $Revision: 1.2 $ - */ - -#ifndef __ACC_SENSOR_H__ -#define __ACC_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor acc_sensor; - -#define ACC_SENSOR "Acc" - -#define ACC_SENSOR_X 0 -#define ACC_SENSOR_Y 1 -#define ACC_SENSOR_Z 2 - -/* - Sensitivity configuration (g-Select1 and g-Select2) - Value g-Range Sensitivity - 0 1.5g 800mV/g - 1 2g 600mV/g - 2 4g 300mV/g - 3 6g 200mV/g -*/ -#define ACC_SENSOR_SENSITIVITY 10 - -#endif /* __ACC_SENSOR_H__ */ diff --git a/platform/jcreate/dev/ext-sensor.c b/platform/jcreate/dev/ext-sensor.c deleted file mode 100644 index a034448cb..000000000 --- a/platform/jcreate/dev/ext-sensor.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne, Marcus Lundén, - * Jesper Karlsson - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:34:42 $ - * $Revision: 1.2 $ - */ - - -#include "contiki.h" -#include "dev/ext-sensor.h" -#include "dev/sky-sensors.h" - -/* SREF_0 is AVCC */ -/* SREF_1 is Vref+ */ -/* ADC0 == P6.0/A0 == port "under" logo */ -/* ADC1 == P6.1/A1 == port "over" logo */ -/* ADC2 == P6.2/A2, bottom expansion port */ -/* ADC3 == P6.1/A3, bottom expansion port, End Of (ADC-)Sequence */ - -#define INPUT_CHANNEL ((1 << INCH_0) | (1 << INCH_1) | \ - (1 << INCH_2) | (1 << INCH_3)) -#define INPUT_REFERENCE SREF_0 -#define EXT_MEM0 ADC12MEM0 -#define EXT_MEM1 ADC12MEM1 -#define EXT_MEM2 ADC12MEM2 -#define EXT_MEM3 ADC12MEM3 - -const struct sensors_sensor ext_sensor; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* ADC0 corresponds to the port under the logo, ADC1 to the port - over the logo, ADC2 and ADC3 corresponds to port on the JCreate - bottom expansion port) */ - switch(type) { - case ADC0: - return EXT_MEM0; - case ADC1: - return EXT_MEM1; - case ADC2: - return EXT_MEM2; - case ADC3: - return EXT_MEM3; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(ext_sensor, "Ext", value, configure, status); diff --git a/platform/jcreate/dev/ext-sensor.h b/platform/jcreate/dev/ext-sensor.h deleted file mode 100644 index c2c9f36e5..000000000 --- a/platform/jcreate/dev/ext-sensor.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Marcus Lundén - * Created : 2005-11-01 - * Updated : $Date: 2010/05/03 21:57:35 $ - * $Revision: 1.1 $ - */ - -#ifndef __EXT_SENSOR_H__ -#define __EXT_SENSOR_H__ - -#include "lib/sensors.h" - -#define ADC0 0 -#define ADC1 1 -#define ADC2 2 -#define ADC3 3 - -extern const struct sensors_sensor ext_sensor; - -#define EXT_SENSOR "Ext" - -#endif /* __EXT_SENSOR_H__ */ diff --git a/platform/jcreate/leds-arch.c b/platform/jcreate/leds-arch.c deleted file mode 100644 index 4f4dc748c..000000000 --- a/platform/jcreate/leds-arch.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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. - * - */ - -/** - * \file - * A leds implementation for the jcreate platform - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#include "contiki.h" -#include "dev/leds.h" - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - LEDS_PxDIR = 0xff; - LEDS_PxOUT = 0xff; -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_arch_get(void) -{ - return ~LEDS_PxOUT; -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(unsigned char leds) -{ - LEDS_PxOUT = ~leds; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/jcreate/platform-jcreate-conf.h b/platform/jcreate/platform-jcreate-conf.h deleted file mode 100644 index 8344f4a1b..000000000 --- a/platform/jcreate/platform-jcreate-conf.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2011, 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. 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. - */ - -/** - * \file - * Platform configuration for the Sentilla JCreate - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ -/* Platform TMOTE_SKY */ -#define TMOTE_SKY 1 - -#define LEDS_CONF_ALL 255 -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 0 - -/* CPU target speed in Hz */ -#define F_CPU 3900000uL /*2457600uL*/ - -/* Our clock resolution, this is the same as Unix HZ. */ -#define CLOCK_CONF_SECOND 128UL - -#define BAUD2UBR(baud) ((F_CPU/baud)) - -#define CCIF -#define CLIF - -#define HAVE_STDINT_H -#include "msp430def.h" - - -/* Types for clocks and uip_stats */ -typedef unsigned short uip_stats_t; -typedef unsigned long clock_time_t; -typedef unsigned long off_t; - -/* the low-level radio driver */ -#define NETSTACK_CONF_RADIO cc2420_driver - -/* LED ports */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x10 -#define LEDS_CONF_GREEN 0x20 -#define LEDS_CONF_YELLOW 0x40 - -/* DCO speed resynchronization for more robust UART, etc. */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED 1 -#endif /* DCOSYNCH_CONF_ENABLED */ -#ifndef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_CONF_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#define ROM_ERASE_UNIT_SIZE 512 -#define XMEM_ERASE_UNIT_SIZE (64*1024L) - - -#define CFS_CONF_OFFSET_TYPE long - - -/* Use the first 64k of external flash for node configuration */ -#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE) - -/* Use the second 64k of external flash for codeprop. */ -#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE) -#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_RAM_CONF_SIZE 4096 - -/* - * SPI bus configuration for the TMote Sky. - */ - -/* SPI input/output registers. */ -#define SPI_TXBUF U0TXBUF -#define SPI_RXBUF U0RXBUF - - /* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while ((U0TCTL & TXEPT) == 0) - /* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while ((IFG1 & URXIFG0) == 0) - /* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while ((IFG1 & UTXIFG0) == 0) - -#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */ -#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ - -#define FLASH_PWR 3 /* P4.3 Output */ -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P4.7 Output */ - -/* Enable/disable flash access to the SPI bus (active low). */ - -#define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) ) -#define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) ) - -#define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) ) -#define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) ) - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 800 - -/* P1.0 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 0 -/* P1.3 - Input: FIFO from CC2420 */ -#define CC2420_FIFO_PORT(type) P1##type -#define CC2420_FIFO_PIN 3 -/* P1.4 - Input: CCA from CC2420 */ -#define CC2420_CCA_PORT(type) P1##type -#define CC2420_CCA_PIN 4 -/* P4.1 - Input: SFD from CC2420 */ -#define CC2420_SFD_PORT(type) P4##type -#define CC2420_SFD_PIN 1 -/* P4.2 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P4##type -#define CC2420_CSN_PIN 2 -/* P4.5 - Output: VREG_EN to CC2420 */ -#define CC2420_VREG_PORT(type) P4##type -#define CC2420_VREG_PIN 5 -/* P4.6 - Output: RESET_N to CC2420 */ -#define CC2420_RESET_PORT(type) P4##type -#define CC2420_RESET_PIN 6 - -#define CC2420_IRQ_VECTOR PORT1_VECTOR - -/* Pin status. */ -#define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN))) -#define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN))) -#define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN))) -#define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN))) - -/* The CC2420 reset pin. */ -#define SET_RESET_INACTIVE() (CC2420_RESET_PORT(OUT) |= BV(CC2420_RESET_PIN)) -#define SET_RESET_ACTIVE() (CC2420_RESET_PORT(OUT) &= ~BV(CC2420_RESET_PIN)) - -/* CC2420 voltage regulator enable pin. */ -#define SET_VREG_ACTIVE() (CC2420_VREG_PORT(OUT) |= BV(CC2420_VREG_PIN)) -#define SET_VREG_INACTIVE() (CC2420_VREG_PORT(OUT) &= ~BV(CC2420_VREG_PIN)) - -/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */ -#define CC2420_FIFOP_INT_INIT() do { \ - CC2420_FIFOP_PORT(IES) &= ~BV(CC2420_FIFOP_PIN); \ - CC2420_CLEAR_FIFOP_INT(); \ - } while(0) - -/* FIFOP on external interrupt 0. */ -#define CC2420_ENABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) |= BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_DISABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) &= ~BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_CLEAR_FIFOP_INT() do {CC2420_FIFOP_PORT(IFG) &= ~BV(CC2420_FIFOP_PIN);} while(0) - -/* - * Enables/disables CC2420 access to the SPI bus (not the bus). - * (Chip Select) - */ - - /* ENABLE CSn (active low) */ -#define CC2420_SPI_ENABLE() (CC2420_CSN_PORT(OUT) &= ~BV(CC2420_CSN_PIN)) - /* DISABLE CSn (active low) */ -#define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) -#define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) - -#endif /* __PLATFORM_CONF_H__ */ diff --git a/platform/mbxxx/Makefile.mbxxx b/platform/mbxxx/Makefile.mbxxx index 61513ba96..752b2576b 100644 --- a/platform/mbxxx/Makefile.mbxxx +++ b/platform/mbxxx/Makefile.mbxxx @@ -1,4 +1,4 @@ -ARCH= irq.c sensors.c acc-sensor.c button-sensor.c temperature-sensor.c mems.c contact-sensor.c +ARCH= irq.c sensors.c acc-sensor.c button-sensor.c temperature-sensor.c mems.c contact-sensor.c i2c.c eeprom.c CONTIKI_TARGET_DIRS = . dev diff --git a/platform/mbxxx/apps/shell-sensors.h b/platform/mbxxx/apps/shell-sensors.h index 23d50585a..3edff9181 100644 --- a/platform/mbxxx/apps/shell-sensors.h +++ b/platform/mbxxx/apps/shell-sensors.h @@ -42,12 +42,12 @@ * Salvatore Pitrulli */ -#ifndef __SHELL_SENSORS_H__ -#define __SHELL_SENSORS_H__ +#ifndef SHELL_SENSORS_H_ +#define SHELL_SENSORS_H_ #include "shell.h" void shell_sensors_init(void); -#endif /* __SHELL_SENSORS_H__ */ +#endif /* SHELL_SENSORS_H_ */ /** @} */ diff --git a/platform/mbxxx/board.c b/platform/mbxxx/board.c index 277a377c5..7ae833bb9 100644 --- a/platform/mbxxx/board.c +++ b/platform/mbxxx/board.c @@ -57,7 +57,9 @@ * - MB954 B * - MB954 C * - MB950 A +* - MB950 B * - MB951 A +* - MB951 B * - IDZ401V1 */ /*---------------------------------------------------------------------------*/ @@ -77,6 +79,7 @@ #include "hal/micro/cortexm3/mfg-token.h" #endif #include +#include "dev/i2c.h" const LedResourceType LedsMB851A[] = { { @@ -318,6 +321,17 @@ const BoardResourcesType MB950A = { &stlm20PA4noDiv, }; +const BoardResourcesType MB950B = { + "MB950 B", + (BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_STM32F), + BUTTONS_MB950B, + LEDS_MB950B, + &ioMB950A, + &infraRedLedMB851A, + &memsSensor, + &stlm20PA4noDiv, +}; + const BoardResourcesType MB951A = { "MB951 A", (BOARD_HAS_STM32F), @@ -329,6 +343,17 @@ const BoardResourcesType MB951A = { NULL, }; +const BoardResourcesType MB951B = { + "MB951 B", + (BOARD_HAS_STM32F), + BUTTONS_MB951B, + LEDS_MB951B, + &ioMB951A, + NULL, + NULL, + NULL, +}; + const BoardResourcesType IDZ401V1 = { "IDZ401V1", (BOARD_HAS_STM32F), @@ -349,7 +374,9 @@ static const BoardResourcesType *boardList [] = { &MB954B, &MB954C, &MB950A, + &MB950B, &MB951A, + &MB951B, &IDZ401V1 }; @@ -496,6 +523,7 @@ void halBoardPowerUp(void) if ((boardDescription->flags & BOARD_HAS_MEMS) || (boardDescription->flags & BOARD_HAS_EEPROM)) { halGpioConfig(PORTA_PIN(1), GPIOCFG_OUT_ALT_OD); halGpioConfig(PORTA_PIN(2), GPIOCFG_OUT_ALT_OD); + i2c_enable(); } /* Configure GPIO for ADC access (temp sensor) */ if (boardDescription->flags & BOARD_HAS_TEMP_SENSOR) { diff --git a/platform/mbxxx/board.h b/platform/mbxxx/board.h index 9c83ecd6b..c44fac987 100644 --- a/platform/mbxxx/board.h +++ b/platform/mbxxx/board.h @@ -48,8 +48,8 @@ * */ /*---------------------------------------------------------------------------*/ -#ifndef _BOARD_H_ -#define _BOARD_H_ +#ifndef BOARD_H_ +#define BOARD_H_ char boardName[16]; @@ -100,10 +100,18 @@ char boardName[16]; * \brief Define the number of LEDs in the specific board revision */ #define LEDS_MB950A 2 +/** + * \brief Define the number of LEDs in the specific board revision + */ +#define LEDS_MB950B 2 /** * \brief Define the number of LEDs in the specific board revision */ #define LEDS_MB951A 2 +/** + * \brief Define the number of LEDs in the specific board revision + */ +#define LEDS_MB951B 2 @@ -152,10 +160,18 @@ char boardName[16]; * \brief Define the number of user buttons in the specific board revision */ #define BUTTONS_MB950A 5 +/** + * \brief Define the number of user buttons in the specific board revision + */ +#define BUTTONS_MB950B 5 /** * \brief Define the number of user buttons in the specific board revision */ #define BUTTONS_MB951A 1 +/** + * \brief Define the number of user buttons in the specific board revision + */ +#define BUTTONS_MB951B 1 @@ -347,7 +363,7 @@ void halBoardPowerDown(void); void boardPrintStringDescription(void); -#endif /* _BOARD_H_ */ +#endif /*BOARD_H_ */ /** @} // END addtogroup */ diff --git a/platform/mbxxx/clock.c b/platform/mbxxx/clock.c new file mode 100644 index 000000000..2a01eb8b7 --- /dev/null +++ b/platform/mbxxx/clock.c @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2010, STMicroelectronics. + * 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 Contiki OS + * + */ +/*---------------------------------------------------------------------------*/ +/** +* \file +* Clock for STM32W. +* \author +* Salvatore Pitrulli +*/ +/*---------------------------------------------------------------------------*/ + +/* + * File customized for mbxxx platform. It uses systick timer to control button + * status without interrupts, as well as for system clock. + */ + +#include PLATFORM_HEADER +#include "hal/error.h" +#include "hal/hal.h" +#include "dev/stm32w-systick.h" + +#include "sys/clock.h" +#include "sys/etimer.h" +#include "dev/button-sensor.h" +#include "uart1.h" +#include "dev/leds.h" +#include "dev/stm32w-radio.h" + +#define DEBUG DEBUG_NONE +#include "net/uip-debug.h" + +// The value that will be load in the SysTick value register. +#define RELOAD_VALUE 24000-1 // 1 ms with a 24 MHz clock + +static volatile clock_time_t count; +static volatile unsigned long current_seconds = 0; +static unsigned int second_countdown = CLOCK_SECOND; + +/*---------------------------------------------------------------------------*/ +void SysTick_Handler(void) +{ + + count++; + + if(button_sensor.status(SENSORS_READY)){ + button_sensor.value(0); // sensors_changed is called inside this function. + } + + if(etimer_pending()) { + etimer_request_poll(); + } + + if (--second_countdown == 0) { + current_seconds++; + second_countdown = CLOCK_SECOND; + } + +} + +/*---------------------------------------------------------------------------*/ + +void clock_init(void) +{ + + ATOMIC( + + //Counts the number of ticks. + count = 0; + + SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK); + SysTick_SetReload(RELOAD_VALUE); + SysTick_ITConfig(ENABLE); + SysTick_CounterCmd(SysTick_Counter_Enable); + + ) +} + +/*---------------------------------------------------------------------------*/ + +clock_time_t clock_time(void) +{ + return count; +} + +/*---------------------------------------------------------------------------*/ +/** + * Delay the CPU for a multiple of TODO + */ +void clock_delay(unsigned int i) +{ + for (; i > 0; i--) { /* Needs fixing XXX */ + unsigned j; + for (j = 50; j > 0; j--) + asm ("nop"); + } +} + +/*---------------------------------------------------------------------------*/ +/** + * Wait for a multiple of 1 ms. + * + */ +void clock_wait(clock_time_t i) +{ + clock_time_t start; + + start = clock_time(); + while(clock_time() - start < (clock_time_t)i); +} +/*---------------------------------------------------------------------------*/ + +unsigned long clock_seconds(void) +{ + return current_seconds; +} + +void sleep_seconds(int seconds) +{ + uint32_t quarter_seconds = seconds * 4; + uint8_t radio_on; + + + halPowerDown(); + radio_on = stm32w_radio_is_on(); + stm32w_radio_driver.off(); + + halSleepForQsWithOptions(&quarter_seconds, 0); + + + ATOMIC( + + halPowerUp(); + + // Update OS system ticks. + current_seconds += seconds - quarter_seconds / 4 ; // Passed seconds + count += seconds * CLOCK_SECOND - quarter_seconds * CLOCK_SECOND / 4 ; + + if(etimer_pending()) { + etimer_request_poll(); + } + + SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK); + SysTick_SetReload(RELOAD_VALUE); + SysTick_ITConfig(ENABLE); + SysTick_CounterCmd(SysTick_Counter_Enable); + + ) + + stm32w_radio_driver.init(); + if(radio_on){ + stm32w_radio_driver.on(); + } + + uart1_init(115200); + leds_init(); + rtimer_init(); + + PRINTF("WakeInfo: %04x\r\n", halGetWakeInfo()); + + +} diff --git a/platform/mbxxx/contiki-conf.h b/platform/mbxxx/contiki-conf.h index 60f4c3b5b..d6fc2b823 100644 --- a/platform/mbxxx/contiki-conf.h +++ b/platform/mbxxx/contiki-conf.h @@ -48,8 +48,8 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #ifdef PLATFORM_CONF_H #include PLATFORM_CONF_H @@ -173,5 +173,5 @@ #include PROJECT_CONF_H #endif /* PROJECT_CONF_H */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ /** @} */ diff --git a/platform/mbxxx/contiki-init-net.h b/platform/mbxxx/contiki-init-net.h index 008ad2431..ca586cd94 100644 --- a/platform/mbxxx/contiki-init-net.h +++ b/platform/mbxxx/contiki-init-net.h @@ -44,10 +44,10 @@ */ /*---------------------------------------------------------------------------*/ -#ifndef __CONTIKI_INIT_NET_H__ -#define __CONTIKI_INIT_NET_H__ +#ifndef CONTIKI_INIT_NET_H_ +#define CONTIKI_INIT_NET_H_ void print_address(uip_ds6_addr_t *lladdr); -#endif /* __CONTIKI_INIT_NET_H__ */ +#endif /* CONTIKI_INIT_NET_H_ */ /** @} */ diff --git a/platform/mbxxx/dev/acc-sensor.c b/platform/mbxxx/dev/acc-sensor.c index fc3fe026b..0a5439ec6 100644 --- a/platform/mbxxx/dev/acc-sensor.c +++ b/platform/mbxxx/dev/acc-sensor.c @@ -57,55 +57,53 @@ static int active(void) { uint8_t reg; - if(!i2c_read_reg (kLIS3L02DQ_SLAVE_ADDR,CTRL_REG1, ®, 1)) + if(!MEMS_Read_Reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, ®, 1)) return FALSE; - + return (reg & 0x40) ? TRUE : FALSE ; } /*---------------------------------------------------------------------------*/ static int value(int type) { - int8_t i2c_data = 0; uint8_t reg_addr; - + switch(type) { case ACC_X_AXIS: reg_addr = OUTX_H; break; - + case ACC_Y_AXIS: reg_addr = OUTY_H; break; - + case ACC_Z_AXIS: reg_addr = OUTZ_H; break; - + default: - return 0; - } - - i2c_read_reg(kLIS3L02DQ_SLAVE_ADDR, reg_addr, (uint8_t *)&i2c_data, 1); - - if(MEMS_GetFullScale()==ACC_HIGH_RANGE){ - return ((int16_t)i2c_data)*HIGH_RANGE_SENSITIVITY; - } - else { - return ((int16_t)i2c_data)*LOW_RANGE_SENSITIVITY; + return 0; } + MEMS_Read_Reg(kLIS3L02DQ_SLAVE_ADDR, reg_addr, (uint8_t *)&i2c_data, 1); + + if(MEMS_GetFullScale()==ACC_HIGH_RANGE){ + return ((int16_t)i2c_data) * HIGH_RANGE_SENSITIVITY; + } + else { + return ((int16_t)i2c_data) * LOW_RANGE_SENSITIVITY; + } } /*---------------------------------------------------------------------------*/ static int configure(int type, int value) { switch(type) { - + case SENSORS_HW_INIT: - return Mems_Init(); - + return MEMS_Init(); + case SENSORS_ACTIVE: if(value){ if(MEMS_On()){ @@ -115,17 +113,18 @@ configure(int type, int value) return 0; } else - return MEMS_Off(); - + return MEMS_Off(); + case ACC_RANGE: return MEMS_SetFullScale((boolean)value); - - case ACC_HPF: + + case ACC_HPF: if(value < ACC_HPF_DISABLE){ - return i2c_write_reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, (1<<4) | (uint8_t)value); + return MEMS_Write_Reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, + (1<<4) | (uint8_t)value); } else { - return i2c_write_reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, 0x00); + return MEMS_Write_Reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, 0x00); } } return 0; @@ -135,18 +134,15 @@ static int status(int type) { switch(type) { - + case SENSORS_READY: return active(); } - + return 0; } /*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(acc_sensor, ACC_SENSOR, - value, configure, status); - - +SENSORS_SENSOR(acc_sensor, ACC_SENSOR, value, configure, status); /** @} */ diff --git a/platform/mbxxx/dev/acc-sensor.h b/platform/mbxxx/dev/acc-sensor.h index 51ab20c72..a33cb5852 100644 --- a/platform/mbxxx/dev/acc-sensor.h +++ b/platform/mbxxx/dev/acc-sensor.h @@ -44,8 +44,8 @@ */ /*---------------------------------------------------------------------------*/ -#ifndef __ACC_SENSOR_H__ -#define __ACC_SENSOR_H__ +#ifndef ACC_SENSOR_H_ +#define ACC_SENSOR_H_ #include "lib/sensors.h" #include "mems.h" @@ -79,5 +79,5 @@ extern const struct sensors_sensor acc_sensor; #define ACC_Y_AXIS 2 #define ACC_Z_AXIS 3 -#endif /* __ACC_SENSOR_H__ */ +#endif /* ACC_SENSOR_H_ */ /** @} */ diff --git a/platform/mbxxx/dev/contact-sensor.h b/platform/mbxxx/dev/contact-sensor.h index d7ebc7412..bb6ee1e2f 100644 --- a/platform/mbxxx/dev/contact-sensor.h +++ b/platform/mbxxx/dev/contact-sensor.h @@ -45,8 +45,8 @@ */ /*---------------------------------------------------------------------------*/ -#ifndef __CONTACT_SENSOR_H__ -#define __CONTACT_SENSOR_H__ +#ifndef CONTACT_SENSOR_H_ +#define CONTACT_SENSOR_H_ #include "lib/sensors.h" @@ -54,5 +54,5 @@ extern const struct sensors_sensor contact_sensor; #define CONTACT_SENSOR "Contact" -#endif /* __CONTACT_SENSOR_H__ */ +#endif /* CONTACT_SENSOR_H_ */ /** @} */ diff --git a/platform/mbxxx/dev/eeprom.c b/platform/mbxxx/dev/eeprom.c new file mode 100644 index 000000000..4932787da --- /dev/null +++ b/platform/mbxxx/dev/eeprom.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2013, IDentification Automation Laboratory + * IDALab (http://www.idalab.unisalento.it) + * Department of Innovation Engineering - University of Salento + * + * 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. + * + * 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. + * + */ + +/** + * \file eeprom.c + * \brief ST M24C64W EEPROM driver. + * \author Maria Laura Stefanizzi + * \date 2013-11-20 + */ + +#include PLATFORM_HEADER +#include +#include + + +#define EE_HW_ADDRESS 0xA0 +#define EE_PAGESIZE 32 +#define EE_PAGEMASK 0x1F +#define EE_MAX_TRIALS 300 + +/* Write Cycle polling + * + * During the internal Write cycle, the device disconnects itself from the bus, + * and writes a copy of the data from its internal latches to the memory cells. + */ +static inline void +eeprom_wait(void) +{ + uint32_t trials = 0; + + /* Keep looping till the slave acknowledge his address or maximum number of + trials is reached */ + do { + /* Generate start */ + i2c_start(); + + /* Device select in in write mode */ + i2c_write(EE_HW_ADDRESS | 0x0); + + /* Check if the maximum allowed number of trials has been reached */ + if(trials++ == EE_MAX_TRIALS) { + /* If the maximum number of trials has been reached, exit the function */ + break; + } + } while((SC2_STAT(SC_TWIRXNAK)) == SC_TWIRXNAK); + /* eeprom reply with an ACK then it has terminated the internal Write cycle */ + + i2c_stop(); +} + +/** + * eeprom initializzation function + */ +void +eeprom_init(void) +{ + /* Nothing must be done here */ +} + +/** + * Write data to eeprom + * @param addr The eeprom memory address + * @param buf It is the buffer of bytes that will be written to the eeprom + * @param size It is the number of byte to write + */ +void +eeprom_write(eeprom_addr_t addr, unsigned char *buf, int size) +{ + unsigned int i = 0; + unsigned int curaddr; + + curaddr = addr; + for(i = 0; i < size; i++) { + /* If we are writing the first byte or are on a EE_PAGEMASK page boundary + we have to start a new write. */ + if(i == 0 || (curaddr & EE_PAGEMASK) == 0) { + + i2c_start(); + i2c_write(EE_HW_ADDRESS | 0x0); + + /* Write the new address to the bus. */ + i2c_write((curaddr & 0xFF00) >> 8); + i2c_write(curaddr & 0xFF); + } + + /* Write byte. */ + i2c_write(buf[i] & 0xFF); + + /* If we are writing the last byte totally or of a 32b page + generate a stop condition */ + if(i == size - 1 || (curaddr & EE_PAGEMASK) == EE_PAGEMASK) { + i2c_stop(); + eeprom_wait(); + } + + curaddr++; + } +} + +/** + * Read data from eeprom + * @param addr The eeprom memory address + * @param buf It is the destination buffer in witch the bytes will be written + * @param size It is the number of byte to read + */ +void +eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size) +{ + uint8_t i; + + i2c_start(); + + /* Select eeprom with write mode bit enabled */ + i2c_write(EE_HW_ADDRESS | 0x0); + + /* Send address */ + i2c_write((addr & 0xFF00) >> 8); + i2c_write(addr & 0xFF); + + i2c_start(); + + /* Select eeprom with write mode bit disabled */ + i2c_write(EE_HW_ADDRESS | 0x1); + + for(i = 0; i < size; i++) { + if(i < (size - 1)) { + /* Read data and send ACK */ + *(buf + i) = i2c_read(1); + } else { + /* Last data, don't send ACK */ + *(buf + i) = i2c_read(0); + } + } + + i2c_stop(); +} + +/** @} */ diff --git a/platform/mbxxx/dev/i2c.c b/platform/mbxxx/dev/i2c.c new file mode 100644 index 000000000..96fb46a84 --- /dev/null +++ b/platform/mbxxx/dev/i2c.c @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2013, IDentification Automation Laboratory + * IDALab (http://www.idalab.unisalento.it) + * Department of Innovation Engineering - University of Salento + * + * 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. + * + * 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. + * + */ + +/** + * \file i2c.c + * \brief I2C bus master driver for mbxxx platform. + * \author Maria Laura Stefanizzi + * \date 2013-11-20 + */ + +#include +#include +#include "dev/i2c.h" +#include PLATFORM_HEADER + +#define WAIT_FIN_SC2(FLAG) while(!SC2_STAT(FLAG)) {} + +/** + * Configure serial controller in I2C mode and set I2C speed. + */ +void +i2c_enable(void) +{ + /* Configure serial controller to I2C mode */ + SC2_MODE = SC2_MODE_I2C; + + /* + * The SCL is produced by dividing down 12MHz according to + * this equation: + * Rate = 12 MHz / ( (LIN + 1) * (2^EXP) ) + * + * Configure rate registers for Fast Mode operation (400 kbps) + */ + SC2_RATELIN = 14; + SC2_RATEEXP = 1; + + /* Reset control registers */ + SC2_TWICTRL1 = SC2_TWICTRL1_RESET; + SC2_TWICTRL2 = SC2_TWICTRL2_RESET; +} + +/** + * Configure serial controller in disabled mode + */ +void +i2c_disable(void) +{ + SC2_MODE = SC2_MODE_DISABLED; +} + +/** + * Generate I2C START condition + */ +void +i2c_start(void) +{ + SC2_TWICTRL1 |= SC_TWISTART; + WAIT_FIN_SC2(SC_TWICMDFIN); +} + +/** + * Generate I2C STOP condition + */ +void +i2c_stop(void) +{ + SC2_TWICTRL1 |= SC_TWISTOP; + WAIT_FIN_SC2(SC_TWICMDFIN); +} + +/** + * Send a byte to I2C bus + * @param data The data that must be sent + */ +void +i2c_write(uint8_t data) +{ + SC2_DATA = data; + + /* Configure control register 1 for byte transmission */ + SC2_TWICTRL1 |= SC_TWISEND; + WAIT_FIN_SC2(SC_TWITXFIN); +} + +/** + * Read a byte from I2C bus + * @param ack If true enable ACK generation after byte reception + * @return The received byte + */ +uint8_t +i2c_read(int ack) +{ + if(ack) { + /* Enable ACK generation after current received byte */ + SC2_TWICTRL2 |= SC_TWIACK; + } else { + /* Disable ACK generation */ + SC2_TWICTRL2 &= ~SC_TWIACK; + } + + /* Configure control register 1 for byte reception */ + SC2_TWICTRL1 |= SC_TWIRECV; + WAIT_FIN_SC2(SC_TWIRXFIN); + + return SC2_DATA; +} diff --git a/platform/esb/net/uip-driver.h b/platform/mbxxx/dev/i2c.h similarity index 73% rename from platform/esb/net/uip-driver.h rename to platform/mbxxx/dev/i2c.h index c067f647b..c85bc6d8b 100644 --- a/platform/esb/net/uip-driver.h +++ b/platform/mbxxx/dev/i2c.h @@ -1,7 +1,10 @@ /* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * All rights reserved. + * Copyright (c) 2013, IDentification Automation Laboratory + * IDALab (http://www.idalab.unisalento.it) + * Department of Innovation Engineering - University of Salento * + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -29,20 +32,23 @@ */ /** - * \file - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson + * \file i2c.h + * \brief I2C bus master driver for mbxxx platform. + * \author Maria Laura Stefanizzi + * \date 2013-11-20 */ +#ifndef I2C_H +#define I2C_H -#ifndef __UIP_DRIVER_H__ -#define __UIP_DRIVER_H__ +#define SC2_STAT(FLAG) (SC2_TWISTAT & FLAG) -#include "net/netstack.h" +void i2c_enable(void); +void i2c_disable(void); +void i2c_start(void); +void i2c_stop(void); -uint8_t uip_driver_send(void); +void i2c_write(uint8_t data); +uint8_t i2c_read(int ack); -extern const struct network_driver uip_driver; +#endif /* I2C_H */ -#endif /* __UIP_DRIVER_H__ */ diff --git a/platform/mbxxx/dev/mems.c b/platform/mbxxx/dev/mems.c index 95409fac0..5f74f1e43 100644 --- a/platform/mbxxx/dev/mems.c +++ b/platform/mbxxx/dev/mems.c @@ -23,205 +23,19 @@ #include PLATFORM_HEADER #include "mems.h" #include "timer.h" +#include "i2c.h" /* Private define -- ---------------------------------------------------------*/ - -#define TIMEOUT 20000 - #define SUCCESS 1 -#define FAIL 0 - -#define SEND_BYTE(data) do{ SC2_DATA=(data); SC2_TWICTRL1 |= SC_TWISEND; }while(0) - -#define WAIT_CMD_FIN() { \ - struct timer t; \ - timer_set(&t, CLOCK_SECOND/100); \ - while((SC2_TWISTAT&SC_TWICMDFIN)!=SC_TWICMDFIN){ \ - if(timer_expired(&t)){ \ - return FAIL; \ - } \ - } \ - } - -#define WAIT_TX_FIN() { \ - struct timer t; \ - timer_set(&t, CLOCK_SECOND/100); \ - while((SC2_TWISTAT&SC_TWITXFIN)!=SC_TWITXFIN){ \ - if(timer_expired(&t)){ \ - return FAIL; \ - } \ - } \ - } -#define WAIT_RX_FIN() { \ - struct timer t; \ - timer_set(&t, CLOCK_SECOND/100); \ - while((SC2_TWISTAT&SC_TWIRXFIN)!=SC_TWIRXFIN){ \ - if(timer_expired(&t)){ \ - return FAIL; \ - } \ - } \ - } +#define FAIL 0 /* Private variables ---------------------------------------------------------*/ static boolean fullscale_state; -/* Private functions ---------------------------------------------------------*/ -static uint8_t I2C_MEMS_Init (void); -//extern void halInternalResetWatchDog(void); -static uint8_t I2C_Send_Frame (uint8_t DeviceAddress, uint8_t *pBuffer, uint8_t NoOfBytes); -uint8_t i2c_write_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t reg_value); -//static uint8_t I2C_MEMS_Read (t_mems_data *mems_data); - /* Functions -----------------------------------------------------------------*/ /******************************************************************************* -* Function Name : Mems_Init -* Description : It inits mems -* Input : None -* Output : status -* Return : None -*******************************************************************************/ -uint8_t Mems_Init(void) -{ - uint8_t ret = 0; - - // GPIO assignments - // PA1: SC2SDA (Serial Data) - // PA2: SC2SCL (Serial Clock) - - //-----SC2 I2C Master GPIO configuration - - TIM2_CCER &= 0xFFFFEEEE; - SC2_MODE = SC2_MODE_I2C; - GPIO_PACFGL &= 0xFFFFF00F; - GPIO_PACFGL |= 0x00000DD0; - - SC2_RATELIN = 14; // generates standard 100kbps or 400kbps - SC2_RATEEXP = 1; // 3 yields 100kbps; 1 yields 400kbps - SC2_TWICTRL1 = 0; // start from a clean state - SC2_TWICTRL2 = 0; // start from a clean state - - ret = I2C_MEMS_Init(); - - fullscale_state = MEMS_LOW_RANGE; - -//Add later if really needed -#ifdef ST_DBG - if (!ret) - I2C_DeInit(MEMS_I2C); -#endif - - return ret; -}/* end Mems_Init */ - -/******************************************************************************* -* Function Name : Mems_GetValue -* Description : It returns the 3 mems acceleration values related to x,y,z -* axes in mems_data -* Input : mems_data -* Output : status -* Return : None -*******************************************************************************/ -//uint8_t Mems_GetValue(t_mems_data *mems_data) -//{ -// uint8_t i; -// i = I2C_MEMS_Read(mems_data); -// return i; -//} - - -/* Private Functions ---------------------------------------------------------*/ - -/******************************************************************************* -* Function Name : I2C_Send_Frame -* Description : It sends I2C frame -* Input : DeviceAddress is the destination device address -* pBUffer is the buffer data -* NoOfBytes is the number of bytes -* Output : None -* Return : 1 if the frame has been successfully sent, 0 otherwise. -*******************************************************************************/ -static uint8_t I2C_Send_Frame (uint8_t DeviceAddress, uint8_t *pBuffer, uint8_t NoOfBytes) -{ - uint8_t i, data; - - SC2_TWICTRL1 |= SC_TWISTART; // send start - WAIT_CMD_FIN(); - - SEND_BYTE(DeviceAddress); // send the address low byte - WAIT_TX_FIN(); - - // loop sending the data - for (i=0; i 1) - addr += REPETIR; - - SC2_TWICTRL1 |= SC_TWISTART; // send start - WAIT_CMD_FIN(); - - SEND_BYTE(slave_addr | 0x00); // send the address low byte - WAIT_TX_FIN(); - - SEND_BYTE(addr); - WAIT_TX_FIN(); - - SC2_TWICTRL1 |= SC_TWISTART; // send start - WAIT_CMD_FIN(); - - SEND_BYTE(slave_addr | 0x01); // send the address low byte - WAIT_TX_FIN(); - - // loop receiving the data - for (i=0;i 1) + addr += REPETIR; + + i2c_start(); + + /* send the address low byte */ + i2c_write(slave_addr | 0x00); + + i2c_write(addr); + + i2c_start(); + + /* send the address low byte */ + i2c_write(slave_addr | 0x01); + + /* loop receiving the data */ + for (i = 0; i < NoOfBytes; i++){ + + if (i < (NoOfBytes - 1)) + /* ack on receipt of data */ + ack = 1; + else + /* don't ack if last one */ + ack = 0; + + /* receive data */ + *(pBuffer+i) = i2c_read(ack); + } + + i2c_stop(); + + return SUCCESS; +}/* end MEMS_Read_Reg() */ /******************************************************************************* -* Function Name : I2C_MEMS_Init -* Description : It performs basic MEMS register writes for initialization -* purposes +* Function Name : MEMS_Init +* Description : It inits mems * Input : None -* Output : None -* Return : 1 if the device has been successfully initialized, 0 otherwise. +* Output : status +* Return : None *******************************************************************************/ -static uint8_t I2C_MEMS_Init (void) +uint8_t +MEMS_Init(void) { - uint8_t i = 0; - - i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, STATUS_REG, 0x00); //no flag - i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, FF_WU_CFG, 0x00); // all off - i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, DD_CFG, 0x00); // all off - //i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, (1<<4) | (1<<1) | (1 << 0)); - - i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, 0x00); - //i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0xC7); - i += i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0x87); - - if (i != 5) - return 0; + TIM2_CCER &= 0xFFFFEEEE; + MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, STATUS_REG, 0x00); //no flag + MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, FF_WU_CFG, 0x00); // all off + MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, DD_CFG, 0x00); // all off + MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG2, 0x00); + MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0x87); + fullscale_state = MEMS_LOW_RANGE; return 1; -}/* end I2C_MEMS_Init() */ +}/* end MEMS_Init */ /******************************************************************************* * Function Name : I2C_MEMS_On @@ -288,21 +140,23 @@ static uint8_t I2C_MEMS_Init (void) * Output : None * Return : 1 if the device has been successfully set to normal mode, 0 otherwise. *******************************************************************************/ -uint8_t MEMS_On (void) +uint8_t +MEMS_On (void) { - return i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0xC7); + return MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0xC7); } /******************************************************************************* -* Function Name : I2C_MEMS_Off +* Function Name : MEMS_Off * Description : It turn off the device. * Input : None * Output : None * Return : 1 if the device has been successfully set to power-down mode, 0 otherwise. *******************************************************************************/ -uint8_t MEMS_Off (void) +uint8_t +MEMS_Off (void) { - return i2c_write_reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0x87); + return MEMS_Write_Reg (kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, 0x87); } /******************************************************************************* @@ -312,13 +166,13 @@ uint8_t MEMS_Off (void) * Output : None * Return : 1 if the device has been successfully set to full scale mode, 0 otherwise. *******************************************************************************/ -uint8_t MEMS_SetFullScale (boolean range) +uint8_t +MEMS_SetFullScale (boolean range) { uint8_t i2c_buffer; - - if(!i2c_read_reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, &i2c_buffer, 1)) - return 0; - + + MEMS_Read_Reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, &i2c_buffer, 1); + if(range==MEMS_HIGH_RANGE){ i2c_buffer |= 0x20; } @@ -326,49 +180,26 @@ uint8_t MEMS_SetFullScale (boolean range) i2c_buffer &= ~0x20; } - if(!i2c_write_reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, i2c_buffer)) - return 0; - + MEMS_Write_Reg(kLIS3L02DQ_SLAVE_ADDR, CTRL_REG1, i2c_buffer); + fullscale_state = range; - + return 1; - } /******************************************************************************* -* Function Name : I2C_MEMS_GetFullScale +* Function Name : MEMS_GetFullScale * Description : It get the full-scale range of the device. * Input : None * Output : None * Return : range HIGH for high scale selection, LOW for low range. *******************************************************************************/ -boolean MEMS_GetFullScale (void) -{ +boolean +MEMS_GetFullScale (void) +{ return fullscale_state; } -/******************************************************************************* -* Function Name : I2C_MEMS_Read -* Description : It reads 3 axes acceleration data from mems -* Input : None -* Output : mems_data -* Return : 1 if acceleration data has been successfully read, 0 otherwise -*******************************************************************************/ -//static uint8_t I2C_MEMS_Read (t_mems_data *mems_data) -//{ -// uint8_t i, i2c_buffer[8]; -// -// i = i2c_read_reg (kLIS3L02DQ_SLAVE_ADDR, OUTX_L, i2c_buffer, 8); -// -// mems_data->outx_h = i2c_buffer[0]; -// mems_data->outx_l = i2c_buffer[1]; -// mems_data->outy_h = i2c_buffer[2]; -// mems_data->outy_l = i2c_buffer[3]; -// mems_data->outz_h = i2c_buffer[4]; -// mems_data->outz_l = i2c_buffer[5]; -// -// return i; -//}/* end I2C_MEMS_Read() */ - /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ /** @} */ + diff --git a/platform/mbxxx/dev/mems.h b/platform/mbxxx/dev/mems.h index 4f72a2291..b41fe43a5 100644 --- a/platform/mbxxx/dev/mems.h +++ b/platform/mbxxx/dev/mems.h @@ -18,8 +18,8 @@ * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ -#ifndef _MEMS_H_ -#define _MEMS_H_ +#ifndef MEMS_H_ +#define MEMS_H_ /* Define --------------------------------------------------------------------*/ #include "mems_regs.h" @@ -49,17 +49,19 @@ typedef struct { /* Functions -----------------------------------------------------------------*/ /* Mems Initialization function */ -uint8_t Mems_Init(void); +uint8_t MEMS_Init(void); uint8_t MEMS_On(void); uint8_t MEMS_Off(void); uint8_t MEMS_SetFullScale(boolean range); boolean MEMS_GetFullScale(void); +uint8_t MEMS_Read_Reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t *pBuffer, + uint8_t NoOfBytes); +uint8_t MEMS_Write_Reg (uint8_t slave_addr, uint8_t reg_addr, + uint8_t reg_value); -/* Get mems acceleration values */ -uint8_t Mems_GetValue(t_mems_data *mems_data); - -#endif /* _MEMS_H_ */ +#endif /*MEMS_H_ */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ /** @} */ + diff --git a/platform/mbxxx/dev/mems_regs.h b/platform/mbxxx/dev/mems_regs.h index ab0276846..33da5c82a 100644 --- a/platform/mbxxx/dev/mems_regs.h +++ b/platform/mbxxx/dev/mems_regs.h @@ -18,8 +18,8 @@ * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ -#ifndef _MEMS_REGS_H_ -#define _MEMS_REGS_H_ +#ifndef MEMS_REGS_H_ +#define MEMS_REGS_H_ /* Private include ------------------------------------------------------------*/ @@ -139,7 +139,7 @@ uint8_t i2c_read_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t *pBuffer, ui //-reg_value is the value of the register to be written---// uint8_t i2c_write_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t reg_value); -#endif /* _MEMS_REGS_H_ */ +#endif /*MEMS_REGS_H_ */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ /** @} */ diff --git a/platform/mbxxx/dev/temperature-sensor.h b/platform/mbxxx/dev/temperature-sensor.h index 48b218342..a9f6400a4 100644 --- a/platform/mbxxx/dev/temperature-sensor.h +++ b/platform/mbxxx/dev/temperature-sensor.h @@ -54,8 +54,8 @@ * (see STM32W108 errata). */ -#ifndef __TEMPERATURE_SENSOR_H__ -#define __TEMPERATURE_SENSOR_H__ +#ifndef TEMPERATURE_SENSOR_H_ +#define TEMPERATURE_SENSOR_H_ #include "lib/sensors.h" @@ -63,5 +63,5 @@ extern const struct sensors_sensor temperature_sensor; #define TEMPERATURE_SENSOR "Temperature" -#endif /* __TEMPERATURE_SENSOR_H__ */ +#endif /* TEMPERATURE_SENSOR_H_ */ /** @} */ diff --git a/platform/mbxxx/platform-conf.h b/platform/mbxxx/platform-conf.h index 7c19a9e52..5ed278687 100644 --- a/platform/mbxxx/platform-conf.h +++ b/platform/mbxxx/platform-conf.h @@ -48,13 +48,13 @@ */ /*---------------------------------------------------------------------------*/ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ #include PLATFORM_HEADER #include -#include // For memcpm(). +#include // For memcpm(). /* Platform-dependent definitions */ #define CC_CONF_REGISTER_ARGS 0 @@ -84,6 +84,7 @@ typedef unsigned long clock_time_t; #define CLOCK_CONF_SECOND 1000 typedef unsigned long rtimer_clock_t; + #define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0) #define LEDS_CONF_RED_PIN boardDescription->io->leds[1].gpioPin @@ -97,6 +98,7 @@ typedef unsigned long rtimer_clock_t; #define UIP_ARCH_CHKSUM 0 #define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN +#define EEPROM_CONF_SIZE 8000 -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ /** @} */ diff --git a/platform/micaz/contiki-conf.h b/platform/micaz/contiki-conf.h index e12140445..38d666e0b 100644 --- a/platform/micaz/contiki-conf.h +++ b/platform/micaz/contiki-conf.h @@ -39,8 +39,8 @@ * Kasun Hewage */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #define HAVE_STDINT_H #include "avrdef.h" @@ -203,4 +203,4 @@ typedef unsigned short uip_stats_t; typedef unsigned long off_t; -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/micaz/dev/adc.h b/platform/micaz/dev/adc.h index 473290b86..a51b3cebe 100644 --- a/platform/micaz/dev/adc.h +++ b/platform/micaz/dev/adc.h @@ -30,11 +30,11 @@ * */ -#ifndef __ADC_H__ -#define __ADC_H__ +#ifndef ADC_H_ +#define ADC_H_ void adc_init(); uint16_t get_adc(int channel); -#endif /* __ADC_H__ */ +#endif /* ADC_H_ */ diff --git a/platform/micaz/dev/sensors/mts300.h b/platform/micaz/dev/sensors/mts300.h index d217e9a23..0e07af034 100644 --- a/platform/micaz/dev/sensors/mts300.h +++ b/platform/micaz/dev/sensors/mts300.h @@ -38,8 +38,8 @@ * Kasun Hewage */ -#ifndef __MTS300_H__ -#define __MTS300_H__ +#ifndef MTS300_H_ +#define MTS300_H_ #include #include "contiki-conf.h" @@ -106,7 +106,7 @@ uint16_t get_mic(); void mts300_init(); -#endif /* __MTS300_H__ */ +#endif /* MTS300_H_ */ diff --git a/platform/micaz/init-net.h b/platform/micaz/init-net.h index 8c3711980..066a6d4fd 100644 --- a/platform/micaz/init-net.h +++ b/platform/micaz/init-net.h @@ -38,9 +38,9 @@ * Kasun Hewage */ -#ifndef __INIT_NET_H__ -#define __INIT_NET_H__ +#ifndef INIT_NET_H_ +#define INIT_NET_H_ void init_net(void); -#endif /* __INIT_NET_H__ */ +#endif /* INIT_NET_H_ */ diff --git a/platform/micaz/platform-conf.h b/platform/micaz/platform-conf.h index ebf459031..9a5a41f8c 100644 --- a/platform/micaz/platform-conf.h +++ b/platform/micaz/platform-conf.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -208,4 +208,4 @@ void clock_adjust_ticks(clock_time_t howmany); #define CC2420_SPI_ENABLE() (PORTB &= ~BV(CSN)) /* ENABLE CSn (active low) */ #define CC2420_SPI_DISABLE() (PORTB |= BV(CSN)) /* DISABLE CSn (active low) */ -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/minimal-net/contiki-conf.h b/platform/minimal-net/contiki-conf.h index 7fc897886..3fb85b001 100644 --- a/platform/minimal-net/contiki-conf.h +++ b/platform/minimal-net/contiki-conf.h @@ -30,8 +30,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include #include @@ -179,4 +179,4 @@ typedef unsigned long clock_time_t; /* Not part of C99 but actually present */ int strcasecmp(const char*, const char*); -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/msb430/Makefile b/platform/msb430/Makefile deleted file mode 100644 index 120434cd0..000000000 --- a/platform/msb430/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $Id: Makefile,v 1.3 2007/08/17 13:10:16 nvt-se Exp $ - -all: test-abc -upload: test-abc test-abc.u - -test-abc: - $(MAKE) test-abc.firmware && \ - $(MAKE) test-abc.firmware && \ - $(MAKE) test-abc.firmware - -CONTIKI=../.. -TARGET=msb430 - -include $(CONTIKI)/Makefile.include diff --git a/platform/msb430/Makefile.msb430 b/platform/msb430/Makefile.msb430 deleted file mode 100644 index 8ac7f68f9..000000000 --- a/platform/msb430/Makefile.msb430 +++ /dev/null @@ -1,74 +0,0 @@ -SENSORS = sensors.c sht11.c -MSB = dma.c infomem.c node-id.c \ - msb430-uart1.c rs232.c \ - cc1020.c cc1020-uip.c adc.c \ - msb430-slip-arch.c sd.c sd-arch.c \ - cfs-coffee.c cfs-coffee-arch.c - -CONTIKI_TARGET_DIRS = . dev apps loader -ifndef CONTIKI_TARGET_MAIN -CONTIKI_TARGET_MAIN = contiki-msb430-main.c -endif - -CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(MSB) $(CONTIKI_TARGET_MAIN) - -MCU=msp430f1612 -include $(CONTIKI)/cpu/msp430/Makefile.msp430 - -contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} -# $(AR) rcf $@ $^ - -ifndef BASE_IP -BASE_IP := 172.16.1.1 -endif - -### System dependent Makefile - -ifeq ($(HOST_OS),FreeBSD) - # settings for FreeBSD - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd -else - ifeq ($(HOST_OS),Windows) - # settings for Windows - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win - else - # settings for an arbitary unix-like platform - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix - endif -endif - -# If we are not running under Windows, we assume Linux -ifndef MOTELIST - USBDEVPREFIX= - SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux - MOTELIST = $(CONTIKI)/tools/sky/motelist-linux - MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);') - CMOTES=$(MOTES) -endif - -msb-motelist: - $(MOTELIST) -msb-motes: - @echo $(MOTES) - -ifdef MOTE -serialdump: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M` - -serialview: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp - -login: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) -else -serialdump: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M` - -serialview: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp - -login: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) -endif diff --git a/platform/msb430/apps/Makefile.apps b/platform/msb430/apps/Makefile.apps deleted file mode 100644 index faa02d97d..000000000 --- a/platform/msb430/apps/Makefile.apps +++ /dev/null @@ -1,2 +0,0 @@ -helloworld: helloworld.c -test-abc: test-abc.c diff --git a/platform/msb430/apps/acc-test.c b/platform/msb430/apps/acc-test.c deleted file mode 100644 index 09cf96842..000000000 --- a/platform/msb430/apps/acc-test.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "net/rime.h" -#include "dev/sd.h" - -#include -#include - -/*---------------------------------------------------------------------------*/ -PROCESS(test_acc_process, "Accelerometer test"); -AUTOSTART_PROCESSES(&test_acc_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_acc_process, ev, data) -{ - static struct etimer et; - static int x, y, z; - static uint32_t xa, ya, za; - - PROCESS_BEGIN(); - - while(1) { - etimer_set(&et, CLOCK_SECOND / 8); - PROCESS_WAIT_EVENT(); - if (etimer_expired(&et)) { - adc_on(); - x = ADC12MEM0; - y = ADC12MEM1; - z = ADC12MEM2; - xa = xa + x - (xa >> 4); - ya = ya + y - (ya >> 4); - za = za + z - (za >> 4); - adc_off(); - printf("x=%ld, y=%ld, z=%ld\n", - (xa >> 4) - x, (ya >> 4) - y, (za >> 4) - z); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/apps/sd-test.c b/platform/msb430/apps/sd-test.c deleted file mode 100644 index 53acd9eb9..000000000 --- a/platform/msb430/apps/sd-test.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Test for an SD driver. - * \author - * Nicolas Tsiftes - */ - - -#include "contiki.h" -#include "dev/sd.h" -#include "lib/random.h" - -#include -#include - -PROCESS(sd_test, "SD test process"); -AUTOSTART_PROCESSES(&sd_test); - -#define BUF_SIZE 64 - -PROCESS_THREAD(sd_test, event, data) -{ - static unsigned long iter; - static unsigned long offset; - char buf[BUF_SIZE]; - static struct etimer et; - int r, buflen; - - PROCESS_BEGIN(); - - etimer_set(&et, CLOCK_SECOND / 16); - - offset = 0; - for(iter = 1;; iter++) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - memset(buf, 0, sizeof(buf)); - buflen = sprintf(buf, "(%ld) Testing the SD card (%ld)", iter, iter); - - if((iter & 7) == 0) { - offset = random_rand() & 0xffff; - } else { - offset += random_rand() & 0xff; - } - - r = sd_write(offset, buf, buflen + 1); - if(r > 0) { - memset(buf, 0, sizeof(buf)); - r = sd_read(offset, buf, buflen + 1); - if(r > 0) { - printf("read %s (offset %lu)\n", buf, offset); - } else { - printf("read error: %d (%s)\n", r, sd_error_string(r)); - } - } else { - printf("write error: %d (%s)\n", r, sd_error_string(r)); - } - etimer_restart(&et); - } - - PROCESS_END(); -} diff --git a/platform/msb430/apps/test-sht11.c b/platform/msb430/apps/test-sht11.c deleted file mode 100644 index 7ceb6fe13..000000000 --- a/platform/msb430/apps/test-sht11.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Testing the SHT11 sensor. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "dev/sht11.h" - -#include - -PROCESS(test_sht11_process, "SHT11 test"); -AUTOSTART_PROCESSES(&test_sht11_process); - -PROCESS_THREAD(test_sht11_process, ev, data) -{ - static struct etimer et; - static unsigned rh; - - PROCESS_BEGIN(); - - for (etimer_set(&et, CLOCK_SECOND);; etimer_reset(&et)) { - PROCESS_YIELD(); - printf("Temperature: %u degrees Celsius\n", - (unsigned) (-39.60 + 0.01 * sht11_temp())); - rh = sht11_humidity(); - printf("Rel. humidity: %u%%\n", - (unsigned) (-4 + 0.0405*rh - 2.8e-6*(rh*rh))); - } - - PROCESS_END(); -} diff --git a/platform/msb430/buildscripts/Makefile.freebsd b/platform/msb430/buildscripts/Makefile.freebsd deleted file mode 100644 index 625d3bb81..000000000 --- a/platform/msb430/buildscripts/Makefile.freebsd +++ /dev/null @@ -1,18 +0,0 @@ -ifndef JTAG - JTAG := $(CONTIKI)/platform/$(TARGET)/buildscripts/jtag/pyjtag/jtag.py -endif - -ifndef JTAG_PORT - JTAG_PORT = /dev/ppi0 -endif - -%.u: %.$(TARGET) - $(JTAG) -l $(JTAG_PORT) -m - $(JTAG) -l $(JTAG_PORT) -D -D -S -R 2048 -p $^ - $(JTAG) -l $(JTAG_PORT) -D -r - -r: - $(JTAG) -l $(JTAG_PORT) -r - -erase: - $(JTAG) -l $(JTAG_PORT) -e diff --git a/platform/msb430/buildscripts/Makefile.unix b/platform/msb430/buildscripts/Makefile.unix deleted file mode 100644 index 58f308b79..000000000 --- a/platform/msb430/buildscripts/Makefile.unix +++ /dev/null @@ -1,18 +0,0 @@ -ifndef JTAG - JTAG := $(CONTIKI)/platform/$(TARGET)/buildscripts/jtag/pyjtag/jtag.py -endif - -ifndef JTAG_PORT - JTAG_PORT = /dev/parport0 -endif - -%.u: %.$(TARGET) - $(JTAG) -l $(JTAG_PORT) -m - $(JTAG) -l $(JTAG_PORT) -D -D -S -R 2048 -p $^ - $(JTAG) -l $(JTAG_PORT) -D -r - -r: - $(JTAG) -l $(JTAG_PORT) -r - -erase: - $(JTAG) -l $(JTAG_PORT) -e diff --git a/platform/msb430/buildscripts/Makefile.win b/platform/msb430/buildscripts/Makefile.win deleted file mode 100644 index 3f7928b87..000000000 --- a/platform/msb430/buildscripts/Makefile.win +++ /dev/null @@ -1,15 +0,0 @@ -ifndef JTAG_PORT - JTAG_PORT = LPT1 -endif - -ifdef DEBUG - DEBUG_ARGS = -D -D -D -D -endif - -%.u: %.ihex - msp430-jtag $(DEBUG_ARGS) -l $(JTAG_PORT) -mI $^ - -#CW=cw23 - -#%.u: %.ihex -# $(CW) -d f430p $^ \ No newline at end of file diff --git a/platform/msb430/buildscripts/jtag/pyjtag/_parjtag.so b/platform/msb430/buildscripts/jtag/pyjtag/_parjtag.so deleted file mode 100755 index 3eeec6b89..000000000 Binary files a/platform/msb430/buildscripts/jtag/pyjtag/_parjtag.so and /dev/null differ diff --git a/platform/msb430/buildscripts/jtag/pyjtag/elf.py b/platform/msb430/buildscripts/jtag/pyjtag/elf.py deleted file mode 100644 index 2ab16b1c2..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/elf.py +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/env python -import struct - -# ELF object file reader -# (C) 2003 cliechti@gmx.net -# Python license - -# size alignment -# Elf32_Addr 4 4 Unsigned program address -# Elf32_Half 2 2 Unsigned medium integer -# Elf32_Off 4 4 Unsigned file offset -# Elf32_Sword 4 4 Signed large integer -# Elf32_Word 4 4 Unsigned large integer -# unsignedchar 1 1 Unsigned small integer - -#define EI_NIDENT 16 -#~ typedef struct{ - #~ unsigned char e_ident[EI_NIDENT]; - #~ Elf32_Half e_type; - #~ Elf32_Half e_machine; - #~ Elf32_Word e_version; - #~ Elf32_Addr e_entry; - #~ Elf32_Off e_phoff; - #~ Elf32_Off e_shoff; - #~ Elf32_Word e_flags; - #~ Elf32_Half e_ehsize; - #~ Elf32_Half e_phentsize; - #~ Elf32_Half e_phnum; - #~ Elf32_Half e_shentsize; - #~ Elf32_Half e_shnum; - #~ Elf32_Half e_shstrndx; -#~ } Elf32_Ehdr; - - -#Section Header -#~ typedef struct { - #~ Elf32_Word sh_name; - #~ Elf32_Word sh_type; - #~ Elf32_Word sh_flags; - #~ Elf32_Addr sh_addr; - #~ Elf32_Off sh_offset; - #~ Elf32_Word sh_size; - #~ Elf32_Word sh_link; - #~ Elf32_Word sh_info; - #~ Elf32_Word sh_addralign; - #~ Elf32_Word sh_entsize; -#~ } Elf32_Shdr; - -#~ typedef struct { - #~ Elf32_Word p_type; - #~ Elf32_Off p_offset; - #~ Elf32_Addr p_vaddr; - #~ Elf32_Addr p_paddr; - #~ Elf32_Word p_filesz; - #~ Elf32_Word p_memsz; - #~ Elf32_Word p_flags; - #~ Elf32_Word p_align; -#~ } Elf32_Phdr; - - -class ELFException(Exception): pass - -class ELFSection: - """read and store a section""" - Elf32_Shdr = "= section.sh_addr + section.sh_size) \ - and (not (section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS) \ - or (p.p_offset <= section.sh_offset \ - and (p.p_offset + p.p_filesz >= section.sh_offset + section.sh_size)))): - return section.sh_addr + p.p_paddr - p.p_vaddr - return section.sh_addr - - def getSections(self): - """get sections relevant for the application""" - res = [] - for section in self.sections: - if section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS: - res.append(section) - return res - - def __str__(self): - """pretty print for debug...""" - return "%s(self.e_type=%r, self.e_machine=%r, self.e_version=%r, sections=%r)" % ( - self.__class__.__name__, - self.e_type, self.e_machine, self.e_version, - [section.name for section in self.sections]) - - -if __name__ == '__main__': - print "This is only a module test!" - elf = ELFObject() - elf.fromFile(open("test.elf")) - if elf.e_type != ELFObject.ET_EXEC: - raise Exception("No executable") - print elf - - #~ print repr(elf.getSection('.text').data) - #~ print [(s.name, hex(s.sh_addr)) for s in elf.getSections()] - print "-"*20 - for p in elf.sections: print p - print "-"*20 - for p in elf.getSections(): print p - print "-"*20 - for p in elf.getProgrammableSections(): print p diff --git a/platform/msb430/buildscripts/jtag/pyjtag/elf.pyc b/platform/msb430/buildscripts/jtag/pyjtag/elf.pyc deleted file mode 100644 index 10662cddb..000000000 Binary files a/platform/msb430/buildscripts/jtag/pyjtag/elf.pyc and /dev/null differ diff --git a/platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py b/platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py deleted file mode 100644 index c917ec975..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -"""Test File generator. -This tool generates a hex file, of given size, ending on address -0xffff. - -USAGE: hen-ihex.py size_in_kilobyte - -The resulting Intel-hex file is output to stdout, use redirection -to save the data to a file. -""" - -#return a string with data in intel hex format -def makeihex(address, data): - out = [] - start = 0 - while start len(data): end = len(data) - out.append(_ihexline(address, [ord(x) for x in data[start:end]])) - start += 16 - address += 16 - out.append(_ihexline(address, [], end=1)) #append no data but an end line - return ''.join(out) - -def _ihexline(address, buffer, end=0): - out = [] - if end: - type = 1 - else: - type = 0 - out.append( ':%02X%04X%02X' % (len(buffer),address&0xffff,type) ) - sum = len(buffer) + ((address>>8)&255) + (address&255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - out.append('%02X' % (b&255) ) - sum += b&255 - out.append('%02X\n' %( (-sum)&255)) - return ''.join(out) - -if __name__ == '__main__': - import struct, sys - if len(sys.argv) != 2: - print __doc__ - sys.exit(1) - - size = int(sys.argv[1]) #in kilo - startadr = 0x10000 - 1024*size - data = ''.join([struct.pack(">H", x) for x in range(startadr, startadr+ 1024*size, 2)]) - print makeihex(startadr, data) diff --git a/platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi b/platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi deleted file mode 100644 index a2cb801b8..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi +++ /dev/null @@ -1,108 +0,0 @@ -Name "install-pyjtag" -OutFile "install-pyjtag.exe" - -!define SF_SELECTED 1 -!define SF_SUBSEC 2 -!define SF_SUBSECEND 4 -!define SF_BOLD 8 -!define SF_RO 16 -!define SF_EXPAND 32 - -!define SECTION_OFF 0xFFFFFFFE - -LicenseText License -LicenseData license.txt - -SetOverwrite on -SetDateSave on - -; The default installation directory -InstallDir $PROGRAMFILES\mspgcc -; Registry key to check for directory (so if you install again, it will -; overwrite the old one automatically) -InstallDirRegKey HKLM SOFTWARE\mspgcc "rootdir" - -; The text to prompt the user to enter a directory -DirText "This will install the pyjtag executables. You can choose the same \ - directory as for the other mspgcc tools." - -; The text to prompt the user to enter a directory -ComponentText "Select which optional things you want installed." - -Section "msp430-jtag (required)" - SectionIn RO - SetOutPath $INSTDIR - - File /r bin - File /oname=license-pyjtag.txt license.txt - File /oname=readme-pyjtag.txt readme.txt - File /oname=bin\jtag.py jtag.py - - ; Write the installation path into the registry - WriteRegStr HKLM SOFTWARE\mspgcc "rootdir" "$INSTDIR" - ; Write the uninstall keys for Windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "DisplayName" "mspgcc pyjtag (remove only)" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "UninstallString" '"$INSTDIR\uninstall-pyjtag.exe"' - WriteUninstaller "uninstall-pyjtag.exe" -SectionEnd - -Section "giveio (needed on Win NT/2k/XP, but NOT on 9x/ME)" - SetOutPath $INSTDIR\bin - File ..\jtag\hardware_access\giveio\giveio.sys - File ..\jtag\hardware_access\giveio\loaddrv.exe - SetOutPath $INSTDIR - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe install giveio $INSTDIR\bin\giveio.sys' - Pop $0 ;return value/error/timeout - IntCmp $0 2 ext_here ;assume its alredy installed - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe start giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe starttype giveio auto' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - WriteRegStr HKLM SOFTWARE\mspgcc "giveio" "started" - Goto ext_ok -ext_err: - DetailPrint "Error while installing and starting giveio" - MessageBox MB_OK|MB_ICONSTOP "Error while installing and starting giveio" - Goto ext_ok -ext_here: - DetailPrint "Installing giveio gave an error, assuming its already installed" -ext_ok: -SectionEnd - -; special uninstall section. -Section "Uninstall" - ; remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" - DeleteRegKey HKLM SOFTWARE\NSIS_Example2 - ; remove files - Delete $INSTDIR\bin\msp430-jtag.exe - Delete $INSTDIR\bin\_parjtag.pyd - Delete $INSTDIR\bin\jtag.py - Delete $INSTDIR\bin\HIL.dll - Delete $INSTDIR\bin\MSP430mspgcc.dll - ;XXX python22.dll is left installed as it is used by pybsl and other tools - Delete $INSTDIR\license-pyjtag.txt - Delete $INSTDIR\readme-pyjtag.txt - ; giveio - ; if it was started by us, stop it - ReadRegStr $0 HKLM SOFTWARE\mspgcc "giveio" - StrCmp $0 '' no_giveio - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe stop giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe remove giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - Goto no_giveio -giveio_err: - DetailPrint "Error while uninstalling giveio service" - MessageBox MB_OK|MB_ICONSTOP "Error while uninstalling giveio service" -no_giveio: - Delete loaddrv.exe - Delete giveio.sys - ; MUST REMOVE UNINSTALLER, too - Delete $INSTDIR\uninstall-pyjtag.exe -SectionEnd diff --git a/platform/msb430/buildscripts/jtag/pyjtag/jtag.py b/platform/msb430/buildscripts/jtag/pyjtag/jtag.py deleted file mode 100755 index 0cb556a91..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/jtag.py +++ /dev/null @@ -1,604 +0,0 @@ -#!/usr/bin/env python -#Parallel JTAG programmer for the MSP430 embedded proccessor. -# -#(C) 2002 Chris Liechti -#this is distributed under a free software license, see license.txt -# -#Requires Python 2+ and the binary extension _parjtag. - -import sys -import _parjtag - -VERSION = "1.3" - -DEBUG = 0 #disable debug messages by default - - -#frame specific consts -ERASE_MASS = 2 -ERASE_MAIN = 1 -ERASE_SGMT = 0 - -#states -FREERUNNING = 0 -STOPPED = 1 - -#Configurations of the MSP430 driver -VERIFICATION_MODE = 0 #Verify data downloaded to FLASH memories. -RAMSIZE_OPTION = 1 #Change RAM used to download and program flash blocks -DEBUG_OPTION = 2 #Set debug level. Enables debug outputs. - -#enumeration of output formats for uploads -HEX = 0 -INTELHEX = 1 -BINARY = 2 - -#exceptions -class JTAGException(Exception): pass - -#for the use with memread -def hexdump( (adr, memstr) ): - """Print a hex dump of data collected with memread - arg1: tuple with adress, memory - return None""" - count = 0 - ascii = '' - for value in map(ord, memstr): - if not count: print "%04x: " % adr, - print "%02x" % value, - ascii += (32 <= value < 128) and chr(value) or '.' - count += 1 - adr += 1 - if count == 16: - count = 0 - print " ", ascii - ascii = '' - if count < 16: print " "*(16-count), " ", ascii - -def makeihex( (address, data) ): - """work though the data and output lines in inzel hex format. - and end tag is appended""" - start = 0 - while start len(data): end = len(data) - _ihexline(address, [ord(x) for x in data[start:end]]) - start += 16 - address += 16 - _ihexline(address, [], type=1) #append no data but an end line - -def _ihexline(address, buffer, type=0): - """encode one line, output with checksum""" - sys.stdout.write( ':%02X%04X%02X' % (len(buffer), address & 0xffff, type) ) - sum = len(buffer) + ((address >> 8) & 255) + (address & 255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - sys.stdout.write('%02X' % (b & 255)) - sum += b&255 - sys.stdout.write('%02X\n' %( (-sum) & 255)) - - -class Segment: - """store a string with memory contents along with its startaddress""" - def __init__(self, startaddress = 0, data=None): - if data is None: - self.data = '' - else: - self.data = data - self.startaddress = startaddress - - def __getitem__(self, index): - return self.data[index] - - def __len__(self): - return len(self.data) - - def __repr__(self): - return "Segment(startaddress = 0x%04x, data=%r)" % (self.startaddress, self.data) - -class Memory: - """represent memory contents. with functions to load files""" - def __init__(self, filename=None): - self.segments = [] - if filename: - self.filename = filename - self.loadFile(filename) - - def append(self, seg): - self.segments.append(seg) - - def __getitem__(self, index): - return self.segments[index] - - def __len__(self): - return len(self.segments) - - def loadIHex(self, file): - """load data from a (opened) file in Intel-HEX format""" - segmentdata = [] - currentAddr = 0 - startAddr = 0 - lines = file.readlines() - for l in lines: - if not l.strip(): continue #skip empty lines - if l[0] != ':': raise Exception("File Format Error\n") - l = l.strip() #fix CR-LF issues... - length = int(l[1:3],16) - address = int(l[3:7],16) - type = int(l[7:9],16) - check = int(l[-2:],16) - if type == 0x00: - if currentAddr != address: - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = address - segmentdata = [] - for i in range(length): - segmentdata.append( chr(int(l[9+2*i:11+2*i],16)) ) - currentAddr = length + currentAddr - elif type == 0x01: - pass - else: - sys.stderr.write("Ignored unknown field (type 0x%02x) in ihex file.\n" % type) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadTIText(self, file): - """load data from a (opened) file in TI-Text format""" - next = 1 - currentAddr = 0 - startAddr = 0 - segmentdata = [] - #Convert data for MSP430, TXT-File is parsed line by line - while next >= 1: - #Read one line - l = file.readline() - if not l: break #EOF - l = l.strip() - if l[0] == 'q': break - elif l[0] == '@': #if @ => new address => send frame and set new addr. - #create a new segment - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = int(l[1:],16) - segmentdata = [] - else: - for i in l.split(): - segmentdata.append(chr(int(i,16))) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadELF(self, file): - """load data from a (opened) file in ELF object format. - File must be seekable""" - import elf - obj = elf.ELFObject() - obj.fromFile(file) - if obj.e_type != elf.ELFObject.ET_EXEC: - raise Exception("No executable") - for section in obj.getSections(): - if DEBUG: - sys.stderr.write("ELF section %s at 0x%04x %d bytes\n" % (section.name, section.lma, len(section.data))) - if len(section.data): - self.segments.append( Segment(section.lma, section.data) ) - - def loadFile(self, filename): - """fill memory with the contents of a file. file type is determined from extension""" - #TODO: do a contents based detection - if filename[-4:].lower() == '.txt': - self.loadTIText(open(filename, "rb")) - elif filename[-4:].lower() in ('.a43', '.hex'): - self.loadIHex(open(filename, "rb")) - else: - self.loadELF(open(filename, "rb")) - - def getMemrange(self, fromadr, toadr): - """get a range of bytes from the memory. unavailable values are filled with 0xff.""" - res = '' - toadr = toadr + 1 #python indxes are excluding end, so include it - while fromadr < toadr: - for seg in self.segments: - segend = seg.startaddress + len(seg.data) - if seg.startaddress <= fromadr and fromadr < segend: - if toadr > segend: #not all data in segment - catchlength = segend-fromadr - else: - catchlength = toadr-fromadr - res = res + seg.data[fromadr-seg.startaddress : fromadr-seg.startaddress+catchlength] - fromadr = fromadr + catchlength #adjust start - if len(res) >= toadr-fromadr: - break #return res - else: #undefined memory is filled with 0xff - res = res + chr(255) - fromadr = fromadr + 1 #adjust start - return res - -class JTAG: - """wrap the _parjtag extension""" - - def __init__(self): - self.showprogess = 0 - - def connect(self, lpt=None): - """connect to specified or default port""" - if lpt is None: - _parjtag.connect() - else: - _parjtag.connect(lpt) - - def close(self): - """release JTAG""" - _parjtag.release() - - def uploadData(self, startaddress, size): - """upload a datablock""" - if DEBUG > 1: sys.stderr.write("* uploadData()\n") - return _parjtag.memread(startaddress, size) - - def actionMassErase(self): - """Erase the flash memory completely (with mass erase command)""" - sys.stderr.write("Mass Erase...\n") - _parjtag.memerase(ERASE_MASS) - - def actionMainErase(self): - """Erase the MAIN flash memory, leave the INFO mem""" - sys.stderr.write("Erase Main Flash...\n") - _parjtag.memerase(ERASE_MAIN, 0xfffe) - - def makeActionSegmentErase(self, address): - """Selective segment erase""" - class SegmentEraser: - def __init__(self, segaddr): - self.address = segaddr - def __call__(self): - sys.stderr.write("Erase Segment @ 0x%04x...\n" % self.address) - _parjtag.memerase(ERASE_SGMT, self.address) - return SegmentEraser(address) - - def actionEraseCheck(self): - """check the erasure of required flash cells.""" - sys.stderr.write("Erase Check by file ...\n") - if self.data is not None: - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != '\xff'*len(seg.data): raise JTAGException("Erase check failed") - else: - raise JTAGException("cannot do erase check against data with not knowing the actual data") - - def progess_update(self, count, total): - sys.stderr.write("\r%d%%" % (100*count/total)) - - def actionProgram(self): - """program data into flash memory.""" - if self.data is not None: - sys.stderr.write("Program ...\n") - if self.showprogess: - _parjtag.set_flash_callback(self.progess_update) - bytes = 0 - for seg in self.data: - _parjtag.memwrite(seg.startaddress, seg.data) - bytes += len(seg.data) - if self.showprogess: - sys.stderr.write("\r") - sys.stderr.write("%i bytes programmed.\n" % bytes) - else: - raise JTAGException("programming without data not possible") - - def actionVerify(self): - """Verify programmed data""" - if self.data is not None: - sys.stderr.write("Verify ...\n") - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != seg.data: raise JTAGException("Verify failed") - else: - raise JTAGException("verify without data not possible") - - def actionReset(self): - """perform a reset""" - sys.stderr.write("Reset device ...\n") - _parjtag.reset(0, 0) - - def actionRun(self, address): - """start program at specified address""" - raise NotImplementedError - #sys.stderr.write("Load PC with 0x%04x ...\n" % address) - - def funclet(self): - """download and start funclet""" - sys.stderr.write("Download and execute of funclet...\n") - if len(self.data) > 1: - raise JTAGException("don't know how to handle multiple segments in funclets") - _parjtag.funclet(self.data[0].data) - sys.stderr.write("Funclet OK.\n") - -def usage(): - """print some help message""" - sys.stderr.write(""" -USAGE: %s [options] [file] -Version: %s - -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. -""" % (sys.argv[0], VERSION)) - -def main(): - global DEBUG - import getopt - filetype = None - filename = None - reset = 0 - wait = 0 - goaddr = None - jtag = JTAG() - toinit = [] - todo = [] - startaddr = None - size = 2 - outputformat= HEX - lpt = None - funclet = None - ramsize = None - - sys.stderr.write("MSP430 parallel JTAG programmer Version: %s\n" % VERSION) - try: - opts, args = getopt.getopt(sys.argv[1:], - "hl:weEmpvrg:Du:d:s:xbiITfR:S", - ["help", "lpt=", "wait" - "masserase", "erasecheck", "mainerase", "program", - "erase=", "eraseinfo", - "verify", "reset", "go=", "debug", - "upload=", "download=", "size=", "hex", "bin", "ihex", - "intelhex", "titext", "funclet", "ramsize=", "progress"] - ) - except getopt.GetoptError: - # print help information and exit: - usage() - sys.exit(2) - - for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-l", "--lpt"): - lpt = a - elif o in ("-w", "--wait"): - wait = 1 - elif o in ("-e", "--masserase"): - toinit.append(jtag.actionMassErase) #Erase Flash - elif o in ("-E", "--erasecheck"): - toinit.append(jtag.actionEraseCheck) #Erase Check (by file) - elif o in ("-m", "--mainerase"): - toinit.append(jtag.actionMainErase) #Erase main Flash - elif o == "--erase": - try: - seg = int(a, 0) - toinit.append(jtag.makeActionSegmentErase(seg)) - except ValueError: - sys.stderr.write("segment address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o == "--eraseinfo": - toinit.append(jtag.makeActionSegmentErase(0x1000)) - toinit.append(jtag.makeActionSegmentErase(0x1080)) - elif o in ("-p", "--program"): - todo.append(jtag.actionProgram) #Program file - elif o in ("-v", "--verify"): - todo.append(jtag.actionVerify) #Verify file - elif o in ("-r", "--reset"): - reset = 1 - elif o in ("-g", "--go"): - try: - goaddr = int(a, 0) #try to convert decimal - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-D", "--debug"): - DEBUG = DEBUG + 1 - elif o in ("-u", "--upload"): - try: - startaddr = int(a, 0) #try to convert number of any base - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-s", "--size"): - try: - size = int(a, 0) - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - #outut formats - elif o in ("-x", "--hex"): - outputformat = HEX - elif o in ("-b", "--bin"): - outputformat = BINARY - elif o in ("-i", "--ihex"): - outputformat = INTELHEX - #input formats - elif o in ("-I", "--intelhex"): - filetype = 0 - elif o in ("-T", "--titext"): - filetype = 1 - #others - elif o in ("-f", "--funclet"): - funclet = 1 - elif o in ("-R", "--ramsize"): - try: - ramsize = int(a, 0) - except ValueError: - sys.stderr.write("ramsize must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-S", "--progress"): - jtag.showprogess = 1 - - if len(args) == 0: - sys.stderr.write("Use -h for help\n") - elif len(args) == 1: #a filename is given - if not funclet: - if not todo: #if there are no actions yet - todo.extend([ #add some useful actions... - jtag.actionProgram, - ]) - filename = args[0] - else: #number of args is wrong - usage() - sys.exit(2) - - if DEBUG: #debug infos - sys.stderr.write("debug level set to %d\n" % DEBUG) - _parjtag.configure(DEBUG_OPTION, DEBUG) - sys.stderr.write("python version: %s\n" % sys.version) - - - #sanity check of options - if goaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --go is specified!\n") - reset = 0 - - if startaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --upload is specified!\n") - reset = 0 - - #prepare data to download - jtag.data = Memory() #prepare downloaded data - if filetype is not None: #if the filetype is given... - if filename is None: - raise ValueError("no filename but filetype specified") - if filename == '-': #get data from stdin - file = sys.stdin - else: - file = open(filename,"rb") #or from a file - if filetype == 0: #select load function - jtag.data.loadIHex(file) #intel hex - elif filetype == 1: - jtag.data.loadTIText(file) #TI's format - else: - raise ValueError("illegal filetype specified") - else: #no filetype given... - if filename == '-': #for stdin: - jtag.data.loadIHex(sys.stdin) #assume intel hex - elif filename: - jtag.data.loadFile(filename) #autodetect otherwise - - if DEBUG > 5: sys.stderr.write("File: %r\n" % filename) - - try: - jtag.connect(lpt) #try to open port - except IOError: - raise #do not handle here - else: #continue if open was successful - if ramsize is not None: - _parjtag.configure(RAMSIZE_OPTION, ramsize) - #initialization list - if toinit: #erase and erase check - if DEBUG: sys.stderr.write("Preparing device ...\n") - for f in toinit: f() - - #work list - if todo: - if DEBUG > 0: #debug - #show a nice list of sheduled actions - sys.stderr.write("TODO list:\n") - for f in todo: - try: - sys.stderr.write(" %s\n" % f.func_name) - except AttributeError: - sys.stderr.write(" %r\n" % f) - for f in todo: f() #work through todo list - - if reset: #reset device first if desired - jtag.actionReset() - - if funclet is not None: #download and start funclet - jtag.funclet() - - if goaddr is not None: #start user programm at specified address - jtag.actionRun(goaddr) #load PC and execute - - #upload datablock and output - if startaddr is not None: - if goaddr: #if a program was started... - raise NotImplementedError - #TODO: - #sys.stderr.write("Waiting to device for reconnect for upload: ") - data = jtag.uploadData(startaddr, size) #upload data - if outputformat == HEX: #depending on output format - hexdump( (startaddr, data) ) #print a hex display - elif outputformat == INTELHEX: - makeihex( (startaddr, data) ) #ouput a intel-hex file - else: - sys.stdout.write(data) #binary output w/o newline! - wait = 0 #wait makes no sense as after the upload the device is still stopped - - if wait: #wait at the end if desired - sys.stderr.write("Press ...\n") #display a prompt - raw_input() #wait for newline - - _parjtag.reset(1, 1) #reset and release target - #~ jtag.actionReset() - jtag.close() #Release communication port - -if __name__ == '__main__': - try: - main() - except SystemExit: - raise #let pass exit() calls - except KeyboardInterrupt: - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("user abort.\n") #short messy in user mode - sys.exit(1) #set errorlevel for script usage - except Exception, msg: #every Exception is caught and displayed - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("\nAn error occoured:\n%s\n" % msg) #short messy in user mode - sys.exit(1) #set errorlevel for script usage diff --git a/platform/msb430/buildscripts/jtag/pyjtag/license.txt b/platform/msb430/buildscripts/jtag/pyjtag/license.txt deleted file mode 100644 index 810a2d24c..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/license.txt +++ /dev/null @@ -1,62 +0,0 @@ -Copyright (c) 2001-2002 Chris Liechti - -All Rights Reserved. - -This is the Python license. In short, you can use this product in -commercial and non-commercial applications, modify it, redistribute it. -A notification to the author when you use and/or modify it is welcome. - -TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE -============================================ - -LICENSE AGREEMENT ------------------ - -1. This LICENSE AGREEMENT is between the copyright holder of this -product, and the Individual or Organization ("Licensee") accessing -and otherwise using this product in source or binary form and its -associated documentation. - -2. Subject to the terms and conditions of this License Agreement, -the copyright holder hereby grants Licensee a nonexclusive, -royalty-free, world-wide license to reproduce, analyze, test, -perform and/or display publicly, prepare derivative works, distribute, -and otherwise use this product alone or in any derivative version, -provided, however, that copyright holders License Agreement and -copyright holders notice of copyright are retained in this product -alone or in any derivative version prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates this product or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to this product. - -4. The copyright holder is making this product available to Licensee -on an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS -OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT -LIMITATION, THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY -REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR -ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS PRODUCT WILL -NOT INFRINGE ANY THIRD PARTY RIGHTS. - -5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY -OTHER USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR -CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, -DISTRIBUTING, OR OTHERWISE USING THIS PRODUCT, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY -THEREOF. - -6. This License Agreement will automatically terminate upon a -material breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between the -copyright holder and Licensee. This License Agreement does not grant -permission to use trademarks or trade names from the copyright holder -in a trademark sense to endorse or promote products or services of -Licensee, or any third party. - -8. By copying, installing or otherwise using this product, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. diff --git a/platform/msb430/buildscripts/jtag/pyjtag/makefile b/platform/msb430/buildscripts/jtag/pyjtag/makefile deleted file mode 100644 index 5482fa2f1..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/makefile +++ /dev/null @@ -1,33 +0,0 @@ - -.PHONY: all FORCE clean windist - -all: windist - -#wrap py to exe and build windows installer -windist: - python setup.py py2exe - rm -r bin - mv dist/jtag/jtag.exe dist/msp430-jtag.exe - mv dist/jtag/* dist/ - rmdir dist/jtag - mv dist bin - rm -r build - - -#generate test files -fill60k.a43: - python gen-ihex.py 60 >$@ -fill48k.a43: - python gen-ihex.py 48 >$@ -fill32k.a43: - python gen-ihex.py 32 >$@ -fill16k.a43: - python gen-ihex.py 16 >$@ -fill8k.a43: - python gen-ihex.py 8 >$@ -fill4k.a43: - python gen-ihex.py 4 >$@ - -#clean up the mess... -clean: - rm -r dist build bin \ No newline at end of file diff --git a/platform/msb430/buildscripts/jtag/pyjtag/readme.txt b/platform/msb430/buildscripts/jtag/pyjtag/readme.txt deleted file mode 100644 index bdd3da6c2..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/readme.txt +++ /dev/null @@ -1,182 +0,0 @@ -pyJTAG ------- - -Software to talk to the parallel port JTAG PCB as seen with the FET kits. -It is released under a free software license, -see license.txt for more details. - -(C) 2002-2003 Chris Liechti - -Features --------- - -- understands TI-Text and Intel-hex -- download to Flash and/or RAM, erase, verify -- reset device -- load addres into R0/PC and run -- upload a memory block MSP->PC (output as binary data or hex dump) -- written in Python, runs on Win32, Linux, BSD -- use per command line, or in a Python script - -Requirements ------------- -- Linux, BSD, Un*x or Windows PC -- Python 2.0 or newer, 2.2 recomeded -- Parallel JTAG hardware with an MSP430 device connected - -Installation ------------- -Python installations are available from www.python.org. On Windows simply -use the installer. The win32all package has an installer too. These -installations should run fine with the deafults. - -On Linux just Python is needed. On some distributions is Python 1.5.2 -installed per default. You may meed to change the first line in the script -from "python" to "python2". Maybe Python 2.x is in a separate package that -has to be installed. There are rpm and deb binary packages and a source -tarball available through the Python homepage. - -The pyjtag archive can simply be unpacked to a directory, Windows users -can use WinZip or WinRar among others to extract the gzipped tar file. -If you want to run it from everywhere the directory where the file jtag.py -is, should be added to the PATH. -Look at "~/.profile", "/etc/profile" on Linux, "autoexec.bat" on Win9x/ME, -System Properties/Environment in Win2000/NT/XP. - -_parjtag.so/dll from the jtag archive must be copied to the same directory as -jtag.py. On Windows also MSP430mspgcc.dll and HIL.dll must be located in the -same dir or somewhere in the PATH. - -Short introduction ------------------- -This software uses the JTAG hardware that comes with the FET kits. It is -connected to the parallel port. - -The program can be started by typing "python jtag.py" in a console. Often -it works also with just "jtag.py" or "./jtag.py". - -USAGE: jtag.py [options] [file] -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. - - -Examples --------- -These examples assume that you have added the installation directory to -the PATH. Type the full path to jtag.py otherwise and maybe use -"python jtag.py". Depending on installation it may also appear under the -name "msp430-jtag". - -jtag.py -e - Only erase flash. - -jtag.py -eErw 6port.a43 - Erase flash, erase check, download an executable, run it (reset) - and wait. - -jtag.py -mS -R 2048 6port.a43 - Use ramsize option on a device with 2k RAM to speed up - download. Of course any value from 128B up to the maximum - a device has is allowed. - The progress and mainerase options are also activated. - Only erasing the main memory is useful to keep calibration - data in the information memory. - -jtag.py 6port.a43 - Download of an executable to en empty (new or erased) device. - (Note that in new devices some of the first bytes in the - information memory are random data. If data should be - downloaded there, specify -eE.) - -jtag.py --go=0x220 ramtest.a43 - Download a program into RAM and run it, may not work - with all devices. - -jtag.py -f blinking.a43 - Download a program into RAM and run it. It must be - a special format with "startadr", "entrypoint", - "exitpoint" as the first three words in the data - and it must end on "jmp $". See MSP430debug sources - for more info. - -jtag.py -u 0x0c00 -s 1024 - Get a memory dump in HEX, from the bootstrap loader. - or save the binary in a file: - "python jtag.py -u 0x0c00 -s 1024 -b >dump.bin" - or as an intel-hex file: - "python jtag.py -u 0x0c00 -s 1024 -i >dump.a43" - -jtag.py -r - Just start the user program (with a reset). - -cat 6port.a43|jtag.py -e - - Pipe the data from "cat" to jtag.py to erase and program the - flash. (un*x example, don't forget the dash at the end of the - line) - -History -------- -1.0 public release -1.1 fix of verify error -1.2 use the verification during programming -1.3 meinerase, progress options, ihex output - -References ----------- -- Python: http://www.python.org - -- Texas Instruments MSP430 Homepage, links to Datasheets and Application - Notes: http://www.ti.com/sc/msp430 - diff --git a/platform/msb430/buildscripts/jtag/pyjtag/setup.py b/platform/msb430/buildscripts/jtag/pyjtag/setup.py deleted file mode 100644 index 982b58340..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -# setup.py -from distutils.core import setup -import glob -import py2exe - -setup( - name="msp430-jtag", - scripts=["jtag.py"], - ) \ No newline at end of file diff --git a/platform/msb430/cfs-coffee-arch.c b/platform/msb430/cfs-coffee-arch.c deleted file mode 100644 index 605ee79ff..000000000 --- a/platform/msb430/cfs-coffee-arch.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee functions the MSB-430 platform. - * \author - * Nicolas Tsiftes - */ - -#include "cfs-coffee-arch.h" -#include "dev/sd.h" - -#include - -int -cfs_coffee_arch_erase(unsigned sector) -{ - char buf[SD_DEFAULT_BLOCK_SIZE]; - sd_offset_t start_offset; - sd_offset_t end_offset; - sd_offset_t offset; - - memset(buf, 0, sizeof(buf)); - - start_offset = COFFEE_START + sector * COFFEE_SECTOR_SIZE; - end_offset = start_offset + COFFEE_SECTOR_SIZE; - - for(offset = start_offset; offset < end_offset; offset += SD_DEFAULT_BLOCK_SIZE) { - if(sd_write(offset, buf, sizeof(buf)) < 0) { - return -1; - } - } - return 0; -} diff --git a/platform/msb430/cfs-coffee-arch.h b/platform/msb430/cfs-coffee-arch.h deleted file mode 100644 index 6c1b960a0..000000000 --- a/platform/msb430/cfs-coffee-arch.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Coffee header for the Tmote Sky platform. - * \author - * Nicolas Tsiftes - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki-conf.h" -#include "dev/sd.h" - -/* Coffee configuration parameters. */ -#define COFFEE_SECTOR_SIZE (10*1024*1024UL) -#define COFFEE_PAGE_SIZE 1024UL -#define COFFEE_START 0 -#define COFFEE_SIZE (COFFEE_SECTOR_SIZE * 2) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 6 -#define COFFEE_FD_SET_SIZE 8 -#define COFFEE_LOG_TABLE_LIMIT 256 -#define COFFEE_DYN_SIZE 32*1024UL -#define COFFEE_LOG_SIZE 8*1024UL -#define COFFEE_MICRO_LOGS 0 - -/* Flash operations. */ -#define COFFEE_WRITE(buf, size, offset) \ - sd_write(COFFEE_START + (offset), (char *)(buf), (size)) - -#define COFFEE_READ(buf, size, offset) \ - sd_read(COFFEE_START + (offset), (char *)buf, (size)) - -#define COFFEE_ERASE(sector) \ - cfs_coffee_arch_erase(sector) - -/* Coffee types. */ -typedef int16_t coffee_page_t; -typedef sd_offset_t coffee_offset_t; - -int cfs_coffee_arch_erase(unsigned); - -#endif /* !COFFEE_ARCH_H */ diff --git a/platform/msb430/contiki-conf.h b/platform/msb430/contiki-conf.h deleted file mode 100644 index e6b525d40..000000000 --- a/platform/msb430/contiki-conf.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - -#define HAVE_STDINT_H -#include "msp430def.h" - -#define WITH_SD 0 - -#define NETSTACK_CONF_RADIO cc1020_driver -#define NETSTACK_CONF_RDC lpp_driver -#define NETSTACK_CONF_MAC csma_driver -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_FRAMER framer_nullmac - -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 - -#define ENERGEST_CONF_ON 1 - -#define IRQ_PORT1 0x01 -#define IRQ_PORT2 0x02 -#define IRQ_ADC 0x03 - -/* MSP430 information memory */ -#define INFOMEM_START 0x1000 -#define INFOMEM_BLOCK_SIZE 128 -#define INFOMEM_NODE_ID 0x0000 /* - 0x0004 */ - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_INLINE inline -#define CC_CONF_VA_ARGS 1 - -#define LPP_CONF_LISTEN_TIME 2 -#define LPP_CONF_OFF_TIME (CLOCK_SECOND - (LPP_CONF_LISTEN_TIME)) -#define QUEUEBUF_CONF_NUM 4 - - -#define CCIF -#define CLIF - -/* Clear channel assessment timeout for sending with the CC1020 radio. (ms) */ -#define CC1020_CONF_CCA_TIMEOUT 10 - -/* Clock */ -typedef unsigned clock_time_t; -#define CLOCK_CONF_SECOND 64 -#define F_CPU 2457600uL /* CPU target speed in Hz. */ - -#define BAUD2UBR(baud) (F_CPU/(baud)) - -#include "ctk/ctk-vncarch.h" - -#define LOG_CONF_ENABLED 0 - -/** - * The statistics data type. - * - * This datatype determines how high the statistics counters are able - * to count. - */ -typedef uint16_t uip_stats_t; - -typedef int bool; -#define TRUE 1 -#define FALSE 0 - -#define UIP_CONF_ICMP_DEST_UNREACH 1 -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_BUFFER_SIZE 116 -#define UIP_CONF_RECEIVE_WINDOW (UIP_CONF_BUFFER_SIZE - 40) -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 8 -#define UIP_CONF_UDP_CONNS 8 -#define UIP_CONF_FWCACHE_SIZE 20 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 - -#define LOADER_CONF_ARCH "loader/loader-arch.h" - -#define ELFLOADER_CONF_DATAMEMORY_SIZE 100 -#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000 - -/* LEDs ports MSB430 */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x80 -#define LEDS_CONF_GREEN 0x00 -#define LEDS_CONF_YELLOW 0x00 - -#endif /* !CONTIKI_CONF_H */ diff --git a/platform/msb430/contiki-msb430-main.c b/platform/msb430/contiki-msb430-main.c deleted file mode 100644 index 8b6b4f187..000000000 --- a/platform/msb430/contiki-msb430-main.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Main system file for the MSB-430 port. - * \author - * Michael Baar , Nicolas Tsiftes - */ -#include -#include - -#include "contiki.h" -#include "contiki-msb430.h" -#include "dev/adc.h" -#include "dev/sd.h" -#include "dev/serial-line.h" -#include "dev/sht11.h" -#include "dev/watchdog.h" - -extern volatile bool uart_edge; - -extern void init_net(void); - -SENSORS(NULL); - -static void -msb_ports_init(void) -{ - P1SEL = 0x00; P1OUT = 0x00; P1DIR = 0x00; - P2SEL = 0x00; P2OUT = 0x18; P2DIR = 0x1A; - P3SEL = 0x00; P3OUT = 0x09; P3DIR = 0x21; - P4SEL = 0x00; P4OUT = 0x00; P4DIR = 0x00; - P5SEL = 0x0E; P5OUT = 0xF9; P5DIR = 0xFD; - P6SEL = 0x07; P6OUT = 0x00; P6DIR = 0xC8; -} - -int -main(void) -{ -#if WITH_SD - int r; -#endif /* WITH_SD */ - - msp430_cpu_init(); - watchdog_stop(); - - /* Platform-specific initialization. */ - msb_ports_init(); - adc_init(); - - clock_init(); - rtimer_init(); - - sht11_init(); - leds_init(); - leds_on(LEDS_ALL); - - process_init(); - - /* serial interface */ - rs232_set_input(serial_line_input_byte); - rs232_init(); - serial_line_init(); - - uart_lock(UART_MODE_RS232); - uart_unlock(UART_MODE_RS232); -#if WITH_UIP - slip_arch_init(BAUD2UBR(115200)); -#endif - - -#if WITH_SD - r = sd_initialize(); - if(r < 0) { - printf("Failed to initialize the SD driver: %s\n", sd_error_string(r)); - } else { - sd_offset_t capacity; - printf("The SD driver was successfully initialized\n"); - capacity = sd_get_capacity(); - if(capacity < 0) { - printf("Failed to get the SD card capacity: %s\n", sd_error_string(r)); - } else { - printf("SD card capacity: %u MB\n", - (unsigned)(capacity / (1024UL * 1024))); - } - } -#endif - - node_id_restore(); - - /* System timers */ - process_start(&etimer_process, NULL); - ctimer_init(); - - /* Networking stack. */ - NETSTACK_RADIO.init(); - NETSTACK_RDC.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); - { - rimeaddr_t rimeaddr; - - rimeaddr.u8[0] = node_id & 0xff; - rimeaddr.u8[1] = node_id >> 8; - rimeaddr_set_node_addr(&rimeaddr); - } - - energest_init(); - -#if PROFILE_CONF_ON - profile_init(); -#endif /* PROFILE_CONF_ON */ - - leds_off(LEDS_ALL); - - printf("Node %d.%d: %s %s, channel check rate %u Hz\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? - 1 : (unsigned)NETSTACK_RDC.channel_check_interval())); - - autostart_start(autostart_processes); - - /* - * This is the scheduler loop. - */ - ENERGEST_ON(ENERGEST_TYPE_CPU); - - while (1) { - int r; -#if PROFILE_CONF_ON - profile_episode_start(); -#endif /* PROFILE_CONF_ON */ - do { - /* Reset watchdog. */ - watchdog_periodic(); - r = process_run(); - } while(r > 0); - -#if PROFILE_CONF_ON - profile_episode_end(); -#endif /* PROFILE_CONF_ON */ - - /* - * Idle processing. - */ - int s = splhigh(); /* Disable interrupts. */ - if (process_nevents() != 0) { - splx(s); /* Re-enable interrupts. */ - } else { - static unsigned long irq_energest = 0; - /* Re-enable interrupts and go to sleep atomically. */ - ENERGEST_OFF(ENERGEST_TYPE_CPU); - ENERGEST_ON(ENERGEST_TYPE_LPM); - /* - * We only want to measure the processing done in IRQs when we - * are asleep, so we discard the processing time done when we - * were awake. - */ - energest_type_set(ENERGEST_TYPE_IRQ, irq_energest); - - if (uart_edge) { - _BIC_SR(LPM1_bits + GIE); - } else { - _BIS_SR(LPM1_bits + GIE); - } - - /* - * We get the current processing time for interrupts that was - * done during the LPM and store it for next time around. - */ - dint(); - irq_energest = energest_type_time(ENERGEST_TYPE_IRQ); - eint(); - ENERGEST_OFF(ENERGEST_TYPE_LPM); - ENERGEST_ON(ENERGEST_TYPE_CPU); -#if PROFILE_CONF_ON - profile_clear_timestamps(); -#endif /* PROFILE_CONF_ON */ - } - } - - return 0; -} diff --git a/platform/msb430/contiki-msb430.h b/platform/msb430/contiki-msb430.h deleted file mode 100644 index 80afabd21..000000000 --- a/platform/msb430/contiki-msb430.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -#ifndef CONTIKI_MSB430_H -#define CONTIKI_MSB430_H - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" - -#include "dev/cc1020.h" -#include "dev/hwconf.h" -#include "dev/infomem.h" -#include "dev/leds.h" -#include "dev/lpm.h" -#include "dev/msb430-uart1.h" -#include "dev/rs232.h" -#include "dev/serial-line.h" -#include "dev/slip.h" - -#include "lib/sensors.h" -#include "net/rime.h" -#include "sys/node-id.h" - -#if WITH_SD -#include "dev/sd.h" -#endif /* WITH_SD */ - -#endif /* !CONTIKI_MSB430_H */ diff --git a/platform/msb430/dev/adc.c b/platform/msb430/dev/adc.c deleted file mode 100644 index fb14d3723..000000000 --- a/platform/msb430/dev/adc.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * ADC functions. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "contiki-msb430.h" - -void -adc_init(void) -{ - ADC12CTL0 = SHT0_15 | SHT1_15 | MSC; - - /* - * SHP: sampling timer - * CONSEQ3: repeat sequence of channels - * CSTARTADD: conversion start address 0 - */ - ADC12CTL1 = SHP | CONSEQ_3 | CSTARTADD_0; - - /* P60: A0 */ - ADC12MCTL0 = INCH_0 | SREF_0; - ADC12MCTL1 = INCH_1 | SREF_0; - ADC12MCTL2 = INCH_2 | SREF_0; - - /* P61: A1 */ - ADC12MCTL3 = ADC12MCTL4 = ADC12MCTL5 = INCH_1 | SREF_0; - - /* P62: A2 */ - ADC12MCTL6 = ADC12MCTL7 = ADC12MCTL8 = ADC12MCTL9 = INCH_2 | SREF_0; - - /* P63: A3 */ - ADC12MCTL10 = INCH_3 | SREF_0; - - /* P64: A4 */ - ADC12MCTL11 = INCH_4 | SREF_0; - - /* P65: A5 */ - ADC12MCTL12 = INCH_5 | SREF_0; - - /* INCH10: Temperature sensor. */ - ADC12MCTL13 = INCH_10 | SREF_0 | EOS; -} - -void -adc_on(void) -{ - ADC12CTL0 |= ADC12ON; - clock_delay(20000); - ADC12CTL0 |= ENC; - ADC12CTL0 |= ADC12SC; -} - -void -adc_off(void) -{ - ADC12CTL0 &= ~ENC; - clock_delay(20000); - ADC12CTL0 &= ~ADC12ON; -} diff --git a/platform/msb430/dev/adc.h b/platform/msb430/dev/adc.h deleted file mode 100644 index e8d5a2dd9..000000000 --- a/platform/msb430/dev/adc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -#ifndef ADC_H -#define ADC_H - -void adc_init(void); -void adc_on(void); -void adc_off(void); - -#endif /* !ADC_H */ diff --git a/platform/msb430/dev/cc1020-internal.h b/platform/msb430/dev/cc1020-internal.h deleted file mode 100644 index f0053ea97..000000000 --- a/platform/msb430/dev/cc1020-internal.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef CC1020_INTERNAL_H -#define CC1020_INTERNAL_H - -#include "contiki.h" - -#define CC1020_MAIN 0x00 -#define CC1020_INTERFACE 0x01 -#define CC1020_RESET 0x02 -#define CC1020_SEQUENCING 0x03 -#define CC1020_FREQ_2A 0x04 -#define CC1020_FREQ_1A 0x05 -#define CC1020_FREQ_0A 0x06 -#define CC1020_CLOCK_A 0x07 -#define CC1020_FREQ_2B 0x08 -#define CC1020_FREQ_1B 0x09 -#define CC1020_FREQ_0B 0x0A -#define CC1020_CLOCK_B 0x0B -#define CC1020_VCO 0x0C -#define CC1020_MODEM 0x0D -#define CC1020_DEVIATION 0x0E -#define CC1020_AFC_CONTROL 0x0F -#define CC1020_FILTER 0x10 -#define CC1020_VGA1 0x11 -#define CC1020_VGA2 0x12 -#define CC1020_VGA3 0x13 -#define CC1020_VGA4 0x14 -#define CC1020_LOCK 0x15 -#define CC1020_FRONTEND 0x16 -#define CC1020_ANALOG 0x17 -#define CC1020_BUFF_SWING 0x18 -#define CC1020_BUFF_CURRENT 0x19 -#define CC1020_PLL_BW 0x1A -#define CC1020_CALIBRATE 0x1B -#define CC1020_PA_POWER 0x1C -#define CC1020_MATCH 0x1D -#define CC1020_PHASE_COMP 0x1E -#define CC1020_GAIN_COMP 0x1F -#define CC1020_POWERDOWN 0x20 -#define CC1020_TEST1 0x21 -#define CC1020_TEST2 0x22 -#define CC1020_TEST3 0x23 -#define CC1020_TEST4 0x24 -#define CC1020_TEST5 0x25 -#define CC1020_TEST6 0x26 -#define CC1020_TEST7 0x27 -#define CC1020_STATUS 0x40 -#define CC1020_RESET_DONE 0x41 -#define CC1020_RSS 0x42 -#define CC1020_AFC 0x43 -#define CC1020_GAUSS_FILTER 0x44 -#define CC1020_STATUS1 0x45 -#define CC1020_STATUS2 0x46 -#define CC1020_STATUS3 0x47 -#define CC1020_STATUS4 0x48 -#define CC1020_STATUS5 0x49 -#define CC1020_STATUS6 0x4A -#define CC1020_STATUS7 0x4B - -/* Flags for the MAIN register. */ -#define RESET_N 1 -#define BIAS_PD (1<<1) -#define XOSC_PD (1<<2) -#define FS_PD (1<<3) -#define PD_MODE_1 (1<<4) -#define PD_MODE_2 (1<<5) -#define F_REG (1<<6) -#define RXTX (1<<7) - -/* In power up mode, the MAIN register modifies some flags to the following. */ -#define SEQ_PD (1<<1) -#define SEQ_CAL_1 (1<<2) -#define SEQ_CAL_2 (1<<3) - -// For CC1020_STATUS -#define CARRIER_SENSE 0x08 -#define LOCK_CONTINUOUS 0x10 -#define LOCK_INSTANT 0x20 -#define SEQ_ERROR 0x40 -#define CAL_COMPLETE 0x80 - -#define PA_POWER 0x0F // initial default for output power -#define LOCK_NOK 0x00 -#define LOCK_OK 0x01 -#define LOCK_RECAL_OK 0x02 -#define CAL_TIMEOUT 0x7FFE -#define LOCK_TIMEOUT 0x7FFE -#define RESET_TIMEOUT 0x7FFE -#define TX_CURRENT 0x87 -#define RX_CURRENT 0x86 - -// CC1020 driver configuration - -// PDI (Data in) is on P21 -#define PDO (P2IN & 0x01) - -// PSEL is on P30 and low active -#define PSEL_ON do { P3OUT &= ~0x01; } while(0) -#define PSEL_OFF do { P3OUT |= 0x01; } while(0) -#define PCLK_HIGH do { P2OUT |= 0x08; } while(0) -#define PCLK_LOW do { P2OUT &= ~0x08; } while(0) - -// PDO (Data out) is on P22 -#define PDI_HIGH do { P2OUT |= 0x02; } while(0) - -#define PDI_LOW do { P2OUT &= ~0x02; } while(0) - -// Enable power for LNA (P24, low-active) -#define LNA_POWER_ON() do { P2OUT &= ~0x10; } while(0) - -#define LNA_POWER_OFF() do { P2OUT |= 0x10; } while(0) - -#define CC_LOCK (P2IN & 0x04) - -#define DISABLE_RX_IRQ() \ - do { IE1 &= ~(URXIE0); } while(0) - -#define ENABLE_RX_IRQ() \ - do { IFG1 &= ~URXIFG0; IE1 |= URXIE0; } while(0) - -#define ACK_TIMEOUT_115 4 // In RADIO_STROKE ticks -#define ACK_TIMEOUT_19 16 - -#define MHZ_869525 1 - -const uint8_t cc1020_config_19200[41] = { - 0x01, // 0x00, MAIN - 0x0F, // 0x01, INTERFACE - 0xFF, // 0x02, RESET - 0x8F, // 0x03, SEQUENCING - // 869.525 at 50kHz - 0x3A, // 0x04, FREQ_2A - 0x32, // 0x05, FREQ_1A - 0x97, // 0x06, FREQ_0A // 19200 - 0x38, // 0x07, CLOCK_A // 19200 - 0x3A, // 0x08, FREQ_2B - 0x37, // 0x09, FREQ_1B - 0xEB, // 0x0A, FREQ_0B // 19200 - 0x38, // 0x0B, CLOCK_B // 19200 - 0x44, // 0x0C, VCO 44 - 0x51, // 0x0D, MODEM Manchester - 0x2B, // 0x0E, DEVIATION // FSK - 0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC - 0x25, // 0x10, FILTER Bandwith 51.2 kHz i.e. channel spacing 100kHz - 0x61, // 0x11, VGA1 - 0x55, // 0x12, VGA2 - 0x2D, // 0x13, VGA3 - 0x37, // 0x14, VGA4 // 0x29, VGA4 ADJUSTED CS to 23! - 0x40, // 0x15, LOCK is Carrier SENSE - 0x76, // 0x16, FRONTEND - 0x87, // 0x17, ANALOG, RX=86/TX=87 - 0x10, // 0x18, BUFF_SWING - 0x25, // 0x19, BUFF_CURRENT - 0xAE, // 0x1A, PLL_BW - 0x34, // 0x1B, CALIBRATE - PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0 - 0xF0, // 0x1D, MATCH - 0x00, // 0x1E, PHASE_COMP - 0x00, // 0x1F, GAIN_COMP - 0x00, // 0x20, POWERDOWN - 0x4d, // 0x4d, // 0x21, - 0x10, // 0x10, // 0x22, - 0x06, // 0x06, // 0x23, - 0x00, // 0x00, // 0x24, - 0x40, // 0x40, // 0x25, - 0x00, // 0x00, // 0x26, - 0x00, // 0x00, // 0x27, - // Not in real config of chipCon from here!!! - ACK_TIMEOUT_19 -}; - -const uint8_t cc1020_config_115200[41] = { - 0x01, // 0x00, MAIN - 0x0F, // 0x01, INTERFACE - 0xFF, // 0x02, RESET - 0x8F, // 0x03, SEQUENCING - // 869.525 at 200kHz - 0x3A, // 0x04, FREQ_2A - 0x32, // 0x05, FREQ_1A - 0x97, // 0x06, FREQ_0A // 19200 - 0x29, // 0x07, CLOCK_A // 19200 - 0x3A, // 0x08, FREQ_2B - 0x37, // 0x09, FREQ_1B - 0xEB, // 0x0A, FREQ_0B // 19200 - 0x29, // 0x0B, CLOCK_B // 19200 - 0x44, // 0x0C, VCO 44 - 0x51, // 0x0D, MODEM Manchester - 0x58, // 0x0E, DEVIATION // FSK - 0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC - 0x80, // 0x10, FILTER Bandwith 307.2kHz, i.e. channel spacing 500 kHz - 0x61, // 0x11, VGA1 - 0x57, // 0x12, VGA2 - 0x30, // 0x13, VGA3 - 0x35, // 0x14, VGA4 - 0x20, // 0x15, LOCK is Carrier SENSE - 0x76, // 0x16, FRONTEND - 0x87, // 0x17, ANALOG, RX=86/TX=87 - 0x10, // 0x18, BUFF_SWING - 0x25, // 0x19, BUFF_CURRENT - 0xAE, // 0x1A, PLL_BW - 0x34, // 0x1B, CALIBRATE - PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0 - 0xF0, // 0x1D, MATCH - 0x00, // 0x1E, PHASE_COMP - 0x00, // 0x1F, GAIN_COMP - 0x00, // 0x20, POWERDOWN - 0x4d, // 0x21, - 0x10, // 0x22, - 0x06, // 0x23, - 0x00, // 0x24, - 0x40, // 0x25, - 0x00, // 0x26, - 0x00, // 0x27, - // Not in real config of chipCon from here!!! - ACK_TIMEOUT_115 -}; - -/// cc1020 state -enum cc1020_state { - CC1020_OFF = 0, - CC1020_RX = 0x01, - CC1020_TX = 0x02, - - CC1020_RX_SEARCHING = 0x10, // searching for preamble + sync word - CC1020_RX_RECEIVING = 0x20, // receiving bytes - CC1020_RX_PROCESSING = 0x40, // processing data in buffer - - CC1020_OP_STATE = 0x73, - - CC1020_TURN_OFF = 0x80, -}; - -#define CC1020_SET_OPSTATE(opstate) cc1020_state = ((cc1020_state & ~CC1020_OP_STATE) | (opstate)) - -/****************************************************************************** - * @name Packet specification - * @{ - */ - -// header: number of bytes in packet including header -struct cc1020_header { - uint8_t pad; - uint8_t length; -} __attribute__((packed)); - - -#define CC1020_BUFFERSIZE 128 - - -#define PREAMBLE_SIZE 6 -#define PREAMBLE 0xAA - -#define SYNCWORD_SIZE 2 -#define HDR_SIZE (sizeof (struct cc1020_header)) - -#define CRC_SIZE 2 - -#define TAIL_SIZE 2 -#define TAIL 0xFA - - -///@} - -#endif /* CC1020_INTERNAL_H */ diff --git a/platform/msb430/dev/cc1020-uip.h b/platform/msb430/dev/cc1020-uip.h deleted file mode 100644 index 652b40b3d..000000000 --- a/platform/msb430/dev/cc1020-uip.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef CC1020_UIP_H -#define CC1020_UIP_H - -void cc1020_uip_init(void); -uint8_t cc1020_uip_send(void); - -#endif /* !CC1020_UIP_H */ diff --git a/platform/msb430/dev/cc1020.c b/platform/msb430/dev/cc1020.c deleted file mode 100644 index f5c9ba291..000000000 --- a/platform/msb430/dev/cc1020.c +++ /dev/null @@ -1,803 +0,0 @@ -/* - * Copyright 2006, Freie Universitaet Berlin. All rights reserved. - * - * These sources were developed at the Freie Universitaet Berlin, Computer - * Systems and Telematics group. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - 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. - * - * - Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" - * basis, without any representations or warranties of any kind, express - * or implied including, but not limited to, representations or - * warranties of non-infringement, merchantability or fitness for a - * particular purpose. In no event shall FUB 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 implementation was originally developed by the CST group at the FUB. - */ - -/** - * \file cc1020.c - * \author FUB ScatterWeb Developers, Michael Baar, Nicolas Tsiftes - **/ - -#include -#include - -#include "contiki.h" -#include "contiki-msb430.h" -#include "cc1020-internal.h" -#include "cc1020.h" -#include "lib/random.h" -#include "lib/crc16.h" -#include "net/rime/rimestats.h" -#include "dev/dma.h" -#include "sys/energest.h" -#include "isr_compat.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define SEND_TIMEOUT 10 - -static int cc1020_calibrate(void); -static int cc1020_setupTX(int); -static int cc1020_setupRX(int); -static void cc1020_setupPD(void); -static void cc1020_wakeupTX(int); -static void cc1020_wakeupRX(int); -static uint8_t cc1020_read_reg(uint8_t addr); -static void cc1020_write_reg(uint8_t addr, uint8_t adata); -static void cc1020_load_config(const uint8_t *); -static void cc1020_reset(void); - -static const uint8_t syncword[SYNCWORD_SIZE] = {0xD3, 0x91}; - -/* current mode of cc1020 chip */ -static volatile enum cc1020_state cc1020_state = CC1020_OFF; -static volatile uint8_t cc1020_rxbuf[HDR_SIZE + CC1020_BUFFERSIZE]; -static uint8_t cc1020_txbuf[PREAMBLE_SIZE + SYNCWORD_SIZE + HDR_SIZE + - CC1020_BUFFERSIZE + TAIL_SIZE]; - -/* number of bytes in receive and transmit buffers respectively. */ -static uint8_t cc1020_rxlen; -static uint8_t cc1020_txlen; - -/* received signal strength indicator reading for last received packet */ -static volatile uint8_t rssi; - -/* callback when a packet has been received */ -static uint8_t cc1020_pa_power = PA_POWER; - -static volatile char dma_done; - -/* Radio driver AAPI functions. */ -static int cc1020_init(void); -static int cc1020_prepare(const void *payload, unsigned short payload_len); -static int cc1020_transmit(unsigned short transmit_len); -static int cc1020_send(const void *payload, unsigned short payload_len); -static int cc1020_read(void *buf, unsigned short buf_len); -static int cc1020_channel_clear(void); -static int cc1020_receiving_packet(void); -static int cc1020_pending_packet(void); -static int cc1020_on(void); -static int cc1020_off(void); - -const struct radio_driver cc1020_driver = - { - cc1020_init, - cc1020_prepare, - cc1020_transmit, - cc1020_send, - cc1020_read, - cc1020_channel_clear, - cc1020_receiving_packet, - cc1020_pending_packet, - cc1020_on, - cc1020_off - }; - -#define MS_DELAY(x) clock_delay(354 * (x)) - -PROCESS(cc1020_receiver_process, "CC1020 receiver"); - -static void -dma_callback(void) -{ - dma_done = 1; -} - -static void -reset_receiver(void) -{ - /* reset receiver */ - cc1020_rxlen = 0; - - if((cc1020_state & CC1020_TURN_OFF) && (cc1020_txlen == 0)) { - cc1020_off(); - } else { - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_SEARCHING); - cc1020_set_rx(); - ENABLE_RX_IRQ(); - } -} - -static int -cc1020_init(void) -{ - cc1020_setupPD(); - cc1020_reset(); - cc1020_load_config(cc1020_config_19200); - - /* init tx buffer with preamble + syncword */ - memset(cc1020_txbuf, PREAMBLE, PREAMBLE_SIZE); - cc1020_txbuf[PREAMBLE_SIZE] = syncword[0]; - cc1020_txbuf[PREAMBLE_SIZE + 1] = syncword[1]; - - /* calibrate receiver */ - cc1020_wakeupRX(RX_CURRENT); - if(!cc1020_calibrate()) { - PRINTF("cc1020: rx calibration failed\n"); - return -1; - } - - /* calibrate transmitter */ - cc1020_wakeupTX(TX_CURRENT); - if(!cc1020_calibrate()) { - PRINTF("cc1020: tx calibration failed\n"); - return -1; - } - - /* power down */ - cc1020_setupPD(); - - process_start(&cc1020_receiver_process, NULL); - dma_subscribe(0, dma_callback); - - return 0; -} - -void -cc1020_set_rx(void) -{ - int s; - - s = splhigh(); - - /* Reset SEL for P3[1-3] (CC DIO, DIO, DCLK) and P3[4-5] (Camera Rx+Tx) */ - P3SEL &= ~0x3E; - IFG1 &= ~(UTXIE0 | URXIE0); /* Clear interrupt flags */ - ME1 &= ~(UTXE0 | URXE0); /* Disable Uart0 Tx + Rx */ - UCTL0 = SWRST; /* U0 into reset state. */ - UCTL0 |= CHAR | SYNC; /* 8-bit character, SPI, Slave mode */ - - /* CKPH works also, but not CKPH+CKPL or none of them!! */ - UTCTL0 = CKPL | STC; - URCTL0 = 0x00; - UBR00 = 0x00; /* No baudrate divider */ - UBR10 = 0x00; /* settings for a spi */ - UMCTL0 = 0x00; /* slave. */ - ME1 |= URXE0; /* Enable USART0 RXD, disabling does not yield any powersavings */ - P3SEL |= 0x0A; /* Select rx line and clk */ - UCTL0 &= ~SWRST; /* Clear reset bit */ - splx(s); - - /* configure driver */ - cc1020_rxlen = 0; /* receive buffer position to start */ - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_SEARCHING); /* driver state to receive mode */ - - /* configure radio */ - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - cc1020_wakeupRX(RX_CURRENT); - cc1020_setupRX(RX_CURRENT); - LNA_POWER_ON(); /* enable amplifier */ - - /* activate */ - IE1 |= URXIE0; /* enable interrupt */ -} - -void -cc1020_set_tx(void) -{ - int s; - - /* configure radio rx */ - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - LNA_POWER_OFF(); /* power down LNA */ - s = splhigh(); - DISABLE_RX_IRQ(); - P3SEL &= ~0x02; /* Ensure Rx line is off */ - splx(s); - - /* configure radio tx */ - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - cc1020_wakeupTX(TX_CURRENT); - cc1020_setupTX(TX_CURRENT); - P3SEL |= 0x0C; /* select Tx line and clk */ - U0CTL |= SWRST; /* UART to reset mode */ - IFG1 &= ~UTXIFG0; /* Reset IFG. */ - - /* configure driver */ - CC1020_SET_OPSTATE(CC1020_TX); -} - -void -cc1020_set_power(uint8_t pa_power) -{ - cc1020_pa_power = pa_power; -} - -static int -cc1020_prepare(const void *payload, unsigned short payload_len) -{ - return -1; -} - -static int -cc1020_transmit(unsigned short transmit_len) -{ - return 0; -} - -static int -cc1020_send(const void *buf, unsigned short len) -{ - int normal_header = HDR_SIZE + len; - uint16_t rxcrc = 0xffff; /* For checksum purposes */ - rtimer_clock_t timeout_time; - - timeout_time = RTIMER_NOW() + RTIMER_SECOND / 1000 * SEND_TIMEOUT; - while(cc1020_state & CC1020_RX_RECEIVING) { - if(RTIMER_CLOCK_LT(timeout_time, RTIMER_NOW())) { - PRINTF("cc1020: transmission blocked by reception in progress\n"); - return RADIO_TX_ERR; - } - } - - if(cc1020_state == CC1020_OFF) { - return RADIO_TX_ERR; - } - - if(len > CC1020_BUFFERSIZE) { - return RADIO_TX_ERR; - } - - /* The preamble and the sync word are already in buffer. */ - cc1020_txlen = PREAMBLE_SIZE + SYNCWORD_SIZE; - - /* header */ - cc1020_txbuf[cc1020_txlen++] = 0x00; - cc1020_txbuf[cc1020_txlen++] = normal_header + CRC_SIZE; - - /* Adding the checksum on header and data */ - rxcrc = crc16_add(normal_header & 0xff, rxcrc); - rxcrc = crc16_add((normal_header >> 8) & 0xff, rxcrc); - - rxcrc = crc16_data(buf, len, rxcrc); - - /* data to send */ - memcpy((char *)cc1020_txbuf + cc1020_txlen, buf, len); - cc1020_txlen += len; - - /* Send checksum */ - cc1020_txbuf[cc1020_txlen++] = rxcrc >> 8; - cc1020_txbuf[cc1020_txlen++] = rxcrc & 0xff; - - /* suffix */ - cc1020_txbuf[cc1020_txlen++] = TAIL; - cc1020_txbuf[cc1020_txlen++] = TAIL; - - /* Switch to transceive mode. */ - cc1020_set_tx(); - - /* Initiate radio transfer. */ - dma_done = 0; - dma_transfer((unsigned char *)&TXBUF0, cc1020_txbuf, cc1020_txlen); - while(!dma_done); - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - RIMESTATS_ADD(lltx); - - /* clean up */ - cc1020_txlen = 0; - if(cc1020_state & CC1020_TURN_OFF) { - cc1020_off(); - } else { - cc1020_set_rx(); - } - - return RADIO_TX_OK; -} - -static int -cc1020_read(void *buf, unsigned short size) -{ - unsigned len; - - if(cc1020_rxlen <= HDR_SIZE) { - return 0; - } - - len = cc1020_rxlen - HDR_SIZE; - if(len > size) { - RIMESTATS_ADD(toolong); - return -1; - } - - memcpy(buf, (char *)cc1020_rxbuf + HDR_SIZE, len); - RIMESTATS_ADD(llrx); - reset_receiver(); - - return len; -} - -static int -cc1020_channel_clear(void) -{ - return (cc1020_read_reg(CC1020_STATUS) & CARRIER_SENSE); -} - -static int -cc1020_receiving_packet(void) -{ - return cc1020_state & CC1020_RX_RECEIVING; -} - -static int -cc1020_pending_packet(void) -{ - return cc1020_state & CC1020_RX_PROCESSING; -} - -int -cc1020_on(void) -{ - if(cc1020_state == CC1020_OFF) { - cc1020_set_rx(); - } else if(cc1020_state & CC1020_TURN_OFF) { - cc1020_state &= ~CC1020_TURN_OFF; - cc1020_set_rx(); - } - - return 1; -} - -int -cc1020_off(void) -{ - int s; - - if(cc1020_state != CC1020_OFF) { - if(cc1020_state & CC1020_RX_SEARCHING) { - /* Discard the current read buffer when the radio is shutting down. */ - cc1020_rxlen = 0; - - LNA_POWER_OFF(); /* power down lna */ - s = splhigh(); - DISABLE_RX_IRQ(); - cc1020_state = CC1020_OFF; - splx(s); - cc1020_setupPD(); /* power down radio */ - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - cc1020_state = CC1020_OFF; - } else { - cc1020_state |= CC1020_TURN_OFF; - } - } - return 1; -} - -uint8_t -cc1020_get_rssi(void) -{ - return (cc1020_read_reg(CC1020_RSS) & 0x7F); -} - -uint8_t -cc1020_get_packet_rssi(void) -{ - return rssi; -} - -PROCESS_THREAD(cc1020_receiver_process, ev, data) -{ - int len; - - PROCESS_BEGIN(); - - while(1) { - ev = PROCESS_EVENT_NONE; - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - /* Verify the checksum. */ - uint16_t expected_crc = 0xffff; - uint16_t actual_crc; - - actual_crc = (cc1020_rxbuf[cc1020_rxlen - CRC_SIZE] << 8) | - cc1020_rxbuf[cc1020_rxlen - CRC_SIZE + 1]; - cc1020_rxlen -= CRC_SIZE; - - expected_crc = crc16_add(cc1020_rxlen & 0xff, expected_crc); - expected_crc = crc16_add((cc1020_rxlen >> 8) & 0xff, expected_crc); - expected_crc = crc16_data((char *)&cc1020_rxbuf[HDR_SIZE], - cc1020_rxlen - HDR_SIZE, expected_crc); - - if(expected_crc == actual_crc) { - len = cc1020_read(packetbuf_dataptr(), PACKETBUF_SIZE); - packetbuf_set_datalen(len); - NETSTACK_RDC.input(); - } else { - RIMESTATS_ADD(badcrc); - reset_receiver(); - } - } - - PROCESS_END(); -} - -ISR(UART0RX, cc1020_rxhandler) -{ - static signed char syncbs; - static union { - struct { - uint8_t b2; - uint8_t b1; - uint8_t b4; - uint8_t b3; - }; - struct { - uint16_t i1; - uint16_t i2; - }; - } shiftbuf; - static unsigned char pktlen; - - if(cc1020_state & CC1020_RX_SEARCHING) { - shiftbuf.b1 = shiftbuf.b2; - shiftbuf.b2 = shiftbuf.b3; - shiftbuf.b3 = shiftbuf.b4; - shiftbuf.b4 = RXBUF0; - if(shiftbuf.i1 == 0xAAD3 && shiftbuf.b3 == 0x91) { - /* 0 AA D3 91 00 | FF 00 | */ - syncbs = 0; - cc1020_rxbuf[cc1020_rxlen++] = shiftbuf.b4; - } else if(shiftbuf.i1 == 0x5569 && shiftbuf.i2 == 0xC880) { - /* 1 55 69 C8 80 | 7F 80 | */ - syncbs = -1; - } else if(shiftbuf.i1 == 0xAAB4 && shiftbuf.i2 == 0xE440) { - /* 2 AA B4 E4 40 | 3F C0 | */ - syncbs = -2; - } else if(shiftbuf.i1 == 0x555A && shiftbuf.i2 == 0x7220) { - /* 3 55 5A 72 20 | 1F E0 | */ - syncbs = -3; - } else if(shiftbuf.i1 == 0xAAAD && shiftbuf.i2 == 0x3910) { - /* 4 AA AD 39 10 | 0F F0 | */ - syncbs = -4; - } else if(shiftbuf.i1 == 0x5556 && shiftbuf.i2 == 0x9C88) { - /* 5 55 56 9C 88 | 07 F8 | */ - syncbs = +3; - } else if(shiftbuf.i1 == 0xAAAB && shiftbuf.i2 == 0x4E44) { - /* 6 AA AB 4E 44 | 03 FC | */ - syncbs = +2; - } else if(shiftbuf.i1 == 0x5555 && shiftbuf.i2 == 0xA722) { - /* 7 55 55 A7 22 | 01 FE | */ - syncbs = +1; - } else { - return; - } - rssi = cc1020_get_rssi(); - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_RECEIVING); - } else if(cc1020_state & CC1020_RX_RECEIVING) { - if(syncbs == 0) { - cc1020_rxbuf[cc1020_rxlen] = RXBUF0; - } else { - shiftbuf.b3 = shiftbuf.b4; - shiftbuf.b4 = RXBUF0; - if(syncbs < 0) { - shiftbuf.i1 = shiftbuf.i2 << -syncbs; - cc1020_rxbuf[cc1020_rxlen] = shiftbuf.b1; - } else { - shiftbuf.i1 = shiftbuf.i2 >> syncbs; - cc1020_rxbuf[cc1020_rxlen] = shiftbuf.b2; - } - } - - cc1020_rxlen++; - - if(cc1020_rxlen == HDR_SIZE) { - pktlen = ((struct cc1020_header *)cc1020_rxbuf)->length; - if(pktlen == 0 || pktlen > sizeof (cc1020_rxbuf)) { - cc1020_rxlen = 0; - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_SEARCHING); - } - } else if(cc1020_rxlen > HDR_SIZE) { - if(cc1020_rxlen == pktlen) { - /* Disable interrupts while processing the packet. */ - DISABLE_RX_IRQ(); - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_PROCESSING); - _BIC_SR_IRQ(LPM3_bits); - process_poll(&cc1020_receiver_process); - } - } - } -} - -static void -cc1020_write_reg(uint8_t addr, uint8_t adata) -{ - unsigned int i; - uint8_t data; - - data = addr << 1; - PSEL_ON; - - /* Send address bits */ - for(i = 0; i < 7; i++) { - PCLK_LOW; - if(data & 0x80) { - PDI_HIGH; - } else { - PDI_LOW; - } - data = data << 1; - PCLK_HIGH; - nop(); - } - - /* Send read/write bit */ - /* Ignore bit in data, always use 1 */ - PCLK_LOW; - PDI_HIGH; - PCLK_HIGH; - nop(); - data = adata; - - /* Send data bits */ - for(i = 0; i < 8; i++) { - PCLK_LOW; - if(data & 0x80) { - PDI_HIGH; - } else { - PDI_LOW; - } - data = data << 1; - PCLK_HIGH; - nop(); - } - - PCLK_LOW; - PSEL_OFF; -} - -static uint8_t -cc1020_read_reg(uint8_t addr) -{ - unsigned int i; - uint8_t data; - - data = addr << 1; - PSEL_ON; - - /* Send address bits */ - for(i = 0; i < 7; i++) { - PCLK_LOW; - if(data & 0x80) { - PDI_HIGH; - } else { - PDI_LOW; - } - data = data << 1; - PCLK_HIGH; - nop(); - } - - /* Send read/write bit */ - /* Ignore bit in data, always use 0 */ - PCLK_LOW; - PDI_LOW; - PCLK_HIGH; - nop(); - PCLK_LOW; - - /* Receive data bits */ - for(i = 0; i < 8; i++) { - nop(); - PCLK_HIGH; - nop(); - data = data << 1; - if(PDO) { - data++; - } - PCLK_LOW; - } - - PSEL_OFF; - - return data; -} - -static void -cc1020_load_config(const uint8_t * config) -{ - int i; - - for(i = 0; i < 0x28; i++) - cc1020_write_reg(i, config[i]); -} - -static void -cc1020_reset(void) -{ - /* Reset CC1020 */ - cc1020_write_reg(CC1020_MAIN, 0x0FU & ~0x01U); - - /* Bring CC1020 out of reset */ - cc1020_write_reg(CC1020_MAIN, 0x1F); -} - -static int -cc1020_calibrate(void) -{ - unsigned int timeout_cnt; - - /* Turn off PA to avoid spurs during calibration in TX mode */ - cc1020_write_reg(CC1020_PA_POWER, 0x00); - - /* Start calibration */ - cc1020_write_reg(CC1020_CALIBRATE, 0xB5); - while((cc1020_read_reg(CC1020_STATUS) & CAL_COMPLETE) == 0); - - /* Monitor lock */ - for(timeout_cnt = LOCK_TIMEOUT; timeout_cnt > 0; timeout_cnt--) { - if(cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS) { - break; - } - } - - /* Restore PA_POWER */ - cc1020_write_reg(CC1020_PA_POWER, cc1020_pa_power); - - /* Return state of LOCK_CONTINUOUS bit */ - return (cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS) == LOCK_CONTINUOUS; -} - -static int -cc1020_lock(void) -{ - char lock_status; - int i; - - /* Monitor LOCK, lasts 420 - 510 cycles @ 4505600 = 93 us - 113 us */ - for(i = LOCK_TIMEOUT; i > 0; i--) { - lock_status = cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS; - if(lock_status) { - break; - } - } - - if(lock_status == LOCK_CONTINUOUS) { - return LOCK_OK; - } - - return cc1020_calibrate() ? LOCK_RECAL_OK : LOCK_NOK; -} - -static int -cc1020_setupRX(int analog) -{ - char lock_status; - - /* Switch into RX, switch to freq. reg A */ - cc1020_write_reg(CC1020_MAIN, 0x01); - lock_status = cc1020_lock(); - - /* Switch RX part of CC1020 on */ - cc1020_write_reg(CC1020_INTERFACE, 0x02); - - /* Return LOCK status to application */ - return lock_status; -} - -static int -cc1020_setupTX(int analog) -{ - char lock_status; - - /* Switch into TX, switch to freq. reg B */ - cc1020_write_reg(CC1020_MAIN, 0xC1); - lock_status = cc1020_lock(); - - /* Restore PA_POWER */ - cc1020_write_reg(CC1020_PA_POWER, cc1020_pa_power); - - /* Turn OFF DCLK squelch in TX */ - cc1020_write_reg(CC1020_INTERFACE, 0x01); - - /* Return LOCK status to application */ - return lock_status; -} - -static void -cc1020_setupPD(void) -{ - /* - * Power down components and reset all registers except MAIN - * to their default values. - */ - cc1020_write_reg(CC1020_MAIN, - RESET_N | BIAS_PD | FS_PD | XOSC_PD | PD_MODE_1); - - /* Turn off the power amplifier. */ - cc1020_write_reg(CC1020_PA_POWER, 0x00); - - cc1020_write_reg(CC1020_POWERDOWN, 0x1F); -} - -static void -cc1020_wakeupRX(int analog) -{ - /* Turn on crystal oscillator core. */ - cc1020_write_reg(CC1020_MAIN, 0x1B); - - /* Setup bias current adjustment. */ - cc1020_write_reg(CC1020_ANALOG, analog); - - /* - * Wait for the crystal oscillator to stabilize. - * This typically takes 2-5 ms. - */ - MS_DELAY(5); - - /* Turn on bias generator. */ - cc1020_write_reg(CC1020_MAIN, 0x19); - - /* Turn on frequency synthesizer. */ - cc1020_write_reg(CC1020_MAIN, 0x11); -} - -static void -cc1020_wakeupTX(int analog) -{ - /* Turn on crystal oscillator core. */ - cc1020_write_reg(CC1020_MAIN, 0xDB); - - /* Setup bias current adjustment. */ - cc1020_write_reg(CC1020_ANALOG, analog); - - /* - * Wait for the crystal oscillator to stabilize. - * This typically takes 2-5 ms. - */ - MS_DELAY(5); - - /* Turn on bias generator. */ - cc1020_write_reg(CC1020_MAIN, 0xD9); - - /* Turn on frequency synthesizer. */ - MS_DELAY(1); - cc1020_write_reg(CC1020_MAIN, 0xD1); -} - diff --git a/platform/msb430/dev/cc1020.h b/platform/msb430/dev/cc1020.h deleted file mode 100644 index 364b71650..000000000 --- a/platform/msb430/dev/cc1020.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2006, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universitaet Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2006 -*/ - -/** - * \file cc1020.h - * \author FUB ScatterWeb Developers, Michael Baar, Nicolas Tsiftes - **/ - -#ifndef CC1020_H -#define CC1020_H - -#include "dev/radio.h" - -extern const uint8_t cc1020_config_19200[]; -extern const uint8_t cc1020_config_115200[]; - -#if 0 -void cc1020_init(const uint8_t* config); -#endif -void cc1020_set_rx(void); -void cc1020_set_tx(void); -void cc1020_set_power(uint8_t pa_power); -int cc1020_carrier_sense(void); -uint8_t cc1020_get_rssi(void); -uint8_t cc1020_get_packet_rssi(void); -int cc1020_sending(void); -#if 0 -int cc1020_send(const void *buf, unsigned short size); -int cc1020_read(void *buf, unsigned short size); -void cc1020_set_receiver(void (*recv)(const struct radio_driver *)); -int cc1020_on(void); -int cc1020_off(void); -#endif -extern const struct radio_driver cc1020_driver; - -PROCESS_NAME(cc1020_sender_process); - -#endif diff --git a/platform/msb430/dev/dma.c b/platform/msb430/dev/dma.c deleted file mode 100644 index ce175ee12..000000000 --- a/platform/msb430/dev/dma.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * DMA interrupt handling. - * \author - * Nicolas Tsiftes - */ -#include "contiki.h" - -#include "contiki-msb430.h" -#include "dev/cc1020.h" -#include "dev/dma.h" -#include "isr_compat.h" - -static void (*callbacks[DMA_LINES])(void); - -ISR(DACDMA, irq_dacdma) -{ - if(DMA0CTL & DMAIFG) { - DMA0CTL &= ~(DMAIFG | DMAIE); - if(callbacks[0] != NULL) { - callbacks[0](); - } - _BIC_SR_IRQ(LPM3_bits); - } - - if(DMA1CTL & DMAIFG) { - DMA1CTL &= ~(DMAIFG | DMAIE); - if(callbacks[1] != NULL) { - callbacks[1](); - } - _BIC_SR_IRQ(LPM3_bits); - } - - if(DMA2CTL & DMAIFG) { - DMA2CTL &= ~(DMAIFG | DMAIE); - if(callbacks[2] != NULL) { - callbacks[2](); - } - _BIC_SR_IRQ(LPM3_bits); - } - - if(DAC12_0CTL & DAC12IFG) { - DAC12_0CTL &= ~(DAC12IFG | DAC12IE); - } - - if(DAC12_1CTL & DAC12IFG) { - DAC12_1CTL &= ~(DAC12IFG | DAC12IE); - } -} - -int -dma_subscribe(int line, void (*callback)(void)) -{ - if(line >= DMA_LINES) { - return -1; - } - - callbacks[line] = callback; - return 0; -} - -void -dma_transfer(unsigned char *dst, unsigned char *src, unsigned len) -{ - /* Configure DMA Channel 0 for UART0 TXIFG. */ - DMACTL0 = DMA0TSEL_4; - - /* No DMAONFETCH, ROUNDROBIN, ENNMI. */ - DMACTL1 = 0x0000; - - /* - * Set single transfer mode with byte-per-byte transfers. - * - * The source address is incremented for each byte, while the - * destination address remains constant. - * - * In order to avoid missing the first rising edge of the trigger - * signal, it is important to use the level-sensitive trigger when - * using USART transfer interrupts. - */ - DMA0CTL = DMADT_0 | DMADSTINCR_0 | DMASRCINCR_3 | DMASBDB | DMALEVEL; - - DMA0SA = (unsigned) src; - DMA0DA = (unsigned) dst; - DMA0SZ = len; - - DMA0CTL |= DMAEN | DMAIE; /* enable DMA and interrupts */ - U0CTL &= ~SWRST; /* enable the UART state machine */ -} diff --git a/platform/msb430/dev/dma.h b/platform/msb430/dev/dma.h deleted file mode 100644 index cabcad4d7..000000000 --- a/platform/msb430/dev/dma.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -#ifndef DMA_H -#define DMA_H - -#define DMA_LINES 2 - -void dma_init(void); -int dma_subscribe(int, void (*)(void)); -void dma_transfer(unsigned char *, unsigned char *, unsigned); - -extern process_event_t dma_event; - -#endif diff --git a/platform/msb430/dev/infomem.c b/platform/msb430/dev/infomem.c deleted file mode 100644 index 53cd27448..000000000 --- a/platform/msb430/dev/infomem.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2007, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2007 -*/ - -/** - * @file infomem.c - * @addtogroup storage - * @brief MSP430 Infomemory Storage - * @author Michael Baar - * - * Functions to store and read data from the two infomemories (2 x 128 Bytes). - * Offset addresses start at zero, size has a maximum of 128, write operations - * across both blocks are not allowed. - */ -#include -#include -#include "contiki-conf.h" -#include "infomem.h" - -void -infomem_read(void *buffer, unsigned int offset, unsigned char size) -{ - uint8_t *address = (uint8_t *)INFOMEM_START + offset; - memcpy(buffer, address, size); -} - -bool -infomem_write(unsigned int offset, unsigned char count, ...) -{ - char backup[INFOMEM_BLOCK_SIZE]; - uint8_t *buffer; - uint16_t i; - uint8_t *flash; - va_list argp; - uint16_t size; - uint8_t *data; - int s; - - if(offset > (2 * INFOMEM_BLOCK_SIZE)) { - return FALSE; - } - - flash = (uint8_t *)INFOMEM_START; - - s = splhigh(); - - /* backup into RAM */ - memcpy(backup, flash, INFOMEM_BLOCK_SIZE); - - /* merge backup with new data */ - va_start(argp, count); - - buffer = (uint8_t *)backup + offset; - for(i = 0; i < count; i++) { - data = va_arg(argp, uint8_t *); - size = va_arg(argp, uint16_t); - memcpy(buffer, data, size); - buffer += size; - } - - va_end(argp); - - /* init flash access */ - FCTL2 = FWKEY + FSSEL1 + FN2; - FCTL3 = FWKEY; - - /* erase flash */ - FCTL1 = FWKEY + ERASE; - *flash = 0; - - /* write flash */ - FCTL1 = FWKEY + WRT; - buffer = (uint8_t *)backup; - for(i = 0; i < INFOMEM_BLOCK_SIZE; i++) { - *flash++ = *buffer++; - } - - FCTL1 = FWKEY; - FCTL3 = FWKEY + LOCK; - - splx(s); - - return TRUE; -} diff --git a/platform/msb430/dev/infomem.h b/platform/msb430/dev/infomem.h deleted file mode 100644 index 6885551be..000000000 --- a/platform/msb430/dev/infomem.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright 2006, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2006 -*/ - -/** - * @file infomem.h - * @addtogroup storage - * @brief MSP430 Infomemory Storage - * - * @author Michael Baar - */ - -#ifndef INFOMEM_H -#define INFOMEM_H - -#if !defined(INFOMEM_START) || !defined(INFOMEM_BLOCK_SIZE) - #error "infomem position (INFOMEM_START) and block size (INFOMEM_BLOCK_SIZE) need to be defined for the platform" -#endif - -/** - * @brief Read bytes from infomemory - * @param[out] buffer Pointer to buffer for read data - * @param[in] offset Offset in infomemory (0-254) - * @param[in] size Number of bytes to read - */ -void infomem_read(void *buffer, unsigned int offset, unsigned char size); - -/** - * @brief Write bytes to infomemory - * @param[in] offset Offset in infomemory (0-254) - * @param[in] count Number of items following - * each item is a pair pointer, length - * - * Example: Infomem_write( 0, 2, &a,3, &b,1 ); - * - * \note: The MSP430 has two consecutive blocks of infomemory. - * Each is 128 bytes large. The offset is the relative address - * starting at the beginning of the first block. You can write an - * arbitrary number of bytes at any offset, but this function - * cannot write across the two blocks of infomemory. - */ -bool infomem_write(unsigned int offset, unsigned char count, ...); - -#endif // !INFOMEM_H diff --git a/platform/msb430/dev/msb430-uart1.c b/platform/msb430/dev/msb430-uart1.c deleted file mode 100644 index d8ce6a44c..000000000 --- a/platform/msb430/dev/msb430-uart1.c +++ /dev/null @@ -1,231 +0,0 @@ -/* -Copyright 2007, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2007 -*/ - -/** - * @file ScatterWeb.Uart.c - * @addtogroup interfaces - * @brief UART interface - * @author Michael Baar - * - * UART switch for RS232 and SPI protocols on UART1 written for - * ScatterWeb MSB boards. Compatible to ScatterWeb EOS, - * ScatterWeb Bootload and Contiki. - */ - -#include "contiki.h" -#include -#include "dev/msb430-uart1.h" -#include "dev/lpm.h" -#include "isr_compat.h" - -#ifndef U1ME -#define U1ME ME2 -#endif - -volatile unsigned char uart_mode = UART_MODE_RESET; -volatile unsigned char uart_lockcnt = 0; -volatile uint8_t uart_edge = 0; - -static unsigned char uart_speed_br0[UART_NUM_MODES]; -static unsigned char uart_speed_br1[UART_NUM_MODES]; -static unsigned char uart_speed_bmn[UART_NUM_MODES]; -static uart_handler_t uart_handler[UART_NUM_MODES] = {NULL, NULL}; - -/*---------------------------------------------------------------------------*/ -static void -uart_configure(unsigned mode) -{ - _DINT(); /* disable interrupts */ - - UART_WAIT_TXDONE(); /* wait till all buffered data has been transmitted */ - - if(mode == UART_MODE_RS232) { - P5OUT |= 0x01; - /* unselect SPI */ - P3SEL |= 0xC0; - /* select rs232 */ - UCTL1 = SWRST | CHAR; /* 8-bit character */ - UTCTL1 |= SSEL1; /* UCLK = MCLK */ - /* activate */ - U1ME |= UTXE1 | URXE1; /* Enable USART1 TXD/RXD */ - } else if(mode == UART_MODE_SPI) { - P3SEL &= ~0xC0; /* unselect RS232 */ - // to SPI mode - UCTL1 = SWRST | CHAR | SYNC | MM; /* 8-bit SPI Master */ - /* - * SMCLK, 3-pin mode, clock idle low, data valid on - * rising edge, UCLK delayed - */ - UTCTL1 |= CKPH | SSEL1 | SSEL0 | STC; /* activate */ - U1ME |= USPIE1; /* Enable USART1 SPI */ - } - - /* restore speed settings */ - UBR01 = uart_speed_br0[mode]; /* set baudrate */ - UBR11 = uart_speed_br1[mode]; - UMCTL1 = uart_speed_bmn[mode]; /* set modulation */ - - UCTL1 &= ~SWRST; /* clear reset flag */ - _EINT(); /* enable interrupts */ -} -/*---------------------------------------------------------------------------*/ -void -uart_set_speed(unsigned mode, unsigned ubr0, - unsigned ubr1, unsigned umctl) -{ - /* store the setting */ - uart_speed_br0[mode] = ubr0; /* baudrate */ - uart_speed_br1[mode] = ubr1; /* baudrate */ - uart_speed_bmn[mode] = umctl; /* modulation */ - - /* reconfigure, if mode active */ - if(uart_mode == mode) { - uart_configure(mode); - } -} -/*---------------------------------------------------------------------------*/ -void -uart_set_handler(unsigned mode, uart_handler_t handler) -{ - /* store the setting */ - uart_handler[mode] = handler; - if(mode == uart_mode) { - if(handler == NULL) { - IE2 &= ~URXIE1; /* Disable USART1 RX interrupt */ - } else { - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ - } - } -} -/*---------------------------------------------------------------------------*/ -int -uart_lock(unsigned mode) -{ - /* already locked? */ - if(uart_mode != mode && uart_lockcnt > 0) { - return 0; - } - - /* increase lock count */ - uart_lockcnt++; - /* switch mode (if neccessary) */ - uart_set_mode(mode); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -uart_lock_wait(unsigned mode) -{ - while(UART_WAIT_LOCK(mode)) { - _NOP(); - } - return uart_lock(mode); -} -/*---------------------------------------------------------------------------*/ -int -uart_unlock(unsigned mode) -{ - if((uart_lockcnt == 0) || (mode != uart_mode)) { - uart_lockcnt = 0; - uart_set_mode(UART_MODE_DEFAULT); - return 0; - } - - /* decrement lock */ - if(uart_lockcnt > 0) { - uart_lockcnt--; - /* if no more locks, switch back to default mode */ - if(uart_lockcnt == 0) { - uart_set_mode(UART_MODE_DEFAULT); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -uart_set_mode(unsigned mode) -{ - /* do nothing if the mode is already set */ - if(mode == uart_mode) { - return; - } - - IE2 &= ~(URXIE1 | UTXIE1); /* disable irq */ - uart_configure(mode); /* configure uart parameters */ - uart_mode = mode; - - if(uart_handler[mode] != NULL) { - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ - } -} -/*---------------------------------------------------------------------------*/ -int -uart_get_mode(void) -{ - return uart_mode; -} -/*---------------------------------------------------------------------------*/ -ISR(UART1RX, uart_rx) -{ - uart_handler_t handler = uart_handler[uart_mode]; - int c; - - if(!(IFG2 & URXIFG1)) { - /* If rising edge is detected, toggle & return */ - uart_edge = 1; - U1TCTL &= ~URXSE; - U1TCTL |= URXSE; - _BIC_SR_IRQ(LPM3_bits); - return; - } - uart_edge = 0; - if(!(URCTL1 & RXERR)) { - c = UART_RX; - if(handler(c)) { - _BIC_SR_IRQ(LPM3_bits); - } - } else { - /* read out the char to clear the interrupt flags. */ - c = UART_RX; - } -} diff --git a/platform/msb430/dev/msb430-uart1.h b/platform/msb430/dev/msb430-uart1.h deleted file mode 100644 index 470eb852d..000000000 --- a/platform/msb430/dev/msb430-uart1.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -Copyright 2007, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2007 -*/ - -/** - * @addtogroup interfaces - * @{ */ - -/** - * @defgroup uart1 UART1 - * The UART module multiplexes differenct protocol on the MSB's UART1 - * interface. Currently RS232 and SPI are supported. - * @{ - */ - -/** - * \file Header file for for the MSB430 UART driver. - * \author Michael Baar - */ - -#ifndef MSB430_UART1_H -#define MSB430_UART1_H - -#define UART_RX RXBUF1 -#define UART_TX TXBUF1 -#define UART_RESET_RX() do { U1IFG &= ~URXIFG1; } while(0) -#define UART_RESET_RXTX() do { U1IFG &= ~(URXIFG1 | UTXIFG1); } while(0) -#define UART_WAIT_RX() while((U1IFG & URXIFG1) == 0) { _NOP(); } -#define UART_WAIT_TX() while((U1IFG & UTXIFG1) == 0) { _NOP(); } -#define UART_WAIT_TXDONE() while((UTCTL1 & TXEPT) == 0) { _NOP(); } - -/** - * @brief Operating state - */ -extern volatile unsigned char uart_mode; -extern volatile unsigned char uart_lockcnt; - -/** - * @name UART mode flags - * @{ - */ -#define UART_MODE_RS232 (0x00u) ///< RS232 mode -#define UART_MODE_SPI (0x01u) ///< SPI mode -#define UART_MODE_DEFAULT UART_MODE_RS232 -#define UART_NUM_MODES (UART_MODE_SPI + 1) ///< Highest mode number -#define UART_MODE_RESET (0xFFu) ///< reset with current settings -/** @} */ - -#define UART_WAIT_LOCK(x) ((uart_mode != x) && (uart_lockcnt)) -#define UART_MODE_IS(x) (uart_mode == x) - -typedef int(*uart_handler_t)(unsigned char); - -/** - * \brief Initialize the UART module - * - * This function is called from the boot up code to - * initalize the UART module. - */ -void uart_init(void); - -void uart_set_speed(unsigned, unsigned, unsigned, unsigned); -void uart_set_handler(unsigned, uart_handler_t); -int uart_lock(unsigned); -int uart_lock_wait(unsigned); -int uart_unlock(unsigned); -void uart_set_mode(unsigned); -int uart_get_mode(void); - -#endif /* !MSB430_UART1_H */ - -/** @} */ -/** @} */ diff --git a/platform/msb430/dev/rs232.c b/platform/msb430/dev/rs232.c deleted file mode 100644 index 44a299813..000000000 --- a/platform/msb430/dev/rs232.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** \addtogroup esbrs232 - * @{ */ - -/** - * \file - * RS232 communication device driver for the MSP430. - * \author Adam Dunkels - * - * This file contains an RS232 device driver for the MSP430 microcontroller. - * - */ -#include "contiki.h" -#include -#include "dev/msb430-uart1.h" -#include "rs232.h" - -#ifndef U1IFG -#define U1IFG IFG2 -#endif - -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -rs232_init(void) -{ - rs232_set_speed(RS232_115200); -} -/*---------------------------------------------------------------------------*/ -int -putchar(int c) -{ - if(uart_get_mode() == UART_MODE_RS232) { - /* Loop until the transmission buffer is available. */ - UART_WAIT_TX(); - /* Transmit the data. */ - UART_TX = c; - return c; - } else { - return -1; - } -} -/*---------------------------------------------------------------------------*/ -void -rs232_send(char c) -{ - /* Check if the UART is in RS232 mode before sending. - This check can be ommitted if every access to rs232 locks the uart - before using it. - */ - - putchar(c); -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_speed(enum rs232_speed speed) -{ - // baud - const unsigned char br_table[5][3] = { - {0x00, 0x01, 0x00}, // 9600 - {0x80, 0x00, 0x00}, // 19200 - {0x40, 0x00, 0x00}, // 38400 - {0x2a, 0x00, 0x5b}, // 57600 - {0x15, 0x00, 0x4a} // 115200 - }; - - uart_set_speed(UART_MODE_RS232, br_table[speed][0], - br_table[speed][1], br_table[speed][2]); -} -/*---------------------------------------------------------------------------*/ -void -rs232_print(char *cptr) -{ - /* lock UART for the print operation */ - if(uart_lock(UART_MODE_RS232)) { - while(*cptr != 0) { - rs232_send(*cptr); - ++cptr; - } - uart_unlock(UART_MODE_RS232); - } -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_input(uart_handler_t f) -{ - uart_set_handler(UART_MODE_RS232, f); -} -/** @} */ diff --git a/platform/msb430/dev/rs232.h b/platform/msb430/dev/rs232.h deleted file mode 100644 index 59f1ffe33..000000000 --- a/platform/msb430/dev/rs232.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ - -/** \addtogroup esb - * @{ */ - -/** - * \defgroup esbrs232 ESB RS232 - * - * @{ - */ - -/** - * \file - * Header file for MSP430 RS232 driver. - * \author Adam Dunkels - * - */ -#ifndef __RS232_H__ -#define __RS232_H__ - -#include "dev/msb430-uart1.h" - -enum rs232_speed { - RS232_9600 = 0, - RS232_19200 = 1, - RS232_38400 = 2, - RS232_57600 = 3, - RS232_115200 = 4 -}; - -/** - * \brief Initialize the RS232 module - * - * This function is called from the boot up code to - * initalize the RS232 module. - */ -void rs232_init(void); - -/** - * \brief Set an input handler for incoming RS232 data - * \param f A pointer to a byte input handler - * - * This function sets the input handler for incoming RS232 - * data. The input handler function is called for every - * incoming data byte. The function is called from the - * RS232 interrupt handler, so care must be taken when - * implementing the input handler to avoid race - * conditions. - * - * The return value of the input handler affects the sleep - * mode of the CPU: if the input handler returns non-zero - * (true), the CPU is awakened to let other processing - * take place. If the input handler returns zero, the CPU - * is kept sleeping. - */ -void rs232_set_input(uart_handler_t f); - -/** - * \brief Configure the speed of the RS232 hardware - * \param speed The speed - * - * This function configures the speed of the RS232 - * hardware. The allowed parameters are RS232_9600, - * RS232_19200, RS232_38400, RS232_57600, and RS232_115200. - */ -void rs232_set_speed(enum rs232_speed speed); - -/** - * \brief Print a text string on RS232 - * \param str A pointer to the string that is to be printed - * - * This function prints a string to RS232. The string must - * be terminated by a null byte. The RS232 module must be - * correctly initalized and configured for this function - * to work. - */ -void rs232_print(char *text); - -/** - * \brief Print a character on RS232 - * \param c The character to be printed - * - * This function prints a character to RS232. The RS232 - * module must be correctly initalized and configured for - * this function to work. - */ -void rs232_send(char c); - -#endif /* __RS232_H__ */ - -/** @} */ -/** @} */ diff --git a/platform/msb430/dev/sd-arch.c b/platform/msb430/dev/sd-arch.c deleted file mode 100644 index 02f5666f0..000000000 --- a/platform/msb430/dev/sd-arch.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Architecture-dependent functions for SD over SPI. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "msb430-uart1.h" -#include "sd-arch.h" - -#define SPI_IDLE 0xff - -int -sd_arch_init(void) -{ - P2SEL &= ~64; - P2DIR &= ~64; - - P5SEL |= 14; - P5SEL &= ~1; - P5OUT |= 1; - P5DIR |= 13; - P5DIR &= ~2; - - uart_set_speed(UART_MODE_SPI, 2, 0, 0); - - return 0; -} - - -void -sd_arch_spi_write(int c) -{ - UART_TX = c; - UART_WAIT_TXDONE(); -} - -void -sd_arch_spi_write_block(uint8_t *bytes, int amount) -{ - int i; - volatile char dummy; - - for(i = 0; i < amount; i++) { - UART_TX = bytes[i]; - UART_WAIT_TXDONE(); - UART_WAIT_RX(); - dummy = UART_RX; - } -} - - -unsigned -sd_arch_spi_read(void) -{ - if((U1IFG & URXIFG1) == 0) { - UART_TX = SPI_IDLE; - UART_WAIT_RX(); - } - return UART_RX; -} diff --git a/platform/msb430/dev/sd-arch.h b/platform/msb430/dev/sd-arch.h deleted file mode 100644 index f540505f6..000000000 --- a/platform/msb430/dev/sd-arch.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * SD driver implementation using SPI. - * \author - * Nicolas Tsiftes - */ - -#ifndef SD_ARCH_H -#define SD_ARCH_H - -#include "msb430-uart1.h" - -#ifndef U1IFG -#define U1IFG IFG2 -#endif /* U1IFG */ - -#define MS_DELAY(x) clock_delay(354 * (x)) - -/* Machine-dependent macros. */ -#define LOCK_SPI() do { \ - if(!uart_lock(UART_MODE_SPI)) {\ - return 0; \ - } \ - } while(0) -#define UNLOCK_SPI() do { \ - uart_unlock(UART_MODE_SPI); \ - } while(0) - -#define SD_CONNECTED() !(P2IN & 0x40) -#define LOWER_CS() (P5OUT &= ~0x01) -#define RAISE_CS() do { \ - UART_WAIT_TXDONE(); \ - P5OUT |= 0x01; \ - UART_TX = SPI_IDLE; \ - UART_WAIT_TXDONE(); \ - } while(0) - -/* Configuration parameters. */ -#define SD_TRANSACTION_ATTEMPTS 512 -#define SD_READ_RESPONSE_ATTEMPTS 8 -#define SD_READ_BLOCK_ATTEMPTS 2 - -int sd_arch_init(void); -void sd_arch_spi_write(int c); -void sd_arch_spi_write_block(uint8_t *bytes, int amount); -unsigned sd_arch_spi_read(void); - -#endif /* !SD_ARCH_H */ diff --git a/platform/msb430/dev/sd.c b/platform/msb430/dev/sd.c deleted file mode 100644 index b1ef4c21b..000000000 --- a/platform/msb430/dev/sd.c +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * SD driver implementation using SPI. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "sd.h" -#include "sd-arch.h" - -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* MIN */ - -#define SPI_IDLE 0xff - -/* SD commands */ -#define GO_IDLE_STATE 0 -#define SEND_OP_COND 1 -#define SWITCH_FUNC 6 -#define SEND_IF_COND 8 -#define SEND_CSD 9 -#define SEND_CID 10 -#define STOP_TRANSMISSION 12 -#define SEND_STATUS 13 -#define READ_SINGLE_BLOCK 17 -#define WRITE_BLOCK 24 -#define READ_OCR 58 - -/* SD response lengths. */ -#define R1 1 -#define R2 2 -#define R3 5 -#define R7 5 - -#define START_BLOCK_TOKEN 0xfe - -/* Status codes returned after writing a block. */ -#define DATA_ACCEPTED 2 -#define DATA_CRC_ERROR 5 -#define DATA_WRITE_ERROR 6 - -static uint16_t rw_block_size; -static uint16_t block_size; - -static int read_register(int register_cmd, char *buf, int register_size); -/*---------------------------------------------------------------------------*/ -static int -send_command(uint8_t cmd, uint32_t argument) -{ - uint8_t req[6]; - - req[0] = 0x40 | cmd; - req[1] = argument >> 24; - req[2] = argument >> 16; - req[3] = argument >> 8; - req[4] = argument; - /* The CRC hard-wired to 0x95 is only needed for the initial - GO_IDLE_STATE command. */ - req[5] = 0x95; - - sd_arch_spi_write(SPI_IDLE); - sd_arch_spi_write_block(req, sizeof(req)); - sd_arch_spi_write(SPI_IDLE); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -get_response(int length) -{ - int i; - int x; - static uint8_t r[R7]; - - for(i = 0; i < SD_READ_RESPONSE_ATTEMPTS; i++) { - x = sd_arch_spi_read(); - if((x & 0x80) == 0) { - /* A get_response byte is indicated by the MSB being 0. */ - r[0] = x; - break; - } - } - - if(i == SD_READ_RESPONSE_ATTEMPTS) { - return NULL; - } - - for(i = 1; i < length; i++) { - r[i] = sd_arch_spi_read(); - } - - return r; -} -/*---------------------------------------------------------------------------*/ -static unsigned char * -transaction(int command, unsigned long argument, - int response_type, unsigned attempts) -{ - unsigned i; - unsigned char *r; - - LOCK_SPI(); - r = NULL; - for(i = 0; i < attempts; i++) { - LOWER_CS(); - send_command(command, argument); - r = get_response(response_type); - RAISE_CS(); - if(r != NULL) { - break; - } - } - UNLOCK_SPI(); - - return r; -} -/*---------------------------------------------------------------------------*/ -int -sd_initialize(void) -{ - unsigned char reg[16]; - int i; - uint8_t *r, read_bl_len; - - if(sd_arch_init() < 0) { - return SD_INIT_ERROR_ARCH; - } - - if(SD_CONNECTED() < 0) { - return SD_INIT_ERROR_NO_CARD; - } - - r = transaction(GO_IDLE_STATE, 0, R1, SD_TRANSACTION_ATTEMPTS); - if(r != NULL) { - PRINTF("Go-idle result: %d\n", r[0]); - } else { - PRINTF("Failed to get go-idle response\n"); - } - - r = transaction(SEND_IF_COND, 0, R7, SD_TRANSACTION_ATTEMPTS); - if(r != NULL) { - PRINTF("IF cond: %d %d %d %d %d\n", r[0], r[1], r[2], r[3], r[4]); - } else { - PRINTF("failed to get IF cond\n"); - return SD_INIT_ERROR_NO_IF_COND; - } - - LOCK_SPI(); - - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(SEND_OP_COND, 0); - r = get_response(R1); - RAISE_CS(); - if(r != NULL && !(r[0] & 1)) { - break; - } - } - - UNLOCK_SPI(); - - if(r != NULL) { - PRINTF("OP cond: %d (%d iterations)\n", r[0], i); - } else { - PRINTF("Failed to get OP cond get_response\n"); - } - - LOCK_SPI(); - - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(READ_OCR, 0); - r = get_response(R3); - RAISE_CS(); - if(r != NULL) { - break; - } - } - - UNLOCK_SPI(); - - if(r != NULL) { - PRINTF("OCR: %d %d %d %d %d\n", r[0], r[1], r[2], r[3], r[4]); - } - - - if(read_register(SEND_CSD, reg, sizeof(reg)) < 0) { - PRINTF("Failed to get block size of SD card\n"); - return SD_INIT_ERROR_NO_BLOCK_SIZE; - } - - read_bl_len = reg[5] & 0x0f; - block_size = 1 << read_bl_len; - rw_block_size = (block_size > SD_DEFAULT_BLOCK_SIZE) ? - SD_DEFAULT_BLOCK_SIZE : block_size; - PRINTF("Found block size %d\n", block_size); - - /* XXX Arbitrary wait time here. Need to investigate why this is needed. */ - MS_DELAY(5); - - return SD_OK; -} -/*---------------------------------------------------------------------------*/ -int -sd_write_block(sd_offset_t offset, char *buf) -{ - unsigned char *r; - int retval; - int i; - unsigned char data_response; - unsigned char status_code; - - LOCK_SPI(); - r = NULL; - retval = SD_WRITE_ERROR_NO_CMD_RESPONSE; - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(WRITE_BLOCK, offset); - r = get_response(R1); - if(r != NULL) { - break; - } - RAISE_CS(); - } - - if(r != NULL && r[0] == 0) { - /* We received an R1 response with no errors. - Send a start block token to the card now. */ - sd_arch_spi_write(START_BLOCK_TOKEN); - - /* Write the data block. */ - sd_arch_spi_write_block(buf, rw_block_size); - - /* Get a response from the card. */ - retval = SD_WRITE_ERROR_NO_BLOCK_RESPONSE; - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - data_response = sd_arch_spi_read(); - if((data_response & 0x11) == 1) { - /* Data response token received. */ - status_code = (data_response >> 1) & 0x7; - if(status_code == DATA_ACCEPTED) { - retval = rw_block_size; - } else { - retval = SD_WRITE_ERROR_PROGRAMMING; - } - break; - } - } - } - - RAISE_CS(); - UNLOCK_SPI(); - - return retval; -} -/*---------------------------------------------------------------------------*/ -static int -read_block(unsigned read_cmd, sd_offset_t offset, char *buf, int len) -{ - unsigned char *r; - int i; - int token; - int retval; - - LOCK_SPI(); - - r = NULL; - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(read_cmd, offset); - r = get_response(R1); - if(r != NULL) { - break; - } - RAISE_CS(); - } - - if(r != NULL && r[0] == 0) { - /* We received an R1 response with no errors. - Get a token from the card now. */ - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - token = sd_arch_spi_read(); - if(token == START_BLOCK_TOKEN || (token > 0 && token <= 8)) { - break; - } - } - - if(token == START_BLOCK_TOKEN) { - /* A start block token has been received. Read the block now. */ - for(i = 0; i < len; i++) { - buf[i] = sd_arch_spi_read(); - } - - /* Consume CRC. TODO: Validate the block. */ - sd_arch_spi_read(); - sd_arch_spi_read(); - - retval = len; - } else if(token > 0 && token <= 8) { - /* The card returned a data error token. */ - retval = SD_READ_ERROR_TOKEN; - } else { - /* The card never returned a token after our read attempts. */ - retval = SD_READ_ERROR_NO_TOKEN; - } - - RAISE_CS(); - UNLOCK_SPI(); - return retval; - } - - RAISE_CS(); - UNLOCK_SPI(); - - if(r != NULL) { - PRINTF("status during read: %d\n", r[0]); - } - - return SD_READ_ERROR_NO_CMD_RESPONSE; -} -/*---------------------------------------------------------------------------*/ -int -sd_read_block(sd_offset_t offset, char *buf) -{ - return read_block(READ_SINGLE_BLOCK, offset, buf, rw_block_size); -} -/*---------------------------------------------------------------------------*/ -static int -read_register(int register_cmd, char *buf, int register_size) -{ - return read_block(register_cmd, 0, buf, register_size); -} -/*---------------------------------------------------------------------------*/ -sd_offset_t -sd_get_capacity(void) -{ - unsigned char reg[16]; - int r; - uint16_t c_size; - uint8_t c_size_mult; - sd_offset_t block_nr; - sd_offset_t mult; - - r = read_register(SEND_CSD, reg, sizeof(reg)); - if(r < 0) { - return r; - } - - c_size = ((reg[6] & 3) << 10) + (reg[7] << 2) + ((reg[8] >> 6) & 3); - c_size_mult = ((reg[9] & 3) << 1) + ((reg[10] & 0x80) >> 7); - mult = 1 << (c_size_mult + 2); - block_nr = (c_size + 1) * mult; - - return block_nr * block_size; -} -/*---------------------------------------------------------------------------*/ -char * -sd_error_string(int error_code) -{ -#if DEBUG - switch(error_code) { - case SD_OK: - return "operation succeeded"; - case SD_INIT_ERROR_NO_CARD: - return "no card was found"; - case SD_INIT_ERROR_ARCH: - return "architecture-dependent initialization failed"; - case SD_INIT_ERROR_NO_IF_COND: - return "unable to obtain the interface condition"; - case SD_INIT_ERROR_NO_BLOCK_SIZE: - return "unable to obtain the block size"; - case SD_WRITE_ERROR_NO_CMD_RESPONSE: - return "no response from the card after submitting a write request"; - case SD_WRITE_ERROR_NO_BLOCK_RESPONSE: - return "no response from the card after sending a data block"; - case SD_WRITE_ERROR_PROGRAMMING: - return "the write request failed because of a card error"; - case SD_WRITE_ERROR_TOKEN: - return "the card is not ready to grant a write request"; - case SD_READ_ERROR_NO_TOKEN: - case SD_WRITE_ERROR_NO_TOKEN: - return "did not receive a start block token"; - case SD_READ_ERROR_INVALID_SIZE: - return "invalid read block size"; - case SD_READ_ERROR_TOKEN: - return "the card is not ready to read a data block"; - case SD_READ_ERROR_NO_CMD_RESPONSE: - return "no response from the card after submitting a read request"; - default: - break; - } -#endif - return "unspecified error"; -} -/*---------------------------------------------------------------------------*/ -int -sd_write(sd_offset_t offset, char *buf, size_t size) -{ - sd_offset_t address; - uint16_t offset_in_block; - int r, i; - size_t written; - size_t to_write; - char sd_buf[rw_block_size]; - - /* Emulation of data writing using arbitrary offsets and chunk sizes. */ - memset(sd_buf, 0, sizeof(sd_buf)); - written = 0; - offset_in_block = offset & (rw_block_size - 1); - - do { - to_write = MIN(size - written, rw_block_size - offset_in_block); - address = (offset + written) & ~(rw_block_size - 1); - - for(i = 0; i < SD_READ_BLOCK_ATTEMPTS; i++) { - r = sd_read_block(address, sd_buf); - if(r == sizeof(sd_buf)) { - break; - } - } - if(r != sizeof(sd_buf)) { - return r; - } - - memcpy(&sd_buf[offset_in_block], &buf[written], to_write); - r = sd_write_block(address, sd_buf); - if(r != sizeof(sd_buf)) { - return r; - } - written += to_write; - offset_in_block = 0; - } while(written < size); - - return written; -} -/*---------------------------------------------------------------------------*/ -int -sd_read(sd_offset_t offset, char *buf, size_t size) -{ - size_t total_read; - size_t to_read; - char sd_buf[rw_block_size]; - uint16_t offset_in_block; - int r, i; - - /* Emulation of data reading using arbitrary offsets and chunk sizes. */ - total_read = 0; - offset_in_block = offset & (rw_block_size - 1); - - do { - to_read = MIN(size - total_read, rw_block_size - offset_in_block); - for(i = 0; i < SD_READ_BLOCK_ATTEMPTS; i++) { - r = sd_read_block((offset + total_read) & ~(rw_block_size - 1), sd_buf); - if(r == sizeof(sd_buf)) { - break; - } - } - if(r != sizeof(sd_buf)) { - return r; - } - - memcpy(&buf[total_read], &sd_buf[offset_in_block], to_read); - total_read += to_read; - offset_in_block = 0; - } while(total_read < size); - - return size; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/dev/sd.h b/platform/msb430/dev/sd.h deleted file mode 100644 index 8efc33305..000000000 --- a/platform/msb430/dev/sd.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * SD driver interface. - * \author - * Nicolas Tsiftes - */ - -#ifndef SD_H -#define SD_H - -#include "sd-arch.h" - -#define SD_DEFAULT_BLOCK_SIZE 512 -#define SD_REGISTER_SIZE 16 - -/* API return codes. */ -#define SD_OK 1 - -#define SD_INIT_ERROR_NO_CARD -1 -#define SD_INIT_ERROR_ARCH -2 -#define SD_INIT_ERROR_NO_IF_COND -3 -#define SD_INIT_ERROR_NO_BLOCK_SIZE -4 - -#define SD_WRITE_ERROR_NO_CMD_RESPONSE -5 -#define SD_WRITE_ERROR_NO_BLOCK_RESPONSE -6 -#define SD_WRITE_ERROR_PROGRAMMING -7 -#define SD_WRITE_ERROR_TOKEN -8 -#define SD_WRITE_ERROR_NO_TOKEN -9 - -#define SD_READ_ERROR_NO_CMD_RESPONSE -10 -#define SD_READ_ERROR_INVALID_SIZE -11 -#define SD_READ_ERROR_TOKEN -12 -#define SD_READ_ERROR_NO_TOKEN -13 - -/* Type definition. */ -typedef uint32_t sd_offset_t; - -/* API */ -int sd_initialize(void); -int sd_write(sd_offset_t, char *, unsigned); -int sd_read(sd_offset_t, char *, unsigned); -int sd_write_block(sd_offset_t, char *); -int sd_read_block(sd_offset_t, char *); -sd_offset_t sd_get_capacity(void); -char *sd_error_string(int); - -#endif /* !SD_H */ diff --git a/platform/msb430/dev/sht11-arch.h b/platform/msb430/dev/sht11-arch.h deleted file mode 100644 index 42dc6b3c8..000000000 --- a/platform/msb430/dev/sht11-arch.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Architecture-specific definitions for the SHT11 sensor on MSB-430. - * \author - * Nicolas Tsiftes - */ - -#ifndef SHT11_ARCH_H -#define SHT11_ARCH_H - -#define SHT11_ARCH_SDA 4 /* P3.4 */ -#define SHT11_ARCH_SCL 5 /* P3.5 */ -#define SHT11_ARCH_PWR 6 /* P3.6 */ - -#define SHT11_PxDIR P3DIR -#define SHT11_PxIN P3IN -#define SHT11_PxOUT P3OUT -#define SHT11_PxSEL P3SEL - -#endif diff --git a/platform/msb430/doc/msb430.txt b/platform/msb430/doc/msb430.txt deleted file mode 100644 index 840f6db5d..000000000 --- a/platform/msb430/doc/msb430.txt +++ /dev/null @@ -1,51 +0,0 @@ -/** \addtogroup platform - * @{ - **/ - -/** -\defgroup msb430 The Modular Sensor Board - -The Modular Sensor Board (MSB430) was developed by FU-Berlin and was -added as a platform in Contiki in the spring of 2007. In its basic form, -this board consists of a Texas Instruments MSP430f1612 processor, a -Chipcon CC1020 radio chip, an MMA7260Q accelerometer, and a Sensirion -SHT11 temperature and humidity sensor. The MSB also has an SD device, -which makes it suitable for storage-centric sensor networks. There are -also extended versions of the board that are equipped with a GPRS-modem -and a GPS-receiver. - -\section msb430-programming Programming the MSB430 - -The msb430 port requires an installation of mspgcc -(http://mspgcc.sourceforge.net) to compile. Once the compilation tools -have been installed, you can compile your software and Contiki with -three main target types: - -.firmware - A system image in ELF format. -.ihex - A firmware file converted to the Intel Hex format. -.u - Direct upload to a node. - -Before compiling your system, you may want to look at the configuration -options in platform/msb430/configure-conf.h. - -The node is typically programmed by typing - - make TARGET=msb430 .u - -Alternatively, a ready .ihex file can be uploaded to the node by running - - msp430-jtag -l -e -I - -Platform-specific example programs are included in platform/msb430/apps -and can be compiled and uploaded from platform/msb430. A larger set of -examples for Contiki in general are in the examples/ directory. - -More information about the MSB430 platform can be found at -Scatterweb: http://www.scatterweb.com/content/products/MSB_en.html - -@{ - -*/ - -/** @} */ -/** @} */ diff --git a/platform/msb430/init-net-uip.c b/platform/msb430/init-net-uip.c deleted file mode 100644 index 66ee618cd..000000000 --- a/platform/msb430/init-net-uip.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * uIP initialization for the MSB-430 port. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "sys/node-id.h" -#include "dev/slip.h" -#include "dev/cc1020-uip.h" -#include "contiki-msb430.h" - -static struct uip_fw_netif slipif = -{UIP_FW_NETIF(172,16,0,0, 255,255,255,0, slip_send)}; - -static struct uip_fw_netif wsnif = -{UIP_FW_NETIF(0,0,0,0, 0,0,0,0, cc1020_uip_send)}; - -void -init_net(void) -{ - uip_ipaddr_t hostaddr; - cc1020_init(cc1020_config_19200); - - uip_init(); - uip_fw_init(); - /*tcpip_set_forwarding(1);*/ - - process_start(&tcpip_process, NULL); - process_start(&slip_process, NULL); - process_start(&uip_fw_process, NULL); - - rs232_set_input(slip_input_byte); - - cc1020_uip_init(); - cc1020_on(); - - if (node_id > 0) { - uip_ipaddr(&hostaddr, 172, 16, 1, node_id); - uip_sethostaddr(&hostaddr); - } - - uip_fw_register(&slipif); - uip_fw_default(&wsnif); -} diff --git a/platform/msb430/loader/loader-arch.h b/platform/msb430/loader/loader-arch.h deleted file mode 100644 index 260062d5a..000000000 --- a/platform/msb430/loader/loader-arch.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2005, 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. 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 file is part of the Contiki operating system. - * - */ -#ifndef __LOADER_ARCH_H__ -#define __LOADER_ARCH_H__ - -/** - * Load a program from EEPROM. - * - * This function loads a program from EEPROM into the flash ROM (code) and RAM (data). - * - * \param code The address of the first byte of code in the EEPROM. - * - * \param codelen The length of the code. - * - * \param data The address of the first byte of data in the EEPROM. - * - * \param datalen The length of the data. - * - */ -void loader_arch_load(unsigned short startaddr); - -/** - * Unload a program. - * - * This function should not be called directly, but accessed through - * the macro LOADER_UNLOAD(). The function unloads a program from both - * RAM and ROM. - * - * \param codeaddr A pointer to the first byte of program code. - * - * \param dataaddr A pointer to the first byte of program data. - */ -void loader_arch_free(void *codeaddr, void *dataaddr); - -extern void *loader_arch_codeaddr, *loader_arch_dataaddr; - -#ifndef LOADER_UNLOAD -#define LOADER_UNLOAD() loader_arch_free(&loader_arch_codeaddr, &loader_arch_dataaddr) -#endif - -#define LOADER_ARCH_MAGIC 0x373a -#define LOADER_ARCH_VERSION 0x0001 - -#endif /* __LOADER_ARCH_H__ */ diff --git a/platform/msb430/msb430-slip-arch.c b/platform/msb430/msb430-slip-arch.c deleted file mode 100644 index 45768acb1..000000000 --- a/platform/msb430/msb430-slip-arch.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "dev/msb430-uart1.h" -#include "dev/rs232.h" -#include "sys/clock.h" -#include "dev/slip.h" - - -void -slip_arch_writeb(unsigned char c) -{ - rs232_send(c); -} -/*---------------------------------------------------------------------------*/ - -/* - * The serial line is used to transfer IP packets using slip. To make - * it possible to send debug output over the same line we send debug - * output as slip frames (i.e delimeted by SLIP_END). - * - */ -int -putchar(int c) -{ -#define SLIP_END 0300 - static char debug_frame = 0; - - if(!debug_frame) { /* Start of debug output */ - slip_arch_writeb(SLIP_END); - slip_arch_writeb('\r'); /* Type debug line == '\r' */ - debug_frame = 1; - } - - slip_arch_writeb((char)c); - - /* - * Line buffered output, a newline marks the end of debug output and - * implicitly flushes debug output. - */ - if(c == '\n') { - slip_arch_writeb(SLIP_END); - debug_frame = 0; - } - - clock_delay(100); - - return c; -} - -/** - * Initalize the RS232 port and the SLIP driver. - * - */ -void -slip_arch_init(unsigned long ubr) -{ - rs232_set_input(slip_input_byte); -} diff --git a/platform/msb430/node-id.c b/platform/msb430/node-id.c deleted file mode 100644 index 62691813e..000000000 --- a/platform/msb430/node-id.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2006, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "sys/node-id.h" -#include "dev/infomem.h" - -uint16_t node_id = 0; - -/*---------------------------------------------------------------------------*/ -void -node_id_restore(void) -{ - uint16_t newid[2]; - - infomem_read(newid, INFOMEM_NODE_ID, sizeof(newid)); - node_id = (newid[0] == 0xdead) ? newid[1] : 0; -} -/*---------------------------------------------------------------------------*/ -void -node_id_burn(uint16_t id) -{ - uint16_t buffer[2] = { 0xdead, id }; - infomem_write(INFOMEM_NODE_ID, 1, buffer, sizeof(buffer)); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/symbols.c b/platform/msb430/symbols.c deleted file mode 100644 index e2f43ffdb..000000000 --- a/platform/msb430/symbols.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "symbols.h" -const int symbols_nelts = 0; -const struct symbols symbols[] = {{0,0}}; diff --git a/platform/msb430/symbols.h b/platform/msb430/symbols.h deleted file mode 100644 index 378215565..000000000 --- a/platform/msb430/symbols.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "loader/symbols.h" -extern const struct symbols symbols[1]; diff --git a/platform/native/contiki-conf.h b/platform/native/contiki-conf.h index 4b425097c..018268d03 100644 --- a/platform/native/contiki-conf.h +++ b/platform/native/contiki-conf.h @@ -30,8 +30,8 @@ * */ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include #ifndef WIN32_LEAN_AND_MEAN @@ -281,4 +281,4 @@ int strcasecmp(const char*, const char*); #include PROJECT_CONF_H #endif /* PROJECT_CONF_H */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/native/ctk/ctk-curses.h b/platform/native/ctk/ctk-curses.h index 98d432d5b..24ca8be2c 100644 --- a/platform/native/ctk/ctk-curses.h +++ b/platform/native/ctk/ctk-curses.h @@ -30,8 +30,8 @@ * * Author: François Revol */ -#ifndef __CTK_CONSOLE_H__ -#define __CTK_CONSOLE_H__ +#ifndef CTK_CONSOLE_H_ +#define CTK_CONSOLE_H_ #define cputc console_cputc #define cputs console_cputs @@ -63,4 +63,4 @@ void textcolor(unsigned char c); char ctk_arch_getkey(void); unsigned char ctk_arch_keyavail(void); -#endif /* __CTK_CONSOLE_H__ */ +#endif /* CTK_CONSOLE_H_ */ diff --git a/platform/native/dev/beep.h b/platform/native/dev/beep.h index 5dec63179..c2ab7d3f7 100644 --- a/platform/native/dev/beep.h +++ b/platform/native/dev/beep.h @@ -46,8 +46,8 @@ * */ -#ifndef __BEEP_H__ -#define __BEEP_H__ +#ifndef BEEP_H_ +#define BEEP_H_ #define BEEP_ALARM1 1 #define BEEP_ALARM2 2 @@ -159,4 +159,4 @@ void beep_quick(int num); /** @} */ /** @} */ -#endif /* __BEEP_H__ */ +#endif /* BEEP_H_ */ diff --git a/platform/native/dev/button-sensor.h b/platform/native/dev/button-sensor.h index 2a3f28459..2eadebd5f 100644 --- a/platform/native/dev/button-sensor.h +++ b/platform/native/dev/button-sensor.h @@ -1,5 +1,5 @@ -#ifndef __BUTTON_SENSOR_H__ -#define __BUTTON_SENSOR_H__ +#ifndef BUTTON_SENSOR_H_ +#define BUTTON_SENSOR_H_ #include "lib/sensors.h" @@ -9,4 +9,4 @@ extern const struct sensors_sensor button_sensor; void button_press(void); -#endif /* __BUTTON_SENSOR_H__ */ +#endif /* BUTTON_SENSOR_H_ */ diff --git a/platform/native/dev/pir-sensor.h b/platform/native/dev/pir-sensor.h index 84659c760..3cbf181b6 100644 --- a/platform/native/dev/pir-sensor.h +++ b/platform/native/dev/pir-sensor.h @@ -1,5 +1,5 @@ -#ifndef __PIR_SENSOR_H__ -#define __PIR_SENSOR_H__ +#ifndef PIR_SENSOR_H_ +#define PIR_SENSOR_H_ #include "lib/sensors.h" @@ -9,4 +9,4 @@ extern const struct sensors_sensor pir_sensor; void pir_sensor_changed(int strength); -#endif /* __PIR_SENSOR_H__ */ +#endif /* PIR_SENSOR_H_ */ diff --git a/platform/native/dev/temperature-sensor.h b/platform/native/dev/temperature-sensor.h index b7e37b404..89a13324c 100644 --- a/platform/native/dev/temperature-sensor.h +++ b/platform/native/dev/temperature-sensor.h @@ -38,8 +38,8 @@ * $Revision: 1.1 $ */ -#ifndef __TEMPERATURE_SENSOR_H__ -#define __TEMPERATURE_SENSOR_H__ +#ifndef TEMPERATURE_SENSOR_H_ +#define TEMPERATURE_SENSOR_H_ #include "lib/sensors.h" @@ -47,4 +47,4 @@ extern const struct sensors_sensor temperature_sensor; #define TEMPERATURE_SENSOR "Temperature" -#endif /* __TEMPERATURE_SENSOR_H__ */ +#endif /* TEMPERATURE_SENSOR_H_ */ diff --git a/platform/native/dev/vib-sensor.h b/platform/native/dev/vib-sensor.h index 63829973a..c95caa9a5 100644 --- a/platform/native/dev/vib-sensor.h +++ b/platform/native/dev/vib-sensor.h @@ -38,8 +38,8 @@ * $Revision: 1.1 $ */ -#ifndef __VIB_SENSOR_H__ -#define __VIB_SENSOR_H__ +#ifndef VIB_SENSOR_H_ +#define VIB_SENSOR_H_ #include "lib/sensors.h" @@ -49,4 +49,4 @@ extern const struct sensors_sensor vib_sensor; void vib_sensor_changed(void); -#endif /* __VIB_SENSOR_H__ */ +#endif /* VIB_SENSOR_H_ */ diff --git a/platform/pc-6001/Makefile b/platform/pc-6001/Makefile deleted file mode 100644 index 13095ffcc..000000000 --- a/platform/pc-6001/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# -# Makefile for PC-6001 using z80/SDCC -# @author Takahide Matsutsuka -# -# $Id: Makefile,v 1.7 2009/12/16 06:47:18 matsutsuka Exp $ -# - -CONTIKI = ../.. -TARGET=pc-6001 -APPS_DESKTOP = program-handler calc process-list shell about -APPS_NETWORK_CLIENT = $(APPS_DESKTOP) netconf webbrowser email telnet ftp irc -APPS_NETWORK_SERVER = program-handler cmdd telnetd shell -# editor netconf dhcp webbrowser ftp irc email telnet telnetd -# cmdd codeprop webserver vnc -# directory - -PLATFORM_APPS_DESKTOP = multithread tinysample -PLATFORM_APPS_NETWORK = webserver-mini -PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP) - -ifeq ($(MAKECMDGOALS),client) - APPS = $(APPS_NETWORK_CLIENT) -else ifeq ($(MAKECMDGOALS),server) - APPS = $(APPS_NETWORK_SERVER) -else - APPS = $(APPS_DESKTOP) -endif - -# Default values -MEMORY=32K -PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP) -CONTIKI_TARGET_MAIN = contiki-desktop-main.c -CTKCONF = NORMAL -LOADER = 0 - -# Target dependent options -ifeq ($(MAKECMDGOALS),p62) - ARCH=PC6001MK2 -else ifeq ($(MAKECMDGOALS),p6A) - ARCH=PC6001A -else ifeq ($(MAKECMDGOALS),minimal) - MEMORY=16K - CONTIKI_TARGET_MAIN=contiki-minimal-main.c -else ifeq ($(MAKECMDGOALS),serial) - CONTIKI_TARGET_MAIN=contiki-serial-main.c -else ifeq ($(MAKECMDGOALS),rom) - CTKCONF=NOICON - MEMORY=ROM - LOADER = 1 - CONTIKI_TARGET_MAIN=contiki-loader-main.c -else ifeq ($(MAKECMDGOALS),load) - CTKCONF=NOICON - LOADER = 1 - CONTIKI_TARGET_MAIN=contiki-loader-main.c -else ifeq ($(MAKECMDGOALS),server) - CTKCONF=SERVER - PLATFORM_APPS = $(PLATFORM_APPS_NETWORK) - CONTIKI_TARGET_MAIN=contiki-server-main.c -else ifeq ($(MAKECMDGOALS),client) - CTKCONF=CLIENT - PLATFORM_APPS = $(PLATFORM_APPS_NETWORK) - CONTIKI_TARGET_MAIN=contiki-client-main.c -endif - -all : p6 - -p6 : contiki -p62 : contiki -p6A : contiki -minimal : contiki -serial : contiki -rom : contiki.rom -load : contiki -server : contiki -client : contiki - -remove-ctk: - rm -f obj_$(TARGET)/ctk*; - rm -f contiki.ihex -remove-net: - rm -f ${addprefix obj_$(TARGET)/,uip*.o hc.o psock.o rawpacket-udp.o resolv.o slip*.o tcp*.o uaod*.o rime*.o http*.o web*.o}; - rm -f contiki.ihex -remove-mt: - rm -f obj_$(TARGET)/mt*.o - rm -f contiki.ihex - -include $(CONTIKI)/Makefile.include diff --git a/platform/pc-6001/Makefile.pc-6001 b/platform/pc-6001/Makefile.pc-6001 deleted file mode 100644 index 2dde283a3..000000000 --- a/platform/pc-6001/Makefile.pc-6001 +++ /dev/null @@ -1,103 +0,0 @@ -# -# Makefile for PC-6001 using z80/SDCC -# @author Takahide Matsutsuka -# -# $Id: Makefile.pc-6001,v 1.13 2009/12/16 06:47:18 matsutsuka Exp $ -# - -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -### setup default values -ifndef ARCH - ARCH=PC6001 -endif -ifndef MEMORY - MEMORY=32K -endif -ifndef CONTIKI_TARGET_MAIN - CONTIKI_TARGET_MAIN = contiki-main.c -endif -ifndef CTKCONF - CTKCONF=NORMAL -endif -ifndef LOADER - LOADER=0 -endif - -ifndef HEX2BIN - HEX2BINDIR = ../../tools/z80/hex2bin/ - HEX2BIN = $(HEX2BINDIR)/hexameter -endif - -### setup flags to be used in compiler, assembler, and HEX2BIN -PLATFORM = $(CONTIKI)/platform/$(TARGET) -CONTIKI_TARGET_DIRS = . ctk dev loader -CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH) -DCTK_$(CTKCONF) - -ifeq ($(MEMORY),16K) - LDFLAGS += --code-loc 0xc40f --data-loc 0 - HEX2BINFLAGS = -d TAPE=contki $(HEX2BINDIR)/ihx/mode1.ihx -o contiki.p6 -else ifeq ($(MEMORY),ROM) - LDFLAGS += --code-loc 0x4004 --data-loc 0xf000 - HEX2BINFLAGS = -d ROMEXEC=4004 $(HEX2BINDIR)/ihx/rom60.ihx -b 4000 -o contiki.rom -else ifeq ($(ARCH),PC6001MK2) - LDFLAGS += --code-loc 0x800f --data-loc 0 - HEX2BINFLAGS = -d TAPE=contki $(HEX2BINDIR)/ihx/mode5.ihx -o contiki2.p6 -else - LDFLAGS += --code-loc 0x840f --data-loc 0 - HEX2BINFLAGS = -d TAPE=contki $(HEX2BINDIR)/ihx/mode2.ihx -o contiki.p6 -endif - -ifeq ($(LOADER),1) - CFLAGS += -DWITH_LOADER_ARCH=1 -endif - -### Include platform-depend application makefiles - -ifdef PLATFORM_APPS - PLATFORM_APPDIRS += ${addprefix $(PLATFORM)/apps/, $(PLATFORM_APPS)} - PLATFORM_APPINCLUDES = ${foreach APP, $(PLATFORM_APPS), $(PLATFORM)/apps/$(APP)/Makefile.$(APP)} - -include $(PLATFORM_APPINCLUDES) - PLATFORM_APP_SOURCES = ${foreach APP, $(PLATFORM_APPS), $($(APP)_src)} - PLATFORM_DSC_SOURCES = ${foreach APP, $(PLATFORM_APPS), $($(APP)_dsc)} - CONTIKI_SOURCEFILES += $(PLATFORM_APP_SOURCES) $(PLATFORM_DSC_SOURCES) -endif - -CONTIKI_TARGET_SOURCEFILES = \ - $(CTK) cfs-ram.c serial-line.c slip.c \ - resolv.c loader_arch.c \ - ctk-conio_arch.c $(CONTIKI_TARGET_MAIN) - -#you can use the below instead of ctk-conio_arch.c, ctk-conio_arch-asm.cS, -# and libconio_arch-asm.cS -#ctk-conio_arch-source.c - -CONTIKI_ASMFILES += getkey.S isprint_arch.S clock.S rs232-asm.S -CONTIKI_CASMFILES += ctk-conio_arch-asm.cS libconio_arch-asm.cS\ - libconio_arch-small.cS - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -CLEAN += *.rom *.p6 - -contiki: $(HEX2BIN) contiki.p6 - -.SUFFIXES: - -%.p6: %.ihx - $(HEX2BIN) $(HEX2BINFLAGS) $< $(HEX2BINDIR)/ihx/suffix.ihx -%.rom: %.ihx - $(HEX2BIN) $(HEX2BINFLAGS) $< - -$(HEX2BIN): - cd $(HEX2BINDIR); make - -### Define the CPU directory -CONTIKI_CPU=$(CONTIKI)/cpu/z80 -include $(CONTIKI_CPU)/Makefile.z80 - -### Setup directory search path for source files -PROJECTDIRS += $(PLATFORM_APPDIRS) - diff --git a/platform/pc-6001/apps/multithread/Makefile.multithread b/platform/pc-6001/apps/multithread/Makefile.multithread deleted file mode 100644 index 13f57f481..000000000 --- a/platform/pc-6001/apps/multithread/Makefile.multithread +++ /dev/null @@ -1,2 +0,0 @@ -multithread_src = mt-test.c -multithread_dsc = mt-test-dsc.c diff --git a/platform/pc-6001/apps/multithread/mt-test-dsc.c b/platform/pc-6001/apps/multithread/mt-test-dsc.c deleted file mode 100644 index d5e248916..000000000 --- a/platform/pc-6001/apps/multithread/mt-test-dsc.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char mttesticon_bitmap[3*3*8] = { - 0x00, 0x7f, 0x43, 0x4c, 0x58, 0x53, 0x60, 0x6f, - 0x00, 0xff, 0x00, 0x7e, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xfe, 0xc2, 0x32, 0x1a, 0xca, 0x06, 0xf6, - - 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x4f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xfc, 0x01, 0xf3, - 0x02, 0xfa, 0x02, 0x82, 0x3e, 0xfe, 0xfe, 0xfe, - - 0x60, 0x67, 0x50, 0x59, 0x4c, 0x43, 0x7f, 0x00, - 0x07, 0xe7, 0x0f, 0xef, 0x0f, 0x0f, 0xff, 0x00, - 0x8e, 0x06, 0x06, 0x06, 0x8e, 0xfe, 0xfe, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char mttesticon_textmap[9] = { - 'T', 'h', 'r', - 'e', 'a', 'd', - '=', '=', '>' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon mttest_icon = - {CTK_ICON("Multithread test", mttesticon_bitmap, mttesticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(mttest_dsc, - "MultithreadTest", - "mt-test.prg", - mt_process, - &mttest_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/multithread/mt-test-dsc.h b/platform/pc-6001/apps/multithread/mt-test-dsc.h deleted file mode 100644 index 51fdf58c3..000000000 --- a/platform/pc-6001/apps/multithread/mt-test-dsc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef MTTESTDSC_H_ -#define MTTESTDSC_H_ -#include "sys/dsc.h" - -DSC_HEADER(mttest_dsc); - -#endif /*MTTESTDSC_H_*/ diff --git a/platform/pc-6001/apps/multithread/mt-test.c b/platform/pc-6001/apps/multithread/mt-test.c deleted file mode 100644 index c43d1b096..000000000 --- a/platform/pc-6001/apps/multithread/mt-test.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -/** - * \file - * A very simple Contiki application showing how to use the Contiki - * Multi-threading library - * \author - * Oliver Schmidt - * \author for PC-6001 version - * Takahide Matsutsuka - */ - -#include - -#include "contiki.h" -#include "ctk.h" -#include "sys/mt.h" -#include "mtarch.h" - -#define WIN_XSIZE 10 -#define WIN_YSIZE 10 - -static char log[WIN_XSIZE * WIN_YSIZE]; -static struct ctk_window window; -static struct ctk_label loglabel = {CTK_LABEL(0, 0, WIN_XSIZE, WIN_YSIZE, log)}; -PROCESS(mt_process, "Multi-threading test"); - -static char buf[20]; - -void -println(char *str1) -{ - unsigned int i; - - for(i = 1; i < WIN_YSIZE; i++) { - memcpy(&log[(i - 1) * WIN_XSIZE], &log[i * WIN_XSIZE], WIN_XSIZE); - } - memset(&log[(WIN_YSIZE - 1) * WIN_XSIZE], 0, WIN_XSIZE); - - strncpy(&log[(WIN_YSIZE - 1) * WIN_XSIZE], str1, WIN_XSIZE); - - CTK_WIDGET_REDRAW(&loglabel); -} -/*---------------------------------------------------------------------------*/ -static void -thread_func(char *str, int len) -{ - println((char *) (str + len)); - mt_yield(); - - if(len) { - thread_func(str, len - 1); - mt_yield(); - } - - println((char *) (str + len)); -} -/*---------------------------------------------------------------------------*/ -static void -thread_main(void *data) -{ - while(1) { - thread_func((char *)data, 9); - } - mt_exit(); -} - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(mt_process, ev, data) -{ - - static struct etimer timer; - static int toggle = 0; - static struct mt_thread th1; - static struct mt_thread th2; - - PROCESS_BEGIN(); - - ctk_window_new(&window, WIN_XSIZE, WIN_YSIZE, "Multithread"); - CTK_WIDGET_ADD(&window, &loglabel); - memset(log, 0, sizeof(log)); - ctk_window_open(&window); - mt_init(); - mt_start(&th1, thread_main, "JIHGFEDCBA"); - mt_start(&th2, thread_main, "9876543210"); - - etimer_set(&timer, CLOCK_SECOND / 2); - while(1) { - PROCESS_WAIT_EVENT(); - if(ev == PROCESS_EVENT_TIMER) { - if(toggle) { - mt_exec(&th1); - toggle--; - } else { - mt_exec(&th2); - toggle++; - } - etimer_set(&timer, CLOCK_SECOND / 2); - } else if(ev == ctk_signal_window_close || ev == PROCESS_EVENT_EXIT) { - ctk_window_close(&window); - process_exit(&mt_process); - LOADER_UNLOAD(); - } - } - - mt_stop(&th1); - mt_stop(&th2); - mt_remove(); - - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/tinysample/Makefile.tinysample b/platform/pc-6001/apps/tinysample/Makefile.tinysample deleted file mode 100644 index 2a58b3ff9..000000000 --- a/platform/pc-6001/apps/tinysample/Makefile.tinysample +++ /dev/null @@ -1,2 +0,0 @@ -tinysample_src = tinysample.c -tinysample_dsc = tinysample-dsc.c diff --git a/platform/pc-6001/apps/tinysample/tinysample-dsc.c b/platform/pc-6001/apps/tinysample/tinysample-dsc.c deleted file mode 100644 index 4aafc7107..000000000 --- a/platform/pc-6001/apps/tinysample/tinysample-dsc.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * 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 file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -/** - * \file - * A very small sample Contiki application using console. - * \author - * Takahide Matsutsuka - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char tiny_bitmap[3*3*8] = { - 0x00, 0x7f, 0x43, 0x4c, 0x58, 0x53, 0x60, 0x6f, - 0x00, 0xff, 0x00, 0x7e, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xfe, 0xc2, 0x32, 0x1a, 0xca, 0x06, 0xf6, - - 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x4f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xfc, 0x01, 0xf3, - 0x02, 0xfa, 0x02, 0x82, 0x3e, 0xfe, 0xfe, 0xfe, - - 0x60, 0x67, 0x50, 0x59, 0x4c, 0x43, 0x7f, 0x00, - 0x07, 0xe7, 0x0f, 0xef, 0x0f, 0x0f, 0xff, 0x00, - 0x8e, 0x06, 0x06, 0x06, 0x8e, 0xfe, 0xfe, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char tiny_textmap[9] = { - 'T', 'i', 'n', - 'y', 'S', 'a', - 'm', 'p', 'l' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon tiny_icon = - {CTK_ICON("Tiny sample", tiny_bitmap, tiny_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(tiny_dsc, - "Tinysample", - "tinysmaple.prg", - tiny_process, - &tiny_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/tinysample/tinysample-dsc.h b/platform/pc-6001/apps/tinysample/tinysample-dsc.h deleted file mode 100644 index aab795b70..000000000 --- a/platform/pc-6001/apps/tinysample/tinysample-dsc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * 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 file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -/** - * \file - * A very small sample Contiki application using console. - * \author - * Takahide Matsutsuka - */ - -#ifndef TINYSAMPLE_DSC_H_ -#define TINYSAMPLE_DSC_H_ -#include "sys/dsc.h" - -DSC_HEADER(tiny_dsc); - -#endif /*TINYSAMPLE_DSC_H_*/ diff --git a/platform/pc-6001/apps/tinysample/tinysample.c b/platform/pc-6001/apps/tinysample/tinysample.c deleted file mode 100644 index 457156e6d..000000000 --- a/platform/pc-6001/apps/tinysample/tinysample.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * 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 file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -/** - * \file - * A very small sample Contiki application using console. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" -#include "libconio_arch-small.h" - -PROCESS(tiny_process, "Tiny Sample"); - -static char ch[] = "A"; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tiny_process, ev, data) -{ - static struct etimer timer; - - PROCESS_BEGIN(); - - clrscr_arch(); - - while(1) { - etimer_set(&timer, CLOCK_SECOND / 32); - PROCESS_WAIT_EVENT(); - if(etimer_expired(&timer)) { - libputs_arch(ch); - ch[0]++; - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/webserver-mini/Makefile.webserver-mini b/platform/pc-6001/apps/webserver-mini/Makefile.webserver-mini deleted file mode 100644 index 3d6b8babe..000000000 --- a/platform/pc-6001/apps/webserver-mini/Makefile.webserver-mini +++ /dev/null @@ -1,2 +0,0 @@ -webserver-mini_src = webserver-nogui.c httpd.c http-strings.c psock.c memb.c \ - httpd-fs.c httpd-cgi.c diff --git a/platform/pc-6001/apps/webserver-mini/http-strings b/platform/pc-6001/apps/webserver-mini/http-strings deleted file mode 100644 index 6a3fba34f..000000000 --- a/platform/pc-6001/apps/webserver-mini/http-strings +++ /dev/null @@ -1,34 +0,0 @@ -http_http "http://" -http_200 "200 " -http_301 "301 " -http_302 "302 " -http_get "GET " -http_10 "HTTP/1.0" -http_11 "HTTP/1.1" -http_content_type "content-type: " -http_texthtml "text/html" -http_location "location: " -http_host "host: " -http_crnl "\n" -http_index_html "/index.html" -http_404_html "/404.html" -http_referer "Referer:" -http_header_200 "HTTP/1.0 200 OK\nServer: Contiki/2.0\nConnection: close\n" -http_header_404 "HTTP/1.0 404 Not found\nServer: Contiki/2.0\nConnection: close\n" -http_content_type_plain "Content-type: text/plain\n\n" -http_content_type_html "Content-type: text/html\n\n" -http_content_type_css "Content-type: text/css\n\n" -http_content_type_text "Content-type: text/text\n\n" -http_content_type_png "Content-type: image/png\n\n" -http_content_type_gif "Content-type: image/gif\n\n" -http_content_type_jpg "Content-type: image/jpeg\n\n" -http_content_type_binary "Content-type: application/octet-stream\n\n" -http_html ".html" -http_shtml ".shtml" -http_htm ".htm" -http_css ".css" -http_png ".png" -http_gif ".gif" -http_jpg ".jpg" -http_text ".text" -http_txt ".txt" diff --git a/platform/pc-6001/apps/webserver-mini/http-strings.c b/platform/pc-6001/apps/webserver-mini/http-strings.c deleted file mode 100644 index 924f15f12..000000000 --- a/platform/pc-6001/apps/webserver-mini/http-strings.c +++ /dev/null @@ -1,36 +0,0 @@ -const char http_200[5] = -/* "200 " */ -{0x32, 0x30, 0x30, 0x20, }; -const char http_get[5] = -/* "GET " */ -{0x47, 0x45, 0x54, 0x20, }; -const char http_index_html[12] = -/* "/index.html" */ -{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_404_html[10] = -/* "/404.html" */ -{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_referer[9] = -/* "Referer:" */ -{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, }; -const char http_header_200[55] = -/* "HTTP/1.0 200 OK\nServer: Contiki/2.0\nConnection: close\n" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x32, 0x2e, 0x30, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xa, }; -const char http_header_404[62] = -/* "HTTP/1.0 404 Not found\nServer: Contiki/2.0\nConnection: close\n" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34, 0x30, 0x34, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x32, 0x2e, 0x30, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xa, }; -const char http_content_type_plain[27] = -/* "Content-type: text/plain\n\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xa, 0xa, }; -const char http_content_type_html[26] = -/* "Content-type: text/html\n\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0xa, }; -const char http_content_type_binary[41] = -/* "Content-type: application/octet-stream\n\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xa, 0xa, }; -const char http_html[6] = -/* ".html" */ -{0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_shtml[7] = -/* ".shtml" */ -{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, }; diff --git a/platform/pc-6001/apps/webserver-mini/http-strings.h b/platform/pc-6001/apps/webserver-mini/http-strings.h deleted file mode 100644 index 8da08cad6..000000000 --- a/platform/pc-6001/apps/webserver-mini/http-strings.h +++ /dev/null @@ -1,34 +0,0 @@ -extern const char http_http[8]; -extern const char http_200[5]; -extern const char http_301[5]; -extern const char http_302[5]; -extern const char http_get[5]; -extern const char http_10[9]; -extern const char http_11[9]; -extern const char http_content_type[15]; -extern const char http_texthtml[10]; -extern const char http_location[11]; -extern const char http_host[7]; -extern const char http_crnl[2]; -extern const char http_index_html[12]; -extern const char http_404_html[10]; -extern const char http_referer[9]; -extern const char http_header_200[55]; -extern const char http_header_404[62]; -extern const char http_content_type_plain[27]; -extern const char http_content_type_html[26]; -extern const char http_content_type_css [25]; -extern const char http_content_type_text[26]; -extern const char http_content_type_png [26]; -extern const char http_content_type_gif [26]; -extern const char http_content_type_jpg [27]; -extern const char http_content_type_binary[41]; -extern const char http_html[6]; -extern const char http_shtml[7]; -extern const char http_htm[5]; -extern const char http_css[5]; -extern const char http_png[5]; -extern const char http_gif[5]; -extern const char http_jpg[5]; -extern const char http_text[6]; -extern const char http_txt[5]; diff --git a/platform/pc-6001/apps/webserver-mini/httpd-cfs.c b/platform/pc-6001/apps/webserver-mini/httpd-cfs.c deleted file mode 100644 index 389e7e82a..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-cfs.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * 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. - * - * 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 file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include - -#include "contiki-net.h" -#include "cfs/cfs.h" - -#include "webserver.h" -#include "libconio_arch-small.h" - -#include "httpd-cfs.h" - -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 - -#define SEND_STRING(s, str) PSOCK_SEND(s, str, strlen(str)) -MEMB(conns, struct httpd_state, 2); - -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_file(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sout); - - do { - /* Read data from file system into buffer */ - s->len = cfs_read(s->fd, s->outputbuf, sizeof(s->outputbuf)); - - /* If there is data in the buffer, send it */ - if(s->len > 0) { - PSOCK_SEND(&s->sout, s->outputbuf, s->len); - } else { - break; - } - } while(s->len > 0); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_headers(struct httpd_state *s, char *statushdr)) -{ - char *ptr; - - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, statushdr); - SEND_STRING(&s->sout, "Server: " CONTIKI_VERSION_STRING "\r\n"); - - ptr = strrchr(s->filename, '.'); - if(ptr == NULL) { - SEND_STRING(&s->sout, "Content-type: text/plain\r\n\r\n"); - } else if(strncmp(".html", ptr, 5) == 0) { - SEND_STRING(&s->sout, "Content-type: text/html\r\n\r\n"); - } else if(strncmp(".css", ptr, 4) == 0) { - SEND_STRING(&s->sout, "Content-type: text/css\r\n\r\n"); - } else if(strncmp(".png", ptr, 4) == 0) { - SEND_STRING(&s->sout, "Content-type: image/png\r\n\r\n"); - } else if(strncmp(".jpg", ptr, 4) == 0) { - SEND_STRING(&s->sout, "Content-type: image/jpeg\r\n\r\n"); - } else { - SEND_STRING(&s->sout, "Content-type: application/octet-stream\r\n\r\n"); - } - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - PT_BEGIN(&s->outputpt); - - s->fd = cfs_open(s->filename, CFS_READ); - if(s->fd < 0) { - s->fd = cfs_open("404.html", CFS_READ); - if(s->fd < 0) { - uip_abort(); - PT_EXIT(&s->outputpt); - } - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, "HTTP/1.0 404 Not found\r\n")); - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, "HTTP/1.0 200 OK\r\n")); - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); - cfs_close(s->fd); - } - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); - - PSOCK_READTO(&s->sin, ' '); - - if(strncmp(s->inputbuf, "GET ", 4) != 0) { - PSOCK_CLOSE_EXIT(&s->sin); - } - PSOCK_READTO(&s->sin, ' '); - - if(s->inputbuf[0] != '/') { - PSOCK_CLOSE_EXIT(&s->sin); - } - - if(s->inputbuf[1] == ' ') { - strncpy(s->filename, "index.html", sizeof(s->filename)); - } else { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, &s->inputbuf[1], sizeof(s->filename)); - } - - // webserver_log_file(&uip_conn->ripaddr, s->filename); - libputs_arch(s->filename); - s->state = STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, '\n'); - - if(strncmp(s->inputbuf, "Referer:", 8) == 0) { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; - libputs_arch(&s->inputbuf[9]); - // webserver_log(&s->inputbuf[9]); - } - } - - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_appcall(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - memb_free(&conns, s); - } - } else if(uip_connected()) { - s = (struct httpd_state *)memb_alloc(&conns); - if(s == NULL) { - uip_abort(); - return; - } - tcp_markconn(uip_conn, s); - PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - s->state = STATE_WAITING; - timer_set(&s->timer, CLOCK_SECOND * 10); - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - if(timer_expired(&s->timer)) { - uip_abort(); - } - } else { - timer_reset(&s->timer); - } - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_init(void) -{ - tcp_listen(UIP_HTONS(80)); - memb_init(&conns); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-cfs.h b/platform/pc-6001/apps/webserver-mini/httpd-cfs.h deleted file mode 100644 index 868c39d03..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-cfs.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -#ifndef __HTTPD_CFS_H__ -#define __HTTPD_CFS_H__ - -#include "contiki-net.h" - -struct httpd_state { - struct timer timer; - struct psock sin, sout; - struct pt outputpt; - char inputbuf[50]; - char outputbuf[UIP_TCP_MSS]; - char filename[20]; - char state; - int fd; - int len; -}; - - -void httpd_init(void); -void httpd_appcall(void *state); - -#endif /* __HTTPD_CFS_H__ */ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-cgi.c b/platform/pc-6001/apps/webserver-mini/httpd-cgi.c deleted file mode 100644 index ec4ed0095..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-cgi.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -/* - * This file includes functions that are called by the web server - * scripts. The functions takes no argument, and the return value is - * interpreted as follows. A zero means that the function did not - * complete and should be invoked for the next packet as well. A - * non-zero value indicates that the function has completed and that - * the web server should move along to the next script line. - * - */ - - -#include "contiki-net.h" -#include "httpd.h" -#include "httpd-cgi.h" -#include "httpd-fs.h" - -#include "lib/petsciiconv.h" - -#include -#include - - -static struct httpd_cgi_call *calls = NULL; - -/*struct cgifunction { - char *name; - httpd_cgifunction function; -}; - -static struct cgifunction cgitab[] = { - {"file-stats", file_stats}, - {"tcp-connections", tcp_stats}, - {"processes", processes}, - {NULL, NULL} - };*/ - - -static const char closed[] = /* "CLOSED",*/ -{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0}; -static const char syn_rcvd[] = /* "SYN-RCVD",*/ -{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56, - 0x44, 0}; -static const char syn_sent[] = /* "SYN-SENT",*/ -{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e, - 0x54, 0}; -static const char established[] = /* "ESTABLISHED",*/ -{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, - 0x45, 0x44, 0}; -static const char fin_wait_1[] = /* "FIN-WAIT-1",*/ -{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, - 0x54, 0x2d, 0x31, 0}; -static const char fin_wait_2[] = /* "FIN-WAIT-2",*/ -{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, - 0x54, 0x2d, 0x32, 0}; -static const char closing[] = /* "CLOSING",*/ -{0x43, 0x4c, 0x4f, 0x53, 0x49, - 0x4e, 0x47, 0}; -static const char time_wait[] = /* "TIME-WAIT,"*/ -{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41, - 0x49, 0x54, 0}; -static const char last_ack[] = /* "LAST-ACK"*/ -{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43, - 0x4b, 0}; -static const char none[] = "NONE"; -static const char init[] = "INIT"; -static const char running[] = "RUNNING"; -static const char needs_poll[] = "NEEDS POLL"; - -static const char *states[] = { - closed, - syn_rcvd, - syn_sent, - established, - fin_wait_1, - fin_wait_2, - closing, - time_wait, - last_ack, - none, - init, - running, - needs_poll}; - - -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(nullfunction(struct httpd_state *s, char *ptr)) -{ - PSOCK_BEGIN(&s->sout); - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -httpd_cgifunction -httpd_cgi(char *name) -{ - struct httpd_cgi_call *f; - - /* Find the matching name in the table, return the function. */ - for(f = calls; f != NULL; f = f->next) { - if(strncmp(f->name, name, strlen(f->name)) == 0) { - return f->function; - } - } - return nullfunction; -} -/*---------------------------------------------------------------------------*/ -static unsigned short -generate_file_stats(void *arg) -{ - char *f = (char *)arg; - return sprintf((char *)uip_appdata, "%5u", httpd_fs_count(f)); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(file_stats(struct httpd_state *s, char *ptr)) -{ - PSOCK_BEGIN(&s->sout); - - PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, (void *) (strchr(ptr, ' ') + 1)); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static unsigned short -make_tcp_stats(void *arg) -{ - struct uip_conn *conn; - struct httpd_state *s = (struct httpd_state *)arg; - - conn = &uip_conns[s->u.count]; - return sprintf((char *)uip_appdata, - "%d%u.%u.%u.%u:%u%s%u%u%c %c\r\n", - uip_htons(conn->lport), - conn->ripaddr.u8[0], - conn->ripaddr.u8[1], - conn->ripaddr.u8[2], - conn->ripaddr.u8[3], - uip_htons(conn->rport), - states[conn->tcpstateflags & UIP_TS_MASK], - conn->nrtx, - conn->timer, - (uip_outstanding(conn))? '*':' ', - (uip_stopped(conn))? '!':' '); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr)) -{ - - PSOCK_BEGIN(&s->sout); - - for(s->u.count = 0; s->u.count < UIP_CONNS; ++s->u.count) { - if((uip_conns[s->u.count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED) { - PSOCK_GENERATOR_SEND(&s->sout, make_tcp_stats, s); - } - } - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static unsigned short -make_processes(void *p) -{ - char name[40]; - - strncpy(name, PROCESS_NAME_STRING((struct process *)p), 40); - petsciiconv_toascii(name, 40); - - return sprintf((char *)uip_appdata, - "%p%s%p%s\r\n", - p, name, - (char *)((struct process *)p)->thread, - states[9 + ((struct process *)p)->state]); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(processes(struct httpd_state *s, char *ptr)) -{ - PSOCK_BEGIN(&s->sout); - for(s->u.ptr = PROCESS_LIST(); s->u.ptr != NULL; s->u.ptr = ((struct process *)s->u.ptr)->next) { - PSOCK_GENERATOR_SEND(&s->sout, make_processes, s->u.ptr); - } - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -void -httpd_cgi_add(struct httpd_cgi_call *c) -{ - struct httpd_cgi_call *l; - - c->next = NULL; - if(calls == NULL) { - calls = c; - } else { - for(l = calls; l->next != NULL; l = l->next); - l->next = c; - } -} -/*---------------------------------------------------------------------------*/ - -HTTPD_CGI_CALL(file, "file-stats", file_stats); -HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats); -HTTPD_CGI_CALL(proc, "processes", processes); - -void -httpd_cgi_init(void) -{ - httpd_cgi_add(&file); - httpd_cgi_add(&tcp); - httpd_cgi_add(&proc); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-cgi.h b/platform/pc-6001/apps/webserver-mini/httpd-cgi.h deleted file mode 100644 index 21b337a82..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-cgi.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ - -#include "contiki.h" -#include "httpd.h" - -typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *)); - -httpd_cgifunction httpd_cgi(char *name); - -struct httpd_cgi_call { - struct httpd_cgi_call *next; - const char *name; - httpd_cgifunction function; -}; - -void httpd_cgi_add(struct httpd_cgi_call *c); - -#define HTTPD_CGI_CALL(name, str, function) \ -static struct httpd_cgi_call name = {NULL, str, function} - -void httpd_cgi_init(void); -#endif /* __HTTPD_CGI_H__ */ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fs.c b/platform/pc-6001/apps/webserver-mini/httpd-fs.c deleted file mode 100644 index a07b79b7d..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-fs.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2001, 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. 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 file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ - -#include "contiki-net.h" -#include "httpd.h" -#include "httpd-fs.h" -#include "httpd-fsdata.h" - -#include "httpd-fsdata.c" -#include "ctk/libconio_arch-small.h" - -#if HTTPD_FS_STATISTICS -static uint16_t count[HTTPD_FS_NUMFILES]; -#endif /* HTTPD_FS_STATISTICS */ - -/*-----------------------------------------------------------------------------------*/ -static uint8_t -httpd_fs_strcmp(const char *str1, const char *str2) -{ - uint8_t i; - i = 0; - -loop: - if(str2[i] == 0 || - str1[i] == '\r' || - str1[i] == '\n') { - return 0; - } - - if(str1[i] != str2[i]) { - return 1; - } - - ++i; - goto loop; -} -/*-----------------------------------------------------------------------------------*/ -int -httpd_fs_open(const char *name, struct httpd_fs_file *file) -{ -#if HTTPD_FS_STATISTICS - uint16_t i = 0; -#endif /* HTTPD_FS_STATISTICS */ - char* ch; - struct httpd_fsdata_file_noconst *f; - - libputs_arch(name); - for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; - f != NULL; - f = (struct httpd_fsdata_file_noconst *)f->next) { - - if(httpd_fs_strcmp(name, f->name) == 0) { - file->data = f->data; - file->len = f->len; -#if HTTPD_FS_STATISTICS - ++count[i]; -#endif /* HTTPD_FS_STATISTICS */ - return 1; - } -#if HTTPD_FS_STATISTICS - ++i; -#endif /* HTTPD_FS_STATISTICS */ - - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -void -httpd_fs_init(void) -{ -#if HTTPD_FS_STATISTICS - uint16_t i; - for(i = 0; i < HTTPD_FS_NUMFILES; i++) { - count[i] = 0; - } -#endif /* HTTPD_FS_STATISTICS */ -} -/*-----------------------------------------------------------------------------------*/ -#if HTTPD_FS_STATISTICS -uint16_t -httpd_fs_count(char *name) -{ - struct httpd_fsdata_file_noconst *f; - uint16_t i; - - i = 0; - for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; - f != NULL; - f = (struct httpd_fsdata_file_noconst *)f->next) { - - if(httpd_fs_strcmp(name, f->name) == 0) { - return count[i]; - } - ++i; - } - return 0; -} -#endif /* HTTPD_FS_STATISTICS */ -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fs.h b/platform/pc-6001/apps/webserver-mini/httpd-fs.h deleted file mode 100644 index c8cab68d3..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-fs.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2001, 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. 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 file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ -#ifndef __HTTPD_FS_H__ -#define __HTTPD_FS_H__ - -#include "contiki-net.h" - -#define HTTPD_FS_STATISTICS 1 - -struct httpd_fs_file { - char *data; - int len; -}; - -/* file must be allocated by caller and will be filled in - by the function. */ -int httpd_fs_open(const char *name, struct httpd_fs_file *file); - -#ifdef HTTPD_FS_STATISTICS -#if HTTPD_FS_STATISTICS == 1 -uint16_t httpd_fs_count(char *name); -#endif /* HTTPD_FS_STATISTICS */ -#endif /* HTTPD_FS_STATISTICS */ - -void httpd_fs_init(void); - -#endif /* __HTTPD_FS_H__ */ diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fs/404.html b/platform/pc-6001/apps/webserver-mini/httpd-fs/404.html deleted file mode 100644 index 51e053a23..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-fs/404.html +++ /dev/null @@ -1 +0,0 @@ -

404 - file not found

Contiki PC-6001 \ No newline at end of file diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fs/index.html b/platform/pc-6001/apps/webserver-mini/httpd-fs/index.html deleted file mode 100644 index 3255ed2d8..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-fs/index.html +++ /dev/null @@ -1 +0,0 @@ -Contiki on PC-6001

This website is being served by PC-6001 Contiki!

Front page
Network connections
System processes
\ No newline at end of file diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fsdata.c b/platform/pc-6001/apps/webserver-mini/httpd-fsdata.c deleted file mode 100644 index 2cfcf9801..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-fsdata.c +++ /dev/null @@ -1,50 +0,0 @@ -static const unsigned char data_404_html[] = { - /* /404.html */ - 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x3c, 0x62, 0x6f, 0x64, - 0x79, 0x3e, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, - 0x2d, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, - 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, - 0x2f, 0x22, 0x3e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, - 0x20, 0x50, 0x43, 0x2d, 0x36, 0x30, 0x30, 0x31, 0x3c, 0x2f, - 0x61, 0x3e, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, - 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; - -static const unsigned char data_index_html[] = { - /* /index.html */ - 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x3c, 0x68, 0x65, 0x61, - 0x64, 0x3e, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0x43, - 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x20, 0x6f, 0x6e, 0x20, - 0x50, 0x43, 0x2d, 0x36, 0x30, 0x30, 0x31, 0x3c, 0x2f, 0x74, - 0x69, 0x74, 0x6c, 0x65, 0x3e, 0x3c, 0x2f, 0x68, 0x65, 0x61, - 0x64, 0x3e, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x68, - 0x33, 0x3e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x77, 0x65, 0x62, - 0x73, 0x69, 0x74, 0x65, 0x20, 0x69, 0x73, 0x20, 0x62, 0x65, - 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x20, 0x62, 0x79, 0x20, 0x50, 0x43, 0x2d, 0x36, 0x30, 0x30, - 0x31, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x21, - 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, - 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, 0x72, 0x6f, - 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, 0x2f, 0x61, - 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, - 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, - 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x62, - 0x72, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, - 0x22, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, - 0x73, 0x73, 0x65, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x62, - 0x72, 0x3e, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, - 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; - -const struct httpd_fsdata_file file_404_html[] = {{NULL, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}}; - -const struct httpd_fsdata_file file_index_html[] = {{file_404_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}}; - -#define HTTPD_FS_ROOT file_index_html - -#define HTTPD_FS_NUMFILES 2 diff --git a/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h b/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h deleted file mode 100644 index 5d27e299d..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd-fsdata.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2001, 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. 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 file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ -#ifndef __HTTPD_FSDATA_H__ -#define __HTTPD_FSDATA_H__ - -#include "contiki-net.h" - -struct httpd_fsdata_file { - const struct httpd_fsdata_file *next; - const char *name; - const char *data; - const int len; -#ifdef HTTPD_FS_STATISTICS -#if HTTPD_FS_STATISTICS == 1 - uint16_t count; -#endif /* HTTPD_FS_STATISTICS */ -#endif /* HTTPD_FS_STATISTICS */ -}; - -struct httpd_fsdata_file_noconst { - struct httpd_fsdata_file *next; - char *name; - char *data; - int len; -#ifdef HTTPD_FS_STATISTICS -#if HTTPD_FS_STATISTICS == 1 - uint16_t count; -#endif /* HTTPD_FS_STATISTICS */ -#endif /* HTTPD_FS_STATISTICS */ -}; - -#endif /* __HTTPD_FSDATA_H__ */ diff --git a/platform/pc-6001/apps/webserver-mini/httpd.c b/platform/pc-6001/apps/webserver-mini/httpd.c deleted file mode 100644 index c9058b2a9..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * 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. - * - * 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 file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - */ - -#include - -#include "contiki-net.h" - -#include "webserver-nogui.h" -#include "httpd-fs.h" -#include "httpd-cgi.h" -#include "http-strings.h" - -#include "httpd.h" -#include "ctk/libconio_arch-small.h" - -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 - -#define SEND_STRING(s, str) PSOCK_SEND(s, str, (unsigned int)strlen(str)) -MEMB(conns, struct httpd_state, 4); - -#define ISO_nl 0x0a -#define ISO_space 0x20 -#define ISO_bang 0x21 -#define ISO_percent 0x25 -#define ISO_period 0x2e -#define ISO_slash 0x2f -#define ISO_colon 0x3a - -/*---------------------------------------------------------------------------*/ -static unsigned short -generate(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(s->file.len > uip_mss()) { - s->len = uip_mss(); - } else { - s->len = s->file.len; - } - memcpy(uip_appdata, s->file.data, s->len); - - return s->len; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_file(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sout); - - do { - PSOCK_GENERATOR_SEND(&s->sout, generate, s); - s->file.len -= s->len; - s->file.data += s->len; - } while(s->file.len > 0); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_part_of_file(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sout); - - PSOCK_SEND(&s->sout, s->file.data, s->len); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -#if HTTPD_CONF_SCRIPT -static void -next_scriptstate(struct httpd_state *s) -{ - char *p; - - if((p = strchr(s->scriptptr, ISO_nl)) != NULL) { - p += 1; - s->scriptlen -= (unsigned short)(p - s->scriptptr); - s->scriptptr = p; - } else { - s->scriptlen = 0; - } - /* char *p; - p = strchr(s->scriptptr, ISO_nl) + 1; - s->scriptlen -= (unsigned short)(p - s->scriptptr); - s->scriptptr = p;*/ -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_script(struct httpd_state *s)) -{ - char *ptr; - - PT_BEGIN(&s->scriptpt); - - while(s->file.len > 0) { - - /* Check if we should start executing a script. */ - if(*s->file.data == ISO_percent && - *(s->file.data + 1) == ISO_bang) { - s->scriptptr = s->file.data + 3; - s->scriptlen = s->file.len - 3; - if(*(s->scriptptr - 1) == ISO_colon) { - httpd_fs_open(s->scriptptr + 1, &s->file); - PT_WAIT_THREAD(&s->scriptpt, send_file(s)); -#if HTTPD_CONF_CGI - } else { - PT_WAIT_THREAD(&s->scriptpt, - httpd_cgi(s->scriptptr)(s, s->scriptptr)); -#endif /* HTTPD_CONF_CGI */ - } - next_scriptstate(s); - - /* The script is over, so we reset the pointers and continue - sending the rest of the file. */ - s->file.data = s->scriptptr; - s->file.len = s->scriptlen; - } else { - /* See if we find the start of script marker in the block of HTML - to be sent. */ - - if(s->file.len > uip_mss()) { - s->len = uip_mss(); - } else { - s->len = s->file.len; - } - - if(*s->file.data == ISO_percent) { - ptr = strchr(s->file.data + 1, ISO_percent); - } else { - ptr = strchr(s->file.data, ISO_percent); - } - if(ptr != NULL && - ptr != s->file.data) { - s->len = (int)(ptr - s->file.data); - if(s->len >= uip_mss()) { - s->len = uip_mss(); - } - } - PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s)); - s->file.data += s->len; - s->file.len -= s->len; - } - } - - PT_END(&s->scriptpt); -} -#endif /* HTTPD_CONF_SCRIPT */ -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) -{ - char *ptr; - - PSOCK_BEGIN(&s->sout); - - SEND_STRING(&s->sout, statushdr); - - ptr = strrchr(s->filename, ISO_period); - if(ptr == NULL) { - SEND_STRING(&s->sout, http_content_type_binary); - } else if(strncmp(http_html, ptr, 5) == 0 || - strncmp(http_shtml, ptr, 6) == 0) { - SEND_STRING(&s->sout, http_content_type_html); -#if 0 - } else if(strncmp(http_css, ptr, 4) == 0) { - SEND_STRING(&s->sout, http_content_type_css); - } else if(strncmp(http_png, ptr, 4) == 0) { - SEND_STRING(&s->sout, http_content_type_png); - } else if(strncmp(http_gif, ptr, 4) == 0) { - SEND_STRING(&s->sout, http_content_type_gif); - } else if(strncmp(http_jpg, ptr, 4) == 0) { - SEND_STRING(&s->sout, http_content_type_jpg); -#endif - } else { - SEND_STRING(&s->sout, http_content_type_plain); - } - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - char *ptr; - - PT_BEGIN(&s->outputpt); - - if(!httpd_fs_open(s->filename, &s->file)) { - httpd_fs_open(http_404_html, &s->file); - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, - http_header_404)); - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, - http_header_200)); - ptr = strchr(s->filename, ISO_period); -#if HTTPD_CONF_SCRIPT - if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) { - PT_INIT(&s->scriptpt); - PT_WAIT_THREAD(&s->outputpt, handle_script(s)); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); - } -#else /* HTTPD_CONF_SCRIPT */ - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); -#endif /* HTTPD_CONF_SCRIPT */ - } - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); - - PSOCK_READTO(&s->sin, ISO_space); - - if(strncmp(s->inputbuf, http_get, 4) != 0) { - PSOCK_CLOSE_EXIT(&s->sin); - } - PSOCK_READTO(&s->sin, ISO_space); - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - - if(s->inputbuf[1] == ISO_space) { - strncpy(s->filename, http_index_html, sizeof(s->filename)); - } else { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename)); - } - - libputs_arch(s->filename); - - s->state = STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, ISO_nl); - - if(strncmp(s->inputbuf, http_referer, 8) == 0) { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; - } - } - - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_appcall(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - memb_free(&conns, s); - } - } else if(uip_connected()) { - s = (struct httpd_state *)memb_alloc(&conns); - if(s == NULL) { - uip_abort(); - return; - } - tcp_markconn(uip_conn, s); - PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - s->state = STATE_WAITING; - /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ - s->timer = 0; - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - ++s->timer; - if(s->timer >= 20) { - uip_abort(); - memb_free(&conns, s); - } - } else { - s->timer = 0; - } - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_init(void) -{ - tcp_listen(UIP_HTONS(80)); - memb_init(&conns); -#if HTTPD_CONF_CGI - httpd_cgi_init(); -#endif /* HTTPD_CONF_CGI */ -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/webserver-mini/httpd.h b/platform/pc-6001/apps/webserver-mini/httpd.h deleted file mode 100644 index 68d5e6fc6..000000000 --- a/platform/pc-6001/apps/webserver-mini/httpd.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2001-2005, Adam Dunkels. - * 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 uIP TCP/IP stack. - * - * - */ - -#ifndef __HTTPD_H__ -#define __HTTPD_H__ - - -#include "contiki-net.h" -#include "httpd-fs.h" - -#ifndef HTTPD_CONF_CGI -#define HTTPD_CONF_CGI 1 -#endif -#ifndef HTTPD_CONF_SCRIPT -#define HTTPD_CONF_SCRIPT 1 -#endif - -struct httpd_state { - unsigned char timer; - struct psock sin, sout; - struct pt outputpt -#if HTTPD_CONF_SCRIPT - , scriptpt; -#else - ; -#endif /* HTTPD_CONF_SCRIPT */ - char inputbuf[50]; - char filename[20]; - char state; - struct httpd_fs_file file; - int len; -#if HTTPD_CONF_SCRIPT - char *scriptptr; - int scriptlen; -#endif /* HTTPD_CONF_SCRIPT */ - union { - unsigned short count; - void *ptr; - } u; -}; - - -void httpd_init(void); -void httpd_appcall(void *state); - -#endif /* __HTTPD_H__ */ diff --git a/platform/pc-6001/apps/webserver-mini/webserver-nogui.c b/platform/pc-6001/apps/webserver-mini/webserver-nogui.c deleted file mode 100644 index b8c9df139..000000000 --- a/platform/pc-6001/apps/webserver-mini/webserver-nogui.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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 Contiki OS. - * - * - */ - -#include -#include - -#include "contiki.h" - -#include "http-strings.h" -#include "webserver-nogui.h" -#include "httpd.h" - -PROCESS(webserver_nogui_process, "Web server"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(webserver_nogui_process, ev, data) -{ - PROCESS_BEGIN(); - - httpd_init(); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - httpd_appcall(data); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/apps/webserver-mini/webserver-nogui.h b/platform/pc-6001/apps/webserver-mini/webserver-nogui.h deleted file mode 100644 index 551800615..000000000 --- a/platform/pc-6001/apps/webserver-mini/webserver-nogui.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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 Contiki OS - * - * - */ -#ifndef __WEBSERVER_NOGUI_H__ -#define __WEBSERVER_NOGUI_H__ - -#include "contiki-net.h" - -PROCESS_NAME(webserver_nogui_process); - -#ifdef WEBSERVER_CONF_LOG_ENABLED -#define webserver_log(msg) webserver_log(msg) -#define webserver_log_file(requester, file) \ - webserver_log_file(requester, file) -void weblog_message(char *msg); -#else /* WEBSERVER_CONF_LOG_ENABLED */ -void weblog_message(char *msg); -#define webserver_log(msg) -#define webserver_log_file(requester, file) -#endif /* WEBSERVER_CONF_LOG_ENABLED */ - -#endif /* __WEBSERVER_H__ */ diff --git a/platform/pc-6001/contiki-client-main.c b/platform/pc-6001/contiki-client-main.c deleted file mode 100644 index ae09e9196..000000000 --- a/platform/pc-6001/contiki-client-main.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a sample main file with slip network. - * \author - * Takahide Matsutsuka - */ - -//#define WITH_LOADER_ARCH 1 - -#include "contiki.h" - -/* devices */ -#include "net/uip.h" -#include "net/uip-fw-drv.h" -#include "dev/slip.h" -#include "dev/rs232.h" -#include "sys/process.h" - -/* desktop programs */ -#include "program-handler.h" -//#include "process-list-dsc.h" - -/* network programs */ -#include "netconf-dsc.h" -#include "www-dsc.h" -#include "telnet-dsc.h" -//#include "dhcp-dsc.h" -#include "email-dsc.h" -#include "ftp-dsc.h" -#include "irc-dsc.h" - - -/*---------------------------------------------------------------------------*/ -/* inteface */ -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(0, 0, 0, 0, 0, 0, 0, 0, slip_send)}; - -/* ip address of contiki */ -const uip_ipaddr_t hostaddr = { { 10, 0, 1, 10 } }; - -PROCESS_NAME(netconf_process); -PROCESS_NAME(email_process); -PROCESS_NAME(www_process); -PROCESS_NAME(simpletelnet_process); -PROCESS_NAME(ftp_process); -PROCESS_NAME(irc_process); - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - /* initialize process manager. */ - process_init(); - - uip_init(); - uip_sethostaddr(&hostaddr); - uip_fw_default(&slipif); - - /* start services */ - process_start(&etimer_process, NULL); - process_start(&ctk_process, NULL); -// process_start(&program_handler_process, NULL); - process_start(&tcpip_process, NULL); - process_start(&slip_process, NULL); - process_start(&uip_fw_process, NULL); - process_start(&rs232_process, NULL); - -// process_start(&email_process, NULL); -// process_start(&www_process, NULL); -// process_start(&ftp_process, NULL); -// process_start(&irc_process, NULL); - -// process_start(&netconf_process, NULL); - process_start(&simpletelnet_process, NULL); - -#if 0 - /* register programs to the program handler */ - program_handler_add(&processes_dsc, "Processes", 1); - program_handler_add(&netconf_dsc, "Network conf", 1); - program_handler_add(&email_dsc, "E-mail", 1); - program_handler_add(&irc_dsc, "IRC", 1); - program_handler_add(&vnc_dsc, "VNC client", 1); - program_handler_add(&dhcp_dsc, "DHCP client", 1); -#endif - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/contiki-conf.h b/platform/pc-6001/contiki-conf.h deleted file mode 100644 index 8f20e2c5e..000000000 --- a/platform/pc-6001/contiki-conf.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * contiki-conf.h - * A set of configurations of contiki for PC-6001 family. - * \author - * Takahide Matsutsuka - */ - -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#include "z80def.h" -#include "sys/cc.h" -#include -#include -#include "ctk/ctk_arch.h" -#include "strcasecmp.h" -#include "log.h" - -/* Time type. */ -typedef unsigned long clock_time_t; - -/* Defines tick counts for a second. */ -#define CLOCK_CONF_SECOND 1024 - -#define rtimer_arch_now() clock_time() - -/* Memory filesystem RAM size. */ -#define CFS_RAM_CONF_SIZE 512 - -/* Logging.. */ -#define LOG_CONF_ENABLED 0 - -#undef MALLOC_TEST - -/*---------------------------------------------------------------------------*/ -/* screen properties */ -#define LIBCONIO_CONF_ATTRIBUTES_ENABLED -#if defined(ARCH_PC6001MK2) -#define LIBCONIO_VRAM_ATTR 0x4000 -#define LIBCONIO_VRAM_CHAR 0x4400 -#define LIBCONIO_CONF_SCREEN_WIDTH 40 -#define LIBCONIO_CONF_SCREEN_HEIGHT 20 -#define LIBCONIO_COLOR_NORMAL 0x0f -#define LIBCONIO_COLOR_REVERSED 0x70 -#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && defined(MEMORY_16K) -#define LIBCONIO_VRAM_ATTR 0xc000 -#define LIBCONIO_VRAM_CHAR 0xc200 -#define LIBCONIO_CONF_SCREEN_WIDTH 32 -#define LIBCONIO_CONF_SCREEN_HEIGHT 16 -#define LIBCONIO_COLOR_NORMAL 0x20 -#define LIBCONIO_COLOR_REVERSED 0x21 -#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && (defined(MEMORY_32K) || defined(MEMORY_ROM)) -#define LIBCONIO_VRAM_ATTR 0x8000 -#define LIBCONIO_VRAM_CHAR 0x8200 -#define LIBCONIO_CONF_SCREEN_WIDTH 32 -#define LIBCONIO_CONF_SCREEN_HEIGHT 16 -#define LIBCONIO_COLOR_NORMAL 0x20 -#define LIBCONIO_COLOR_REVERSED 0x21 -#else -#error Specify appropriate ARCH & MEMORY combination -#endif /* ARCH_PC6001MK2 */ - -#if 0 /* ctk-conio case */ -#define SCREENCOLOR 0x20 -#define BORDERCOLOR 0x20 -#define WIDGETCOLOR 0x20 -#define WIDGETCOLOR_FWIN 0x20 -#define BACKGROUNDCOLOR 0x20 -#define DIALOGCOLOR 0x20 -#define WINDOWCOLOR 0x20 -#define WINDOWCOLOR_FOCUS 0x21 -#define MENUCOLOR 0x21 -#define MENUCOLOR 0x21 -#define OPENMENUCOLOR 0x22 -#define ACTIVEMENUITEMCOLOR 0x23 -#define WIDGETCOLOR_HLINK 0x21 -#define WIDGETCOLOR_FOCUS 0x20 -#define WIDGETCOLOR_DIALOG 0x22 -#endif - -/* uIP configuration */ -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 4 -#define UIP_CONF_BUFFER_SIZE 400 -#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN -#define UIP_CONF_TCP_SPLIT 0 -#define UIP_CONF_LOGGING 0 - -/* uses SLIP */ -#define UIP_CONF_UDP 0 -#define UIP_CONF_UDP_CHECKSUMS 0 -#define UIP_CONF_LLH_LEN 0 -#undef UIP_CONF_BROADCAST -#undef RS232_CONF_CALLBACK -/* #define RS232_CONF_CALLBACK serial_input_byte */ -#define slip_arch_init(ubr) rs232_arch_init(ubr) -#define slip_arch_writeb(c) rs232_arch_writeb(c) - -#ifdef WITH_LOADER_ARCH -//#define AUTOSTART_ENABLE 1 -#define LOADER_CONF_ARCH "loader_arch.h" -#endif /* WITH_LOADER_ARCH */ - -/*---------------------------------------------------------------------------*/ -/* Application specific configurations. */ - -/* Command shell */ -#define SHELL_GUI_CONF_XSIZE 26 -#define SHELL_GUI_CONF_YSIZE 10 - -/* Text editor */ -#define EDITOR_CONF_WIDTH 26 -#define EDITOR_CONF_HEIGHT 8 - -/* Process list */ -#define PROCESSLIST_CONF_HEIGHT 12 - -/* File dialog */ -#define FILES_CONF_HEIGHT 6 - -/* Shell */ -//#define SHELL_CONF_WITH_PROGRAM_HANDLER 1 - -/* Telnet */ -#define TELNET_CONF_WINDOW_WIDTH 30 -#define TELNET_CONF_WINDOW_HEIGHT 13 -//#define TELNET_CONF_TEXTAREA_HEIGHT 5 // TELNET_WINDOW_HEIGHT - 8 -//#define TELNET_CONF_ENTRY_WIDTH 22 // TELNET_WINDOW_WIDTH - 8 - -/* Telnetd */ -#define TELNETD_CONF_GUI 0 -#define SHELL_CONF_WITH_PROGRAM_HANDLER 0 - -/* Web server */ -#undef WEBSERVER_CONF_LOG_ENABLED -#define HTTPD_CONF_CGI 0 -#define HTTPD_CONF_SCRIPT 0 -#define HTTPD_CONF_STATISTICS 0 - -/* unused yet */ -#define VNC_CONF_REFRESH_ROWS 8 - -#define WWW_CONF_WEBPAGE_WIDTH 76 -#define WWW_CONF_WEBPAGE_HEIGHT 30 - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/pc-6001/contiki-desktop-main.c b/platform/pc-6001/contiki-desktop-main.c deleted file mode 100644 index 5389e3d96..000000000 --- a/platform/pc-6001/contiki-desktop-main.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a sample main file with desktop. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" - -#include "program-handler.h" -#include "about-dsc.h" -#include "calc-dsc.h" -#include "process-list-dsc.h" -#include "shell-dsc.h" -#include "mt-test-dsc.h" - -#if WITH_LOADER_ARCH -#include "directory-dsc.h" -#endif - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - /* initialize process manager. */ - process_init(); - - /* start services */ - process_start(&ctk_process, NULL); - process_start(&program_handler_process, NULL); - process_start(&etimer_process, NULL); - - /* register programs to the program handler */ -#if WITH_LOADER_ARCH - program_handler_add(&directory_dsc, "Directory", 1); - program_handler_add(&processes_dsc, "Processes", 1); - // program_handler_add(&shell_dsc, "Command shell", 1); -#else - program_handler_add(&processes_dsc, "Processes", 1); - program_handler_add(&mttest_dsc, "Multithread", 1); - program_handler_add(&calc_dsc, "Calculator", 1); - program_handler_add(&about_dsc, "About", 1); -// program_handler_add(&shell_dsc, "Command shell", 1); -#endif - - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/contiki-loader-main.c b/platform/pc-6001/contiki-loader-main.c deleted file mode 100644 index 90ff4df76..000000000 --- a/platform/pc-6001/contiki-loader-main.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a main file with loader. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" - -#include "program-handler.h" -//#include "process-list-dsc.h" -//#include "shell-dsc.h" -//#include "directory-dsc.h" - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - /* initialize process manager. */ - process_init(); - - /* start services */ - process_start(&ctk_process, NULL); - process_start(&program_handler_process, NULL); - process_start(&etimer_process, NULL); - - /* register programs to the program handler */ - /* - program_handler_add(&directory_dsc, "Directory", 1); - program_handler_add(&processes_dsc, "Processes", 1); - program_handler_add(&shell_dsc, "Command shell", 1); - */ - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/contiki-main.c b/platform/pc-6001/contiki-main.c deleted file mode 100644 index 1505d9a5a..000000000 --- a/platform/pc-6001/contiki-main.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a main file for standard configuration. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" -#include "ctk/ctk.h" - -#ifndef WITHOUT_GUI -#define CTK_PROCESS &ctk_process, -#else /* WITH_GUI */ -#define CTK_PROCESS -#endif /* WITH_GUI */ - -PROCINIT(CTK_PROCESS - &etimer_process); - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - /* initialize process manager. */ - process_init(); - autostart_start(autostart_processes); - - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/contiki-minimal-main.c b/platform/pc-6001/contiki-minimal-main.c deleted file mode 100644 index 4fa3daa2f..000000000 --- a/platform/pc-6001/contiki-minimal-main.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a minimal main file with desktop. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" - -#include "program-handler.h" -#include "tinysample-dsc.h" - -PROCESS_NAME(tiny_process); -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - /* initialize process manager. */ - process_init(); - - /* start services */ -// process_start(&ctk_process, NULL); -// process_start(&program_handler_process, NULL); - process_start(&etimer_process, NULL); - process_start(&tiny_process, NULL); - -// program_handler_add(&tiny_dsc, "Tiny", 1); - - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/contiki-serial-main.c b/platform/pc-6001/contiki-serial-main.c deleted file mode 100644 index 0bb64b248..000000000 --- a/platform/pc-6001/contiki-serial-main.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a sample main file with serial. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" - -/* devices */ -#include "dev/serial-line.h" -#include "ctk/libconio_arch-small.h" - -#undef RS232_INTR -#ifdef RS232_INTR -void rs232_arch_writeb(uint8_t ch); -void rs232_arch_init(int (* callback)(unsigned char), unsigned long ubr); -#else -#include "dev/rs232.h" -#endif - -PROCESS(stest_process, "Serial test process"); -/*---------------------------------------------------------------------------*/ -static void -rs232_print(char* str) { - while (*str != 0) { - rs232_arch_writeb(*str++); - } -} -/*---------------------------------------------------------------------------*/ -static void -log(char* str) { - while (*str != 0) { - libputc_arch(*str++); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(stest_process, ev, data) -{ - static struct etimer timer; - PROCESS_BEGIN(); - - clrscr_arch(); -#ifdef RS232_INTR - rs232_arch_init(serial_line_input_byte, 0); -#endif - - etimer_set(&timer, CLOCK_SECOND); - - log("Starting serial test process"); - while(1) { - PROCESS_WAIT_EVENT(); - - if (etimer_expired(&timer)) { - log("Sending serial data now"); - rs232_print("GNU's not Unix\n"); - etimer_reset(&timer); - } - - if(ev == serial_line_event_message) { - log(data); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -main(void) -{ - /* initialize process manager. */ - process_init(); - - /* start services */ - process_start(&etimer_process, NULL); - process_start(&serial_line_process, NULL); -#ifndef RS232_INTR - process_start(&rs232_process, NULL); -#endif - process_start(&stest_process, NULL); - - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/contiki-server-main.c b/platform/pc-6001/contiki-server-main.c deleted file mode 100644 index 3a53667bb..000000000 --- a/platform/pc-6001/contiki-server-main.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is a sample main file with slip network. - * \author - * Takahide Matsutsuka - */ - -#include "contiki.h" - -/* devices */ -#include "uip.h" -#include "dev/slip.h" -#include "dev/rs232.h" - -/* network server programs */ -#include "webserver-nogui.h" -#include "cmdd.h" -#include "telnetd.h" -#include "ctk/libconio_arch-small.h" - -/*---------------------------------------------------------------------------*/ -/* inteface */ -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(0, 0, 0, 0, 0, 0, 0, 0, slip_send)}; - -/* ip address of contiki */ -const uip_ipaddr_t hostaddr = { { 10, 0, 1, 10 } }; - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - /* initialize process manager. */ - process_init(); - - clrscr_arch(); - uip_init(); - uip_sethostaddr(&hostaddr); - uip_fw_default(&slipif); - - /* start services */ - process_start(&etimer_process, NULL); - process_start(&tcpip_process, NULL); - process_start(&slip_process, NULL); - process_start(&uip_fw_process, NULL); - process_start(&rs232_process, NULL); - - process_start(&webserver_nogui_process, NULL); -// process_start(&cmdd_process, NULL); -// process_start(&telnetd_process, NULL); - - while(1) { - process_run(); - etimer_request_poll(); - } -} diff --git a/platform/pc-6001/ctk/ctk-conio_arch-asm.cS b/platform/pc-6001/ctk/ctk-conio_arch-asm.cS deleted file mode 100644 index f954c7f5c..000000000 --- a/platform/pc-6001/ctk/ctk-conio_arch-asm.cS +++ /dev/null @@ -1,1175 +0,0 @@ -;;; -;;; -;;; ctk-conio_arch-asm.hS -;;; -;;; Architecture depend ctk-conio implementation. -;;; This assembler source contributes saving speed and memory. -;;; -;;; @author Takahide Matsutsuka -;;; -;;; $Id: ctk-conio_arch-asm.cS,v 1.3 2009/12/11 15:00:38 matsutsuka Exp $ -;;; - - ;; uses preprocessor to enable definitions -#include "ctk_arch-def.h" - - ;; export symbols - .globl _ctk_draw_init - .globl _ctk_draw_clear - .globl _ctk_draw_clear_window - .globl _ctk_draw_window - .globl _ctk_draw_dialog - .globl _ctk_draw_widget - .globl _ctk_draw_windowtitle_height -.if CTK_CONF_MENUS - .globl _ctk_draw_menus -.endif - .globl _ctk_draw_width - .globl _ctk_draw_height - - ;; import symbols - .globl _wherex_arch - .globl _wherey_arch - - .globl _cputc_arch_asm - .globl _cputs_arch_asm - .globl _cputsn_arch_asm - .globl _clip_arch_asm - .globl _clearto_arch_asm - .globl _revers_arch_asm - .globl _chline_arch_asm - .globl _cvline_arch_asm - .globl _gotoxy_arch_asm - - ;; offsets - .globl _off_window_x - .globl _off_window_y - .globl _off_window_h - .globl _off_window_w - .globl _off_window_inactive - .globl _off_window_active - .globl _off_window_next - .globl _off_window_focused - - .globl _off_widget_x - .globl _off_widget_y - .globl _off_widget_w - .globl _off_widget_h - .globl _off_widget_type - .globl _off_widget_window - .globl _off_widget_label_text - .globl _off_widget_button_text - .globl _off_widget_textentry_text - .globl _off_widget_textentry_xpos - .globl _off_widget_textentry_ypos - .globl _off_widget_textentry_state -.if CTK_CONF_HYPERLINK - .globl _off_widget_hyperlink_text -.endif -.if CTK_CONF_ICONS - .globl _off_widget_icon_title - .globl _off_widget_icon_textmap -.endif -.if CTK_CONF_MENUS - .globl _off_menu_title - .globl _off_menu_active - .globl _off_menu_nitems - .globl _off_menu_items - .globl _off_menu_next - .globl _off_menuitem_title - .globl _size_menuitem - .globl _off_menus_open - .globl _off_menus_menus - .globl _off_menus_desktopmenu -.endif - - .area _DATA - - .area _CODE -_ctk_draw_windowtitle_height: - .db 1 - -_ctk_conio_arch_asm_start:: - ;; --------------------------------- - ;; void ctk_draw_init(void) - ;; Stack; retl reth - ;; _F____HL____ AFBCDEHL____ - ;; return void - ;; --------------------------------- -_ctk_draw_init: - xor a - call _revers_arch_asm - ld h, #SCREEN_HEIGHT - ld l, #0 - jr _ctk_draw_clear_asm - - ;; --------------------------------- - ;; ctk_draw_clear(unsigned char clipy1, unsigned char clipy2); - ;; Stack; retl reth clipy1 clipy2 - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_ctk_draw_clear: - ld hl, #2 - add hl, sp - ld e, (hl) ; clipy1 - inc hl - ld d, (hl) ; clipy2 - ;; E = clip1, D = clip2 - ex de, hl -_ctk_draw_clear_asm: - call _clip_arch_asm - ld a, h - sub l ; A = clipy2 - clipy1 - ld b, a ; height - ld c, #SCREEN_WIDTH ; width - ld d, l ; y - ld e, #0 ; x - call _clearbox_arch_asm - ret - -_get_offset: - ;; BC = offset address - ;; HL = base address - ;; return DE = data - ;; ___DE______ - push af - push hl - ld a, (bc) - add a, l - ld l, a - ld a, h - adc #0 - ld h, a - ld e, (hl) - inc hl - ld d, (hl) - pop hl - pop af - ret - - ;; --------------------------------- - ;; ctk_draw_clear_window(struct ctk_window *window, - ;; unsigned char focus, - ;; unsigned char clipy1, - ;; unsigned char clipy2) - ;; Stack; retl reth winl winh focus clipy1 clipy2 - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_ctk_draw_clear_window: - ;; clip_arch(clipy1, clipy2); - ld hl, #5 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - ex de, hl - call _clip_arch_asm - ;; clearbox_arch(window->x + 1, window->y + 2, window->w, window->h); - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - ld h, d - ld l, e ; HL = window - - ld bc, #_off_window_h - call _get_offset - ld d, e ; D = window->h - ld bc, #_off_window_w - call _get_offset ; E = window->w - push de - ld bc, #_off_window_y - call _get_offset ; E = window->y - ld a, e - inc a - inc a - ld bc, #_off_window_x - call _get_offset ; E = window->x - inc e - ld d, a ; D = window->y + 2, E = window->x + 1 - pop bc ; B = h, C = w - call _clearbox_arch_asm - ret - - ;; --------------------------------- - ;; void ctk_draw_dialog(struct ctk_window *dialog) - ;; Stack; retl reth dialogl dialogh - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_ctk_draw_dialog: - ;; ctk_draw_clear_window(dialog, 0, 0, SCREEN_HEIGHT) - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - ld h, #SCREEN_HEIGHT - ld l, #0 - push hl - xor a - push af - inc sp - push de - call _ctk_draw_clear_window - pop de - inc sp - pop hl - - ;; draw_window_asm(dialog, CTK_FOCUS_DIALOG) - ld a, #_CTK_FOCUS_DIALOG - call _draw_window_asm - ret - - ;; --------------------------------- - ;; void ctk_draw_window(struct ctk_window *window, unsigned char focus, - ;; unsigned char clipy1, unsigned char clipy2, - ;; unsigned char draw_borders) - ;; Stack; retl reth winl winh focus cy1 cy2 borders - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_ctk_draw_window: - ;; clip_arch(clipy1, clipy2); - ld hl, #5 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - ex de, hl - call _clip_arch_asm - - ;; DE = window - ;; A = focus = focus & CTK_FOCUS_WINDOW - ;; draw_window_asm(window, focus); - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld a, (hl) - and a, #_CTK_FOCUS_WINDOW - call _draw_window_asm - ret - - ;; --------------------------------- - ;; void draw_window_asm - ;; (struct ctk_window *window, unsigned char focus) - ;; DE = window, A = focus - ;; Stack; retl reth - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_draw_window_asm: - ;; drawbox_asm(window->x, window->y + 1, window->w, window->h); - push af ; focus - ld h, d - ld l, e ; HL = window - ld bc, #_off_window_h - call _get_offset - ld a, e - ld bc, #_off_window_w - call _get_offset - ld d, a - push de ; D = window->h, E = window->w - ld bc, #_off_window_y - call _get_offset - ld a, e - inc a - ld bc, #_off_window_x - call _get_offset - ld d, a ; D = window->y + 1, E = window->x - pop bc ; B = h, C = w, HL = window - call _drawbox_asm - inc d ; D = y = window->y + 2 - inc e ; E = x = window->x + 1 - push de ; Stack; yx focus - - ;; for(w = window->inactive; w != NULL; w = w->next) { - ld bc, #_off_window_inactive - call _get_offset ; DE = w = window->inactive - pop bc ; yx - pop af ; focus - push hl - ;; de = widget, bc = yx, a = focus, hl = window; Stack; window -_ctk_draw_window_asm_loop1: ; draw inactive widgets - ;; HL = e4cd - push af ; Stack; focus window - ld a, d - or e - jr z, _draw_window_asm_next1 ; if (DE == NULL) - pop af ; A = focus, Stack; window - ;; bc = yx, de = w, a = focus - ;; draw_widget(w, x, y, focus); - call _draw_widget_asm - push bc ; Stack; BC=xy HL=window - ld h, d - ld l, e ; HL = w - ld bc, #_off_window_next - call _get_offset ; DE = window->next - pop bc ; bc = yx, Stack; window - jr _ctk_draw_window_asm_loop1 - ;; for(w = window->active; w != NULL; w = w->next) - ;; HL = window, BC = xy, A = focus; Stack; focus -_draw_window_asm_next1: ; Stack; focus window - pop af ; A = focus - pop hl ; HL = window; Stack null - push bc ; Stack yx - ;; calc window->focused - ld bc, #_off_window_focused - call _get_offset ; DE = window->focused - push de ; Stack focused yx - ld bc, #_off_window_active - call _get_offset ; DE = window->active - pop hl ; HL = window->focused, Stack; yx - pop bc ; BC = yx, Stack; null - push af ; Stack; focus - push hl ; Stack; focused focus - - ;; BC = yx, DE = widget, Stack; focused focus -_ctk_draw_window_asm_loop2: ; draw active widgets - ld a, d ; DE = w - or e - jr z, _draw_window_asm_next2 - ;; if (w == window->focused) focus |= CTK_FOCUS_WIDGET; - pop hl ; HL = window->focused; Stack focus - ld a, h - cp d - jr nz, _draw_window_asm_nofocus - ld a, l - cp e - jr nz, _draw_window_asm_nofocus - pop af - push af - or a, #_CTK_FOCUS_WIDGET - jr _draw_window_asm_draw -_draw_window_asm_nofocus: - pop af - push af - ;; A = wfocus, BC = yx de = widget hl = focused -_draw_window_asm_draw: ; Stack; focus - ;; draw_widget(w, posx, posy, wfocus); - call _draw_widget_asm - - push hl ; Stack; focused focus - push bc ; Stack; yx focused focus - ld h, d - ld l, e - ld bc, #_off_window_next - call _get_offset ; DE = w->next - pop bc ; BC = yx, Stack; focused focus - jr _ctk_draw_window_asm_loop2 -_draw_window_asm_next2: ; Stack; focused focus - pop hl - pop af - ret - - - ;; --------------------------------- - ;; ctk_draw_widget(struct ctk_widget *w, - ;; unsigned char focus, - ;; unsigned char clipy1, - ;; unsigned char clipy2); - ;; Stack; retl reth wl wh focus clipy1 clipy2 - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_ctk_draw_widget: - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) ; DE = widget - inc hl - ld a, (hl) ; A = focus - inc hl - ld c, (hl) ; clipy1 - inc hl - ld b, (hl) ; clipy2 - push af ; focus - ld h, b - ld l, c - call _clip_arch_asm - push de ; Stack; widget focus - ex de, hl ; HL = widget - ld bc, #_off_widget_window - call _get_offset - ex de, hl ; HL = window - ld bc, #_off_window_focused - call _get_offset ; DE = focused - pop bc ; pop widget, Stack focus - ld a, b ; compare DE(fucosed) and BC(widget) - sub d - jr nz, _ctk_draw_widget_nofocus - ld a, c - sub e - jr nz, _ctk_draw_widget_nofocus - pop af - or a, #_CTK_FOCUS_WIDGET - push af -_ctk_draw_widget_nofocus: - push bc ; widget, Stack widget focus - ld bc, #_off_window_x - call _get_offset - inc e - ld c, e - push bc - ld bc, #_off_window_y - call _get_offset - inc e - inc e - pop bc - ld b, e ; yx - pop de ; widget - pop af ; focus - ;; FALL THROUGH - - ;; --------------------------------- - ;; static void draw_widget_asm(struct ctk_widget *w, - ;; unsigned char x, unsigned char y, - ;; unsigned char focus) - ;; Stack; retl reth - ;; in; A = focus, BC = yx, DE = widget - ;; ____________ - ;; return void - ;; --------------------------------- -_draw_widget_asm: - push hl - push de - push bc - push af - - push de ; Stack; w - ld h, d - ld l, e - push af - push bc ; Stack; xy, focus, w - ld bc, #_off_widget_x - call _get_offset - ld a, e - pop bc ; Stack; focus w - add c - ld c, a - push bc - ld bc, #_off_widget_y - call _get_offset - ld a, e - pop bc ; Stack; focus, w - add b - ld b, a ; B = ypos, C = xpos - pop af - and a, #_CTK_FOCUS_WIDGET - call _revers_arch_asm - ld h, b - ld l, c - call _gotoxy_arch_asm - pop hl ; Stack; null, HL = w - push hl - push bc - ld bc, #_off_widget_type - call _get_offset - ld a, e ; A = type - ld bc, #_off_widget_w - call _get_offset ; E = w->w; - pop bc ; B = ypos, C = xpos - pop hl ; HL = w - cp a, #_CTK_WIDGET_SEPARATOR - jp z, _draw_widget_separator - cp a, #_CTK_WIDGET_LABEL - jp z, _draw_widget_label - cp a, #_CTK_WIDGET_BUTTON - jp z, _draw_widget_button -.if CTK_CONF_HYPERLINK - cp a, #_CTK_WIDGET_HYPERLINK - jp z, _draw_widget_hyperlink -.endif - cp a, #_CTK_WIDGET_TEXTENTRY - jp z, _draw_widget_textentry -.if CTK_CONF_ICONS - cp a, #_CTK_WIDGET_ICON - jp z, _draw_widget_icon -.endif -_draw_widget_ret: - xor a - call _revers_arch_asm - - pop af - pop bc - pop de - pop hl - ret - ;; BC = ypos, xpos, HL = w, E = w->w, Stack; null -_draw_widget_separator: - ld b, e - call _chline_arch_asm - jr _draw_widget_ret - ;; BC = ypos, xpos, HL = w, E = w->w, Stack; null -_draw_widget_label: - ld a, e - push bc - push hl - ld bc, #_off_widget_h - call _get_offset ; E = h - ld h, e - ld l, a ; H = h, L = w->w - ex (sp), hl ; Stack; H = h, L = w->w; HL = w - ld bc, #_off_widget_label_text - call _get_offset ; DE = text - pop hl ; Stack; yx; H = h, L = w->w - pop bc ; BC = yx -_draw_widget_label_loop: - ld a, h - or a - jr z, _draw_widget_ret - - ;; BC = ypos, xpos, H = h, L = w->w, DE = text - push hl ; Stack; hw - ld h, b - ld l, c - call _gotoxy_arch_asm - pop hl - ;; cputsn_arch(text, w->w); - push hl - push bc - push de ; Stack; text yx hw - ld b, l - call _cputsn_arch_asm ; DE = text - pop de - pop bc - pop hl ; Stack; null - ;; clearto_arch(xpos + w->w); - ld a, c - add a, l - push hl - push de - push bc - call _clearto_arch_asm - pop bc - pop de - pop hl - ;; ++ypos; - inc b - ;; text += w->w; - ld a, e - add a, l - ld e, a - ld a, d - adc a, #0 - ld d, a - - dec h - jr _draw_widget_label_loop - - ;; BC = ypos, xpos, HL = w, E = w->w, Stack; null -_draw_widget_button: - push hl ; w - push de ; w->w - ld a, #0x5b ; '[' - call _cputc_arch_asm - pop de - pop hl - ld a, e - ld bc, #_off_widget_button_text - call _get_offset - ld b, a - call _cputsn_arch_asm - ld a, #0x5d ; ']' - call _cputc_arch_asm - jp _draw_widget_ret -.if CTK_CONF_HYPERLINK - ;; BC = ypos, xpos, HL = w, E = w->w, Stack; null -_draw_widget_hyperlink: - ld a, e - ld bc, #_off_widget_hyperlink_text - call _get_offset - ld b, a - call _cputsn_arch_asm - jp _draw_widget_ret -.endif - - ;; BC = ypos, xpos, HL = w, E = w->w, Stack; null -_draw_widget_textentry: ; 0xc5dc sp=0xf97e ;widget=e3be - ;; e3cd;textentry.xpos<-b224 - ;; stable variables; - ;; w->w, w->h, w->widget.textentry.{state,ypos,xpos), xscroll - push ix - ld ix, #-6 - add ix, sp - ld sp, ix - push bc ; yx - - ld 0(ix), e ; w->w - ld bc, #_off_widget_h - call _get_offset - ld 1(ix), e ; w->h - ld bc, #_off_widget_textentry_state - call _get_offset - ld a, e - sub a, #_CTK_TEXTENTRY_EDIT - ld 2(ix), a ; w->widget.textentry.state - ld bc, #_off_widget_textentry_ypos - call _get_offset - ld 3(ix), e ; w->widget.textentry.ypos - ld bc, #_off_widget_textentry_xpos - call _get_offset - ld 4(ix), e ; w->widget.textentry.xpos - - ;; xscroll = 0; - ;; if(w->widget.textentry.xpos >= w->w - 1) { - ;; xscroll = w->widget.textentry.xpos - w->w + 1; - ;; } - ld a, e - inc a - sub 0(ix) ; xscroll = w->widget.textentry.xpos - w->w + 1 - jr nc, _draw_widget_textentry_next - xor a ; if (xscroll < 0) xscroll = 0 -_draw_widget_textentry_next: ; A = xscroll, Stack; yx - IX - ld 5(ix), a ; xscroll - - ld bc, #_off_widget_textentry_text - call _get_offset ; DE = text - - ld l, #0 ; loop counter - pop bc - ;; L = counter, IX = sp, DE = text, BC = yx, Stack; null -_draw_widget_textentry_loop1: ; 0xc629 - ;; gotoxy_arch(xpos, ypos); - push hl ; Stack; text - ld h, b - ld l, c - call _gotoxy_arch_asm - - ;; if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - ;; w->widget.textentry.ypos == j) - pop hl ; Stack; null, BC = yx, DE = text, L = count - push bc ; Stack; yx - ld a, l - cp a, 1(ix) ; j - w->h - jp nc, _draw_widget_textentry_ret - ld a, 2(ix) ; state - or a ; state == EDIT? - jr nz, _draw_widget_textentry_else - ld a, 3(ix) ; ypos - cp a, l ; ypos == j? - jr nz, _draw_widget_textentry_else - ;; revers_arch(0); - push hl ; Stack count yx - push de ; Stack text count yx - xor a - call _revers_arch_asm - ;; cputc_arch('>'); - ld a, #0x3e ; '>' - call _cputc_arch_asm - - pop de ; Stack count yx - push de ; Stack text count yx - ld a, 5(ix) ; xscroll - add a, e - ld e, a - ld a, d - adc a, #0 - ld d, a ; DE = text[xscroll] - - ld h, #0 ; loop counter - ;; for(i = 0; i < w->w; ++i) -_draw_widget_textentry_loop2: ; 0xc39d Stack text count yx - ;; H = count2, DE = text[xscroll + i] - ld a, h - cp a, 0(ix) ; i - w->w - jr nc, _draw_widget_textentry_loop2exit - ;; revers_arch(i == w->widget.textentry.xpos - xscroll); - push hl ; Stack count2 text count1 yx - ld a, 4(ix) ; w->w.widget.textentry.xpos - sub 5(ix) ; xscroll - sub h ; textentry.xpos - xscroll- i - ld a, #00 ; flags do not change - jr nz, _draw_widget_textentry_revers - ld a, #01 -_draw_widget_textentry_revers: - call _revers_arch_asm - ;; DE = text, Stack; count2 text count1 yx - ;; cputc((c == 0) ? CH_SPACE : c); - ld a, (de) ; ch - or a - jr nz, _draw_widget_textentry_nospace - ld a, #CH_SPACE -_draw_widget_textentry_nospace: - push de - call _cputc_arch_asm - pop de - pop hl ; Stack text count1 yx, H = count2 - inc h - inc de - jr _draw_widget_textentry_loop2 -_draw_widget_textentry_loop2exit: ; Stack text count yx - xor a - call _revers_arch_asm - ld a, #0x3c ; '<' - call _cputc_arch_asm - jr _draw_widget_textentry_endif - -_draw_widget_textentry_else: ; 0xc68a DE = text, L = count1, Stack yx - ;; cputc_arch(CH_VERTLINE); - ld a, #CH_VERTLINE - push hl - push de - call _cputc_arch_asm - pop de - ;; cputsn_arch(text, w->w); - ld b, 0(ix) ; w->w - push de - call _cputsn_arch_asm - pop de ; Stack count1 yx - ;; clearto_arch(xpos + w->w + 1); - pop hl - pop bc - push bc - push hl - push de ; Stack text count yx - ld a, 0(ix) ; w->w - add a, c - inc a ; xpos + w->w + 1 - call _clearto_arch_asm - ;; cputc_arch(CH_VERTLINE); - ld a, #CH_VERTLINE - call _cputc_arch_asm -_draw_widget_textentry_endif: ; Stack text count yx - ;; text += w->w - pop de - ld a, e - add a, 0(ix) - ld e, a - ld a, d - adc a, #0 - ld d, a - - pop hl - ;; i++ - inc l - pop bc - ;; ++ypos; - inc b - jp _draw_widget_textentry_loop1 -_draw_widget_textentry_ret: - pop bc - ld hl, #6 - add hl, sp - ld sp, hl - pop ix - jp _draw_widget_ret - -.if CTK_CONF_ICONS - ;; BC = ypos, xpos, HL = w, E = w->w, Stack; null -_draw_widget_icon: - push bc ; Stack; yx - ld bc, #_off_widget_icon_title - call _get_offset - push de ; Stack; title yx - ld bc, #_off_widget_icon_textmap - call _get_offset - pop hl ; HL = title, DE = textmap - pop bc ; BC = yx - - ;; BC = yx, DE = textmap, HL = title - push hl ; Stack; title - ld h, b - ld l, c ; HL = yx - ld a, e - or d - jr z, _draw_widget_icon_title - - ;; push hl - ;; call _wherex_arch - ;; ld c, l - ;; call _wherey_arch - ;; ld b, l - ;; pop hl - - ld a, #3 ; loop counter -_draw_widget_icon_loop: ; HL = yx, DE = textmap, Stack; title - call _gotoxy_arch_asm - - push af ; Stack; loop title - push hl ; DE = textmap, Stack; yx loop title - - ld b, #3 - call _cputsn_arch_asm ; DE = DE + 3 - - pop hl - pop af ; HL = yx, A = count, Stack; title - - inc h ; y++ - dec a - jr nz, _draw_widget_icon_loop - ;; Stack; title, HL = yx -_draw_widget_icon_title: - pop de ; Stack; null, HL = yx, DE = title - push de ; Stack; title, HL = yx, DE = title - ld b, h - ld c, l ; BC = yx - ex de, hl ; BC = yx, HL = title - ld d, #0 -_draw_widget_icon_title_strlen: - ld a, (hl) - or a - jr z, _draw_widget_icon_title_setpos - inc hl - inc d - jr _draw_widget_icon_title_strlen - ;; D = len, BC = yx, Stack; title -_draw_widget_icon_title_setpos: - ld h, d ; H = len - ld a, d - add a, c ; x + len - cp a, #SCREEN_WIDTH ; x + len - SCREEN_WIDTH - jr c, _draw_widget_icon_title_show - ld a, #SCREEN_WIDTH - sub h - ld c, a - ;; B = y, C = x; H = len, Stack; title -_draw_widget_icon_title_show: - ld a, h ; A = len - ld h, b - ld l, c - call _gotoxy_arch_asm - pop de ; DE = title - ld b, a ; B = len - call _cputsn_arch_asm - jp _draw_widget_ret - -.endif - -.if CTK_CONF_MENUS - ;; --------------------------------- - ;; static void draw_menu(struct ctk_menu *m, struct ctk_menu *open) - ;; in; HL = menu, BC = open - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -_draw_menu_asm: - ;; x = wherex_arch(); - push hl - call _wherex_arch ; A = x - pop hl - push af - ;; cputs_arch(m->title); - push bc - ld bc, #_off_menu_title - call _get_offset ; DE = m->title - push hl ; Stack; menu open x - call _cputs_arch_asm - ;; cputc_arch(CH_SPACE); - ld a, #CH_SPACE - call _cputc_arch_asm - - pop hl ; menu - pop bc ; open, Stack; x - ld a, h - sub b - jp nz, _draw_menu_ret2 - ld a, l - sub c - jp nz, _draw_menu_ret2 - ;; x2 = wherex_arch(); - ;; 0xc473 - push hl - call _wherex_arch ; A = x2 - ld c, l ; C = x2 - pop hl ; Stack; x - ;; HL = menu - push bc - ld bc, #_off_menu_active - call _get_offset - pop bc ; E = m->active - ld d, #0 ; D = y - pop af ; A = x, Stack; null - ld b, a - add a, #CTK_CONF_MENUWIDTH - sub #SCREEN_WIDTH - jr c, _draw_menu_loop1 - jr z, _draw_menu_loop1 - ld a, #SCREEN_WIDTH - sub #CTK_CONF_MENUWIDTH - ld b, a - ;; B = x, C = x2, D = y, E = m->active, HL = menu -_draw_menu_loop1: - ;; if (y == m->nitems) _draw_menu_ret - ld a, d - push de - push hl - push bc - ld bc, #_off_menu_nitems - call _get_offset - cp e - pop bc - pop hl - jr z, _draw_menu_ret ; leave 2byte to pop while return - pop de - ;; if (y == m->active) revers_arch(0); - cp e - jr nz, _draw_menu_next1 - xor a - push hl - call _revers_arch_asm - pop hl - ;; B = x, C = x2, D = y, HL = menu -_draw_menu_next1: ; c4ae - ;; gotoxy_arch(x, y + 1); - push hl - ld h, d - ld l, b - inc h - call _gotoxy_arch_asm - pop hl ; HL = menu, Stack; null - ;; if(m->items[y].title[0] == '-') - push de - push hl ; e7ca - push bc ; Stack; x2x menu y - - ld bc, #_off_menu_items - ld a, (bc) - add a, l - ld l, a - ld a, h - adc #0 - ld h, a ; HL = m->items[0] - - ld bc, #_size_menuitem - ld a, (bc) - ld c, a - ld b, #0 ; BC = sizeof(struct menuitem) - - ld a, d ; A = y -_draw_menu_loop2: - or a - jr z, _draw_menu_next2 - add hl, bc - dec a - jr _draw_menu_loop2 -_draw_menu_next2: - ld bc, #_off_menuitem_title - call _get_offset - ld a, (de) - cp a, #0x2d ; '-' - jr nz, _draw_menu_else - ;; chline_arch(CTK_CONF_MENUWIDTH); - ld b, #CTK_CONF_MENUWIDTH - call _chline_arch_asm - jr _draw_menu_next3 -_draw_menu_else: - ;; cputs_arch(m->items[y].title); - call _cputs_arch_asm -_draw_menu_next3: - ;; clearto_arch(x + CTK_CONF_MENUWIDTH); - pop bc ; B = x, C = x2, Stack; menu y - push bc - ld a, b - add a, #CTK_CONF_MENUWIDTH - call _clearto_arch_asm - ;; revers_arch(1); - ld a, #1 - call _revers_arch_asm - pop bc - pop hl - pop de - inc d - jr _draw_menu_loop1 -_draw_menu_ret: ; C = x2 - ld h, #0 - ld l, c - call _gotoxy_arch_asm -_draw_menu_ret2: - pop af - ret - -_ctk_draw_menus: - ;; --------------------------------- - ;; void ctk_draw_menus(struct ctk_menus *menus); - ;; Stack; retl reth menusl menush - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- - ;; clip_arch(0, SCREEN_HEIGHT); - ld h, #SCREEN_HEIGHT - ld l, #0 - call _clip_arch_asm - ;; gotoxy_arch(0, 0); - ld h, #0 - call _gotoxy_arch_asm - ;; revers_arch(1); - ld a, #1 - call _revers_arch_asm - - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - ld h, d - ld l, e ; HL = menus - ld bc, #_off_menus_desktopmenu - call _get_offset - push de ; Stack; menus->desktopmenu - ld bc, #_off_menus_open - call _get_offset - push de ; Stack; menus->open menus->desktopmenu - ld bc, #_off_menus_menus - call _get_offset - ld h, d - ld l, e ; HL = menu -_ctk_draw_menus_loop1: - ld bc, #_off_menu_next - call _get_offset - ;; if (menu == NULL) _ctk_draw_menus_next1 - ld a, d - or e - jr z, _ctk_draw_menus_next1 - ;; draw_menu_asm(m, menus->open); - ld h, d - ld l, e ; HL = menu->next - pop bc - push bc ; Stack; menus->open menus->desktopmenu - push hl ; Stack; menu menus->open menus->desktopmenu - call _draw_menu_asm - pop hl ; Stack; menus->open menus->desktopmenu - jr _ctk_draw_menus_loop1 -_ctk_draw_menus_next1: - pop de ; menus->open - pop hl ; menus->desktopmenu - push de ; Stack; menus->open - ;; clearto_arch(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1); - ld bc, #_off_menu_title - call _get_offset - ld b ,#0 -_ctk_draw_menus_loop2: - ld a, (de) - or a - jr z, _ctk_draw_menus_next2 - inc b - inc de - jr _ctk_draw_menus_loop2 -_ctk_draw_menus_next2: - ld a, #SCREEN_WIDTH - sub b ; strlen(menus->desktopmenu->title) - dec a ; SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1 - push hl - call _clearto_arch_asm - pop hl ; desktopmenu - pop bc ; open, Stack; null - call _draw_menu_asm - xor a - call _revers_arch_asm - ret -.endif - - ;; --------------------------------- - ;; unsigned char ctk_draw_width(void); - ;; Stack; retl reth - ;; _______L____ - ;; return width - ;; --------------------------------- -_ctk_draw_width: - ld l, #SCREEN_WIDTH - ret - - ;; --------------------------------- - ;; unsigned char ctk_draw_height(void); - ;; Stack; retl reth - ;; _______L____ - ;; return width - ;; --------------------------------- -_ctk_draw_height: - ld l, #SCREEN_HEIGHT - ret - - - ;; --------------------------------- - ;; internal functions - ;; --------------------------------- - - ;; --------------------------------- - ;; static void clearbox_arch_asm(unsigned char x, y, w, h) - ;; Stack; retl reth - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- - ;; DE = yx, B = h, C = w -_clearbox_arch_asm: - ld a, e - add a, c - ld c, a ; to_x = x + w - ld h, d - ld l, e -_clearbox_arch_loop:: - call _gotoxy_arch_asm ; (x, y) - push hl - push bc ; B = h, HL = yx - ld a, c - call _clearto_arch_asm - pop bc - pop hl - inc h ; y++ - djnz _clearbox_arch_loop - ret - - ;; --------------------------------- - ;; void drawbox_asm(unsigned char x, y, w, h) - ;; Stack; retl reth - ;; B = h, C = w, D = y, E = x - ;; AF__________ - ;; return void - ;; --------------------------------- -_drawbox_asm: - push bc - push de - push hl - - ld h, d - ld l, e - inc h - call _gotoxy_arch_asm ; (x, y + 1) - dec h - push hl - push bc ; Stack; hw, yx, B = h - call _cvline_arch_asm - ld a, #CH_LLCORNER - call _cputc_arch_asm - pop bc - push bc ; Stack; hw yx - ld b, c ; w - call _chline_arch_asm - ld a, #CH_LRCORNER - call _cputc_arch_asm - pop bc - pop hl - call _gotoxy_arch_asm ; (x, y) - push hl - push bc ; Stack; hw yx - ld a, #CH_ULCORNER - call _cputc_arch_asm - pop bc - push bc ; Stack; hw yx - ld b, c ; B = w - call _chline_arch_asm - ld a, #CH_URCORNER - call _cputc_arch_asm - pop bc ; B = h - pop hl - ld a, l - inc a - add a, c - ld l, a ; L = x + 1 + w - inc h ; H = y + 1 - call _gotoxy_arch_asm - call _cvline_arch_asm - - pop hl - pop de - pop bc - ret - -_ctk_conio_arch_asm_end:: diff --git a/platform/pc-6001/ctk/ctk-conio_arch-source.c b/platform/pc-6001/ctk/ctk-conio_arch-source.c deleted file mode 100644 index ea843e0da..000000000 --- a/platform/pc-6001/ctk/ctk-conio_arch-source.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is an original source file for - * ctk-conio_arch.c and ctk-conio_arch-asm.S - * \author - * Takahide Matsutsuka - */ - - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "contiki-conf.h" -#include "ctk/ctk_arch.h" -#include - -#ifndef NULL -#define NULL (void *)0 -#endif - -/*---------------------------------------------------------------------------*/ -static char cursx, cursy; -static unsigned char reversed; -static char cy1, cy2; - -unsigned char ctk_draw_windowtitle_height = 1; - -/*---------------------------------------------------------------------------*/ -#define revers(c) reversed = c -#define clip(y1, y2) cy1 = y1; cy2 = y2 -#define OFFSET(x, y) y * SCREEN_WIDTH + x - -/*---------------------------------------------------------------------------*/ -void cputc(char c) { - if (cursy >= cy1 && cursy <= cy2 - && cursy >= 0 && cursy <= SCREEN_HEIGHT - && cursx >= 0 && cursx < SCREEN_WIDTH) { - unsigned int offset = OFFSET(cursx, cursy); - *((char *) VRAM_CHAR + offset) = c; - *((char *) VRAM_ATTR + offset) = reversed ? COLOR_REVERSED : COLOR_NORMAL; - } - cursx++; -} - -/*---------------------------------------------------------------------------*/ -void cputs(char *str) { - while (*str != 0) { - cputc(*str); - str++; - } -} -/*---------------------------------------------------------------------------*/ -void cputsn(char *str, unsigned char len) { - while ((len > 0) && (*str != 0)) { - cputc(*str); - str++; - len--; - } -} -/*---------------------------------------------------------------------------*/ -void chline(unsigned char length) { - while (length > 0) { - cputc(CH_HOLILINE); - length--; - } -} -/*---------------------------------------------------------------------------*/ -/* #define cvline(l) while (l > 0) { cputc(CH_VERTLINE); */ -/* ++cursy; --cursx; l--; } */ - -void cvline(unsigned char length) { - while (length > 0) { - cputc(CH_VERTLINE); - ++cursy; - --cursx; - length--; - } -} -/*---------------------------------------------------------------------------*/ -void gotoxy(unsigned char x, unsigned char y) { - cursx = x; - cursy = y; -} -/*---------------------------------------------------------------------------*/ -void clearTo(char x) { - while (cursx < x) { - cputc(CH_SPACE); - } - cursx = x; -} - -/*---------------------------------------------------------------------------*/ -void ctk_draw_clear(unsigned char clipy1, unsigned char clipy2) { - while (clipy1 < clipy2) { - gotoxy(0, clipy1); - clearTo(SCREEN_WIDTH); - clipy1++; - } -} - -/*---------------------------------------------------------------------------*/ -void ctk_draw_init(void) { - clip(0, SCREEN_HEIGHT); - ctk_draw_clear(0, SCREEN_HEIGHT); -} -/*---------------------------------------------------------------------------*/ -/* - * w: widget - * x, y: screen position of client drawing area (left, top) - * clipx, clipy: screen position of client drawing area (right, bottom) - * clipy1, clipy2: min/max y position of screen - * focus: boolean - */ -void -draw_widget(struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char focus) { - unsigned char xpos, ypos, xscroll; - unsigned char i, j; - char c, *text; -#if CTK_CONF_ICONS - unsigned char len; -#endif /* CTK_CONF_ICONS */ - - xpos = x + w->x; - ypos = y + w->y; - - revers(focus & CTK_FOCUS_WIDGET); - gotoxy(xpos, ypos); - - if (w->type == CTK_WIDGET_SEPARATOR) { - chline(w->w); - } else if (w->type == CTK_WIDGET_LABEL) { - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - gotoxy(xpos, ypos); - cputsn(text, w->w); - clearTo(xpos + w->w); - ++ypos; - text += w->w; - } - } else if (w->type == CTK_WIDGET_BUTTON) { - cputc('['); - cputsn(w->widget.button.text, w->w); - cputc(']'); - } else if (w->type == CTK_WIDGET_HYPERLINK) { - cputsn(w->widget.hyperlink.text, w->w); - } else if (w->type == CTK_WIDGET_TEXTENTRY) { - text = w->widget.textentry.text; - xscroll = 0; - if(w->widget.textentry.xpos >= w->w - 1) { - xscroll = w->widget.textentry.xpos - w->w + 1; - } - for(j = 0; j < w->h; ++j) { - gotoxy(xpos, ypos); - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - w->widget.textentry.ypos == j) { - revers(0); - cputc('>'); - for(i = 0; i < w->w; ++i) { - c = text[i + xscroll]; - revers(i == w->widget.textentry.xpos - xscroll); - cputc((c == 0) ? CH_SPACE : c); - } - revers(0); - cputc('<'); - } else { - cputc(CH_VERTLINE); - cputsn(text, w->w); - clearTo(xpos + w->w + 1); - cputc(CH_VERTLINE); - } - ++ypos; - text += w->w; - } -#if CTK_CONF_ICONS - } else if (w->type == CTK_WIDGET_ICON) { - if(w->widget.icon.textmap != NULL) { - for(i = 0; i < 3; ++i) { - gotoxy(xpos, ypos); - cputc(w->widget.icon.textmap[0 + 3 * i]); - cputc(w->widget.icon.textmap[1 + 3 * i]); - cputc(w->widget.icon.textmap[2 + 3 * i]); - ++ypos; - } - x = xpos; - - len = strlen(w->widget.icon.title); - if(x + len >= SCREEN_WIDTH) { - x = SCREEN_WIDTH - len; - } - gotoxy(x, ypos); - cputs(w->widget.icon.title); - } -#endif /* CTK_CONF_ICONS */ - } - revers(0); - -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) { - - struct ctk_window *win = w->window; - unsigned char posx, posy; - clip(clipy1, clipy2); - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, focus); -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) { - - unsigned char i; - unsigned char x1, x2, y1, y2; - x1 = window->x + 1; - x2 = x1 + window->w; - y1 = window->y + 2; - y2 = y1 + window->h; - - for(i = y1; i < y2; ++i) { - gotoxy(x1, i); - clearTo(x2); - } -} -/*---------------------------------------------------------------------------*/ -void draw_window_sub(struct ctk_window *window, unsigned char focus) { - - unsigned char x, y; - unsigned char x1, y1, x2; - struct ctk_widget *w; - unsigned char wfocus; - - x = window->x; - y = window->y + 1; - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + window->w; - - // |_ - gotoxy(x, y1); - cvline(window->h); - cputc(CH_LLCORNER); - chline(window->w); - cputc(CH_LRCORNER); - - // - - gotoxy(x, y); - cputc(CH_ULCORNER); - chline(window->w); - cputc(CH_URCORNER); - // | - gotoxy(x2, y1); - cvline(window->h); - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - draw_widget(w, x1, y1, wfocus); - } -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_window(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, unsigned char draw_borders) { - clip(clipy1, clipy2); - - focus = focus & CTK_FOCUS_WINDOW; - draw_window_sub(window, focus); -} -/*---------------------------------------------------------------------------*/ -void ctk_draw_dialog(struct ctk_window *dialog) { - clip(0, SCREEN_HEIGHT); - - ctk_draw_clear_window(dialog, 0, 0, SCREEN_HEIGHT); - draw_window_sub(dialog, CTK_FOCUS_DIALOG); -} -/*---------------------------------------------------------------------------*/ -#if CTK_CONF_MENUS -void draw_menu(struct ctk_menu *m, struct ctk_menu *open) { -#if CC_CONF_UNSIGNED_CHAR_BUGS - unsigned char x2; - unsigned int x, y; -#else - unsigned char x2; - unsigned char x, y; -#endif - x = cursx; - cputs(m->title); - cputc(CH_SPACE); - - if (m == open) { - x2 = cursx; - if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) { - x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH; - } - - for(y = 0; y < m->nitems; y++) { - if(y == m->active) { - revers(0); - } - gotoxy(x, y + 1); - if(m->items[y].title[0] == '-') { - chline(CTK_CONF_MENUWIDTH); - } else { - cputs(m->items[y].title); - } - clearTo(x + CTK_CONF_MENUWIDTH); - revers(1); - } - gotoxy(x2, 0); - } -} -/*---------------------------------------------------------------------------*/ -void ctk_draw_menus(struct ctk_menus *menus) { - struct ctk_menu *m; - - clip(0, SCREEN_HEIGHT); - /* Draw menus */ - gotoxy(0, 0); - revers(1); - for(m = menus->menus->next; m != NULL; m = m->next) { - draw_menu(m, menus->open); - } - - clearTo(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1); - - /* Draw desktopmenu */ - draw_menu(menus->desktopmenu, menus->open); - - revers(0); -} -#endif /* CTK_CONF_MENUS */ -/*---------------------------------------------------------------------------*/ -/* Returns width and height of screen. */ -unsigned char ctk_draw_width(void) { - return SCREEN_WIDTH; -} -unsigned char ctk_draw_height(void) { - return SCREEN_HEIGHT; -} - diff --git a/platform/pc-6001/ctk/ctk-conio_arch.c b/platform/pc-6001/ctk/ctk-conio_arch.c deleted file mode 100644 index 12cc833ba..000000000 --- a/platform/pc-6001/ctk/ctk-conio_arch.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is architecture-depend contiki toolkit for PC-6001 family. - * \author - * Takahide Matsutsuka - */ - - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "contiki-conf.h" -#include "ctk/ctk_arch.h" -#include - -/*---------------------------------------------------------------------------*/ -/* - * Offset constants for assembler - */ -const uint8_t off_widget_x = offsetof(struct ctk_widget, x); -const uint8_t off_widget_y = offsetof(struct ctk_widget, y); -const uint8_t off_widget_w = offsetof(struct ctk_widget, w); -const uint8_t off_widget_h = offsetof(struct ctk_widget, h); -const uint8_t off_widget_type = offsetof(struct ctk_widget, type); -const uint8_t off_widget_window = offsetof(struct ctk_widget, window); - -const uint8_t off_widget_label_text = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_label, text); -const uint8_t off_widget_button_text = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_button, text); -const uint8_t off_widget_textentry_text = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_textentry, text); -const uint8_t off_widget_textentry_xpos = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_textentry, xpos); -const uint8_t off_widget_textentry_ypos = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_textentry, ypos); -const uint8_t off_widget_textentry_state = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_textentry, state); -#if CTK_CONF_HYPERLINK -const uint8_t off_widget_hyperlink_text = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_hyperlink, text); -#endif /* CTK_CONF_HYPERLINK */ - -#if CTK_CONF_ICONS -const uint8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_icon, title); -const uint8_t off_widget_icon_textmap = offsetof(struct ctk_widget, widget) + - offsetof(struct ctk_widget_icon, textmap); -#endif /* CTK_CONF_ICONS */ - -const uint8_t off_window_x = offsetof(struct ctk_window, x); -const uint8_t off_window_y = offsetof(struct ctk_window, y); -const uint8_t off_window_h = offsetof(struct ctk_window, h); -const uint8_t off_window_w = offsetof(struct ctk_window, w); -const uint8_t off_window_inactive = offsetof(struct ctk_window, inactive); -const uint8_t off_window_active = offsetof(struct ctk_window, active); -const uint8_t off_window_next = offsetof(struct ctk_window, next); -const uint8_t off_window_focused = offsetof(struct ctk_window, focused); - -#if CTK_CONF_MENUS -const uint8_t off_menu_title = offsetof(struct ctk_menu, title); -const uint8_t off_menu_active = offsetof(struct ctk_menu, active); -const uint8_t off_menu_nitems = offsetof(struct ctk_menu, nitems); -const uint8_t off_menu_items = offsetof(struct ctk_menu, items); -const uint8_t off_menu_next = offsetof(struct ctk_menu, next); -const uint8_t off_menuitem_title = offsetof(struct ctk_menuitem, title); -const uint8_t size_menuitem = sizeof(struct ctk_menuitem); -const uint8_t off_menus_open = offsetof(struct ctk_menus, open); -const uint8_t off_menus_menus = offsetof(struct ctk_menus, menus); -const uint8_t off_menus_desktopmenu = offsetof(struct ctk_menus, desktopmenu); -#endif - -/*---------------------------------------------------------------------------*/ diff --git a/platform/pc-6001/ctk/ctk_arch-def.h b/platform/pc-6001/ctk/ctk_arch-def.h deleted file mode 100644 index c55d88892..000000000 --- a/platform/pc-6001/ctk/ctk_arch-def.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * ctk_arch-def.h - * Definitions of CTK for PC-6001 family, which consist of the following: - * - Configuraton for ctk main library. - * - Configuraton for ctk_arch library. - * This file is used in assembler file with precompilation, so - * NEVER include other than directives and comments. - * \author - * Takahide Matsutsuka - */ - -#ifndef __CTK_ARCH_DEF_H__ -#define __CTK_ARCH_DEF_H__ - -/* characters */ -#if defined(ARCH_PC6001) || defined(ARCH_PC6001MK2) -#define CH_VERTLINE 0x16 -#define CH_HOLILINE 0x17 -#define CH_ULCORNER 0x18 -#define CH_URCORNER 0x19 -#define CH_LLCORNER 0x1a -#define CH_LRCORNER 0x1b -#elif defined(ARCH_PC6001A) -#define CH_VERTLINE '|' -#define CH_HOLILINE '-' -#define CH_ULCORNER '/' -#define CH_URCORNER '\\' -#define CH_LLCORNER '\\' -#define CH_LRCORNER '/' -#else -#error invalid ARCH -#endif -#define CH_SPACE 0x20 - -/* screen properties */ -#if defined(ARCH_PC6001MK2) -#define VRAM_ATTR 0x4000 -#define VRAM_CHAR 0x4400 -#define SCREEN_WIDTH 40 -#define SCREEN_HEIGHT 20 -#define COLOR_NORMAL 0x0f -#define COLOR_REVERSED 0x70 -#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && defined(MEMORY_16K) -#define VRAM_ATTR 0xc000 -#define VRAM_CHAR 0xc200 -#define SCREEN_WIDTH 32 -#define SCREEN_HEIGHT 16 -#define COLOR_NORMAL 0x20 -#define COLOR_REVERSED 0x21 -#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && (defined(MEMORY_32K) || defined(MEMORY_ROM)) -#define VRAM_ATTR 0x8000 -#define VRAM_CHAR 0x8200 -#define SCREEN_WIDTH 32 -#define SCREEN_HEIGHT 16 -#define COLOR_NORMAL 0x20 -#define COLOR_REVERSED 0x21 -#else -#error Specify appropriate ARCH & MEMORY combination -#endif /* ARCH_PC6001MK2 */ - -/* key code */ -#define CH_F1 -16//0xf0 -#define CH_F2 -15//0xf1 -#define CH_F3 -14//0xf2 -#define CH_F4 -13//0xf3 -#define CH_F5 -12//0xf4 -#define CH_TAB 0x09 - -#define CH_CURS_UP 0x1e -#define CH_CURS_DOWN 0x1f -#define CH_CURS_LEFT 0x1d -#define CH_CURS_RIGHT 0x1c -#define CH_ENTER 0x0d -#define CH_ESC 0x1b -#define CH_STOP 0x03 -#define CH_DEL 0x08 - -/* Contiki toolkit options */ - -#if defined(CTK_CLIENT) || defined(CTK_SERVER) -/* If network is available, turn all options off by the memory reason */ -#define CTK_CONF_ICONS 0 -#define CTK_CONF_ICON_TEXTMAPS 0 -#define CTK_CONF_WINDOWS 1 -#define CTK_CONF_WINDOWCLOSE 0 -#define CTK_CONF_WINDOWMOVE 0 -#define CTK_CONF_MENUS 0 -#define CTK_CONF_HYPERLINK 0 -#elif defined(CTK_NOICON) -/* In the case of loader arch, we omit the icons by the memory reason */ -#define CTK_CONF_ICONS 0 -#define CTK_CONF_ICON_TEXTMAPS 0 -#define CTK_CONF_WINDOWS 1 -#define CTK_CONF_WINDOWCLOSE 1 -#define CTK_CONF_WINDOWMOVE 1 -#define CTK_CONF_MENUS 1 -#define CTK_CONF_HYPERLINK 1 -#else /* CTK_MINIMUM */ -/* Toggles support for desktop icons. */ -#define CTK_CONF_ICONS 1 -/* Define if text icon is used. */ -#define CTK_CONF_ICON_TEXTMAPS 1 -/* Toggles support for windows. */ -#define CTK_CONF_WINDOWS 1 -/* Toggles support for closable windows. */ -#define CTK_CONF_WINDOWCLOSE 1 -/* Toggles support for movable windows. */ -#define CTK_CONF_WINDOWMOVE 1 -/* Toggles support for menus. */ -#define CTK_CONF_MENUS 1 -/* Defines if hyperlink is supported. */ -#define CTK_CONF_HYPERLINK 1 -#endif /* CTK_MINIMUM */ - -/* Define if bitmap icon is used. */ -#define CTK_CONF_ICON_BITMAPS 0 -/* Defines the default width of a menu. */ -#define CTK_CONF_MENUWIDTH 16 -/* Defines if screen saver is supported. */ -#define CTK_CONF_SCREENSAVER 0 -/* Defines if mouse is supported. */ -#define CTK_CONF_MOUSE_SUPPORT 0 - -/* The maximum number of menu items in each menu. */ -#define CTK_CONF_MAXMENUITEMS 4 - -/* Key used to switch the frontmost window. */ -#define CTK_CONF_WINDOWSWITCH_KEY CH_F3 -/* Key used to move down a widget. */ -#define CTK_CONF_WIDGETDOWN_KEY CH_TAB -/* Key used to move up a widget. */ -#define CTK_CONF_WIDGETUP_KEY CH_F5 -/* Defines which key that is to be used for activating the menus */ -#define CTK_CONF_MENU_KEY CH_F1 - -#ifdef LIBCONIO_CONF_EXPORT -#define LIBCONIO_EXPORT LIBCONIO_CONF_EXPORT -#else /* LIBCONIO_CONF_EXPORT */ -#define LIBCONIO_EXPORT 0 -#endif /* LIBCONIO_CONF_EXPORT */ - -/* Imported symbols from ctk.h */ - -#define _CTK_FOCUS_NONE 0 -#define _CTK_FOCUS_WIDGET 1 -#define _CTK_FOCUS_WINDOW 2 -#define _CTK_FOCUS_DIALOG 4 - -#define _CTK_WIDGET_SEPARATOR 1 -#define _CTK_WIDGET_LABEL 2 -#define _CTK_WIDGET_BUTTON 3 -#define _CTK_WIDGET_HYPERLINK 4 -#define _CTK_WIDGET_TEXTENTRY 5 -#define _CTK_WIDGET_BITMAP 6 -#define _CTK_WIDGET_ICON 7 - -#define _CTK_TEXTENTRY_NORMAL 0 -#define _CTK_TEXTENTRY_EDIT 1 - -#endif /* __CTK_ARCH_DEF_H__ */ diff --git a/platform/pc-6001/ctk/ctk_arch.h b/platform/pc-6001/ctk/ctk_arch.h deleted file mode 100644 index d6e34057f..000000000 --- a/platform/pc-6001/ctk/ctk_arch.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * ctk_arch.h - * Archtecture specific definitions and library declarations. - * \author - * Takahide Matsutsuka - */ - -#ifndef __CTK_ARCH_H__ -#define __CTK_ARCH_H__ - -#include "ctk/ctk_arch-def.h" -#include "dev/getkey.h" -#include "dev/isprint_arch.h" - -#endif /* __CTK_ARCH_H__ */ diff --git a/platform/pc-6001/ctk/libconio_arch-asm.cS b/platform/pc-6001/ctk/libconio_arch-asm.cS deleted file mode 100644 index 3e30bdf0a..000000000 --- a/platform/pc-6001/ctk/libconio_arch-asm.cS +++ /dev/null @@ -1,382 +0,0 @@ -;;; -;;; -;;; libconio_arch-asm.hS -;;; -;;; Architecture depend libconio implementation. -;;; This assembler source contributes basically saving for speed and memory. -;;; -;;; @author Takahide Matsutsuka -;;; -;;; $Id: libconio_arch-asm.cS,v 1.2 2007/09/29 04:10:00 matsutsuka Exp $ -;;; - - ;; uses preprocessor to enable definitions -#include "ctk_arch-def.h" - - ;; export symbols -.if LIBCONIO_EXPORT - .globl _cputc_arch - .globl _cputs_arch - .globl _cputsn_arch - .globl _chline_arch - .globl _cvline_arch - .globl _gotoxy_arch - .globl _clearto_arch - .globl _revers_arch - .globl _clip_arch -.endif - .globl _wherex_arch - .globl _wherey_arch - - .area _DATA -_screen_cursor: - .ds 1 ; x - .ds 1 ; y -_screen_clips: - .ds 1 ; clip y1 - .ds 1 ; clip y2 -_screen_reversed: - .ds 1 - - .area _CODE - -_libconio_arch_asm_start:: - ;; --------------------------------- - ;; void cputc(char ch); - ;; Stack; retl reth ch - ;; AFBCDEHL____ - ;; return A=1 if output is succeeded, A=0 if not - ;; --------------------------------- -.if LIBCONIO_EXPORT -_cputc_arch: - ld hl, #2 - add hl, sp - ld a, (hl) -.endif ; LIBCONIO_EXPORT - ;; ------------ - ;; A = char - ;; AFBCDEHL____ - ;; ------------ -_cputc_arch_asm:: - push af - ld bc, (#_screen_cursor) ;B=y, C=x - ld de, (#_screen_clips) ;D=cy2, E=cy1 - ld a, b - cp a, e - jr c, _cputc_arch_ret_false ; if (cursy < cy1) - cp a, d - jr z, _cputc_arch_next1 - jr nc, _cputc_arch_ret_false ; if (cursy > cy2) -_cputc_arch_next1: - cp a, #SCREEN_HEIGHT ; cursy - SCREEN_HEIGHT - jr z, _cputc_arch_next2 - jr nc, _cputc_arch_ret_false ; if (cursy > SCREEN_HEIGHT) -_cputc_arch_next2: - ld a, c - cp a, #SCREEN_WIDTH ; cursx - SCREEN_WIDTH - jr nc, _cputc_arch_ret_false ; if (cursx >= SCREEN_WIDTH) - ;; calculate offset - ld a, b ; A=y - ld hl, #0 - ld de, #SCREEN_WIDTH -_cputc_arch_loop: - or a - jr z, _cputc_arch_calcx - add hl, de - dec a - jr _cputc_arch_loop -_cputc_arch_calcx: - ld d, #0 - ld e, c - add hl, de - - ;; putchar - pop af - ld de, #VRAM_CHAR - push hl - add hl, de - ld (hl), a - pop hl - ;; putattr - ld de, #VRAM_ATTR - add hl, de - ld a, (#_screen_reversed) - or a - jr z, _cputc_arch_normal - ld (hl), #COLOR_REVERSED - jr _cputc_arch_ret -_cputc_arch_normal: - ld (hl), #COLOR_NORMAL - ld a, #0x01 -_cputc_arch_ret: - ld hl, #_screen_cursor - inc (hl) - ret -_cputc_arch_ret_false: - pop af - xor a - jr _cputc_arch_ret - - ;; --------------------------------- - ;; void cputs_arch(char *str); - ;; Stack; retl reth strl strh - ;; AFB_DEHL____ - ;; return void - ;; --------------------------------- -.if 1 -_cputs_arch:: - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) -.endif ; LIBCONIO_EXPORT - - ;; ------------ - ;; DE = str - ;; AFB_DEHL____ - ;; ------------ -_cputs_arch_asm:: - ld b, #SCREEN_WIDTH ; max length - jr _cputsn_arch_asm ; take over B and DE - - ;; --------------------------------- - ;; void cputsn(char *str, unsigned char length); - ;; Stack; retl reth strl strh length - ;; AFB_DEHL____ - ;; return void - ;; --------------------------------- -.if LIBCONIO_EXPORT -_cputsn_arch: - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld b, (hl) -.endif ; LIBCONIO_EXPORT - - ;; ------------ - ;; B = nchars - ;; DE = str - ;; AFB_DEHL____ - ;; ------------ -_cputsn_arch_asm:: - ld a, (de) - or a - ret z - push bc - push de - call _cputc_arch_asm - pop de - pop bc - inc de - djnz _cputsn_arch_asm - ret - - ;; --------------------------------- - ;; void chline(unsigned char length); - ;; Stack; retl reth length - ;; AFB_DEHL____ - ;; return void - ;; --------------------------------- -.if LIBCONIO_EXPORT -_chline_arch: - ld hl, #2 - add hl, sp - ld b, (hl) - ;; ------------ - ;; B = length - ;; AFB_DEHL____ - ;; ------------ -.endif -_chline_arch_asm:: - ld a, #CH_HOLILINE - push bc - call _cputc_arch_asm - pop bc - djnz _chline_arch_asm - ret - - ;; --------------------------------- - ;; void cvline(unsigned char length); - ;; Stack; retl reth length - ;; AFB_DEHL____ - ;; return void - ;; --------------------------------- -.if LIBCONIO_EXPORT -_cvline_arch: - ld hl, #2 - add hl, sp - ld b, (hl) ; length -.endif ; LIBCONIO_EXPORT - ;; ------------ - ;; B = length - ;; AFB_DEHL____ - ;; ------------ -_cvline_arch_asm:: - ld hl, (#_screen_cursor) ; H=y, L=x -_cvline_arch_loop: - ld a, #CH_VERTLINE - push hl - push bc - call _cputc_arch_asm - pop bc - pop hl - inc h - ld (#_screen_cursor), hl - djnz _cvline_arch_loop - ret - - ;; --------------------------------- - ;; void gotoxy(unsigned char x, unsigned char y) - ;; Stack; retl reth x y - ;; _F__DEHL____ - ;; return void - ;; --------------------------------- -.if 1 -_gotoxy_arch:: - ld hl, #2 - add hl, sp - ld e, (hl) ; y - inc hl - ld d, (hl) ; x - ld l, e ; L=x - ld h, d ; H=y -.endif ; LIBCONIO_EXPORT - - ;; ------------ - ;; H = x, L = y - ;; ____________ - ;; ------------ -_gotoxy_arch_asm:: - ld (#_screen_cursor), hl - ret - - ;; --------------------------------- - ;; void clearto_arch(unsigned char to) - ;; Stack; retl reth to - ;; AFBCDEHL____ - ;; return void - ;; --------------------------------- -.if LIBCONIO_EXPORT -_clearto_arch: - ld hl, #2 - add hl, sp - ld a, (hl) -.endif ; LIBCONIO_EXPORT - ;; ------------ - ;; A = to - ;; AFBCDEHL____ - ;; ------------ -_clearto_arch_asm:: - ld hl, #_screen_cursor - cp (hl) ; to - cursx - ret z - ret c - push af - ld a, #CH_SPACE - call _cputc_arch_asm - or a - pop af - ret z - jr _clearto_arch_asm - - ;; --------------------------------- - ;; void revers_arch(unsigned char reverse) - ;; Stack; retl reth reverse - ;; A_____HL____ - ;; return void - ;; --------------------------------- -.if LIBCONIO_EXPORT -_revers_arch: - ld hl, #2 - add hl, sp - ld a, (hl) -.endif ; LIBCONIO_EXPORT - ;; A = reverse - ;; ____________ -_revers_arch_asm:: - ld (#_screen_reversed), a - ret - - ;; --------------------------------- - ;; void clip_arch(unsigned char clip1, unsigned char clip2) - ;; Stack; retl reth clip1 clip2 - ;; ____________ - ;; return void - ;; --------------------------------- -.if LIBCONIO_EXPORT -_clip_arch: - push af - push hl - push de - ld hl, #0x08 - add hl, sp - ld de, #_screen_clips - ld a, (hl) - ld (de), a - inc hl - inc de - ld a, (hl) - ld (de), a - pop de - pop hl - pop af - ret -.endif - ;; --------------------------------- - ;; L = clipy1, H = clipy2 - ;; ____________ - ;; --------------------------------- -_clip_arch_asm:: - ld (#_screen_clips), hl - ret - - ;; --------------------------------- - ;; unsigned char wherex_arch() - ;; Stack; retl reth - ;; A______L____ - ;; return x - ;; --------------------------------- -_wherex_arch: - ld a, (#_screen_cursor) - ld l, a - ret - - ;; --------------------------------- - ;; unsigned char wherey_arch() - ;; Stack; retl reth - ;; A______L____ - ;; return y - ;; --------------------------------- -_wherey_arch: - ld a, (#_screen_cursor + 1) - ld l, a - ret - -.if 0 -_newline_arch: - ld hl, #_screen_cursor - xor a - ld (hl), a - inc hl - ld a, (hl) - inc a - cp a, #SCREEN_HEIGHT - jr nc, _newline_arch_scroll - ld (hl), a - ret -_newline_arch_scroll: - ;; TODO: attr and specific impl - dec a - ld (hl), a - ld hl, #VRAM_CHAR + #SCREEN_WIDTH - ld de, #VRAM_CHAR - ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH - #SCREEN_WIDTH - ldir - ret -.endif - -_libconio_arch_asm_end:: diff --git a/platform/pc-6001/ctk/libconio_arch-small.cS b/platform/pc-6001/ctk/libconio_arch-small.cS deleted file mode 100644 index 1ff865faa..000000000 --- a/platform/pc-6001/ctk/libconio_arch-small.cS +++ /dev/null @@ -1,115 +0,0 @@ -;;; -;;; -;;; libconio_arch-small.hS -;;; -;;; Architecture depend libconio implementation. -;;; This assembler source contributes basically saving for speed and memory. -;;; -;;; @author Takahide Matsutsuka -;;; -;;; $Id: libconio_arch-small.cS,v 1.2 2007/11/28 09:38:21 matsutsuka Exp $ -;;; - - ;; uses preprocessor to enable definitions -#include "ctk_arch-def.h" - - ;; export symbols - .globl _clrscr_arch - .globl _libputc_arch - .globl _libputs_arch - - .area _DATA -_screen_offset:: - .ds 2 - - .area _CODE - -_libconio_arch_small_start:: - -_clrscr_arch: - ld hl, #0 - ld (#_screen_offset), hl - ld hl, #VRAM_CHAR - ld bc, #VRAM_CHAR + #SCREEN_HEIGHT * #SCREEN_WIDTH -_clrscr_arch_loop1: - ld (hl), #CH_SPACE - inc hl - ld a, h - cp b - jr nz, _clrscr_arch_loop1 - ld a, l - cp c - jr nz, _clrscr_arch_loop1 - ld hl, #VRAM_ATTR - ld bc, #VRAM_ATTR + #SCREEN_HEIGHT * #SCREEN_WIDTH -_clrscr_arch_loop2: - ld (hl), #COLOR_NORMAL - inc hl - ld a, h - cp b - jr nz, _clrscr_arch_loop2 - ld a, l - cp c - jr nz, _clrscr_arch_loop2 - ret - -_libputc_arch: - ld hl, #2 - add hl, sp - ld a, (hl) -_libputc_asm:: - push af - ld hl, (#_screen_offset) - ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH - ld a, b - cp h - jr nz, _libputc_arch_putc - ld a, c - cp l - jr z, _libputc_arch_scroll -_libputc_arch_putc: - ld bc, #VRAM_CHAR - add hl, bc - pop af - ld (hl), a - ld hl, #_screen_offset - inc (hl) - ret nz - inc hl - inc (hl) - ret -_libputc_arch_scroll: - push de - ld hl, #VRAM_CHAR + #SCREEN_WIDTH - ld de, #VRAM_CHAR - ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH - #SCREEN_WIDTH - push bc - push de - ldir - pop de - pop hl - push hl - ld (#_screen_offset), hl - ld b, #SCREEN_WIDTH - add hl, de -_libputc_arch_scroll_loop: - ld (hl), #CH_SPACE - inc hl - djnz _libputc_arch_scroll_loop - pop hl - pop de - jr _libputc_arch_putc - -_libputs_arch: - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) -_libputs_arch_loop: - ld a, (hl) - or a - ret z - call _libputc_asm - jr _libputs_arch_loop -_libconio_arch_small_end:: diff --git a/platform/pc-6001/ctk/libconio_arch-small.h b/platform/pc-6001/ctk/libconio_arch-small.h deleted file mode 100644 index 985a8dee4..000000000 --- a/platform/pc-6001/ctk/libconio_arch-small.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __LIBCONIO_ARCH_MSLL_H__ -#define __LIBCONIO_ARCH_MSLL_H__ -#include "contiki.h" - -void clrscr_arch(void); -void libputc_arch(unsigned char ch); -void libputs_arch(char* str); - -unsigned char wherex(void); -unsigned char wherey(void); -void gotoxy(unsigned char x, unsigned char y); - - -#endif /* __LIBCONIO_ARCH_MSLL_H__ */ diff --git a/platform/pc-6001/ctk/libconio_arch.h b/platform/pc-6001/ctk/libconio_arch.h deleted file mode 100644 index 7f3162ae0..000000000 --- a/platform/pc-6001/ctk/libconio_arch.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * This is architecture-depend contiki toolkit for PC-6001 family. - * \author - * Takahide Matsutsuka - */ - -#ifndef __LIBCONIO_ARCH_H__ -#define __LIBCONIO_ARCH_H__ - -/* The following functions are used by assembler only */ -#if LIBCONIO_EXPORT -void cputc_arch(char c); -void cputs_arch(char *str); -void cputsn_arch(char *str, unsigned char len); -void chline_arch(unsigned char length); -void cvline_arch(unsigned char length); -void clip_arch(unsigned char clip1, unsigned char clip2); -void clearto_arch(unsigned char to); -void revers_arch(unsigned char reversed); -void gotoxy_arch(unsigned char x, unsigned char y); -#endif /* LIBCONIO_CONF_EXPORT */ -unsigned char wherex_arch(); -unsigned char wherey_arch(); - -#endif /* __LIBCONIO_ARCH_H__ */ diff --git a/platform/pc-6001/dev/clock.S b/platform/pc-6001/dev/clock.S deleted file mode 100644 index 2ca70945b..000000000 --- a/platform/pc-6001/dev/clock.S +++ /dev/null @@ -1,34 +0,0 @@ -;;; -;;; -;;; clock.S -;;; -;;; retrieve tickcount from PC-6001's internal timer -;;; -;;; @author Takahide Matsutsuka -;;; -;;; $Id: clock.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $ -;;; - .globl _clock_time - - .area _GSINIT - ;; --------------------------------- - ;; unsigned long clock_time(); - ;; __BCDEHL____ - ;; return long value as (DE, BC) - ;; --------------------------------- - ;; this function uses PC-6001's internal timer - ;; which counts up 2 per 1/512 sec. - .area _CODE -_clock_time: - ld hl, #0xfa28 - ld c, (hl) - inc hl - ld b, (hl) - inc hl - ld e, (hl) - inc hl - ld d, (hl) - ld l, c - ld h, b - - ret diff --git a/platform/pc-6001/dev/getkey.S b/platform/pc-6001/dev/getkey.S deleted file mode 100644 index 266dd7937..000000000 --- a/platform/pc-6001/dev/getkey.S +++ /dev/null @@ -1,74 +0,0 @@ -;;; -;;; -;;; getkey.S -;;; -;;; PC-6001 architecture-depend key fetch module -;;; -;;; @author Takahide Matsutsuka -;;; - - .globl _keyavail_arch - .globl _getkey_arch - .area _GSINIT - - .area _DATA - ;; unsigned char key; -_key: - .ds 1 - - .area _GSINIT - .area _CODE - - ;; --------------------------------- - ;; unsigned char keyavail_arch(); - ;; AFBC__HL____ - ;; a=getkey, l=getkey - ;; --------------------------------- -_keyavail_arch: - ld hl, #_key - ld a, (hl) - ;; if (key != 0) return 1; else goto _getch; - or a - jr z, _getch - ld l, #0x01 - ret - -_getch: - push hl - ;; A = (keybuf) - call #0x103a - pop hl - ;; if (keybuf != null) goto _getch_key - jr nz, _getch_key - ;; we do not have a keyin - xor a - jr _getch_got -_getch_key: - cp a, #0x14 - jr z, _getch - -_getch_got: - ;; key = getch() - ld (hl), a - ld l, a - ret - - - ;; --------------------------------- - ;; unsigned char getkey_arch(); - ;; AFBC__HL____ - ;; --------------------------------- -_getkey_arch: - ;; if (key == 0) keyavail_arch(); - ld hl, #_key - ld a, (hl) - or a - call z, _keyavail_arch - ;; if (key == 0) goto _havekey - or a - jr z, _havekey - ;; key = 0 - ld (hl), #0x00 -_havekey: - ld l, a - ret diff --git a/platform/pc-6001/dev/getkey.h b/platform/pc-6001/dev/getkey.h deleted file mode 100644 index b1dca4786..000000000 --- a/platform/pc-6001/dev/getkey.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * 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 file is part of the Contiki operating system. - * - */ - -/* - * \file - * A header file for machine depend key fetching functions. - * \author - * Takahide Matsutsuka - */ - -#ifndef __GETKEY_H__ -#define __GETKEY_H__ - -/* defined in getch.S */ -typedef char ctk_arch_key_t; -ctk_arch_key_t keyavail_arch(); -ctk_arch_key_t getkey_arch(); -#define CTK_ARCH_KEY_T -#define ctk_arch_getkey() getkey_arch() -#define ctk_arch_keyavail() keyavail_arch() - -#endif /* __GETKEY_H__ */ diff --git a/platform/pc-6001/dev/isprint_arch.S b/platform/pc-6001/dev/isprint_arch.S deleted file mode 100644 index 4ccf694f2..000000000 --- a/platform/pc-6001/dev/isprint_arch.S +++ /dev/null @@ -1,38 +0,0 @@ -;;; -;;; -;;; isprint-arch.S -;;; -;;; Architecture depend isprint function. -;;; -;;; @author Takahide Matsutsuka -;;; -;;; $Id: isprint_arch.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $ -;;; - .globl _isprint_arch - .area _GSINIT - - ;; unsigned long clock_time(); - ;; return long value as (DE, BC) - - ;; this function is identify if a given - ;; character is printable on PC-6001 - .area _CODE -_isprint_arch: - ;; --------------------------------- - ;; char isprint (unsigned char ch); - ;; Stack; retl reth ch - ;; A_____HL____ - ;; return l - ;; --------------------------------- - ld hl, #2 - add hl, sp - ld a, (hl) - or a - jr z, #_isprint_arch_ret_false - cp #0xfe - jr nc, #_isprint_arch_ret_false - ld l, #1 - ret -_isprint_arch_ret_false: - ld l, #0 - ret diff --git a/platform/pc-6001/dev/isprint_arch.h b/platform/pc-6001/dev/isprint_arch.h deleted file mode 100644 index 90da5f101..000000000 --- a/platform/pc-6001/dev/isprint_arch.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * 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 file is part of the Contiki operating system. - * - */ - -/* - * \file - * A header file for machine depend isprint function. - * \author - * Takahide Matsutsuka - */ - -#ifndef __ISPRINT_ARCH_H__ -#define __ISPRINT_ARCH_H__ - -/* defined in isprint_arch.S */ -unsigned char isprint_arch(char ch); -#define ctk_arch_isprint(c) isprint_arch(c) - -#endif /* __ISPRINT_ARCH_H__ */ diff --git a/platform/pc-6001/dev/rs232-asm.S b/platform/pc-6001/dev/rs232-asm.S deleted file mode 100644 index 1cdfd0183..000000000 --- a/platform/pc-6001/dev/rs232-asm.S +++ /dev/null @@ -1,188 +0,0 @@ -;;; -;;; -;;; rs232-asm.S -;;; -;;; PC-6001 Architecture depend RS-232C implementation, -;;; uses a bunch of BIOS functions. -;;; -;;; @author Takahide Matsutsuka -;;; -;;; $Id: rs232-asm.S,v 1.3 2007/11/28 09:39:30 matsutsuka Exp $ -;;; - - ;; definitions of PC-6001 BIOS routines -_rs232c_initialize = 0x19bf -_buffer_out = 0x2627 -_char_input_sub = 0x2642 -_count_buffer = 0x26a2 -_rs232c_intr_vector = 0xfa04 -_subcpu_handshake_out = 0x0e8f -LOG = 0 -CTK = 0 - ;; export symbols - .globl _rs232_arch_writeb - .globl _rs232_arch_poll - .globl _rs232_arch_init - - .area _CODE - -.if LOG -_hex: - .ascii "0123456789ABCDEF" -.if CTK - .globl _cputc_arch_asm -.else - .globl _libputc_asm - .globl _screen_offset -.endif -_rs232_arch_putc: ; a = data - ld hl, #0 - ld (#_screen_offset), hl - push af - srl a - srl a - srl a - srl a - call _rs232_arch_putc_next1 - pop af - and a, #0x0f -_rs232_arch_putc_next1: - ld hl, #_hex -_rs232_arch_putc_loop: - or a - jr z, _rs232_arch_putc_next2 - inc hl - dec a - jr _rs232_arch_putc_loop -_rs232_arch_putc_next2: - ld a, (hl) -.if CTK - call _cputc_arch_asm -.else - call _libputc_asm -.endif - ret -.endif - - ;; --------------------------------- - ;; void rs232_writeb(uint8_t c) - ;; Stack; retl reth c - ;; AF__D_HL____ - ;; return void - ;; --------------------------------- -_rs232_arch_writeb: - ld hl, #2 - add hl, sp - ld d, (hl) -.if LOG - push de - ld a, #0x77 ; 'w' -.if CTK - call _cputc_arch_asm -.else - call _libputc_asm -.endif - pop de - ;; ld a, d - ;; push de - ;; call _rs232_arch_putc - ;; pop de -.endif -_rs232_arch_writeb_loop: - in a, (#0x81) - and a, #0x01 - cp #0x01 ; TxRDY? 0x01/0x81/0x85 - jr nz, _rs232_arch_writeb_loop - ld a, d - out (#0x80), a - ret - - ;; RS-232C interrupt routine - ;; receive a byte and put it into the buffer -_rs232_arch_intr: - push bc - push af - push de - push hl - in a, (#0x81) - and a, #0x02 ; RxRDY? - jr z, _rs232_arch_intr_next ; no input - in a, (#0x80) - ld e, a - ld a, #0x01 - call _buffer_out ; buffer output A=bufno, e=data -_rs232_arch_intr_next: - ld a, #0x0c - call _subcpu_handshake_out ; sub CPU handshake output A - call _rs232_arch_bufchk - pop hl - pop de - pop af - pop bc - ei - ret - -_rs232_arch_bufchk: - ld a, #0x01 - call _count_buffer ; count buffer available bytes -> A - cp #0x02 ; A >= 2? - ld a, #0x37 ; Rx enable - jr nc, _rs232_arch_bufchk_next ; buffer available bytes >= 2 - ld a, #0x33 ; Rx disable -_rs232_arch_bufchk_next: - out (#0x81),a ; buf available=0x37, buf full=0x33 - ret - - ;; --------------------------------- - ;; unsigned char rs232_arch_poll(unsigned char *stat); - ;; Stack; retl reth statl stath - ;; AFBCDEHL____ - ;; return input byte (*stat == 0 if no input) - ;; --------------------------------- -_rs232_arch_poll: - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - ld a, #0x01 - ld (de), a - di - call _char_input_sub ; read from buffer - ei - push af - call _rs232_arch_bufchk ; buffer check - pop af - jr nz, _rs232_arch_poll_ret - xor a ; we have no data in the buffer - ld (de), a - jr _rs232_arch_poll_ret2 -_rs232_arch_poll_ret: -.if LOG - call _libputc_asm - ;; call _rs232_arch_putc -.endif -_rs232_arch_poll_ret2: - pop af - ld l, a - ret - - ;; --------------------------------- - ;; void rs232_init(unsigned long ubr); - ;; Stack; retl reth ubr1 ubr2 ubr3 ubr4 - ;; AFB_DEHL____ - ;; return void - ;; --------------------------------- -_rs232_arch_init: - ld hl, #_rs232_arch_intr - di - ld (#_rs232c_intr_vector), hl - ei - ;; S2 S1 PE P L2 L1 B2 B1 - ;; 0 1 0 0 1 1 1 1 - ;; 8-N-1 64x clock - ld b, #0x4f - call _rs232c_initialize - ld a, #0x37 - out (#0x81), a - ret diff --git a/platform/pc-6001/dev/rtimer-arch.h b/platform/pc-6001/dev/rtimer-arch.h deleted file mode 100644 index acc1aab84..000000000 --- a/platform/pc-6001/dev/rtimer-arch.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2007, 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. 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 file is part of the Contiki operating system. - * - */ - -/* - * \file - * A configuration file of machine depend rtimer. - * \authort - * Takahide Matsutsuka - */ - - -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ - -#define RTIMER_ARCH_SECOND 1024 - -#endif /* __RTIMER_ARCH_H__ */ diff --git a/platform/pc-6001/loader/loader_arch.c b/platform/pc-6001/loader/loader_arch.c deleted file mode 100644 index 33184e0bf..000000000 --- a/platform/pc-6001/loader/loader_arch.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * loader-arch.c - * A machine-dependent implementation of program loader for PC-6001 family. - * \author - * Takahide Matsutsuka - */ - -#ifdef WITH_LOADER_ARCH -#include "contiki.h" -#include "loader.h" -#include "loader/mef.h" -#include "loader/loader_arch.h" - -unsigned char load_byte() { return 0; } - -struct dsc* -loader_arch_load_dsc(char *name) -{ - mef_load((unsigned char *) 0xc800); - log_message("loader_arch_load_dsc", name); -} -unsigned char -loader_arch_load(char *name, char *arg) -{ - log_message("loader_arch_load", name); - return LOADER_ERR_NOLOADER; -} -void -loader_arch_unload() -{ - log_message("loader_arch_unload", name); -} -void -loader_arch_unload_dsc(struct dsc *dsc) -{ - log_message("loader_arch_unload_dsc", name); -} - -#endif /* WITH_LOADER_ARCH */ diff --git a/platform/pc-6001/loader/loader_arch.h b/platform/pc-6001/loader/loader_arch.h deleted file mode 100644 index 44cf98535..000000000 --- a/platform/pc-6001/loader/loader_arch.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2007, Takahide Matsutsuka. - * 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. - * - * - */ - -/* - * \file - * loader-arch.h - * Definitions of machine-dependent loader for PC-6001 family. - * \author - * Takahide Matsutsuka - */ - -#ifndef __LOADER_ARCH_H__ -#define __LOADER_ARCH_H__ - -#ifdef WITH_LOADER_ARCH -#define LOADER_LOAD(name, arg) loader_arch_load(name, arg) -#define LOADER_UNLOAD() loader_arch_unload() -#define LOADER_LOAD_DSC(name) loader_arch_load_dsc(name) -#define LOADER_UNLOAD_DSC(dsc) loader_arch_unload_dsc(dsc) - - - -struct dsc *loader_arch_load_dsc(char *name); -unsigned char loader_arch_load(char *name, char *arg); -void loader_arch_unload(); -void loader_arch_unload_dsc(struct dsc *dsc); -#endif /* WITH_LOADER_ARCH */ - -#endif /* __LOADER_ARCH_H__ */ diff --git a/platform/redbee-dev/Makefile.redbee-dev b/platform/redbee-dev/Makefile.redbee-dev deleted file mode 100644 index 7c4f29230..000000000 --- a/platform/redbee-dev/Makefile.redbee-dev +++ /dev/null @@ -1,21 +0,0 @@ -# -*- makefile -*- - -CONTIKI_TARGET_DIRS = . dev apps net -CONTIKI_CORE=contiki-mc1322x-main -CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o - -CONTIKI_TARGET_SOURCEFILES += contiki-mc1322x-main.c clock.c button-sensor.c sensors.c slip.c - -CONTIKIMC1322X=$(CONTIKI)/cpu/mc1322x -CONTIKIBOARD=. - -CONTIKI_PLAT_DEFS = - -MCU=arm7tdmi-s - -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - -include $(CONTIKIMC1322X)/Makefile.mc1322x - diff --git a/platform/redbee-dev/button-sensor.c b/platform/redbee-dev/button-sensor.c deleted file mode 100644 index a1e080618..000000000 --- a/platform/redbee-dev/button-sensor.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2010, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * 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. - * - * 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 file is part of the Contiki OS. - * - */ - -#include "lib/sensors.h" -#include "dev/button-sensor.h" - -#include "mc1322x.h" - -#include - -const struct sensors_sensor button_sensor; - -static struct timer debouncetimer; -static int status(int type); - -void kbi4_isr(void) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - } - clear_kbi_evnt(4); -} - -static int -value(int type) -{ - return bit_is_set(gpio_data_get((0x1ULL << 26)), 26) || !timer_expired(&debouncetimer); -} - -static int -configure(int type, int c) -{ - switch (type) { - case SENSORS_ACTIVE: - if (c) { - if(!status(SENSORS_ACTIVE)) { - timer_set(&debouncetimer, 0); - enable_irq_kbi(4); - } - } else { - disable_irq_kbi(4); - } - return 1; - } - return 0; -} - -static int -status(int type) -{ - switch (type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return bit_is_set(*CRM_WU_CNTL, 20); /* check if kbi4 irq is enabled */ - } - return 0; -} - -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/platform/redbee-dev/contiki-conf.h b/platform/redbee-dev/contiki-conf.h deleted file mode 100644 index dceb1490d..000000000 --- a/platform/redbee-dev/contiki-conf.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2010, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - */ - -/** - * \file - * Configuration for MC1322x hobby board based on - * Configuration for sample STK 501 Contiki kernel - * - * \author - * Originial by: - * Simon Barner - */ - -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#include - -/* mc1322x files */ -#include "contiki-mc1322x-conf.h" -/* this is from cpu/mc1322x/board */ -#include "redbee-dev.h" - -/* Clock ticks per second */ -#define CLOCK_CONF_SECOND 100 -/* set to 1 to toggle the green led ever second */ -/* FIXME setting this will break the sensor button (and other gpio) */ -/* since leds_arch hits the entire gpio_data */ -#define BLINK_SECONDS 0 - -#define CCIF -#define CLIF - -/* Baud rate */ -#define BRMOD 9999 -/* 230400 bps, INC=767, MOD=9999, 24Mhz 16x samp */ -/* 115200 bps, INC=767, MOD=9999, 24Mhz 8x samp */ -#define BRINC 767 -/* 921600 bps, MOD=9999, 24Mhz 16x samp */ -//#define INC 3071 -#define SAMP UCON_SAMP_8X -//#define SAMP UCON_SAMP_16X - -#define uart_init uart1_init -#define dbg_putchar(x) uart1_putc(x) - -#define USE_FORMATTED_STDIO 1 -#define MACA_DEBUG 0 -#define CONTIKI_MACA_RAW_MODE 0 -#define USE_32KHZ_XTAL 0 - -#define BLOCKING_TX 0 - -/* end of mc1322x specific config. */ - -/* start of conitki config. */ - -/* Core rtimer.h defaults to 16 bit timer unless RTIMER_CLOCK_LT is defined */ -typedef unsigned long rtimer_clock_t; -#define RTIMER_CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0) - -#define RIMEADDR_CONF_SIZE 8 - -/* EUI64 generation */ -/* Organizationally Unique Identifier */ -#define OUI 0xacde48 /* if IAB is defined then OUI = 0x0050C2 */ -#define IAB 0xA8C /* IAB 0xA8C for use on Redwire products only */ -//#undef IAB /* do not define an IAB if you are using a full OUI */ -//#define EXT_ID 0xdef123 /* lower 12-bits used if IAB is defined */ -#undef EXT_ID /* if an extention id is not defined then one will be generated randomly */ - -#define FLASH_BLANK_ADDR /* if defined then the generated rime address will flashed */ - -#if WITH_UIP6 -/* Network setup for IPv6 */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver -#define NETSTACK_CONF_MAC nullmac_driver -/*#define NETSTACK_CONF_RDC contikimac_driver*/ /* contikimac for redbee hasn't been well tested */ -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_RADIO contiki_maca_driver -#define NETSTACK_CONF_FRAMER framer_802154 - -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 -#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 -#define CXMAC_CONF_ANNOUNCEMENTS 0 -#define XMAC_CONF_ANNOUNCEMENTS 0 - -#else /* WITH_UIP6 */ -/* Network setup for non-IPv6 (rime). */ - -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_MAC csma_driver -#define NETSTACK_CONF_RDC sicslowmac_driver -#define NETSTACK_CONF_RADIO contiki_maca_driver -#define NETSTACK_CONF_FRAMER framer_802154 - -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 - -#define COLLECT_CONF_ANNOUNCEMENTS 1 -#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 -#define CXMAC_CONF_ANNOUNCEMENTS 0 -#define XMAC_CONF_ANNOUNCEMENTS 0 -#define CONTIKIMAC_CONF_ANNOUNCEMENTS 0 - -#define CONTIKIMAC_CONF_COMPOWER 0 -#define XMAC_CONF_COMPOWER 0 -#define CXMAC_CONF_COMPOWER 0 - -#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 - -#endif /* WITH_UIP6 */ - -#define QUEUEBUF_CONF_NUM 16 - -#define PACKETBUF_CONF_ATTRS_INLINE 1 - -#ifndef RF_CHANNEL -#define RF_CHANNEL 26 -#endif /* RF_CHANNEL */ - -#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0 - -#define IEEE802154_CONF_PANID 0xABCD - -#define PROFILE_CONF_ON 0 -#define ENERGEST_CONF_ON 0 - -#define AODV_COMPLIANCE -#define AODV_NUM_RT_ENTRIES 32 - -#define WITH_ASCII 1 - -#define PROCESS_CONF_NUMEVENTS 8 -#define PROCESS_CONF_STATS 1 - -#ifdef WITH_UIP6 - -#define RIMEADDR_CONF_SIZE 8 - -#define UIP_CONF_LL_802154 1 -#define UIP_CONF_LLH_LEN 0 - -#define UIP_CONF_ROUTER 1 -#define UIP_CONF_IPV6_RPL 1 - -#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 -#define UIP_CONF_MAX_ROUTES 30 - -#define UIP_CONF_ND6_SEND_RA 0 -#define UIP_CONF_ND6_REACHABLE_TIME 600000 -#define UIP_CONF_ND6_RETRANS_TIMER 10000 - -#define UIP_CONF_IPV6 1 -#define UIP_CONF_IPV6_QUEUE_PKT 0 -#define UIP_CONF_IPV6_CHECKS 1 -#define UIP_CONF_IPV6_REASSEMBLY 0 -#define UIP_CONF_NETIF_MAX_ADDRESSES 3 -#define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define UIP_CONF_IP_FORWARD 0 -#define UIP_CONF_BUFFER_SIZE 1300 -#define SICSLOWPAN_CONF_FRAG 1 -#define SICSLOWPAN_CONF_MAXAGE 8 - -#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 -#define SICSLOWPAN_CONF_COMPRESSION_HC1 1 -#define SICSLOWPAN_CONF_COMPRESSION_HC01 2 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#ifndef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 1 -#define SICSLOWPAN_CONF_MAXAGE 8 -#endif /* SICSLOWPAN_CONF_FRAG */ -#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 -#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ -#define UIP_CONF_IP_FORWARD 1 -#define UIP_CONF_BUFFER_SIZE 1300 -#endif /* WITH_UIP6 */ - -#define UIP_CONF_ICMP_DEST_UNREACH 1 - -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_RECEIVE_WINDOW 48 -#define UIP_CONF_TCP_MSS 48 -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 8 -#define UIP_CONF_UDP_CONNS 12 -#define UIP_CONF_FWCACHE_SIZE 30 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 - -#define UIP_CONF_TCP_SPLIT 0 - -/* include the project config */ -/* PROJECT_CONF_H might be defined in the project Makefile */ -#ifdef PROJECT_CONF_H -#include PROJECT_CONF_H -#endif /* PROJECT_CONF_H */ - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/redbee-dev/contiki-mc1322x-main.c b/platform/redbee-dev/contiki-mc1322x-main.c deleted file mode 100644 index bab6fa482..000000000 --- a/platform/redbee-dev/contiki-mc1322x-main.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright (c) 2010, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - */ - -#include -#include -#include - -#include "contiki.h" - -#include "dev/leds.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/xmem.h" -#include "dev/button-sensor.h" -#include "lib/random.h" -#include "net/netstack.h" -#include "net/mac/frame802154.h" - -#if WITH_UIP6 -#include "net/sicslowpan.h" -#include "net/uip-ds6.h" -#include "net/mac/sicslowmac.h" -#endif /* WITH_UIP6 */ - -#include "net/rime.h" - -#include "sys/autostart.h" - -/* from libmc1322x */ -#include "mc1322x.h" -#include "default_lowlevel.h" -#include "contiki-maca.h" -#include "contiki-uart.h" - -#define DEBUG 1 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) -#define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) -#else -#define PRINTF(...) -#define PRINT6ADDR(addr) -#define PRINTLLADDR(addr) -#endif - -#ifndef RIMEADDR_NVM -#define RIMEADDR_NVM 0x1E000 -#endif - -#ifndef RIMEADDR_NBYTES -#define RIMEADDR_NBYTES 8 -#endif - -#define PLATFORM_DEBUG 1 -#if PLATFORM_DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - - -#if UIP_CONF_ROUTER - -#ifndef UIP_ROUTER_MODULE -#ifdef UIP_CONF_ROUTER_MODULE -#define UIP_ROUTER_MODULE UIP_CONF_ROUTER_MODULE -#else /* UIP_CONF_ROUTER_MODULE */ -#define UIP_ROUTER_MODULE rimeroute -#endif /* UIP_CONF_ROUTER_MODULE */ -#endif /* UIP_ROUTER_MODULE */ - -extern const struct uip_router UIP_ROUTER_MODULE; - -#endif /* UIP_CONF_ROUTER */ - -#if DCOSYNCH_CONF_ENABLED -static struct timer mgt_timer; -#endif - -#ifndef WITH_UIP -#define WITH_UIP 0 -#endif - -#if WITH_UIP -#include "net/uip.h" -#include "net/uip-fw.h" -#include "net/uip-fw-drv.h" -#include "net/uip-over-mesh.h" -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(192,168,1,2, 255,255,255,255, slip_send)}; -static struct uip_fw_netif meshif = - {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; - -#endif /* WITH_UIP */ - -#define UIP_OVER_MESH_CHANNEL 8 -#if WITH_UIP -static uint8_t is_gateway; -#endif /* WITH_UIP */ - -/*---------------------------------------------------------------------------*/ -void uip_log(char *msg) { printf("%c",msg); } -/*---------------------------------------------------------------------------*/ -#ifndef RF_CHANNEL -#define RF_CHANNEL 26 -#endif -/*---------------------------------------------------------------------------*/ -#if WITH_UIP -static void -set_gateway(void) -{ - if(!is_gateway) { -// leds_on(LEDS_RED); - printf("%d.%d: making myself the IP network gateway.\n\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); - printf("IPv4 address of the gateway: %d.%d.%d.%d\n\n", - uip_ipaddr_to_quad(&uip_hostaddr)); - uip_over_mesh_set_gateway(&rimeaddr_node_addr); - uip_over_mesh_make_announced_gateway(); - is_gateway = 1; - } -} -#endif /* WITH_UIP */ -/*---------------------------------------------------------------------------*/ -static void -print_processes(struct process * const processes[]) -{ - /* const struct process * const * p = processes;*/ - printf("Starting"); - while(*processes != NULL) { - printf(" '%s'", (*processes)->name); - processes++; - } - printf("\n"); -} -/*--------------------------------------------------------------------------*/ - -SENSORS(&button_sensor); - -void -init_lowlevel(void) -{ - /* led direction init */ - set_bit(*GPIO_PAD_DIR0,8); - set_bit(*GPIO_PAD_DIR0,9); - set_bit(*GPIO_PAD_DIR0,10); - set_bit(*GPIO_PAD_DIR0,23); - set_bit(*GPIO_PAD_DIR0,24); - set_bit(*GPIO_PAD_DIR0,25); - - /* button init */ - /* set up kbi */ - enable_irq_kbi(4); - kbi_edge(4); - enable_ext_wu(4); -// kbi_pol_neg(7); -// kbi_pol_pos(7); -// gpio_sel0_pullup(29); -// gpio_pu0_disable(29); - - trim_xtal(); - - /* uart init */ - uart_init(BRINC, BRMOD, SAMP); - - default_vreg_init(); - - maca_init(); - - set_channel(RF_CHANNEL - 11); /* channel 11 */ - set_power(0x12); /* 0x12 is the highest, not documented */ - - /* control TX_ON with the radio */ - *GPIO_FUNC_SEL2 = (0x01 << ((44-16*2)*2)); - gpio_pad_dir_set( 1ULL << 44 ); - - enable_irq(CRM); - -#if USE_32KHZ_XTAL - enable_32khz_xtal(); -#else - cal_ring_osc(); -#endif - -#if USE_32KHZ_XTAL - *CRM_RTC_TIMEOUT = 32768 * 10; -#else - *CRM_RTC_TIMEOUT = cal_rtc_secs * 10; -#endif - - /* XXX debug */ - /* trigger periodic rtc int */ -// clear_rtc_wu_evt(); -// enable_rtc_wu(); -// enable_rtc_wu_irq(); -} - -#if RIMEADDR_SIZE == 1 -const rimeaddr_t addr_ff = { { 0xff } }; -#else /*RIMEADDR_SIZE == 2*/ -#if RIMEADDR_SIZE == 2 -const rimeaddr_t addr_ff = { { 0xff, 0xff } }; -#else /*RIMEADDR_SIZE == 2*/ -#if RIMEADDR_SIZE == 8 -const rimeaddr_t addr_ff = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; -#endif /*RIMEADDR_SIZE == 8*/ -#endif /*RIMEADDR_SIZE == 2*/ -#endif /*RIMEADDR_SIZE == 1*/ - -void iab_to_eui64(rimeaddr_t *eui64, uint32_t oui, uint16_t iab, uint32_t ext) { - /* OUI for IABs */ - eui64->u8[0] = 0x00; - eui64->u8[1] = 0x50; - eui64->u8[2] = 0xc2; - - /* EUI64 field */ - eui64->u8[3] = 0xff; - eui64->u8[4] = 0xfe; - - /* IAB */ - eui64->u8[5] = (iab >> 4) & 0xff; - eui64->u8[6] = (iab & 0xf) << 4; - - /* EXT */ - eui64->u8[6] |= ((ext >> 8) & 0xf); - eui64->u8[7] = ext & 0xff; -} - -void oui_to_eui64(rimeaddr_t *eui64, uint32_t oui, uint32_t ext) { - /* OUI */ - eui64->u8[0] = (oui >> 16) & 0xff; - eui64->u8[1] = (oui >> 8) & 0xff; - eui64->u8[2] = oui & 0xff; - - /* EUI64 field */ - eui64->u8[3] = 0xff; - eui64->u8[4] = 0xfe; - - /* EXT */ - eui64->u8[5] = (ext >> 16) & 0xff; - eui64->u8[6] = (ext >> 8) & 0xff; - eui64->u8[7] = ext & 0xff; -} - -void -set_rimeaddr(rimeaddr_t *addr) -{ - nvmType_t type=0; - nvmErr_t err; - volatile uint8_t buf[RIMEADDR_NBYTES]; - rimeaddr_t eui64; - int i; - - err = nvm_detect(gNvmInternalInterface_c, &type); - - err = nvm_read(gNvmInternalInterface_c, type, (uint8_t *)buf, RIMEADDR_NVM, RIMEADDR_NBYTES); - - rimeaddr_copy(addr,&rimeaddr_null); - - for(i=0; iu8[i] = buf[i]; - } - - if (memcmp(addr, &addr_ff, RIMEADDR_CONF_SIZE)==0) { - - //set addr to EUI64 -#ifdef IAB - #ifdef EXT_ID - PRINTF("address in flash blank, setting to defined IAB and extension.\n\r"); - iab_to_eui64(&eui64, OUI, IAB, EXT_ID); - #else /* ifdef EXT_ID */ - PRINTF("address in flash blank, setting to defined IAB with a random extension.\n\r"); - iab_to_eui64(&eui64, OUI, IAB, *MACA_RANDOM & 0xfff); - #endif /* ifdef EXT_ID */ - -#else /* ifdef IAB */ - - #ifdef EXT_ID - PRINTF("address in flash blank, setting to defined OUI and extension.\n\r"); - oui_to_eui64(&eui64, OUI, EXT_ID); - #else /*ifdef EXT_ID */ - PRINTF("address in flash blank, setting to defined OUI with a random extension.\n\r"); - oui_to_eui64(&eui64, OUI, *MACA_RANDOM & 0xffffff); - #endif /*endif EXTID */ - -#endif /* ifdef IAB */ - - rimeaddr_copy(addr, &eui64); -#ifdef FLASH_BLANK_ADDR - PRINTF("flashing blank address\n\r"); - err = nvm_write(gNvmInternalInterface_c, type, &(eui64.u8), RIMEADDR_NVM, RIMEADDR_NBYTES); -#endif /* ifdef FLASH_BLANK_ADDR */ - } else { - PRINTF("loading rime address from flash.\n\r"); - } - - rimeaddr_set_node_addr(addr); -} - -int -main(void) -{ - volatile uint32_t i; - rimeaddr_t addr; - - /* Initialize hardware and */ - /* go into user mode */ - init_lowlevel(); - - /* Clock */ - clock_init(); - - /* Process subsystem */ - process_init(); - process_start(&etimer_process, NULL); - process_start(&contiki_maca_process, NULL); - - ctimer_init(); - - set_rimeaddr(&addr); - - printf("Rime started with address "); - for(i = 0; i < sizeof(addr.u8) - 1; i++) { - printf("%02X:", addr.u8[i]); - } - printf("%02X\n", addr.u8[i]); - - -#if WITH_UIP6 - memcpy(&uip_lladdr.addr, &addr.u8, sizeof(uip_lladdr.addr)); - /* Setup nullmac-like MAC for 802.15.4 */ -/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */ -/* printf(" %s channel %u\n", sicslowmac_driver.name, RF_CHANNEL); */ - - /* Setup X-MAC for 802.15.4 */ - queuebuf_init(); - NETSTACK_RDC.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); - - printf("%s %s, channel check rate %lu Hz, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: - NETSTACK_RDC.channel_check_interval()), - RF_CHANNEL); - - process_start(&tcpip_process, NULL); - - printf("Tentative link-local IPv6 address "); - { - int i, a; - for(a = 0; a < UIP_DS6_ADDR_NB; a++) { - if (uip_ds6_if.addr_list[a].isused) { - for(i = 0; i < 7; ++i) { - printf("%02x%02x:", - uip_ds6_if.addr_list[a].ipaddr.u8[i * 2], - uip_ds6_if.addr_list[a].ipaddr.u8[i * 2 + 1]); - } - printf("%02x%02x\n", - uip_ds6_if.addr_list[a].ipaddr.u8[14], - uip_ds6_if.addr_list[a].ipaddr.u8[15]); - } - } - } - - if(1) { - uip_ipaddr_t ipaddr; - int i; - uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE); - printf("Tentative global IPv6 address "); - for(i = 0; i < 7; ++i) { - printf("%02x%02x:", - ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]); - } - printf("%02x%02x\n", - ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); - } - - -#else /* WITH_UIP6 */ - - NETSTACK_RDC.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); - - printf("%s %s, channel check rate %lu Hz, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1: - NETSTACK_RDC.channel_check_interval()), - RF_CHANNEL); -#endif /* WITH_UIP6 */ - -#if TIMESYNCH_CONF_ENABLED - timesynch_init(); - timesynch_set_authority_level(rimeaddr_node_addr.u8[0]); -#endif /* TIMESYNCH_CONF_ENABLED */ - -#if WITH_UIP - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ - process_start(&slip_process, NULL); - - slip_set_input_callback(set_gateway); - - { - uip_ipaddr_t hostaddr, netmask; - - uip_init(); - - uip_ipaddr(&hostaddr, 172,16, - rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); - uip_ipaddr(&netmask, 255,255,0,0); - uip_ipaddr_copy(&meshif.ipaddr, &hostaddr); - - uip_sethostaddr(&hostaddr); - uip_setnetmask(&netmask); - uip_over_mesh_set_net(&hostaddr, &netmask); - /* uip_fw_register(&slipif);*/ - uip_over_mesh_set_gateway_netif(&slipif); - uip_fw_default(&meshif); - uip_over_mesh_init(UIP_OVER_MESH_CHANNEL); - printf("uIP started with IP address %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&hostaddr)); - } -#endif /* WITH_UIP */ - - process_start(&sensors_process, NULL); - - print_processes(autostart_processes); - autostart_start(autostart_processes); - - /* Main scheduler loop */ - while(1) { - check_maca(); - - /* TODO: replace this with a uart rx interrupt */ - if(uart1_input_handler != NULL) { - if(uart1_can_get()) { - uart1_input_handler(uart1_getc()); - } - } - - process_run(); - } - - return 0; -} - -/*---------------------------------------------------------------------------*/ -#if LOG_CONF_ENABLED -void -log_message(char *m1, char *m2) -{ - printf("%s%s\n", m1, m2); -} -#endif /* LOG_CONF_ENABLED */ diff --git a/platform/redbee-econotag/Makefile.redbee-econotag b/platform/redbee-econotag/Makefile.redbee-econotag deleted file mode 100644 index 4825b508b..000000000 --- a/platform/redbee-econotag/Makefile.redbee-econotag +++ /dev/null @@ -1,32 +0,0 @@ -# -*- makefile -*- - -define nl - - -endef - -ifndef ALLOW_OLD_PLATFORMS -${error $(nl)$(nl)**** This platform is old and will soon be removed **** $(nl)$(nl)\ -please use TARGET=econotag instead.$(nl)$(nl) \ - (or set ALLOW_OLD_PLATFORMS=1 to proceed)$(nl)$(nl) } -endif - -CONTIKI_TARGET_DIRS = . dev apps net -CONTIKI_CORE=contiki-mc1322x-main -CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o - -CONTIKI_TARGET_SOURCEFILES += contiki-mc1322x-main.c clock.c button-sensor.c sensors.c slip.c light-sensor.c tmp102-sensor.c - -CONTIKIMC1322X=$(CONTIKI)/cpu/mc1322x -CONTIKIBOARD=. - -CONTIKI_PLAT_DEFS = - -MCU=arm7tdmi-s - -ifeq ($(UIP_CONF_IPV6),1) -CFLAGS += -DWITH_UIP6=1 -endif - -include $(CONTIKIMC1322X)/Makefile.mc1322x - diff --git a/platform/redbee-econotag/button-sensor.c b/platform/redbee-econotag/button-sensor.c deleted file mode 100644 index 24b9b63c1..000000000 --- a/platform/redbee-econotag/button-sensor.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2010, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * 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. - * - * 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 file is part of the Contiki OS. - * - */ - -#include "lib/sensors.h" -#include "dev/button-sensor.h" - -#include "mc1322x.h" - -#include - -const struct sensors_sensor button_sensor; - -static struct timer debouncetimer; -static int status(int type); - -void kbi4_isr(void) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - } - clear_kbi_evnt(4); -} - -static int -value(int type) -{ - return GPIO->DATA.GPIO_26 || !timer_expired(&debouncetimer); -} - -static int -configure(int type, int c) -{ - switch (type) { - case SENSORS_ACTIVE: - if (c) { - if(!status(SENSORS_ACTIVE)) { - timer_set(&debouncetimer, 0); - enable_irq_kbi(4); - } - } else { - disable_irq_kbi(4); - } - return 1; - } - return 0; -} - -static int -status(int type) -{ - switch (type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return bit_is_set(*CRM_WU_CNTL, 20); /* check if kbi4 irq is enabled */ - } - return 0; -} - -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/platform/redbee-econotag/contiki-conf.h b/platform/redbee-econotag/contiki-conf.h deleted file mode 100644 index 5cd8295dc..000000000 --- a/platform/redbee-econotag/contiki-conf.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2010, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - */ - -/** - * \file - * Configuration for MC1322x hobby board based on - * Configuration for sample STK 501 Contiki kernel - * - * \author - * Originial by: - * Simon Barner - */ - -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#include - -#define PLATFORM_NAME "Econotag" -#define PLATFORM_TYPE MC1322X -/* mc1322x files */ -#include "contiki-mc1322x-conf.h" -/* this is from cpu/mc1322x/board */ -#include "redbee-econotag.h" - -/* Clock ticks per second */ -#define CLOCK_CONF_SECOND 100 -/* set to 1 to toggle the green led ever second */ -/* FIXME setting this will break the sensor button (and other gpio) */ -/* since leds_arch hits the entire gpio_data */ -#define BLINK_SECONDS 0 -/* Set to 1 to sample an ADC channel every second, 9 second refresh */ -/* Set >1 to sample an ADC channel every tick, 90 msec refresh */ -#define CLOCK_CONF_SAMPLEADC 1 - -#define CCIF -#define CLIF - -/* Baud rate */ -#define BRMOD 9999 -/* 230400 bps, INC=767, MOD=9999, 24Mhz 16x samp */ -/* 115200 bps, INC=767, MOD=9999, 24Mhz 8x samp */ -#define BRINC 767 -/* 921600 bps, MOD=9999, 24Mhz 16x samp */ -//#define BRINC 3071 -#define SAMP UCON_SAMP_8X -//#define SAMP UCON_SAMP_16X - -#define CONSOLE_UART UART1 -#define CONSOLE_BAUD 115200 - -//#define uart_init uart1_init -#define dbg_putchar(x) uart1_putc(x) - -#define USE_FORMATTED_STDIO 1 -#define MACA_DEBUG 0 -#define CONTIKI_MACA_RAW_MODE 0 -#define USE_32KHZ_XTAL 0 - -#define BLOCKING_TX 1 -#define MACA_AUTOACK 1 -#define NULLRDC_CONF_802154_AUTOACK_HW 1 - -#define USE_WDT 0 - -#ifndef WDT_TIMEOUT -#define WDT_TIMEOUT 5000 /* watchdog timeout in ms */ -#endif - -/* end of mc1322x specific config. */ - -/* start of conitki config. */ -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 1 - -/* Core rtimer.h defaults to 16 bit timer unless RTIMER_CLOCK_LT is defined */ -typedef unsigned long rtimer_clock_t; -#define RTIMER_CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0) - -#define RIMEADDR_CONF_SIZE 8 - -/* EUI64 generation */ -/* Organizationally Unique Identifier */ -#define OUI 0xacde48 /* if IAB is defined then OUI = 0x0050C2 */ -#define IAB 0xA8C /* IAB 0xA8C for use on Redwire products only */ -//#undef IAB /* do not define an IAB if you are using a full OUI */ -//#define EXT_ID 0xdef123 /* lower 12-bits used if IAB is defined */ -#undef EXT_ID /* if an extention id is not defined then one will be generated randomly */ - -#define FLASH_BLANK_ADDR /* if defined then the generated rime address will flashed */ - -#if WITH_UIP6 -/* Network setup for IPv6 */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver -#define NETSTACK_CONF_MAC nullmac_driver -/*#define NETSTACK_CONF_RDC contikimac_driver*/ /* contikimac for redbee hasn't been well tested */ -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_RADIO contiki_maca_driver -#define NETSTACK_CONF_FRAMER framer_802154 - -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 -#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 -#define CXMAC_CONF_ANNOUNCEMENTS 0 -#define XMAC_CONF_ANNOUNCEMENTS 0 - -#else /* WITH_UIP6 */ -/* Network setup for non-IPv6 (rime). */ - -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_MAC csma_driver -#define NETSTACK_CONF_RDC sicslowmac_driver -#define NETSTACK_CONF_RADIO contiki_maca_driver -#define NETSTACK_CONF_FRAMER framer_802154 - -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 - -#define COLLECT_CONF_ANNOUNCEMENTS 1 -#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 -#define CXMAC_CONF_ANNOUNCEMENTS 0 -#define XMAC_CONF_ANNOUNCEMENTS 0 -#define CONTIKIMAC_CONF_ANNOUNCEMENTS 0 - -#define CONTIKIMAC_CONF_COMPOWER 0 -#define XMAC_CONF_COMPOWER 0 -#define CXMAC_CONF_COMPOWER 0 - -#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 - -#endif /* WITH_UIP6 */ - -#define QUEUEBUF_CONF_NUM 16 - -#define PACKETBUF_CONF_ATTRS_INLINE 1 - -#ifndef RF_CHANNEL -#define RF_CHANNEL 26 -#endif /* RF_CHANNEL */ - -#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0 - -#define IEEE802154_CONF_PANID 0xABCD - -#define PROFILE_CONF_ON 0 -#define ENERGEST_CONF_ON 0 - -#define AODV_COMPLIANCE -#define AODV_NUM_RT_ENTRIES 32 - -#define WITH_ASCII 1 - -#define PROCESS_CONF_NUMEVENTS 8 -#define PROCESS_CONF_STATS 1 - -#ifdef WITH_UIP6 - -#define RIMEADDR_CONF_SIZE 8 - -#define UIP_CONF_LL_802154 1 -#define UIP_CONF_LLH_LEN 0 - -#define UIP_CONF_ROUTER 1 -#define UIP_CONF_IPV6_RPL 1 - -#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 -#define UIP_CONF_MAX_ROUTES 30 - -#define UIP_CONF_ND6_SEND_RA 0 -#define UIP_CONF_ND6_REACHABLE_TIME 600000 -#define UIP_CONF_ND6_RETRANS_TIMER 10000 - -#define UIP_CONF_IPV6 1 -#define UIP_CONF_IPV6_QUEUE_PKT 0 -#define UIP_CONF_IPV6_CHECKS 1 -#define UIP_CONF_IPV6_REASSEMBLY 0 -#define UIP_CONF_NETIF_MAX_ADDRESSES 3 -#define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define UIP_CONF_IP_FORWARD 0 -#define UIP_CONF_BUFFER_SIZE 1300 -#define SICSLOWPAN_CONF_FRAG 1 -#define SICSLOWPAN_CONF_MAXAGE 8 - -#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 -#define SICSLOWPAN_CONF_COMPRESSION_HC1 1 -#define SICSLOWPAN_CONF_COMPRESSION_HC01 2 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#ifndef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 1 -#define SICSLOWPAN_CONF_MAXAGE 8 -#endif /* SICSLOWPAN_CONF_FRAG */ -#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 -#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ -#define UIP_CONF_IP_FORWARD 1 -#define UIP_CONF_BUFFER_SIZE 1300 -#endif /* WITH_UIP6 */ - -#define UIP_CONF_ICMP_DEST_UNREACH 1 - -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_RECEIVE_WINDOW 300 -#define UIP_CONF_TCP_MSS 48 -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 8 -#define UIP_CONF_UDP_CONNS 12 -#define UIP_CONF_FWCACHE_SIZE 30 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 - -#define UIP_CONF_TCP_SPLIT 0 - -/* include the project config */ -/* PROJECT_CONF_H might be defined in the project Makefile */ -#ifdef PROJECT_CONF_H -#include PROJECT_CONF_H -#endif /* PROJECT_CONF_H */ - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/redbee-econotag/contiki-mc1322x-main.c b/platform/redbee-econotag/contiki-mc1322x-main.c deleted file mode 100644 index e4c9c842b..000000000 --- a/platform/redbee-econotag/contiki-mc1322x-main.c +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright (c) 2010, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - */ - -#include -#include -#include - -#include "contiki.h" - -#include "dev/leds.h" -#include "dev/serial-line.h" -#include "dev/slip.h" -#include "dev/xmem.h" -#include "dev/button-sensor.h" -#include "lib/random.h" -#include "net/netstack.h" -#include "net/mac/frame802154.h" -#include "lib/include/mc1322x.h" - -#if WITH_UIP6 -#include "net/sicslowpan.h" -#include "net/uip-ds6.h" -#include "net/mac/sicslowmac.h" -#endif /* WITH_UIP6 */ - -#include "net/rime.h" - -#include "sys/autostart.h" - -/* from libmc1322x */ -#include "mc1322x.h" -#include "default_lowlevel.h" -#include "contiki-maca.h" -#include "contiki-uart.h" - -/* Get periodic prints from idle loop, from clock seconds or rtimer interrupts */ -/* Use of rtimer will conflict with other rtimer interrupts such as contikimac radio cycling */ -#define PERIODICPRINTS 0 -#if PERIODICPRINTS -//#define PINGS 64 -#define ROUTES 300 -#define STAMPS 60 -#define STACKMONITOR 600 -//#define HEAPMONITOR 60 -uint16_t clocktime; -#define TESTRTIMER 0 -#if TESTRTIMER -uint8_t rtimerflag=1; -struct rtimer rt; -void rtimercycle(void) {rtimerflag=1;} -#endif -#endif - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) -#define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x ",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) -#else -#define PRINTF(...) -#define PRINT6ADDR(addr) -#define PRINTLLADDR(addr) -#endif - -#ifndef RIMEADDR_NVM -#define RIMEADDR_NVM 0x1E000 -#endif - -#ifndef RIMEADDR_NBYTES -#define RIMEADDR_NBYTES 8 -#endif - -#if UIP_CONF_ROUTER - -#ifndef UIP_ROUTER_MODULE -#ifdef UIP_CONF_ROUTER_MODULE -#define UIP_ROUTER_MODULE UIP_CONF_ROUTER_MODULE -#else /* UIP_CONF_ROUTER_MODULE */ -#define UIP_ROUTER_MODULE rimeroute -#endif /* UIP_CONF_ROUTER_MODULE */ -#endif /* UIP_ROUTER_MODULE */ - -extern const struct uip_router UIP_ROUTER_MODULE; - -#endif /* UIP_CONF_ROUTER */ - -#if DCOSYNCH_CONF_ENABLED -static struct timer mgt_timer; -#endif - -#ifndef WITH_UIP -#define WITH_UIP 0 -#endif - -#if WITH_UIP -#include "net/uip.h" -#include "net/uip-fw.h" -#include "net/uip-fw-drv.h" -#include "net/uip-over-mesh.h" -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(192,168,1,2, 255,255,255,255, slip_send)}; -static struct uip_fw_netif meshif = - {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; - -#endif /* WITH_UIP */ - -#define UIP_OVER_MESH_CHANNEL 8 -#if WITH_UIP -static uint8_t is_gateway; -#endif /* WITH_UIP */ - -/*---------------------------------------------------------------------------*/ -void uip_log(char *msg) { printf("%c",msg); } -/*---------------------------------------------------------------------------*/ -#ifndef RF_CHANNEL -#define RF_CHANNEL 26 -#endif -/*---------------------------------------------------------------------------*/ -#if WITH_UIP -static void -set_gateway(void) -{ - if(!is_gateway) { - leds_on(LEDS_RED); - printf("%d.%d: making myself the IP network gateway.\n\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); - printf("IPv4 address of the gateway: %d.%d.%d.%d\n\n", - uip_ipaddr_to_quad(&uip_hostaddr)); - uip_over_mesh_set_gateway(&rimeaddr_node_addr); - uip_over_mesh_make_announced_gateway(); - is_gateway = 1; - } -} -#endif /* WITH_UIP */ -/*---------------------------------------------------------------------------*/ -static void -print_processes(struct process * const processes[]) -{ - /* const struct process * const * p = processes;*/ - printf("Starting"); - while(*processes != NULL) { - printf(" '%s'", (*processes)->name); - processes++; - } - printf("\n"); -} -/*--------------------------------------------------------------------------*/ - -SENSORS(&button_sensor); - -void -init_lowlevel(void) -{ - /* button init */ - /* set up kbi */ - enable_irq_kbi(4); - kbi_edge(4); - enable_ext_wu(4); -// kbi_pol_neg(7); -// kbi_pol_pos(7); -// gpio_sel0_pullup(29); -// gpio_pu0_disable(29); - - trim_xtal(); - - /* uart init */ - uart_init(UART1, 115200); - - default_vreg_init(); - - maca_init(); - - set_channel(RF_CHANNEL - 11); /* channel 11 */ - set_power(0x12); /* 0x12 is the highest, not documented */ - - enable_irq(CRM); - -#if USE_32KHZ_XTAL - enable_32khz_xtal(); -#else - cal_ring_osc(); -#endif - -#if USE_32KHZ_XTAL - *CRM_RTC_TIMEOUT = 32768 * 10; -#else - *CRM_RTC_TIMEOUT = cal_rtc_secs * 10; -#endif - -#if (USE_WDT == 1) - /* set the watchdog timer timeout to 1 sec */ - cop_timeout_ms(WDT_TIMEOUT); - /* enable the watchdog timer */ - CRM->COP_CNTLbits.COP_EN = 1; -#endif - - /* XXX debug */ - /* trigger periodic rtc int */ -// clear_rtc_wu_evt(); -// enable_rtc_wu(); -// enable_rtc_wu_irq(); -} - -#if RIMEADDR_SIZE == 1 -const rimeaddr_t addr_ff = { { 0xff } }; -#else /*RIMEADDR_SIZE == 2*/ -#if RIMEADDR_SIZE == 2 -const rimeaddr_t addr_ff = { { 0xff, 0xff } }; -#else /*RIMEADDR_SIZE == 2*/ -#if RIMEADDR_SIZE == 8 -const rimeaddr_t addr_ff = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; -#endif /*RIMEADDR_SIZE == 8*/ -#endif /*RIMEADDR_SIZE == 2*/ -#endif /*RIMEADDR_SIZE == 1*/ - -void iab_to_eui64(rimeaddr_t *eui64, uint32_t oui, uint16_t iab, uint32_t ext) { - /* OUI for IABs */ - eui64->u8[0] = 0x00; - eui64->u8[1] = 0x50; - eui64->u8[2] = 0xc2; - - /* IAB */ - eui64->u8[3] = (iab >> 4) & 0xff; - eui64->u8[4] = (iab << 4) & 0xf0; - - /* EXT */ - - eui64->u8[4] |= (ext >> 24) & 0xf; - eui64->u8[5] = (ext >> 16) & 0xff; - eui64->u8[6] = (ext >> 8) & 0xff; - eui64->u8[7] = ext & 0xff; -} - -void oui_to_eui64(rimeaddr_t *eui64, uint32_t oui, uint64_t ext) { - /* OUI */ - eui64->u8[0] = (oui >> 16) & 0xff; - eui64->u8[1] = (oui >> 8) & 0xff; - eui64->u8[2] = oui & 0xff; - - /* EXT */ - eui64->u8[3] = (ext >> 32) & 0xff; - eui64->u8[4] = (ext >> 24) & 0xff; - eui64->u8[5] = (ext >> 16) & 0xff; - eui64->u8[6] = (ext >> 8) & 0xff; - eui64->u8[7] = ext & 0xff; -} - -extern unsigned short node_id; - -void -set_rimeaddr(rimeaddr_t *addr) -{ - nvmType_t type=0; - nvmErr_t err; - volatile uint8_t buf[RIMEADDR_NBYTES]; - rimeaddr_t eui64; - int i; - - err = nvm_detect(gNvmInternalInterface_c, &type); - - err = nvm_read(gNvmInternalInterface_c, type, (uint8_t *)buf, RIMEADDR_NVM, RIMEADDR_NBYTES); - - rimeaddr_copy(addr,&rimeaddr_null); - - for(i=0; iu8[i] = buf[i]; - } - - if (memcmp(addr, &addr_ff, RIMEADDR_CONF_SIZE)==0) { - - //set addr to EUI64 -#ifdef IAB - #ifdef EXT_ID - PRINTF("address in flash blank, setting to defined IAB and extension.\n\r"); - iab_to_eui64(&eui64, OUI, IAB, EXT_ID); - #else /* ifdef EXT_ID */ - PRINTF("address in flash blank, setting to defined IAB with a random extension.\n\r"); - iab_to_eui64(&eui64, OUI, IAB, *MACA_RANDOM); - #endif /* ifdef EXT_ID */ - -#else /* ifdef IAB */ - - #ifdef EXT_ID - PRINTF("address in flash blank, setting to defined OUI and extension.\n\r"); - oui_to_eui64(&eui64, OUI, EXT_ID); - #else /*ifdef EXT_ID */ - PRINTF("address in flash blank, setting to defined OUI with a random extension.\n\r"); - oui_to_eui64(&eui64, OUI, ((*MACA_RANDOM << 32) | *MACA_RANDOM)); - #endif /*endif EXTID */ - -#endif /* ifdef IAB */ - - rimeaddr_copy(addr, &eui64); -#ifdef FLASH_BLANK_ADDR - PRINTF("flashing blank address\n\r"); - err = nvm_write(gNvmInternalInterface_c, type, &(eui64.u8), RIMEADDR_NVM, RIMEADDR_NBYTES); -#endif /* ifdef FLASH_BLANK_ADDR */ - } else { - PRINTF("loading rime address from flash.\n\r"); - } - - node_id = (addr->u8[6] << 8 | addr->u8[7]); - rimeaddr_set_node_addr(addr); -} - -int -main(void) -{ - volatile uint32_t i; - rimeaddr_t addr; - - /* Initialize hardware and */ - /* go into user mode */ - init_lowlevel(); - -#if STACKMONITOR - /* Simple stack pointer highwater monitor. Checks for magic numbers in the main - * loop. In conjuction with PERIODICPRINTS, never-used stack will be printed - * every STACKMONITOR seconds. - */ -{ -extern uint32_t __und_stack_top__, __sys_stack_top__; -uint32_t p=(uint32_t)&__und_stack_top__; - do { - *(uint32_t *)p = 0x42424242; - p+=16; - } while (p<(uint32_t)&__sys_stack_top__-100); //don't overwrite our own stack -} -#endif -#if HEAPMONITOR - /* Simple heap pointer highwater monitor. Checks for magic numbers in the main - * loop. In conjuction with PERIODICPRINTS, never-used heap will be printed - * every HEAPMONITOR seconds. - * This routine assumes a linear FIFO heap as used by the printf _sbrk call. - */ -{ -extern uint32_t __heap_start__, __heap_end__; -uint32_t p=(uint32_t)&__heap_end__-4; - do { - *(uint32_t *)p = 0x42424242; - p-=4; - } while (p>=(uint32_t)&__heap_start__); -} -#endif - - /* Clock */ - clock_init(); - - /* LED driver */ - leds_init(); - - /* control TX_ON with the radio */ - GPIO->FUNC_SEL.GPIO_44 = 2; - GPIO->PAD_DIR.GPIO_44 = 1; - - /* Process subsystem */ - process_init(); - process_start(&etimer_process, NULL); - process_start(&contiki_maca_process, NULL); - - ctimer_init(); - - set_rimeaddr(&addr); - - printf("Rime started with address "); - for(i = 0; i < sizeof(addr.u8) - 1; i++) { - printf("%02X:", addr.u8[i]); - } - printf("%02X\n", addr.u8[i]); - - -#if WITH_UIP6 - memcpy(&uip_lladdr.addr, &addr.u8, sizeof(uip_lladdr.addr)); - /* Setup nullmac-like MAC for 802.15.4 */ -/* sicslowpan_init(sicslowmac_init(&cc2420_driver)); */ -/* printf(" %s channel %u\n", sicslowmac_driver.name, RF_CHANNEL); */ - - /* Setup X-MAC for 802.15.4 */ - queuebuf_init(); - NETSTACK_RDC.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); - - printf("%s %s, channel check rate %lu Hz, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: - NETSTACK_RDC.channel_check_interval()), - RF_CHANNEL); - - process_start(&tcpip_process, NULL); - - printf("Tentative link-local IPv6 address "); - { - int i, a; - for(a = 0; a < UIP_DS6_ADDR_NB; a++) { - if (uip_ds6_if.addr_list[a].isused) { - for(i = 0; i < 7; ++i) { - printf("%02x%02x:", - uip_ds6_if.addr_list[a].ipaddr.u8[i * 2], - uip_ds6_if.addr_list[a].ipaddr.u8[i * 2 + 1]); - } - printf("%02x%02x\n", - uip_ds6_if.addr_list[a].ipaddr.u8[14], - uip_ds6_if.addr_list[a].ipaddr.u8[15]); - } - } - } - - if(1) { - uip_ipaddr_t ipaddr; - int i; - uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); - uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); - uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE); - printf("Tentative global IPv6 address "); - for(i = 0; i < 7; ++i) { - printf("%02x%02x:", - ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]); - } - printf("%02x%02x\n", - ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]); - } - - -#else /* WITH_UIP6 */ - - NETSTACK_RDC.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); - - printf("%s %s, channel check rate %lu Hz, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1: - NETSTACK_RDC.channel_check_interval()), - RF_CHANNEL); -#endif /* WITH_UIP6 */ - - *MACA_MACPANID = 0xcdab; /* this is the hardcoded contiki pan, register is PACKET order */ - *MACA_MAC16ADDR = 0xffff; /* short addressing isn't used, set this to 0xffff for now */ - - *MACA_MAC64HI = - addr.u8[0] << 24 | - addr.u8[1] << 16 | - addr.u8[2] << 8 | - addr.u8[3]; - *MACA_MAC64LO = - addr.u8[4] << 24 | - addr.u8[5] << 16 | - addr.u8[6] << 8 | - addr.u8[7]; - PRINTF("setting panid 0x%04x\n\r", *MACA_MACPANID); - PRINTF("setting short mac 0x%04x\n\r", *MACA_MAC16ADDR); - PRINTF("setting long mac 0x%08x_%08x\n\r", *MACA_MAC64HI, *MACA_MAC64LO); - -#if MACA_AUTOACK - set_prm_mode(AUTOACK); -#endif - -#if TIMESYNCH_CONF_ENABLED - timesynch_init(); - timesynch_set_authority_level(rimeaddr_node_addr.u8[0]); -#endif /* TIMESYNCH_CONF_ENABLED */ - -#if WITH_UIP - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ - process_start(&slip_process, NULL); - - slip_set_input_callback(set_gateway); - - { - uip_ipaddr_t hostaddr, netmask; - - uip_init(); - - uip_ipaddr(&hostaddr, 172,16, - rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); - uip_ipaddr(&netmask, 255,255,0,0); - uip_ipaddr_copy(&meshif.ipaddr, &hostaddr); - - uip_sethostaddr(&hostaddr); - uip_setnetmask(&netmask); - uip_over_mesh_set_net(&hostaddr, &netmask); - /* uip_fw_register(&slipif);*/ - uip_over_mesh_set_gateway_netif(&slipif); - uip_fw_default(&meshif); - uip_over_mesh_init(UIP_OVER_MESH_CHANNEL); - printf("uIP started with IP address %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&hostaddr)); - } -#endif /* WITH_UIP */ - - process_start(&sensors_process, NULL); - - print_processes(autostart_processes); - autostart_start(autostart_processes); - - /* Main scheduler loop */ - while(1) { - check_maca(); - -#if (USE_WDT == 1) - cop_service(); -#endif - - if(uart1_input_handler != NULL) { - if(uart1_can_get()) { - uart1_input_handler(uart1_getc()); - } - } - - process_run(); - -#if PERIODICPRINTS -#if TESTRTIMER -/* Timeout can be increased up to 8 seconds maximum. - * A one second cycle is convenient for triggering the various debug printouts. - * The triggers are staggered to avoid printing everything at once. - */ - if (rtimerflag) { - rtimer_set(&rt, RTIMER_NOW()+ RTIMER_ARCH_SECOND*1UL, 1,(void *) rtimercycle, NULL); - rtimerflag=0; -#else - if (clocktime!=clock_seconds()) { - clocktime=clock_seconds(); -#endif - -#if STAMPS -if ((clocktime%STAMPS)==0) { -#if ENERGEST_CONF_ON -#include "lib/print-stats.h" - print_stats(); -#elif RADIOSTATS -extern volatile unsigned long radioontime; - printf("\r%u(%u)s ",clocktime,radioontime); -#else - printf("%us\n",clocktime); -#endif - -} -#endif -#if TESTRTIMER - clocktime+=1; -#endif - -#if PINGS && UIP_CONF_IPV6 -extern void raven_ping6(void); -if ((clocktime%PINGS)==1) { - printf("**Ping\n"); - raven_ping6(); -} -#endif - -#if ROUTES && UIP_CONF_IPV6 -if ((clocktime%ROUTES)==2) { - -extern uip_ds6_netif_t uip_ds6_if; - - uint8_t i,j; - printf("\nAddresses [%u max]\n",UIP_DS6_ADDR_NB); - for (i=0;iipaddr); - printf("\n"); - j=0; - } - if (j) printf(" "); - PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); - { - uip_ds6_route_t *r; - PRINTF("\nRoutes [%u max]\n",UIP_DS6_ROUTE_NB); - j = 1; - for(r = uip_ds6_route_head(); - r != NULL; - r = uip_ds6_route_next(r)) { - ipaddr_add(&r->ipaddr); - PRINTF("/%u (via ", r->length); - ipaddr_add(uip_ds6_route_nexthop(r)); - PRINTF(") %lus\n", r->state.lifetime); - j = 0; - } - } - if (j) printf(" "); - printf("\n---------\n"); -} -#endif - -#if STACKMONITOR -if ((clocktime%STACKMONITOR)==3) { -extern uint32_t __und_stack_top__, __sys_stack_top__; -uint32_t p=(uint32_t)&__und_stack_top__; - do { - if (*(uint32_t *)p != 0x42424242) { - printf("Never-Used stack > %d bytes\n",p-(uint32_t)&__und_stack_top__); - break; - } - p+=16; - } while (p<(uint32_t)&__sys_stack_top__-100); -} -#endif -#if HEAPMONITOR -if ((clocktime%HEAPMONITOR)==4) { -extern uint32_t __heap_start__, __heap_end__; -uint32_t p=(uint32_t)&__heap_end__-4; - do { - if (*(uint32_t *)p != 0x42424242) { - break; - } - p-=4; - } while (p>=(uint32_t)&__heap_start__); - printf("Never-used heap >= %d bytes\n",(uint32_t)&__heap_end__-p-4); -#if 0 -#include -char *ptr=malloc(1); //allocates 16 bytes from the heap -printf("********Got pointer %x\n",ptr); -#endif -} -#endif - - } -#endif /* PERIODICPRINTS */ - } - - return 0; -} - -/*---------------------------------------------------------------------------*/ -#if LOG_CONF_ENABLED -void -log_message(char *m1, char *m2) -{ - printf("%s%s\n", m1, m2); -} -#endif /* LOG_CONF_ENABLED */ diff --git a/platform/redbee-econotag/dev/light-sensor.c b/platform/redbee-econotag/dev/light-sensor.c deleted file mode 100644 index 72994fd6a..000000000 --- a/platform/redbee-econotag/dev/light-sensor.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011, Mariano Alvira and other contributors - * to the MC1322x project (http://mc1322x.devl.org) and Contiki. - * - * Copyright (c) 2005-2010, 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. 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 file is part of the Contiki operating system. - * - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/light-sensor.h" - -#include - -/* Photodiode 1 (P64) on INCH_4 */ -/* Photodiode 2 (P65) on INCH_5 */ -#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5)) -#define INPUT_REFERENCE SREF_0 -#define PHOTOSYNTHETIC_MEM ADC12MEM4 -#define TOTAL_SOLAR_MEM ADC12MEM5 - -const struct sensors_sensor light_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(light_sensor, "Light", value, configure, status); diff --git a/platform/redbee-econotag/dev/light-sensor.h b/platform/redbee-econotag/dev/light-sensor.h deleted file mode 100644 index 52ade2767..000000000 --- a/platform/redbee-econotag/dev/light-sensor.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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. - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - */ - -#ifndef __LIGHT_SENSOR_H__ -#define __LIGHT_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor light_sensor; - -#define LIGHT_SENSOR_PHOTOSYNTHETIC 0 -#define LIGHT_SENSOR_TOTAL_SOLAR 1 - - -#endif /* __LIGHT-SENSOR_H__ */ diff --git a/platform/redbee-econotag/dev/tmp102-sensor.c b/platform/redbee-econotag/dev/tmp102-sensor.c deleted file mode 100644 index 53f0452a4..000000000 --- a/platform/redbee-econotag/dev/tmp102-sensor.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * An interface to the TI TMP102 temperature sensor - * 12 bit temperature reading, 0.5 deg. Celsius accuracy - * ----------------------------------------------------------------- - * - * Author : Hedde Bosman (heddebosman@incas3.eu) - */ - -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/tmp102-sensor.h" - -#ifndef bool -#define bool uint8_t -#endif - -#ifndef false -#define false 0 -#endif - -#ifndef true -#define true 1 -#endif - - -static void set_configuration(uint8_t rate, bool precision) { - uint8_t tx_buf[] = {TMP102_REGISTER_CONFIGURATION, - 0, - (precision ? TMP102_CONF_EXTENDED_MODE : 0) | ((rate << 6) & TMP102_CONF_CONVERSION_RATE) - }; - - i2c_transmitinit(TMP102_ADDR, 3, tx_buf); -} - -/*---------------------------------------------------------------------------*/ -static int value(int type) { - uint8_t reg = TMP102_REGISTER_TEMPERATURE; - uint8_t temp[2]; - int16_t temperature = 0; - - /* transmit the register to start reading from */ - i2c_transmitinit(TMP102_ADDR, 1, ®); - while (!i2c_transferred()); // wait for data to arrive - - /* receive the data */ - i2c_receiveinit(TMP102_ADDR, 2, temp); - while (!i2c_transferred()); // wait for data to arrive - - // 12 bit normal mode - temperature = ((temp[0] <<8) | (temp[1])) >> 4; // lsb - - // 13 bit extended mode - //temperature = ((temp[0] <<8) | (temp[1])) >> 3; // lsb - - temperature = (100*temperature)/16; // in 100th of degrees - - return temperature; -} -/*---------------------------------------------------------------------------*/ -static int status(int type) { - switch (type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return 1; // fix? - break; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int configure(int type, int c) { - switch (type) { - case SENSORS_ACTIVE: - if (c) { - // set active - set_configuration(1, false); // every 1 second, 12bit precision - } else { - // set inactive - } - return 1; - } - return 0; -} - - -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(tmp102_sensor, "Temperature", value, configure, status); // register the functions - diff --git a/platform/redbee-econotag/dev/tmp102-sensor.h b/platform/redbee-econotag/dev/tmp102-sensor.h deleted file mode 100644 index 6d5bd2140..000000000 --- a/platform/redbee-econotag/dev/tmp102-sensor.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * An interface to the TI TMP102 temperature sensor - * 12 bit temperature reading, 0.5 deg. Celsius accuracy - * ----------------------------------------------------------------- - * - * Author : Hedde Bosman (heddebosman@incas3.eu) - */ - -#ifndef __TMP102_SENSOR_H__ -#define __TMP102_SENSOR_H__ - -#include "i2c.h" - -#include "lib/sensors.h" - -extern const struct sensors_sensor tmp102_sensor; - -#define TMP102_VALUE_TYPE_DEFAULT 0 - -#define TMP102_ADDR 0x48 // if A0 @ ground -//#define TMP102_ADDR 0x49 // if A0 @ V+ -//#define TMP102_ADDR 0x4A // if A0 @ SDA -//#define TMP102_ADDR 0x4B // if A0 @ SCL - -#define TMP102_REGISTER_TEMPERATURE 0x00 -#define TMP102_REGISTER_CONFIGURATION 0x01 -#define TMP102_REGISTERO_T_LOW 0x02 -#define TMP102_REGISTERO_T_HIGH 0x03 - - -#define TMP102_CONF_EXTENDED_MODE 0x10 -#define TMP102_CONF_ALERT 0x20 -#define TMP102_CONF_CONVERSION_RATE 0xC0 // 2 bits indicating conversion rate (0.25, 1, 4, 8 Hz) - -#define TMP102_CONF_SHUTDOWN_MODE 0x01 -#define TMP102_CONF_THERMOSTAT_MODE 0x02 // 0 = comparator mode, 1 = interrupt mode -#define TMP102_CONF_POLARITY 0x04 -#define TMP102_CONF_FAULT_QUEUE 0x18 // 2 bits indicating number of faults -#define TMP102_CONF_RESOLUTION 0x60 // 2 bits indicating resolution, default = b11 = 0x60 -#define TMP102_CONF_ONESHOT_READY 0x80 // - - -#endif - diff --git a/platform/seedeye/dev/mrf24j40/mrf24j40.h b/platform/seedeye/dev/mrf24j40/mrf24j40.h index 52b727891..34ea55594 100644 --- a/platform/seedeye/dev/mrf24j40/mrf24j40.h +++ b/platform/seedeye/dev/mrf24j40/mrf24j40.h @@ -47,8 +47,8 @@ * \date 2012-03-21 */ -#ifndef __MRF24J40_H__ -#define __MRF24J40_H__ +#ifndef MRF24J40_H_ +#define MRF24J40_H_ #include #include @@ -223,6 +223,6 @@ typedef union _INT_status { } bits; } INT_status; -#endif /* __MRF24J40_H__ */ +#endif /* MRF24J40_H_ */ /** @} */ diff --git a/platform/seedeye/dev/mrf24j40/mrf24j40_arch.h b/platform/seedeye/dev/mrf24j40/mrf24j40_arch.h index 8a3cda91d..04bd4c87c 100644 --- a/platform/seedeye/dev/mrf24j40/mrf24j40_arch.h +++ b/platform/seedeye/dev/mrf24j40/mrf24j40_arch.h @@ -47,8 +47,8 @@ * \date 2012-03-21 */ -#ifndef __MRF24J40_ARCH_H__ -#define __MRF24J40_ARCH_H__ +#ifndef MRF24J40_ARCH_H_ +#define MRF24J40_ARCH_H_ #include "p32xxxx.h" @@ -123,6 +123,6 @@ do { \ MRF24J40_INTERRUPT_ENABLE_SET(); \ } while(0) -#endif /* __MRF24J40_ARCH_H__ */ +#endif /* MRF24J40_ARCH_H_ */ /** @} */ diff --git a/platform/seedeye/init-net.h b/platform/seedeye/init-net.h index 8f9bcbb27..b217aa218 100644 --- a/platform/seedeye/init-net.h +++ b/platform/seedeye/init-net.h @@ -47,13 +47,13 @@ * \date 2012-03-25 */ -#ifndef __INIT_NET_H__ -#define __INIT_NET_H__ +#ifndef INIT_NET_H_ +#define INIT_NET_H_ #include void init_net(uint8_t ); -#endif /* __INIT_NET_H__ */ +#endif /* INIT_NET_H_ */ /** @} */ diff --git a/platform/seedeye/platform-conf.h b/platform/seedeye/platform-conf.h index d78fc51e1..c33d500b3 100644 --- a/platform/seedeye/platform-conf.h +++ b/platform/seedeye/platform-conf.h @@ -40,8 +40,8 @@ * \date 2012-06-06 */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ #ifndef SEEDEYE_ID #define SEEDEYE_ID 1 @@ -61,4 +61,4 @@ #define CLOCK_CONF_SECOND 1024 -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/sensinode/Makefile.sensinode b/platform/sensinode/Makefile.sensinode index 743a51349..d37dafdd8 100644 --- a/platform/sensinode/Makefile.sensinode +++ b/platform/sensinode/Makefile.sensinode @@ -47,7 +47,6 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CLEAN += *.sensinode ifeq ($(UIP_CONF_IPV6),1) - CFLAGS += -DUIP_CONF_IPV6=1 ifeq ($(OFFSET_FIRMWARE),1) CFLAGS += -DDISCO_ENABLED=1 CONTIKI_TARGET_SOURCEFILES += disco.c diff --git a/platform/sensinode/contiki-conf.h b/platform/sensinode/contiki-conf.h index f3a2a468e..97231b90f 100644 --- a/platform/sensinode/contiki-conf.h +++ b/platform/sensinode/contiki-conf.h @@ -1,5 +1,5 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include "8051def.h" #include "sys/cc.h" @@ -283,4 +283,4 @@ #define UIP_CONF_DS6_AADDR_NBU 1 #endif -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/sensinode/dev/button-sensor.h b/platform/sensinode/dev/button-sensor.h index df3ee6e19..97a185223 100644 --- a/platform/sensinode/dev/button-sensor.h +++ b/platform/sensinode/dev/button-sensor.h @@ -40,9 +40,9 @@ * George Oikonomou - */ -#ifndef __BUTTON_SENSOR_H__ -#define __BUTTON_SENSOR_H__ +#ifndef BUTTON_SENSOR_H_ +#define BUTTON_SENSOR_H_ #include "dev/sensinode-sensors.h" -#endif /* __BUTTON_SENSOR_H__ */ +#endif /* BUTTON_SENSOR_H_ */ diff --git a/platform/sensinode/dev/models.h b/platform/sensinode/dev/models.h index 500932b17..6cf4916f4 100644 --- a/platform/sensinode/dev/models.h +++ b/platform/sensinode/dev/models.h @@ -1,5 +1,5 @@ -#ifndef __MODELS_H__ -#define __MODELS_H__ +#ifndef MODELS_H_ +#define MODELS_H_ /* Define model text */ #ifdef MODEL_N100 @@ -57,4 +57,4 @@ /* Model-Specific startup functions */ void model_init(); void model_uart_intr_en(); -#endif /* __MODELS_H__ */ +#endif /* MODELS_H_ */ diff --git a/platform/sentilla-usb/Makefile.sentilla-usb b/platform/sentilla-usb/Makefile.sentilla-usb deleted file mode 100644 index c766dd8aa..000000000 --- a/platform/sentilla-usb/Makefile.sentilla-usb +++ /dev/null @@ -1,16 +0,0 @@ -# Use custom platform configuration -CFLAGS += -DPLATFORM_CONF_H=\"platform-sentilla-usb-conf.h\" - -# Some drivers such as ds2411.c only compile under platform sky -CFLAGS += -DCONTIKI_TARGET_SKY - -CONTIKI_TARGET_SOURCEFILES += contiki-sentilla-usb-platform.c \ - battery-sensor.c radio-sensor.c temperature-sensor.c - -include $(CONTIKI)/platform/sky/Makefile.common - -ifneq ($(TMOTE_BSL), 1) - ${warning No $(TMOTE_BSL_FILE) command for jcreate/sentilla-usb found. Please install this command in $(CONTIKI)/tools/sky} -endif - -CONTIKI_TARGET_DIRS += ${addprefix ../sky/,. dev apps} diff --git a/platform/sentilla-usb/contiki-sentilla-usb-platform.c b/platform/sentilla-usb/contiki-sentilla-usb-platform.c deleted file mode 100644 index f5ee8c134..000000000 --- a/platform/sentilla-usb/contiki-sentilla-usb-platform.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Platform setup for the sentilla usb platform - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "dev/radio-sensor.h" - -SENSORS(&radio_sensor); - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/platform/sentilla-usb/platform-sentilla-usb-conf.h b/platform/sentilla-usb/platform-sentilla-usb-conf.h deleted file mode 100644 index 579c654a3..000000000 --- a/platform/sentilla-usb/platform-sentilla-usb-conf.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2011, 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. 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. - */ - -/** - * \file - * Platform configuration for the Sentilla USB - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ -/* Platform TMOTE_SKY */ -#define TMOTE_SKY 1 - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 0 - -/* CPU target speed in Hz */ -#define F_CPU 3900000uL /*2457600uL*/ - -/* Our clock resolution, this is the same as Unix HZ. */ -#define CLOCK_CONF_SECOND 128UL - -#define BAUD2UBR(baud) ((F_CPU/baud)) - -#define CCIF -#define CLIF - -#define HAVE_STDINT_H -#include "msp430def.h" - - -/* Types for clocks and uip_stats */ -typedef unsigned short uip_stats_t; -typedef unsigned long clock_time_t; -typedef unsigned long off_t; - -/* the low-level radio driver */ -#define NETSTACK_CONF_RADIO cc2420_driver - -/* LED ports */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x10 -#define LEDS_CONF_GREEN 0x20 -#define LEDS_CONF_YELLOW 0x40 - -/* DCO speed resynchronization for more robust UART, etc. */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED 1 -#endif /* DCOSYNCH_CONF_ENABLED */ -#ifndef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_CONF_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#define ROM_ERASE_UNIT_SIZE 512 -#define XMEM_ERASE_UNIT_SIZE (64*1024L) - - -#define CFS_CONF_OFFSET_TYPE long - - -/* Use the first 64k of external flash for node configuration */ -#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE) - -/* Use the second 64k of external flash for codeprop. */ -#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE) -#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_RAM_CONF_SIZE 4096 - -/* - * SPI bus configuration for the TMote Sky. - */ - -/* SPI input/output registers. */ -#define SPI_TXBUF U0TXBUF -#define SPI_RXBUF U0RXBUF - - /* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while ((U0TCTL & TXEPT) == 0) - /* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while ((IFG1 & URXIFG0) == 0) - /* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while ((IFG1 & UTXIFG0) == 0) - -#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */ -#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ - -#define FLASH_PWR 3 /* P4.3 Output */ -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P4.7 Output */ - -/* Enable/disable flash access to the SPI bus (active low). */ - -#define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) ) -#define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) ) - -#define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) ) -#define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) ) - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 800 - -/* P1.0 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 0 -/* P1.3 - Input: FIFO from CC2420 */ -#define CC2420_FIFO_PORT(type) P1##type -#define CC2420_FIFO_PIN 3 -/* P1.4 - Input: CCA from CC2420 */ -#define CC2420_CCA_PORT(type) P1##type -#define CC2420_CCA_PIN 4 -/* P4.1 - Input: SFD from CC2420 */ -#define CC2420_SFD_PORT(type) P4##type -#define CC2420_SFD_PIN 1 -/* P4.2 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P4##type -#define CC2420_CSN_PIN 2 -/* P4.5 - Output: VREG_EN to CC2420 */ -#define CC2420_VREG_PORT(type) P4##type -#define CC2420_VREG_PIN 5 -/* P4.6 - Output: RESET_N to CC2420 */ -#define CC2420_RESET_PORT(type) P4##type -#define CC2420_RESET_PIN 6 - -#define CC2420_IRQ_VECTOR PORT1_VECTOR - -/* Pin status. */ -#define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN))) -#define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN))) -#define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN))) -#define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN))) - -/* The CC2420 reset pin. */ -#define SET_RESET_INACTIVE() (CC2420_RESET_PORT(OUT) |= BV(CC2420_RESET_PIN)) -#define SET_RESET_ACTIVE() (CC2420_RESET_PORT(OUT) &= ~BV(CC2420_RESET_PIN)) - -/* CC2420 voltage regulator enable pin. */ -#define SET_VREG_ACTIVE() (CC2420_VREG_PORT(OUT) |= BV(CC2420_VREG_PIN)) -#define SET_VREG_INACTIVE() (CC2420_VREG_PORT(OUT) &= ~BV(CC2420_VREG_PIN)) - -/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */ -#define CC2420_FIFOP_INT_INIT() do { \ - CC2420_FIFOP_PORT(IES) &= ~BV(CC2420_FIFOP_PIN); \ - CC2420_CLEAR_FIFOP_INT(); \ - } while(0) - -/* FIFOP on external interrupt 0. */ -#define CC2420_ENABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) |= BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_DISABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) &= ~BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_CLEAR_FIFOP_INT() do {CC2420_FIFOP_PORT(IFG) &= ~BV(CC2420_FIFOP_PIN);} while(0) - -/* - * Enables/disables CC2420 access to the SPI bus (not the bus). - * (Chip Select) - */ - - /* ENABLE CSn (active low) */ -#define CC2420_SPI_ENABLE() (CC2420_CSN_PORT(OUT) &= ~BV(CC2420_CSN_PIN)) - /* DISABLE CSn (active low) */ -#define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) -#define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) - -#endif /* __PLATFORM_CONF_H__ */ diff --git a/platform/sky/Makefile.common b/platform/sky/Makefile.common index 64484e1da..2f8b32dc0 100644 --- a/platform/sky/Makefile.common +++ b/platform/sky/Makefile.common @@ -3,7 +3,7 @@ ARCH=spi.c ds2411.c xmem.c i2c.c node-id.c sensors.c cfs-coffee.c \ cc2420.c cc2420-aes.c cc2420-arch.c cc2420-arch-sfd.c \ sky-sensors.c uip-ipchksum.c \ - checkpoint-arch.c uart1.c slip_uart1.c uart1-putchar.c + uart1.c slip_uart1.c uart1-putchar.c CONTIKI_TARGET_DIRS = . dev apps net ifndef CONTIKI_TARGET_MAIN diff --git a/platform/sky/checkpoint-arch.c b/platform/sky/checkpoint-arch.c deleted file mode 100644 index 8fa5a7f39..000000000 --- a/platform/sky/checkpoint-arch.c +++ /dev/null @@ -1,692 +0,0 @@ -/* - * Copyright (c) 2010, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Checkpoint library implementation for the Tmote Sky platform. - * - * \author - * Fredrik Osterlind - */ - -#include "contiki.h" - -#include "lib/crc16.h" -#include "lib/checkpoint.h" - -#include "sys/rtimer.h" -#include "sys/mt.h" -#include "sys/energest.h" -#include "sys/compower.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/serial-line.h" -#include "dev/uart1.h" -#include "dev/cc2420.h" -#include "dev/button-sensor.h" -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include - -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef CHECKPOINT_ROLLBACK_BUTTON -#define CHECKPOINT_ROLLBACK_BUTTON 1 /* rollback "cp_wdt" on button click */ -#endif /* CHECKPOINT_ROLLBACK_BUTTON */ - -#if CHECKPOINT_ROLLBACK_BUTTON -PROCESS(checkpoint_button_process, "Rollback on button"); -#endif /* CHECKPOINT_ROLLBACK_BUTTON */ - -#define WITH_SERIAL_COMMANDS 0 /* checkpoint via serial port */ -#if WITH_SERIAL_COMMANDS -#if UART1_CONF_TX_WITH_INTERRUPT -#error TX_WITH_INTERRUPTS must be 0 -#endif /* UART1_CONF_TX_WITH_INTERRUPT */ -#define PRINTF_COMMAND(...) printf(__VA_ARGS__) -#else /* WITH_SERIAL_COMMANDS */ -#define PRINTF_COMMAND(...) -#endif /* WITH_SERIAL_COMMANDS */ - -#define COMMAND_ROLLBACK 1 -#define COMMAND_CHECKPOINT 2 -#define COMMAND_METRICS 3 - -#define INCLUDE_RAM 1 /* Less then 10240 bytes */ -#define INCLUDE_TIMERS 1 /* 16 bytes */ -#define INCLUDE_LEDS 1 /* 1 bytes */ -/* ... */ - -/* 10kb memory */ -#define RAM_START 0x1100 -#define RAM_END 0x3900 - -#define PAUSE_TIME() \ - TACTL &= ~(MC1); \ - TBCTL &= ~(MC1); \ - watchdog_stop(); -#define RESUME_TIME() \ - TACTL |= MC1; \ - TBCTL |= MC1; \ - TACCR1 = clock_fine_max(); \ - watchdog_start(); -#define PAUSE_TIME_INT() \ - dint(); \ - PAUSE_TIME(); -#define RESUME_TIME_INT() \ - RESUME_TIME(); \ - eint(); - -static struct mt_thread checkpoint_thread; -static uint8_t preset_cmd; -static int preset_fd; - -/* bookkeeping */ -#if WITH_SERIAL_COMMANDS -static int nr_pongs=0; -#endif /* WITH_SERIAL_COMMANDS */ -static int nr_checkpoints=0, nr_rollbacks=0, nr_metrics=0; - -/*---------------------------------------------------------------------------*/ -typedef union { - unsigned char u8[2]; - unsigned short u16; -} word_union_t; -/*---------------------------------------------------------------------------*/ -static int -write_byte(int fd, uint8_t c) -{ - return cfs_write(fd, &c, 1); -} -/*---------------------------------------------------------------------------*/ -static void -write_word(int fd, uint16_t w) -{ - word_union_t tmp; - tmp.u16 = w; - write_byte(fd, tmp.u8[0]); - write_byte(fd, tmp.u8[1]); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -read_byte(int fd) -{ - uint8_t c; - cfs_read(fd, &c, 1); - return c; -} -/*---------------------------------------------------------------------------*/ -static uint16_t -read_word(int fd) -{ - word_union_t tmp; - tmp.u8[0] = read_byte(fd); - tmp.u8[1] = read_byte(fd); - return tmp.u16; -} -/*---------------------------------------------------------------------------*/ -static void -thread_checkpoint(int fd) -{ -#if INCLUDE_RAM - unsigned char *addr; - uint16_t size = 0; - unsigned char *thread_mem_start = (unsigned char *)&checkpoint_thread.thread.stack; - unsigned char *thread_mem_end = thread_mem_start + sizeof(checkpoint_thread.thread.stack) - 1; - unsigned char *coffee_mem_start = cfs_coffee_get_protected_mem(&size); - unsigned char *coffee_mem_end = coffee_mem_start + size - 1; -#endif /* INCLUDE_RAM */ - - /*PRINTF("protected thread memory: %u, size=%u\n", (uint16_t) thread_mem_start, sizeof(checkpoint_thread.thread.stack));*/ - /*PRINTF("protected coffee memory: %u, size=%u\n", (uint16_t) coffee_mem_start, size);*/ - - /* RAM */ -#if INCLUDE_RAM - for(addr = (unsigned char *)RAM_START; - addr < (unsigned char *)RAM_END; - addr++) { - - if((addr >= thread_mem_start && addr <= thread_mem_end)) { - /* Skip */ - continue; - } - - if((addr >= coffee_mem_start && addr <= coffee_mem_end)) { - /* Skip */ - continue; - } - - /* TODO Use write_array() */ - write_byte(fd, *addr); - - /*if(((int)addr % 512) == 0) { - PRINTF("."); - }*/ - } - -#endif /* INCLUDE_RAM */ - - /* Timers */ -#if INCLUDE_TIMERS - write_word(fd, TACTL); - write_word(fd, TACCTL1); - write_word(fd, TACCR1); - write_word(fd, TAR); - - write_word(fd, TBCTL); - write_word(fd, TBCCTL1); - write_word(fd, TBCCR1); - write_word(fd, TBR); -#endif /* INCLUDE_TIMERS */ - - /* LEDs */ -#if INCLUDE_LEDS - write_byte(fd, leds_arch_get()); -#endif /* INCLUDE_LEDS */ - - /* Radio */ - /* ADC */ - /* ... */ - - write_byte(fd, -1); /* Coffee padding byte */ -} -/*---------------------------------------------------------------------------*/ -static void -thread_rollback(int fd) -{ -#if INCLUDE_RAM - unsigned char *addr; - uint16_t size = 0; - unsigned char *thread_mem_start = (unsigned char *)&checkpoint_thread.thread.stack; - unsigned char *thread_mem_end = thread_mem_start + sizeof(checkpoint_thread.thread.stack) - 1; - unsigned char *coffee_mem_start = cfs_coffee_get_protected_mem(&size); - unsigned char *coffee_mem_end = coffee_mem_start + size - 1; -#endif /* INCLUDE_RAM */ - - /*PRINTF("protected thread memory: %u, size=%u\n", (uint16_t) thread_mem_start, sizeof(checkpoint_thread.thread.stack));*/ - /*PRINTF("protected coffee memory: %u, size=%u\n", (uint16_t) coffee_mem_start, size);*/ - - /* RAM */ -#if INCLUDE_RAM - for(addr = (unsigned char *)RAM_START; - addr < (unsigned char *)RAM_END; - addr++) { - if((addr >= thread_mem_start && addr <= thread_mem_end)) { - /* Skip */ - continue; - } - - if((addr >= coffee_mem_start && addr <= coffee_mem_end)) { - /* Skip */ - continue; - } - - *addr = read_byte(fd); - } -#endif /* INCLUDE_RAM */ - - /* Timers */ -#if INCLUDE_TIMERS - TACTL = read_word(fd); - TACCTL1 = read_word(fd); - TACCR1 = read_word(fd); - TAR = read_word(fd); - - TBCTL = read_word(fd); - TBCCTL1 = read_word(fd); - TBCCR1 = read_word(fd); - TBR = read_word(fd); -#endif /* INCLUDE_TIMERS */ - - /* LEDs */ -#if INCLUDE_LEDS - leds_arch_set(read_byte(fd)); -#endif /* INCLUDE_LEDS */ - - /* Radio */ - /* ADC */ - /* ... */ - - read_byte(fd); /* Coffee padding byte */ -} -/*---------------------------------------------------------------------------*/ -#if WITH_SERIAL_COMMANDS -static uint32_t -thread_metric_tx(void) -{ - energest_flush(); - return energest_type_time(ENERGEST_TYPE_TRANSMIT); -} -/*---------------------------------------------------------------------------*/ -static uint32_t -thread_metric_rx(void) -{ - energest_flush(); - return energest_type_time(ENERGEST_TYPE_LISTEN); -} -#endif /* WITH_SERIAL_COMMANDS */ -/*---------------------------------------------------------------------------*/ -static void -thread_metrics(void) -{ - PRINTF_COMMAND("METRICS:START\n"); - PRINTF_COMMAND("M:RTIMER_NOW:%u\n", RTIMER_NOW()); /* TODO extract */ - PRINTF_COMMAND("M:ENERGY_TX:%lu\n", thread_metric_tx()); - PRINTF_COMMAND("M:ENERGY_RX:%lu\n", thread_metric_rx()); - PRINTF_COMMAND("M:RTIMER_NOW2:%u\n", RTIMER_NOW()); - nr_metrics++; - PRINTF_COMMAND("METRICS:DONE %u\n", nr_metrics); -} -/*---------------------------------------------------------------------------*/ -static void -checkpoint_thread_loop(void *data) -{ - uint8_t cmd; - int fd; - - while(1) { - /* Store command and file descriptor on stack */ - cmd = preset_cmd; - fd = preset_fd; - - /* Handle command */ - if(cmd == COMMAND_ROLLBACK) { - PRINTF_COMMAND("RB:START\n"); - thread_rollback(fd); - nr_rollbacks++; - PRINTF_COMMAND("RB:DONE %u\n", nr_rollbacks); - /* TODO Synch before leaving this thread. */ - } else if(cmd == COMMAND_CHECKPOINT) { - PRINTF_COMMAND("CP:START\n"); - thread_checkpoint(fd); - thread_metrics(); - nr_checkpoints++; - PRINTF_COMMAND("CP:DONE %u\n", nr_checkpoints); - } else if(cmd == COMMAND_METRICS) { - thread_metrics(); - } else { - printf("ERROR: Unknown thread command: %u\n", cmd); - } - - /* Return to Contiki */ - mt_yield(); - } -} -/*---------------------------------------------------------------------------*/ -int -checkpoint_arch_size() -{ - return 10258; -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_checkpoint(int fd) -{ - PAUSE_TIME_INT(); - - preset_cmd = COMMAND_CHECKPOINT; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - RESUME_TIME_INT(); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_rollback(int fd) -{ - PAUSE_TIME_INT(); - - preset_cmd = COMMAND_ROLLBACK; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - RESUME_TIME_INT(); -} -/*---------------------------------------------------------------------------*/ -static uint8_t inited = 0; -void -checkpoint_arch_init(void) -{ - if(inited) { - return; - } - - mt_init(); - mt_start(&checkpoint_thread, checkpoint_thread_loop, NULL); - inited = 1; - -#if CHECKPOINT_ROLLBACK_BUTTON - process_start(&checkpoint_button_process, NULL); -#endif /* CHECKPOINT_ROLLBACK_BUTTON */ - - /*mt_stop(&checkpoint_thread);*/ - /*mt_remove();*/ -} -/*---------------------------------------------------------------------------*/ -struct power_log { - uint32_t transmit; - uint32_t listen; -}; -/*---------------------------------------------------------------------------*/ -#if WITH_SERIAL_COMMANDS -static void -serial_interrupt_checkpoint() -{ - int fd = 0; - PAUSE_TIME(); - - if(SPI_IS_ENABLED()) { - /* SPI is busy, abort */ - PRINTF_COMMAND("CP:SPIBUSY\n"); - RESUME_TIME(); - return; - } - - /* Open file */ - cfs_remove("cp"); - cfs_coffee_reserve("cp", checkpoint_arch_size()); - fd = cfs_open("cp", CFS_WRITE); - - if(fd < 0) { - printf("ERROR: No file access (cp)\n"); - RESUME_TIME(); - return; - } - - /* Checkpoint */ - preset_cmd = COMMAND_CHECKPOINT; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - /* Close file */ - cfs_close(fd); - - RESUME_TIME(); -} -/*---------------------------------------------------------------------------*/ -static void -serial_interrupt_rollback() -{ - int fd = 0; - PAUSE_TIME(); - - if(SPI_IS_ENABLED()) { - /* SPI is busy, abort */ - PRINTF_COMMAND("RB:SPIBUSY\n"); - RESUME_TIME(); - return; - } - - /* Open file */ - fd = cfs_open("cp", CFS_READ); - - if(fd < 0) { - printf("ERROR: No file access (rb)\n"); - RESUME_TIME(); - return; - } - - /* Rollback */ - preset_cmd = COMMAND_ROLLBACK; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - /* Close file */ - cfs_close(fd); - - RESUME_TIME(); -} -/*---------------------------------------------------------------------------*/ -static void -serial_interrupt_metrics() -{ - PAUSE_TIME(); - - preset_cmd = COMMAND_METRICS; - preset_fd = -1; - mt_exec(&checkpoint_thread); - - RESUME_TIME(); -} -/*---------------------------------------------------------------------------*/ -static const unsigned char command_checkpoint[] = { 'c', 'p', '\n' }; -static const unsigned char command_rollback[] = { 'r', 'b', '\n' }; -static const unsigned char command_metrics[] = { 'm', 't', '\n' }; -static volatile int command_checkpoint_state = 0; -static volatile int command_rollback_state = 0; -static volatile int command_metrics_state = 0; -/*---------------------------------------------------------------------------*/ -static int -serial_input_byte_intercept(unsigned char c) -{ - /* Detect checkpoint request */ - if(command_checkpoint[command_checkpoint_state] == c) { - command_checkpoint_state++; - - if(command_checkpoint_state == sizeof(command_checkpoint)) { - serial_interrupt_checkpoint(); - command_checkpoint_state = 0; - } - } else { - command_checkpoint_state = 0; - } - - /* Detect rollback request */ - if(command_rollback[command_rollback_state] == c) { - command_rollback_state++; - - if(command_rollback_state == sizeof(command_rollback)) { - serial_interrupt_rollback(); - command_rollback_state = 0; - } - } else { - command_rollback_state = 0; - } - - /* Detect metrics request */ - if(command_metrics[command_metrics_state] == c) { - command_metrics_state++; - - if(command_metrics_state == sizeof(command_metrics)) { - serial_interrupt_metrics(); - command_metrics_state = 0; - } - } else { - command_metrics_state = 0; - } - - /* Forward to serial line input byte */ - return serial_line_input_byte(c); -} -/*---------------------------------------------------------------------------*/ -static void -handle_get_command(void) -{ - int fd = 0; - fd = cfs_open("cp", CFS_READ); - if(fd < 0) { - printf("ERROR: No file access (get)\n"); - } else { - PRINTF_COMMAND("GET:START\n"); - char data[8]; - int offset=0, size=0, read=8; - unsigned short crc = 0; - cfs_seek(fd, offset, CFS_SEEK_SET); - - while (read == 8) { - int i; - - /*if(offset != cfs_seek(fd, offset, CFS_SEEK_SET)) { - printf("bad seek, breaking\n"); - break; - }*/ - read = cfs_read(fd, data, 8); - size += read; - - printf("%04i: ", offset); /*REMOVE*/ - for (i=0; i < read; i++) { - crc = crc16_add((uint8_t) data[i], crc); - printf("%02x", (uint8_t) (0xff&data[i])); - } - printf("\n"); - - offset += 8; - } - - PRINTF_COMMAND("GET:DONE CRC=%u\n", crc); - cfs_close(fd); - } -} -/*---------------------------------------------------------------------------*/ -static int -hex_decode_char(char c) -{ - if(c >= 'A' && c <= 'F') { - return c - 'A' + 10; - } else if(c >= 'a' && c <= 'f') { - return c - 'a' + 10; - } else if(c >= '0' && c <= '9') { - return c - '0'; - } else { - printf("WARN: bad hex: %c\n", c); - return 0; - } -} -/*---------------------------------------------------------------------------*/ -PROCESS(checkpoint_serial_process, "Checkpoint via serial commands"); -PROCESS_THREAD(checkpoint_serial_process, ev, data) -{ - static int set_fd = -1; - static int set_count = -1; - - PROCESS_BEGIN(); - - /* Note: 'cp', 'rb', and 'mt' commands are intercepted */ - PROCESS_PAUSE(); - uart1_set_input(serial_input_byte_intercept); - - /* Format Coffee? */ - PRINTF("Formatting Coffee\n"); - cfs_coffee_format(); - PRINTF("Formatting Coffee... done!\n"); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL); - - if(strcmp("set", data) == 0) { - /* TODO Handle set command */ - /* Open file */ - cfs_remove("cp"); - cfs_coffee_reserve("cp", checkpoint_arch_size()); - set_fd = cfs_open("cp", CFS_WRITE); - set_count = 0; - if(set_fd < 0) { - printf("SET:FSBUSY\n"); - } else { - printf("SET:LINE\n"); - } - } else if(set_fd >= 0 && strcmp("set:done", data) == 0) { - cfs_close(set_fd); - set_fd = -1; - if(set_count == 9862) { - printf("SET:DONE\n"); - } else { - printf("SET:WRONGSIZE\n"); - } - } else if(set_fd >= 0) { - /* We are ready for another line */ - printf("SET:LINE\n"); - /* Set command: parse hex data */ - int len = strlen((char*)data); - if(len > 16 || (len%2)!=0) { - printf("WARN: bad set data: %s\n", (char*)data); - } else { - int i; - for (i=0; i < len; i+=2) { - uint8_t b = - (hex_decode_char(((char*)data)[i]) << 4) + - (hex_decode_char(((char*)data)[i+1])); - - PRINTF("Parsing set command: writing to CFS: %02x\n", b); - write_byte(set_fd, b); /* TODO Check return value */ - set_count++; - } - } - } else if(strcmp("", data) == 0 || - strcmp("cp", data) == 0 || - strcmp("rb", data) == 0 || - strcmp("mt", data) == 0) { - /* ignore commands: handled by interrupt */ - } else if(strcmp("ping", data) == 0) { - nr_pongs++; - printf("pong %u\n", nr_pongs); - } else if(strcmp("get", data) == 0) { - handle_get_command(); - } else { - printf("WARN: Unknown command: '%s'\n", (char*)data); - } - } - - PROCESS_END(); -} -#endif /* WITH_SERIAL_COMMANDS */ -/*---------------------------------------------------------------------------*/ -#if CHECKPOINT_ROLLBACK_BUTTON -PROCESS_THREAD(checkpoint_button_process, ev, data) -{ - PROCESS_BEGIN(); - - button_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == sensors_event && data == &button_sensor) { - int fd = 0; - - /* Rollback from Coffee file "cp_wdt" */ - fd = cfs_open("cp_wdt", CFS_READ); - if(fd >= 0) { - checkpoint_rollback(fd); - cfs_close(fd); - } - } - } - - PROCESS_END(); -} -#endif /* CHECKPOINT_ROLLBACK_BUTTON */ diff --git a/platform/sky/dev/light-sensor.h b/platform/sky/dev/light-sensor.h index 486e6a8bb..411c6fa33 100644 --- a/platform/sky/dev/light-sensor.h +++ b/platform/sky/dev/light-sensor.h @@ -36,8 +36,8 @@ * $Revision: 1.2 $ */ -#ifndef __LIGHT_SENSOR_H__ -#define __LIGHT_SENSOR_H__ +#ifndef LIGHT_SENSOR_H_ +#define LIGHT_SENSOR_H_ #include "lib/sensors.h" @@ -47,4 +47,4 @@ extern const struct sensors_sensor light_sensor; #define LIGHT_SENSOR_TOTAL_SOLAR 1 -#endif /* __LIGHT-SENSOR_H__ */ +#endif /* LIGHT-SENSOR_H_ */ diff --git a/platform/sky/dev/light.h b/platform/sky/dev/light.h index 8ea84b997..52962b162 100644 --- a/platform/sky/dev/light.h +++ b/platform/sky/dev/light.h @@ -29,12 +29,12 @@ * This file is part of the Contiki operating system. * */ -#ifndef __LIGHT_H__ -#define __LIGHT_H__ +#ifndef LIGHT_H_ +#define LIGHT_H_ void sensors_light_init(void); unsigned sensors_light1(void); unsigned sensors_light2(void); -#endif /* __LIGHT_H__ */ +#endif /* LIGHT_H_ */ diff --git a/platform/sky/dev/sky-sensors.h b/platform/sky/dev/sky-sensors.h index 4a5e8d9e1..df2aeea48 100644 --- a/platform/sky/dev/sky-sensors.h +++ b/platform/sky/dev/sky-sensors.h @@ -36,11 +36,11 @@ * $Revision: 1.2 $ */ -#ifndef __SKY_SENSORS_H__ -#define __SKY_SENSORS_H__ +#ifndef SKY_SENSORS_H_ +#define SKY_SENSORS_H_ int sky_sensors_status(uint16_t input, int type); int sky_sensors_configure(uint16_t input, uint8_t reference, int type, int value); -#endif /* __SKY_SENSORS_H__ */ +#endif /* SKY_SENSORS_H_ */ diff --git a/platform/sky/dev/temperature-sensor.h b/platform/sky/dev/temperature-sensor.h index 6ac9b77d2..05eafe852 100644 --- a/platform/sky/dev/temperature-sensor.h +++ b/platform/sky/dev/temperature-sensor.h @@ -37,8 +37,8 @@ * Niclas Finne */ -#ifndef __TEMPERATURE_SENSOR_H__ -#define __TEMPERATURE_SENSOR_H__ +#ifndef TEMPERATURE_SENSOR_H_ +#define TEMPERATURE_SENSOR_H_ #include "lib/sensors.h" @@ -46,4 +46,4 @@ extern const struct sensors_sensor temperature_sensor; #define TEMPERATURE_SENSOR "Temperature" -#endif /* __TEMPERATURE_SENSOR_H__ */ +#endif /* TEMPERATURE_SENSOR_H_ */ diff --git a/platform/sky/platform-conf.h b/platform/sky/platform-conf.h index ea1ee7acd..e597a208f 100644 --- a/platform/sky/platform-conf.h +++ b/platform/sky/platform-conf.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -209,4 +209,4 @@ typedef unsigned long off_t; #define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) #define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/stepper-robot/Makefile b/platform/stepper-robot/Makefile deleted file mode 100644 index beeb7adb3..000000000 --- a/platform/stepper-robot/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -TARGET=stepper-robot - -all: core - -core: - $(MAKE) core.$(TARGET) - -CONTIKI=../.. - -CORE=core-nosyms.$(TARGET) - -CONTIKI_TARGET_MAIN=contiki-main.c - -codeprop: $(CONTIKI)/tools/codeprop.c - cc -g -Wall $< -o $@ - -clean: stepper_robot_clean - -.PHONY: stepper_robot_clean - -stepper_robot_clean: - -rm codeprop - -include $(CONTIKI)/Makefile.include - diff --git a/platform/stepper-robot/Makefile.stepper-robot b/platform/stepper-robot/Makefile.stepper-robot deleted file mode 100644 index b74e6180d..000000000 --- a/platform/stepper-robot/Makefile.stepper-robot +++ /dev/null @@ -1,29 +0,0 @@ -STEPPER_ROBOT = leds.c leds-arch.c sam7s-spi.c stepper-process.c stepper.c stepper-interrupt.c stepper-move.c - -#CODEPROP_SOURCES = codeprop-otf.c ram-segments.c -UIPDRIVERS= cc2420.c cc2420-interrupt.c \ -cc2420-spi.c slip.c - -CONTIKI_TARGET_DIRS = . stepper - -# Master clock frequency -MCK=23961600 -CFLAGS+=-DAUTOSTART_ENABLE - -ifndef CONTIKI_TARGET_MAIN -CONTIKI_TARGET_MAIN = robot-main.c -endif - -CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(STEPPER_ROBOT) \ - $(CODEPROP_SOURCES) $(CONTIKI_TARGET_MAIN) - -# include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps - -include $(CONTIKI)/cpu/arm/at91sam7s/Makefile.at91sam7s - -#contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} - -ifndef BASE_IP -BASE_IP := 172.16.1.1 -endif - diff --git a/platform/stepper-robot/cc2420-interrupt.c b/platform/stepper-robot/cc2420-interrupt.c deleted file mode 100644 index 3b60711d8..000000000 --- a/platform/stepper-robot/cc2420-interrupt.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include -#include - -static void NACKEDFUNC -cc2420_fifop_interrupt (void) /* System Interrupt Handler */ -{ - ISR_STORE(); - ISR_ENABLE_NEST(); - cc2420_interrupt(); - ISR_DISABLE_NEST(); - *AT91C_AIC_EOICR = 0; /* End of Interrupt */ - ISR_RESTORE(); -} - -void -cc2420_interrupt_fifop_int_init(void) -{ - *AT91C_PIOA_ASR = AT91C_PA30_IRQ1; - *AT91C_PIOA_PDR = AT91C_PA30_IRQ1; - AT91C_AIC_SMR[AT91C_ID_IRQ1] = AT91C_AIC_SRCTYPE_POSITIVE_EDGE | 4; - AT91C_AIC_SVR[AT91C_ID_IRQ1] = (unsigned long)cc2420_fifop_interrupt; - /* *AT91C_AIC_IECR = (1 << AT91C_ID_IRQ1); */ -} - -#ifndef __MAKING_DEPS__ - -inline int splhigh(void) -{ - int save; -#ifndef __THUMBEL__ - asm("mrs %0, CPSR\n\torr r1,%0,#0x80\n\tmsr CPSR_c, r1" : "=r" (save)::"r1"); -#else -#error Must be compiled in ARM mode -#endif - return save; -} - -inline void splx(int saved) -{ -#ifndef __THUMBELL__ - asm("msr CPSR_c, %0" ::"r" (saved)); -#else -#error Must be compiled in ARM mode -#endif -} - -#endif /* __MAKING_DEPS__ */ diff --git a/platform/stepper-robot/cc2420-interrupt.h b/platform/stepper-robot/cc2420-interrupt.h deleted file mode 100644 index f36927850..000000000 --- a/platform/stepper-robot/cc2420-interrupt.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __CC2420_CORE_INTERRUPT_H__9499CTDNSK__ -#define __CC2420_CORE_INTERRUPT_H__9499CTDNSK__ - -void -cc2420_interrupt_fifop_int_init(void); -#endif /* __CC2420_CORE_INTERRUPT_H__9499CTDNSK__ */ diff --git a/platform/stepper-robot/cc2420-spi.c b/platform/stepper-robot/cc2420-spi.c deleted file mode 100644 index 04c5d6e17..000000000 --- a/platform/stepper-robot/cc2420-spi.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -#include - -#define SPI_SPEED 1000000 /* 1MHz clock*/ -#define SPI_DLYBCT 1 -#define SPI_DLYBS 20 - - -#ifndef BV -#define BV(b) (1<<(b)) -#endif - -void -cc2420_arch_init(void) -{ - spi_init(); - - AT91C_SPI_CSR[CC2420_DEFAULT_DEV] = - ((SPI_DLYBCT<<24) | (SPI_DLYBS<<16) | (((MCK+SPI_SPEED/2)/SPI_SPEED)<<8) - | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8 | AT91C_SPI_CSAAT); -} diff --git a/platform/stepper-robot/contiki-conf.h b/platform/stepper-robot/contiki-conf.h deleted file mode 100644 index c457801af..000000000 --- a/platform/stepper-robot/contiki-conf.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __CONTIKI_CONF_H__CDBB4VIH3I__ -#define __CONTIKI_CONF_H__CDBB4VIH3I__ - -#include -#include -#include -#include - -#define CCIF -#define CLIF - -#define WITH_UIP 1 -#define WITH_ASCII 1 - -#define CLOCK_CONF_SECOND 100 - -/* These names are deprecated, use C99 names. */ -typedef uint8_t u8_t; -typedef uint16_t u16_t; -typedef uint32_t u32_t; -typedef int8_t s8_t; -typedef int16_t s16_t; -typedef int32_t s32_t; - -typedef unsigned int clock_time_t; -typedef unsigned int uip_stats_t; - -#ifndef BV -#define BV(x) (1<<(x)) -#endif - -/* SPI */ -#define SPI_TXBUF *AT91C_SPI_TDR - -#define SPI_RXBUF ((unsigned char)*AT91C_SPI_RDR) - -#define SPI_WAITFOREOTx() while ((*AT91C_SPI_SR & AT91C_SPI_TXEMPTY) == 0) - -#define SPI_WAITFOREORx() while ((*AT91C_SPI_SR & AT91C_SPI_RDRF) == 0) - -/* CC2420 control pins */ -/* LOOP count for waiting 20 symbols in the CC2420 code - same as MSP? */ -#define CC2420_CONF_SYMBOL_LOOP_COUNT 800 - - -#define FIFO_IS_1 (*AT91C_PIOA_PDSR & AT91C_PIO_PA2) -#define VREG_IS_1 1 /* Hardwired */ -#define FIFOP_IS_1 (*AT91C_PIOA_PDSR & AT91C_PIO_PA30) -#define SFD_IS_1 (*AT91C_PIOA_PDSR & AT91C_PIO_PA15) -#define CCA_IS_1 1 - -#define SET_RESET_INACTIVE() setreg(CC2420_MAIN, 0xf800); -#define SET_RESET_ACTIVE() setreg(CC2420_MAIN, 0x0000); - -#define SET_VREG_ACTIVE() -#define SET_VREG_INACTIVE() - -#define FIFOP_INT_INIT() cc2420_interrupt_fifop_int_init() -#define DISABLE_FIFOP_INT() (*AT91C_AIC_IDCR = (1 << AT91C_ID_IRQ1)) -#define ENABLE_FIFOP_INT() (*AT91C_AIC_IECR = (1 << AT91C_ID_IRQ1)) - -#define CC2420_DEFAULT_DEV 1 - -#define SPI_ENABLE() \ -do { \ -*AT91C_SPI_MR = ((*AT91C_SPI_MR & ~AT91C_SPI_PCS) \ - | ((~(1< -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "net/mac/nullmac.h" -#include "net/rime.h" - -#include "contiki-main.h" - -#ifndef RF_CHANNEL -#define RF_CHANNEL 15 -#endif - - -#if WITH_UIP -#include "net/uip.h" -#include "net/uip-fw.h" -#include "net/uip-fw-drv.h" -#include "net/uip-over-mesh.h" - - -static struct uip_fw_netif meshif = - {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; - -#define UIP_OVER_MESH_CHANNEL 9 - -uint8_t is_gateway = 0; -struct trickle_conn gateway_trickle; - -#endif /* WITH_UIP */ - -extern char __heap_end__; -extern char __heap_start__; - - -rimeaddr_t node_addr __attribute__((weak)) = {{0,2}}; - -/*--------------------------------------------------------------------------*/ -#if WITH_UIP - -/* Receive address of gateway */ - -static void -trickle_recv(struct trickle_conn *c) -{ - if (!is_gateway) { - struct gateway_msg *msg; - msg = rimebuf_dataptr(); - printf("%d.%d: gateway message: %d.%d\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - msg->gateway.u8[0], msg->gateway.u8[1]); - - uip_over_mesh_set_gateway(&msg->gateway); - } -} - -const static struct trickle_callbacks trickle_call = {trickle_recv}; - -/*---------------------------------------------------------------------------*/ -#endif - -#if 0 -/* Wathcdog is already disabled in startup code */ -static void -wdt_setup() -{ - -} -#endif - -static void -wdt_reset() -{ - *AT91C_WDTC_WDCR = (0xa5<<24) | AT91C_WDTC_WDRSTT; -} - -#if 0 -static uip_ipaddr_t gw_addr = {{172,16,0,1}}; -#endif - - -int -main() -{ - disableIRQ(); - disableFIQ(); - *AT91C_AIC_IDCR = 0xffffffff; - *AT91C_PMC_PCDR = 0xffffffff; - *AT91C_PMC_PCER = (1 << AT91C_ID_PIOA); - - dbg_setup_uart(); - printf("Initialising\n"); - leds_init(); - clock_init(); - process_init(); - process_start(&etimer_process, NULL); - - ctimer_init(); - - enableIRQ(); - - printf("Beginning CC2420 setup\n"); - cc2420_init(); - cc2420_set_pan_addr(0x2024, 0, NULL); - cc2420_set_channel(RF_CHANNEL); - rime_init(nullmac_init(&cc2420_driver)); - printf("CC2420 setup done\n"); - - rimeaddr_set_node_addr(&node_addr); - printf("Rime started with address %d.%d\n", node_addr.u8[0], node_addr.u8[1]); - - #if WITH_UIP - { - uip_ipaddr_t hostaddr, netmask; - - uip_init(); - - uip_ipaddr(&hostaddr, 172,16, - rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); - uip_ipaddr(&netmask, 255,255,0,0); - uip_ipaddr_copy(&meshif.ipaddr, &hostaddr); - printf("Host addr\n"); - uip_sethostaddr(&hostaddr); - uip_setnetmask(&netmask); - uip_over_mesh_set_net(&hostaddr, &netmask); - /* uip_fw_register(&slipif);*/ - /*uip_over_mesh_set_gateway_netif(&slipif);*/ - uip_fw_register(&meshif); - uip_fw_default(&meshif); - printf("Mesh init\n"); - uip_over_mesh_init(UIP_OVER_MESH_CHANNEL); - printf("uIP started with IP address %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&hostaddr)); - } -#endif /* WITH_UIP */ - - - -#if WITH_UIP - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ - - trickle_open(&gateway_trickle, CLOCK_SECOND * 4, GATEWAY_TRICKLE_CHANNEL, - &trickle_call); -#endif /* WITH_UIP */ - - printf("Heap size: %ld bytes\n", &__heap_end__ - (char*)sbrk(0)); - printf("Started\n"); - - /* procinit_init(); */ - - autostart_start(autostart_processes); - printf("Processes running\n"); - while(1) { - do { - /* Reset watchdog. */ - wdt_reset(); - } while(process_run() > 0); - /* Idle! */ - /* Stop processor clock */ - *AT91C_PMC_SCDR |= AT91C_PMC_PCK; - } - return 0; -} diff --git a/platform/stepper-robot/core.c b/platform/stepper-robot/core.c deleted file mode 100644 index 0ac8437a8..000000000 --- a/platform/stepper-robot/core.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include -#include -#include -#include "codeprop-otf.h" -#include -#include - -PROCESS(blink_process, "LED blink process"); - -PROCESS_THREAD(blink_process, ev , data) -{ - static struct etimer timer; - PROCESS_BEGIN(); - etimer_set(&timer, CLOCK_SECOND/2); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT || - ev== PROCESS_EVENT_TIMER); - if (ev == PROCESS_EVENT_EXIT) break; - leds_invert(LEDS_RED); - etimer_reset(&timer); - } - PROCESS_END(); -} - -AUTOSTART_PROCESSES(&codeprop_process, &ram_segments_cleanup_process, &stepper_process,&blink_process); diff --git a/platform/stepper-robot/gateway/Makefile b/platform/stepper-robot/gateway/Makefile deleted file mode 100644 index fd867a7b4..000000000 --- a/platform/stepper-robot/gateway/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CONTIKI=../../../../contiki-2.x/ -TARGET=stepper-robot - -MCK=23961600 -XSLTPROC=xsltproc - -CONTIKI_TARGET_MAIN=contiki-main.c - -all: gateway - -include $(CONTIKI)/Makefile.include diff --git a/platform/stepper-robot/gateway/gateway.c b/platform/stepper-robot/gateway/gateway.c deleted file mode 100644 index dd13f4186..000000000 --- a/platform/stepper-robot/gateway/gateway.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "contiki-main.h" - -/* SLIP interface */ - -extern struct uip_fw_netif cc2420if; - -rimeaddr_t node_addr = {{0,129}}; - -static struct uip_fw_netif slipif = -{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)}; - -/* USB buffers */ -static unsigned char input_buffer[128]; -static unsigned char output_buffer[128]; -static unsigned char interrupt_buffer[16]; - -#define DEV_TO_HOST 0x81 -#define HOST_TO_DEV 0x02 - -#define GATEWAY_TRICKLE_CHANNEL 8 -void -slip_arch_init(unsigned long ubr) -{ -} - -void -slip_arch_writeb(unsigned char c) -{ - while(usb_send_data(DEV_TO_HOST, &c, 1) != 1); -} - -#if WITH_UIP - -static void -set_gateway(void) -{ - struct gateway_msg msg; - /* Make this node the gateway node, unless it already is the - gateway. */ - if(!is_gateway) { - leds_on(LEDS_RED); - printf("%d.%d: making myself the gateway\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); - uip_over_mesh_set_gateway(&rimeaddr_node_addr); - rimeaddr_copy(&(msg.gateway), &rimeaddr_node_addr); - rimebuf_copyfrom(&msg, sizeof(struct gateway_msg)); - trickle_send(&gateway_trickle); - is_gateway = 1; - } -} -#endif /* WITH_UIP */ - -PROCESS(gateway_process, "Gateway process"); - - -PROCESS_THREAD(gateway_process, ev , data) -{ - static struct etimer timer; - PROCESS_BEGIN(); - usb_set_user_process(process_current); - usb_setup(); - usb_cdc_acm_setup(); - - uip_fw_default(&slipif); - uip_over_mesh_set_gateway_netif(&slipif); - - process_start(&slip_process, NULL); - - set_gateway(); - - while(ev != PROCESS_EVENT_EXIT) { - PROCESS_WAIT_EVENT(); - if (ev == PROCESS_EVENT_TIMER) { - leds_toggle(LEDS_YELLOW); - /* printf("FIFOP: %d\n", FIFOP_IS_1); */ - etimer_restart(&timer); - } else if (ev == PROCESS_EVENT_MSG) { - const struct usb_user_msg * const msg = data; - switch(msg->type) { - case USB_USER_MSG_TYPE_CONFIG: - printf("User config\n"); - if (msg->data.config != 0) { - usb_setup_bulk_endpoint(DEV_TO_HOST, - input_buffer, sizeof(input_buffer)); - usb_setup_bulk_endpoint(HOST_TO_DEV, - output_buffer, sizeof(output_buffer)); - usb_setup_interrupt_endpoint(0x83,interrupt_buffer, - sizeof(interrupt_buffer)); - etimer_set(&timer, CLOCK_SECOND); - } else { - etimer_stop(&timer); - usb_disable_endpoint(DEV_TO_HOST); - usb_disable_endpoint(HOST_TO_DEV); - usb_disable_endpoint(0x83); - - } - break; - case USB_USER_MSG_TYPE_EP_OUT(2): - { - /*unsigned int len = msg->data.length; - printf("Received %d:\n", len); */ - { - unsigned char ch; - unsigned int xfer; - while((xfer = usb_recv_data(HOST_TO_DEV, &ch, 1)) > 0) { - /* printf(" %02x",ch); */ - if (slip_input_byte(ch)) break; - } - /* printf("\n"); */ - } - } - break; - } - - } - } - printf("USB test process exited\n"); - PROCESS_END(); -} - -AUTOSTART_PROCESSES(&gateway_process); diff --git a/platform/stepper-robot/leds-arch.c b/platform/stepper-robot/leds-arch.c deleted file mode 100644 index 8a51173fe..000000000 --- a/platform/stepper-robot/leds-arch.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -#define GREEN_PIN AT91C_PIO_PA3 -#define YELLOW_PIN AT91C_PIO_PA4 -#define RED_PIN AT91C_PIO_PA8 - -#define ALL_PINS (GREEN_PIN | YELLOW_PIN | RED_PIN) - -void -leds_arch_init(void) -{ - *AT91C_PIOA_PER = ALL_PINS; - *AT91C_PIOA_OER = ALL_PINS; - *AT91C_PIOA_MDER = ALL_PINS; - *AT91C_PIOA_SODR = ALL_PINS; -} - -unsigned char -leds_arch_get(void) -{ - unsigned char on = 0; - if (*AT91C_PIOA_ODSR & GREEN_PIN) on |= LEDS_GREEN; - if (*AT91C_PIOA_ODSR & YELLOW_PIN) on |= LEDS_YELLOW; - if (*AT91C_PIOA_ODSR & RED_PIN) on |= LEDS_RED; - return on; -} - -void -leds_arch_set(unsigned char leds) -{ - unsigned int set = 0; - if (leds & LEDS_GREEN) set |= GREEN_PIN; - if (leds & LEDS_YELLOW) set |= YELLOW_PIN; - if (leds & LEDS_RED) set |= RED_PIN; - *AT91C_PIOA_CODR = set; - *AT91C_PIOA_SODR = (~set) & ALL_PINS; -} diff --git a/platform/stepper-robot/robot-main.c b/platform/stepper-robot/robot-main.c deleted file mode 100644 index c57de8dc0..000000000 --- a/platform/stepper-robot/robot-main.c +++ /dev/null @@ -1,183 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "net/mac/nullmac.h" -#include "net/rime.h" - - -#ifndef RF_CHANNEL -#define RF_CHANNEL 15 -#endif - -#ifndef WITH_UIP -#define WITH_UIP 1 -#endif - -#if WITH_UIP -#include "net/uip.h" -#include "net/uip-fw.h" -#include "net/uip-fw-drv.h" -#include "net/uip-over-mesh.h" - -static struct uip_fw_netif meshif = - {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; - -#define UIP_OVER_MESH_CHANNEL 9 - -#endif /* WITH_UIP */ - -static rimeaddr_t node_addr = {{0,2}}; - -extern char __heap_end__; -extern char __heap_start__; - - -static const uint32_t stepper0_steps_acc[] = MICRO_STEP(0,3); -static const uint32_t stepper0_steps_run[] = MICRO_STEP(0,2); -static const uint32_t stepper0_steps_hold[] = MICRO_STEP(0,1); - -static const uint32_t stepper1_steps_acc[] = MICRO_STEP(1,3); -static const uint32_t stepper1_steps_run[] = MICRO_STEP(1,2); -static const uint32_t stepper1_steps_hold[] = MICRO_STEP(1,1); - -static StepperAccSeq seq_heap[40]; - -static void -init_seq_heap() -{ - unsigned int i; - for(i = 0; i < sizeof(seq_heap)/sizeof(seq_heap[0]); i++) { - seq_heap[i].next = NULL; - stepper_free_seq(&seq_heap[i]); - } -} - -static void -robot_stepper_init() -{ - init_seq_heap(); - stepper_init(AT91C_BASE_TC0, AT91C_ID_TC0); - *AT91C_PIOA_OER = STEPPER_INHIBIT; - *AT91C_PIOA_MDER = STEPPER_INHIBIT; /* | STEPPER0_IOMASK; */ - *AT91C_PIOA_CODR = STEPPER_INHIBIT; - stepper_init_io(1, STEPPER_IOMASK(0), stepper0_steps_acc, - stepper0_steps_run, stepper0_steps_hold, - (sizeof(stepper0_steps_run) / sizeof(stepper0_steps_run[0]))); - stepper_init_io(0, STEPPER_IOMASK(1), stepper1_steps_acc, - stepper1_steps_run, stepper1_steps_hold, - (sizeof(stepper1_steps_run) / sizeof(stepper1_steps_run[0])));} - - -#if 0 -/* Wathcdog is already disabled in startup code */ -static void -wdt_setup() -{ - -} -#endif - -static void -wdt_reset() -{ - *AT91C_WDTC_WDCR = (0xa5<<24) | AT91C_WDTC_WDRSTT; -} - -#if 0 -static uip_ipaddr_t gw_addr = {{172,16,0,1}}; -#endif - - -int -main() -{ - disableIRQ(); - disableFIQ(); - *AT91C_AIC_IDCR = 0xffffffff; - *AT91C_PMC_PCDR = 0xffffffff; - *AT91C_PMC_PCER = (1 << AT91C_ID_PIOA); - - dbg_setup_uart(); - printf("Initialising\n"); - leds_arch_init(); - clock_init(); - process_init(); - process_start(&etimer_process, NULL); - ctimer_init(); - - robot_stepper_init(); - - enableIRQ(); - - cc2420_init(); - cc2420_set_pan_addr(0x2024, 0, &uip_hostaddr.u16[1]); - cc2420_set_channel(RF_CHANNEL); - rime_init(nullmac_init(&cc2420_driver)); - printf("CC2420 setup done\n"); - - rimeaddr_set_node_addr(&node_addr); - - #if WITH_UIP - { - uip_ipaddr_t hostaddr, netmask; - - uip_init(); - - uip_ipaddr(&hostaddr, 172,16, - rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); - uip_ipaddr(&netmask, 255,255,0,0); - uip_ipaddr_copy(&meshif.ipaddr, &hostaddr); - printf("Host addr\n"); - uip_sethostaddr(&hostaddr); - uip_setnetmask(&netmask); - uip_over_mesh_set_net(&hostaddr, &netmask); - /* uip_fw_register(&slipif);*/ - /*uip_over_mesh_set_gateway_netif(&slipif);*/ - uip_fw_default(&meshif); - printf("Mesh init\n"); - uip_over_mesh_init(UIP_OVER_MESH_CHANNEL); - printf("uIP started with IP address %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&hostaddr)); - } -#endif /* WITH_UIP */ - - -#if WITH_UIP - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ -#endif /* WITH_UIP */ - - printf("Heap size: %ld bytes\n", &__heap_end__ - (char*)sbrk(0)); - printf("Started\n"); - - autostart_start(autostart_processes); - printf("Processes running\n"); - while(1) { - do { - /* Reset watchdog. */ - wdt_reset(); - } while(process_run() > 0); - /* Idle! */ - /* Stop processor clock */ - *AT91C_PMC_SCDR |= AT91C_PMC_PCK; - } - return 0; -} diff --git a/platform/stepper-robot/sam7s-spi.c b/platform/stepper-robot/sam7s-spi.c deleted file mode 100644 index b1ff7bd8c..000000000 --- a/platform/stepper-robot/sam7s-spi.c +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include - -/* Prevents interrupts using SPI at inappropriate times */ -unsigned char spi_busy = 0; - -#define SPI_SPEED 1000000 /* 1MHz clock*/ -#define SPI_DLYBCT 1 -#define SPI_DLYBS 20 - -#define SPI_TRANSFER (AT91C_PA12_MISO | AT91C_PA13_MOSI | AT91C_PA14_SPCK) - -#define SPI_CS (AT91C_PA11_NPCS0 | AT91C_PA31_NPCS1) - -void -spi_init() -{ - static uint8_t initialised = 0; - if (!initialised) { - *AT91C_SPI_CR = AT91C_SPI_SPIDIS | AT91C_SPI_SWRST; - *AT91C_PMC_PCER = (1 << AT91C_ID_SPI); - *AT91C_PIOA_ASR = SPI_TRANSFER | SPI_CS; - *AT91C_PIOA_PDR = SPI_TRANSFER | SPI_CS; - *AT91C_PIOA_PPUER = AT91C_PA12_MISO | SPI_CS; - *AT91C_SPI_MR = (AT91C_SPI_MSTR | AT91C_SPI_PS_FIXED - | AT91C_SPI_MODFDIS | AT91C_SPI_PCS); - - /* It seems necessary to set the clock speed for chip select 0 - even if it's not used. */ - AT91C_SPI_CSR[0] = (MCK/SPI_SPEED)<<8; - - *AT91C_SPI_CR = AT91C_SPI_SPIEN; - initialised = 1; - } -} - -void -spi_init_chip_select(unsigned int chip, unsigned int speed, - unsigned int dlybct, - unsigned int dlybs, unsigned int phase, - unsigned int polarity) -{ - spi_init(); - - AT91C_SPI_CSR[chip] = - ((dlybct<<24) | (dlybs<<16) | (((MCK+speed/2)/speed)<<8) - | (phase?AT91C_SPI_NCPHA:0) | (polarity?AT91C_SPI_CPOL:0) - | AT91C_SPI_BITS_8 | AT91C_SPI_CSAAT); -} - -#if 0 -#define DBG_SEND dbg_blocking_putchar('>'); -#define DBG_RECV dbg_blocking_putchar('<'); -#else -#define DBG_SEND -#define DBG_RECV -#endif - -void -spi_transfer(unsigned int chip, const struct spi_block *block, unsigned int blocks) -{ - spi_busy = 1; - while(!(*AT91C_SPI_SR & AT91C_SPI_TXEMPTY)); /* wait unti previous transfer is done */ - - /* Clear any data left in the receiver */ - (void)*AT91C_SPI_RDR; - (void)*AT91C_SPI_RDR; - - /* Select chip */ - *AT91C_SPI_MR = ((*AT91C_SPI_MR & ~AT91C_SPI_PCS) - | ((~(1< 0) { - struct spi_block current = *block++; - if (current.send) { - if (current.receive) { - /* Send and receive */ - while(current.len-- > 0) { - while(!(*AT91C_SPI_SR & AT91C_SPI_TDRE)); - *AT91C_SPI_TDR = *current.send++; - DBG_SEND; - while(!(*AT91C_SPI_SR & AT91C_SPI_RDRF)); - *current.receive++ = *AT91C_SPI_RDR; - DBG_RECV; - } - } else { - /* Send only */ - while(current.len-- > 0) { - while(!(*AT91C_SPI_SR & AT91C_SPI_TDRE)); - *AT91C_SPI_TDR = *current.send++; - DBG_SEND; - while(!(*AT91C_SPI_SR & AT91C_SPI_RDRF)); - (void)*AT91C_SPI_RDR; - DBG_RECV; - } - } - } else { - if (current.receive) { - /* Receive only */ - while(current.len-- > 0) { - while(!(*AT91C_SPI_SR & AT91C_SPI_TDRE)); - *AT91C_SPI_TDR = 0; - DBG_SEND; - while(!(*AT91C_SPI_SR & AT91C_SPI_RDRF)); - *current.receive++ = *AT91C_SPI_RDR; - DBG_RECV; - } - } else { - /* Clock only */ - while(current.len-- > 0) { - while(!(*AT91C_SPI_SR & AT91C_SPI_TDRE)); - *AT91C_SPI_TDR = 0; - DBG_SEND; - while(!(*AT91C_SPI_SR & AT91C_SPI_RDRF)); - (void)*AT91C_SPI_RDR; - DBG_RECV; - } - } - } - } - *AT91C_SPI_CR = AT91C_SPI_LASTXFER; - - spi_busy = 0; -} diff --git a/platform/stepper-robot/sam7s-spi.h b/platform/stepper-robot/sam7s-spi.h deleted file mode 100644 index 7a2f41f67..000000000 --- a/platform/stepper-robot/sam7s-spi.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __CORE_SPI_H__KBMMOKI6CG__ -#define __CORE_SPI_H__KBMMOKI6CG__ -#include - -void -spi_init(); - -#define SPI_POLARITY_INACTIVE_HIGH 1 -#define SPI_POLARITY_INACTIVE_LOW 1 - -#define SPI_PHASE_CHANGE_CAPTURE 0 -#define SPI_PHASE_CAPTURE_CHANGE 1 - -struct spi_block { - const uint8_t *send; /* NULL for receive only */ - uint8_t *receive; /* NULL for send only */ - uint16_t len; /* transfer length, non-zero */ -}; - -void -spi_transfer(unsigned int chip, const struct spi_block *block, unsigned int blocks); - -void -spi_init_chip_select(unsigned int chip, unsigned int speed, - unsigned int dlybct, - unsigned int dlybs, unsigned int phase, - unsigned int polarity); - -#endif /* __CORE_SPI_H__KBMMOKI6CG__ */ diff --git a/platform/stepper-robot/stepper-process.c b/platform/stepper-robot/stepper-process.c deleted file mode 100644 index b371bf834..000000000 --- a/platform/stepper-robot/stepper-process.c +++ /dev/null @@ -1,517 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#undef putchar - - -static unsigned int -parse_uint_hex(const char **pp, const char *end) -{ - unsigned int v = 0; - while(*pp < end) { - char ch; - if ((ch = **pp) >= '0' && ch <= '9') { - v = v* 16 + (ch - '0'); - } else if (ch >= 'A' && ch <= 'F') { - v = v* 16 + (ch - 'A') + 10; - } else break; - (*pp)++; - } - return v; -} - -static int -parse_int_hex(const char **pp, const char *end) -{ - if (*pp == end) return 0; - if (**pp == '-') { - (*pp)++; - return -parse_uint_hex(pp, end); - } else { - return parse_uint_hex(pp, end); - } -} - -static void -skip_white(const char **pp, const char *end) -{ - char ch; - while(*pp < end && ((ch = **pp) == ' ' || ch == '\t')) (*pp)++; -} - -static const char hex_chars[] = - {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; - -static void -format_uint_hex(char **str, char *end, unsigned int v) -{ - char buffer[10]; - char *p = buffer+10; - if (*str == end) return; - if (v == 0) { - *(*str)++ = '0'; - return; - } - while(v > 0) { - *--p = hex_chars[v&0xf]; - v >>= 4; - } - while((p < buffer+10) && (*str < end)) { - *(*str)++ = *p++; - } -} - -static void -format_int_hex(char **str, char *end, int v) -{ - if (v < 0) { - if (*str == end) return; - *(*str)++ = '-'; - v = -v; - } - format_uint_hex(str, end, v); -} - -static void -format_ull_hex(char **str, char *end, unsigned long long int v) -{ - char buffer[16]; - char *p = buffer+10; - if (*str == end) return; - if (v == 0) { - *(*str)++ = '0'; - return; - } - while(v > 0) { - *--p = hex_chars[v&0xf]; - v >>= 4; - } - while((p < buffer+10) && (*str < end)) { - *(*str)++ = *p++; - } -} -static void -format_ll_hex(char **str, char *end, long long v) -{ - if (v < 0) { - if (*str == end) return; - *(*str)++ = '-'; - v = -v; - } - format_ull_hex(str, end, v); -} - -typedef struct _ReplyBuffer ReplyBuffer; - -struct _ReplyBuffer -{ - char buffer[70]; /* Should be small enough to fit in one packet */ - char *write; -}; - -static ReplyBuffer tcp_reply; -static ReplyBuffer udp_reply; - -#define REPLY_BUFFER_END(reply) ((reply)->buffer+sizeof((reply)->buffer)) -#define REPLY_BUFFER_LEFT(reply) \ -((reply)->buffer+sizeof((reply)->buffer) - (reply)->write) - -static void -reply_char(ReplyBuffer *reply, char c) -{ - if (REPLY_BUFFER_LEFT(reply) > 0) { - *reply->write++ = c; - } -} - -static void -reply_str(ReplyBuffer *reply, char *str) -{ - while(reply->write < REPLY_BUFFER_END(reply) && *str != '\0') - *reply->write++ = *str++; -} - -static void -stepper_reply(ReplyBuffer *reply, StepperResult res) -{ - switch(res) { - case STEPPER_OK: - reply_str(reply, "OK"); - break; - case STEPPER_ERR_MEM: - reply_str(reply, "ERR MEM"); - break; - case STEPPER_ERR_TOO_LATE: - reply_str(reply, "ERR LATE"); - break; - case STEPPER_ERR_INDEX: /* Sholdn't happen here */ - reply_str(reply, "ERR INDEX"); - break; - default: - reply_str(reply, "ERR"); - } - reply_char(reply, '\n'); -} - -#define CHECK_INPUT_LEFT(x) \ -do {\ -if ((x) > inend - input_line) {reply_str(reply, "ERR\n");return 0;}\ -} while(0) - -static int -handle_line(const char *input_line, const char *inend, ReplyBuffer *reply) -{ - unsigned long when; -#if 0 - { - const char *p = input_line; - printf("Got line: '"); - while(p < inend) { - putchar(*p++); - } - printf("'\n"); - fsync(1); - } -#endif - skip_white(&input_line, inend); - CHECK_INPUT_LEFT(1); - if (*input_line == '#') { - input_line++; - reply_char(reply, '#'); - while (input_line < inend &&*input_line != ' ') { - reply_char(reply, *input_line++); - } - reply_char(reply, ' '); - } - skip_white(&input_line, inend); - - if (*input_line == '@') { - input_line++; - when = parse_uint_hex(&input_line, inend); - } else { - when = stepper_current_period() + 3; - } - skip_white(&input_line, inend); - CHECK_INPUT_LEFT(1); - if (input_line[0] == 'L' || input_line[0] == 'R') { - unsigned int stepper_index = (input_line[0] == 'R' ? 1 : 0); - CHECK_INPUT_LEFT(1); - input_line++; - if (input_line[0] == 'S') { - int speed; - input_line++; - if (input_line == inend) { - /* printf("Speed: %ld\n", - stepper_current_velocity(stepper_index)/VEL_SCALE);*/ - reply_char(reply, input_line[-2]); - reply_char(reply, 'S'); - format_int_hex(&reply->write, REPLY_BUFFER_END(reply), - stepper_current_velocity(stepper_index)/VEL_SCALE); - reply_char(reply, '\n'); - } else { - speed = parse_int_hex(&input_line, inend); - if (*input_line == ',') { - StepperResult res; - unsigned int acc; - input_line++; - acc = parse_uint_hex(&input_line, inend); - /* printf("Speed=%d, Acc=%u\n", speed, acc); */ - res = stepper_set_velocity(stepper_index, &when, - acc, speed*VEL_SCALE); - - stepper_reply(reply, res); - } else { - reply_str(reply, "ERR\n"); - } - } - } else if (input_line[0] == 'C') { - reply_char(reply, input_line[-1]); - reply_char(reply, 'C'); - format_ll_hex(&reply->write, REPLY_BUFFER_END(reply), - stepper_current_step(stepper_index)); - reply_char(reply, '\n'); - } else if (input_line[0] == 'M') { - unsigned int speed; - unsigned int acc; - int move; - input_line++; - speed = parse_uint_hex(&input_line, inend); - CHECK_INPUT_LEFT(1); - if (*input_line == ',') { - input_line++; - acc = parse_uint_hex(&input_line, inend); - if (*input_line == ',') { - StepperResult res; - input_line++; - move = parse_int_hex(&input_line, inend); - /*printf("Speed=%u, Acc=%u, Move=%d\n", speed, acc, move);*/ - res = stepper_move(stepper_index, &when, - acc,speed*VEL_SCALE,move*DIST_SCALE); - stepper_reply(reply, res); - } else { - reply_str(reply, "ERR\n"); - } - } else { - reply_str(reply, "ERR\n"); - } - } else { - reply_str(reply, "ERR\n"); - } - } else if (input_line[0] == 'E') { - STEPPER_ENABLE(); - printf("Stepper enabled\n"); - reply_str(reply, "OK\n"); - } else if (input_line[0] == 'D') { - STEPPER_DISABLE(); - printf("Stepper disabled\n"); - reply_str(reply, "OK\n"); - } else if (input_line[0] == 'p') { - reply_char(reply, 'p'); - format_int_hex(&reply->write, REPLY_BUFFER_END(reply), - cc2420_last_rssi); - reply_char(reply, ','); - format_uint_hex(&reply->write, REPLY_BUFFER_END(reply), - cc2420_last_correlation); - reply_char(reply, '\n'); - } else if (input_line[0] == 'T') { - reply_char(reply, 'T'); - format_int_hex(&reply->write, REPLY_BUFFER_END(reply), - stepper_current_period()); - reply_char(reply, '\n'); - } else if (input_line[0] == 'q') { - return 1; - } else { - reply_str(reply, "ERR\n"); - } - return 0; -} -static unsigned int transmit_len = 0; - -static void -send_reply() -{ - if (transmit_len == 0) { - transmit_len = tcp_reply.write - tcp_reply.buffer; - if (transmit_len > 0) { - /* printf("Sending len = %d\n", transmit_len); */ - uip_send(tcp_reply.buffer, transmit_len); - } - } -} - - -static void -handle_connection() -{ - static char exiting = 0; - static char line_buffer[100]; - static char *line_end; - if (uip_connected()) { - exiting = 0; - transmit_len = 0; - line_end = line_buffer; - tcp_reply.write = tcp_reply.buffer; - reply_str(&tcp_reply, "Ready\n"); - send_reply(); - } - if (uip_acked()) { - if (tcp_reply.write - tcp_reply.buffer > transmit_len) { - memmove(tcp_reply.buffer, tcp_reply.buffer + transmit_len, - tcp_reply.write - tcp_reply.buffer - transmit_len); - } - tcp_reply.write -= transmit_len; - /* printf("Acked: %d left\n", reply_buffer.write-reply_buffer.buffer); */ - transmit_len = 0; - if (exiting && tcp_reply.write == tcp_reply.buffer) { - uip_close(); - exiting = 0; - } - } - if (uip_newdata()) { - const char *read_pos = uip_appdata; - const char *read_end = read_pos + uip_len; - /* printf("Got data\n"); */ - while(read_pos < read_end) { - if (line_end == line_buffer+sizeof(line_buffer)) { - /* Buffer too small, just discard everything */ - line_end = line_buffer; - } - *line_end++ = *read_pos++; - if (line_end[-1] == '\n' || line_end[-1] == '\r' || line_end[-1] == ';'){ - if (line_end - 1 != line_buffer) { - if (handle_line(line_buffer, line_end - 1, &tcp_reply)) { - send_reply(); - /* Postpone closing if there's reply data left to be sent. */ - if (transmit_len == 0) - uip_close(); - else - exiting = 1; - break; - } - } - line_end = line_buffer; - } - } - send_reply(); - } - - if (uip_poll()) { - send_reply(); - } - if(uip_rexmit()) { - printf("Retransmit\n"); - if (transmit_len > 0) - uip_send(tcp_reply.buffer, transmit_len); - } - -} - -PROCESS(udp_stepper_process, "UDP stepper process"); - -PROCESS_THREAD(udp_stepper_process, ev, data) -{ - static struct etimer timer; - static struct uip_udp_conn *conn; - static char listening = 1; /* Listen for connections from anyone */ - static uip_ipaddr_t any; - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("udp_stepper_process starting\n"); - - uip_ipaddr(&any, 0,0,0,0); - conn = udp_new(&any, UIP_HTONS(0), NULL); - if (!conn) goto exit; - uip_udp_bind(conn, UIP_HTONS(1010)); - etimer_set(&timer, CLOCK_SECOND*2); - while(1) { - PROCESS_YIELD(); - - if(ev == tcpip_event) { - if (uip_newdata()) { - struct uip_udpip_hdr *header = (struct uip_udpip_hdr *)uip_buf; - const char *line_start = uip_appdata; - const char *line_end = line_start; - const char *packet_end = line_start + uip_len; - udp_reply.write = udp_reply.buffer; - while(line_end < packet_end) { - if (*line_end == '\n' || *line_end == '\r' || *line_end == ';' ) { - if (line_end != line_start) { - handle_line(line_start, line_end, &udp_reply); - } - line_start = line_end+1; - } - line_end++; - } - /* Check if we are connected to a client, if not reconnect */ - if (listening) { - uip_udp_remove(conn); - conn = udp_new(&header->srcipaddr, header->srcport, &conn); - if (!conn) goto exit; - uip_udp_bind(conn, UIP_HTONS(1010)); - listening = 0; - } - etimer_reset(&timer); - tcpip_poll_udp(conn); - } else if (uip_poll()) { - if (data == &conn) { - uip_send(udp_reply.buffer, udp_reply.write - udp_reply.buffer); - /* printf("sent %ld\n", udp_reply.write - udp_reply.buffer); */ - } - } - } else if (ev == PROCESS_EVENT_TIMER) { - uip_udp_remove(conn); - conn = udp_new(&any, UIP_HTONS(0), NULL); - if (!conn) goto exit; - uip_udp_bind(conn, UIP_HTONS(1010)); - listening = 1; - } - } - - exit: - /* Contiki does automatic garbage collection of uIP state and we - * need not worry about that. */ - printf("udprecv_process exiting\n"); - PROCESS_END(); -} - -static const uint32_t stepper0_steps_acc[] = MICRO_STEP(0,3); -static const uint32_t stepper0_steps_run[] = MICRO_STEP(0,2); -static const uint32_t stepper0_steps_hold[] = MICRO_STEP(0,1); - -static const uint32_t stepper1_steps_acc[] = MICRO_STEP(1,3); -static const uint32_t stepper1_steps_run[] = MICRO_STEP(1,2); -static const uint32_t stepper1_steps_hold[] = MICRO_STEP(1,1); - -static StepperAccSeq seq_heap[40]; - -static void -init_seq_heap() -{ - unsigned int i; - for(i = 0; i < sizeof(seq_heap)/sizeof(seq_heap[0]); i++) { - seq_heap[i].next = NULL; - stepper_free_seq(&seq_heap[i]); - } -} - -static void -robot_stepper_init() -{ - disableIRQ(); - init_seq_heap(); - stepper_init(AT91C_BASE_TC0, AT91C_ID_TC0); - *AT91C_PIOA_OER = STEPPER_INHIBIT; - *AT91C_PIOA_MDER = STEPPER_INHIBIT; /* | STEPPER0_IOMASK; */ - *AT91C_PIOA_CODR = STEPPER_INHIBIT; - stepper_init_io(1, STEPPER_IOMASK(0), stepper0_steps_acc, - stepper0_steps_run, stepper0_steps_hold, - (sizeof(stepper0_steps_run) / sizeof(stepper0_steps_run[0]))); - stepper_init_io(0, STEPPER_IOMASK(1), stepper1_steps_acc, - stepper1_steps_run, stepper1_steps_hold, - (sizeof(stepper1_steps_run) / sizeof(stepper1_steps_run[0]))); - enableIRQ(); -} - - -PROCESS(stepper_process, "Stepper control process"); - -PROCESS_THREAD(stepper_process, ev, data) -{ - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - robot_stepper_init(); - tcp_listen(UIP_HTONS(1010)); - - process_start(&udp_stepper_process, NULL); - printf("Stepper starting\n"); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - if(uip_connected()) { - /* printf("connected\n"); */ - handle_connection(); /* Initialise parser */ - while(!(uip_aborted() || uip_closed() || uip_timedout())) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - handle_connection(); - } - } - printf("disconnected\n"); - } - - exit: - /* Contiki does automatic garbage collection of uIP state and we - * need not worry about that. */ - printf("Stepper exiting\n"); - PROCESS_END(); -} - diff --git a/platform/stepper-robot/stepper-process.h b/platform/stepper-robot/stepper-process.h deleted file mode 100644 index fc396749a..000000000 --- a/platform/stepper-robot/stepper-process.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __STEPPER_PROCESS_H__1OAHVG2XPP__ -#define __STEPPER_PROCESS_H__1OAHVG2XPP__ -#include - -PROCESS_NAME(stepper_process); - -#endif /* __STEPPER_PROCESS_H__1OAHVG2XPP__ */ diff --git a/platform/stepper-robot/stepper/stepper-interrupt.c b/platform/stepper-robot/stepper/stepper-interrupt.c deleted file mode 100644 index b89d8fabf..000000000 --- a/platform/stepper-robot/stepper/stepper-interrupt.c +++ /dev/null @@ -1,296 +0,0 @@ -#include -#include -#include -#include - - - -StepperContext stepper_context; - - -static void -do_step(StepperTimerStep *step) -{ - const uint32_t *io_steps; - StepperState *state = step->state; - - - if (step->power >= STEPPER_POWER_ACC) { - io_steps = state->acc_steps; - } else if (step->power >= STEPPER_POWER_RUN) { - io_steps = state->run_steps; - } else { - io_steps = state->hold_steps; - } - if (io_steps) { - if (step->direction == STEPPER_DIRECTION_FORWARD){ - state->step_count++; - /* dbg_putchar('+'); */ - if (++state->current_step == state->sequence_length) - state->current_step = 0; - } else { - state->step_count--; - /* dbg_putchar('-'); */ - if (state->current_step-- == 0) - state->current_step = state->sequence_length-1; - } - *AT91C_PIOA_ODSR = (*AT91C_PIOA_ODSR & ~state->io_mask) - | (io_steps[state->current_step] & state->io_mask); -#ifdef TIMING_ERRORS - { - long err = ((long)stepper_context.timer_channel->TC_CV - (long)step->time); - if (err >= (TIMER_FREQ/PPS/2)) { - err -= TIMER_FREQ/PPS; - } else if (err < -(TIMER_FREQ/PPS/2)) { - err += TIMER_FREQ/PPS; - } - if (err < state->err_min) state->err_min = err; - if (err > state->err_max) state->err_max = err; - } -#endif - } -} - -static void -set_hold(StepperState *state) { - *AT91C_PIOA_ODSR = (*AT91C_PIOA_ODSR & ~state->io_mask) - | (state->hold_steps[state->current_step] & state->io_mask); -} -static void -advance_step() -{ - StepperTimerStep *current =stepper_context.current_step; - AT91PS_TC timer = stepper_context.timer_channel; - unsigned int now = timer->TC_CV; - while (current && current->time <= now) { - do_step(current); - current = current->next; - if (!current) break; - timer->TC_RA = current->time; - now = timer->TC_CV; - } - stepper_context.current_step = current; -} - - -static inline int64_t -mulsu48_16(int64_t a, uint32_t b) -{ - return a*(int64_t)b; -} - -/* Find a solution for s = a*t*t +v * t in the interval [t_low, t_high[ */ -static unsigned long -solve_dist(long long s, long a, long long v, unsigned long t_low, unsigned long t_high) -{ - long long s_low = mulsu48_16((a*(long)t_low+ v), t_low); - long long s_high = mulsu48_16((a*(long)t_high + v), t_high); - if (s >= s_low && s <= s_high) { - while(t_low + 2 < t_high) { - unsigned long t = (t_high + t_low) / 2; - long long s_mid = mulsu48_16((a*(long)t + v), t); - if (s < s_mid) { - t_high = t; - s_high = s_mid; - } else { - t_low = t; - s_low = s_mid; - } - } - } else { - while(t_low + 1 < t_high) { - unsigned long t = (t_high + t_low) / 2; - long long s_mid = mulsu48_16((a*(long)t + v), t); - if (s > s_mid) { - t_high = t; - s_high = s_mid; - } else { - t_low = t; - s_low = s_mid; - } - } - } - return (t_high + t_low) / 2; -} - - -#define HEAP_SIZE 65 -static StepperTimerStep step_heap[2][HEAP_SIZE]; -static unsigned short heap_pos = 0; /* Next free position in heap */ -static unsigned char current_heap = 0; - -static StepperTimerStep * -allocate_step() -{ - if (heap_pos >= HEAP_SIZE) return NULL; - return &step_heap[current_heap][heap_pos++]; -} - -static void -switch_step_heap() -{ - current_heap ^= 1; - heap_pos = 0; -} - -StepperTimerStep ** -insert_step(StepperTimerStep **at, StepperState *state, - unsigned int time, uint8_t direction, uint8_t power) -{ - StepperTimerStep *new_step; - while(*at && (*at)->time <= time) { - at = &(*at)->next; - } - new_step = allocate_step(); - if (!new_step) return at; - new_step->next = *at; - new_step->state = state; - new_step->time = time; - new_step->direction = direction; - new_step->power = power; - *at = new_step; - /* dbg_putchar('!'); */ - return &new_step->next; -} - -/* Determine suitable power for the current state */ -static uint8_t -get_power(StepperState *state) -{ - if (state->acceleration != 0) return STEPPER_POWER_ACC; - if (state->velocity == 0) return STEPPER_POWER_HOLD; - return STEPPER_POWER_RUN; -} - -#define SQ(x) ((x)*(x)) -#define S_SCALING ((2LL*SQ((long long)TIMER_FREQ)) / DIST_SCALE ) -#define V_SCALING (2LL*TIMER_FREQ/VEL_SCALE) - - -static void -step_interval(StepperState *state) -{ - unsigned int i; - long long v = state->velocity * V_SCALING; - long long a = state->acceleration; - unsigned long t = 0; - StepperTimerStep **at = &stepper_context.steps; - if (state->n_steps >= 0) { - long long s = -state->step_frac * S_SCALING; - for (i = 0; i < state->n_steps; i++) { - s+= DIST_SCALE * S_SCALING; - t = solve_dist(s, a, v, t, TIMER_FREQ/PPS); - /* printf("F%ld\n", t); */ - at = insert_step(at, state, t, STEPPER_DIRECTION_FORWARD, get_power(state)); - } - } else { - long long s = (DIST_SCALE - state->step_frac) * S_SCALING; - for (i = 0; i < -state->n_steps; i++) { - s-= DIST_SCALE * S_SCALING; - t = solve_dist(s, a, v, t, TIMER_FREQ/PPS); - /* printf("B%ld\n", t); */ - at = insert_step(at, state, t, STEPPER_DIRECTION_BACKWARD, get_power(state)); - } - } -} -static void -setup_speed(StepperState *state) -{ - long steps; - long step_frac; - /* printf("%ld v= %ld s=%ld\n",stepper_context.period_count, */ -/* state->velocity, state->step_frac); */ - step_frac = (state->acceleration + 2 * state->velocity - + state->step_frac); - steps = step_frac / DIST_SCALE; - step_frac -= steps * DIST_SCALE; - if (step_frac <0) { - step_frac += DIST_SCALE; - steps--; - } - - /* printf("step_frac=%ld (%f) steps=%ld\n",step_frac, */ -/* (double)step_frac/(double)(DIST_SCALE), steps); */ - state->n_steps = steps; - step_interval(state); - state->velocity += state->acceleration; - state->step_frac = step_frac; - state->step_full += steps; -} - -static void -advance_period() -{ - unsigned int s; - StepperTimerStep *current =stepper_context.current_step; - /* Do any remaining step */ - while (current) { - do_step(current); - current = current->next; - } - /* Start from the beginning */ - stepper_context.current_step = stepper_context.steps; - stepper_context.steps = NULL; - if (stepper_context.current_step) { - stepper_context.timer_channel->TC_RA = stepper_context.current_step->time; - } else { - stepper_context.timer_channel->TC_RA = 0xffff; - } - /* In case there is a step very early in the period */ - advance_step(); - stepper_context.period_count++; - *AT91C_AIC_EOICR = 0; - for(s = 0; s < NUM_STEPPERS; s++) { - StepperState *state = &stepper_context.steppers[s]; - StepperAccSeq *acc_seq; - if (state->acceleration == 0 && state->velocity == 0) { - /* Set hold power if stationary */ - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - set_hold(state); - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - } - while ((acc_seq = state->acceleration_sequence) - && acc_seq->period == stepper_context.period_count + 1) { - state->acceleration_sequence = acc_seq->next; - if (acc_seq->acceleration == STEPPER_ACC_INVALID) { - if (stepper_context.user_callback) { - stepper_context.user_callback(s, stepper_context.period_count); - } - } else { - state->acceleration = acc_seq->acceleration; - } - acc_seq->next = NULL; /* Only free this one */ - stepper_free_seq(acc_seq); - } - setup_speed(&stepper_context.steppers[s]); - } - /* Prepare heap for next period */ - switch_step_heap(); -} - -/* Here we have a proper stack frame and can use local variables */ -static void stepper_int_safe() __attribute((noinline)); -static void -stepper_int_safe() -{ - unsigned int status; - status = stepper_context.timer_channel->TC_SR; - if (status & AT91C_TC_CPAS) { - advance_step(); - /* dbg_putchar('*'); */ - } - if (status & AT91C_TC_CPCS) { - advance_period(); - } else { - *AT91C_AIC_EOICR = 0; /* End of Interrupt */ - } - -} - -void NACKEDFUNC stepper_timer_interrupt (void) { - ISR_STORE(); - ISR_ENABLE_NEST(); - stepper_int_safe(); - ISR_DISABLE_NEST(); - ISR_RESTORE(); -} diff --git a/platform/stepper-robot/stepper/stepper-interrupt.h b/platform/stepper-robot/stepper/stepper-interrupt.h deleted file mode 100644 index 1356004d7..000000000 --- a/platform/stepper-robot/stepper/stepper-interrupt.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __STEPPER3_INTERRUPT_H__2MHD6D6PQ1__ -#define __STEPPER3_INTERRUPT_H__2MHD6D6PQ1__ - -#include - -/* Timer frequency */ -#define TIMER_FREQ 748800 - -typedef struct _StepperContext StepperContext; -typedef struct _StepperState StepperState; -typedef struct _StepperTimerStep StepperTimerStep; - -#define MAX_STEPS_PER_PERIOD 40 -#define NUM_STEPPERS 2 - -#define STEPPER_MAX_VELOCITY 4000 -#define STEPPER_MAX_ACCELRATION 4000 - - -#define TIMING_ERRORS - -struct _StepperState -{ - long step_count; - uint32_t io_mask; - const uint32_t *acc_steps; /* Stepping sequence when accelerating */ - const uint32_t *run_steps; /* Stepping sequence when running */ - const uint32_t *hold_steps; /* Stepping sequence when stationary */ - uint8_t current_step; /* in stepping sequence */ - uint8_t sequence_length; - - long velocity; /* steps/second * PPS */ - long acceleration; /* steps/second^2 */ - long step_full; /* steps, same as step_count at period boundaries */ - long step_frac; /* (steps * PPS^2 * 2) % steps * PPS^2 */ - - long n_steps; /* full steps to move during this period */ - - StepperAccSeq *acceleration_sequence; - -#ifdef TIMING_ERRORS - long err_max; - long err_min; -#endif -}; - -#define STEPPER_POWER_ACC 30 -#define STEPPER_POWER_RUN 20 -#define STEPPER_POWER_HOLD 10 -#define STEPPER_POWER_OFF 0 - -#define STEPPER_DIRECTION_NONE 0 -#define STEPPER_DIRECTION_FORWARD 1 -#define STEPPER_DIRECTION_BACKWARD 2 - -struct _StepperTimerStep -{ - StepperTimerStep *next; - StepperState *state; - uint16_t time; - uint8_t direction; - uint8_t power; -}; - - -struct _StepperContext -{ - unsigned int flags; - unsigned long period_count; - AT91PS_TC timer_channel; - StepperState steppers[NUM_STEPPERS]; - StepperTimerStep *steps; - StepperTimerStep *current_step; - StepperUserCallback user_callback; -}; - -extern StepperContext stepper_context; -#endif /* __STEPPER3_INTERRUPT_H__2MHD6D6PQ1__ */ - -void stepper_timer_interrupt(void); diff --git a/platform/stepper-robot/stepper/stepper-move.c b/platform/stepper-robot/stepper/stepper-move.c deleted file mode 100644 index 8fe6df631..000000000 --- a/platform/stepper-robot/stepper/stepper-move.c +++ /dev/null @@ -1,193 +0,0 @@ -#include -#include -#include -#include - -#if 0 -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) do {} while (0) -#endif - -static unsigned int -isqrt(unsigned long x) -{ - unsigned int r; - unsigned int b2 = 0x40000000; - unsigned int b = 0x8000; - while(x < b2) { - b2 >>= 2; - b >>= 1; - } - if (b == 0) return 0; - r = b; - b >>= 1; - while(b > 0) { - r += b; - unsigned int t = r*r; - if (t > x) { - r -= b; - } - b >>=1; - } - return r; -} - -#define ACC_FIRST_UP 0 -#define ACC_K1_UP 1 -#define ACC_LAST_UP 2 -#define ACC_TOP 3 -#define ACC_FIRST_DOWN 4 -#define ACC_K1_DOWN 5 -#define ACC_LAST_DOWN 6 -#define ACC_END 7 - -typedef struct _AccDiff AccDiff; -struct _AccDiff -{ - long diff; - unsigned long pos; -}; - - -static inline long -base_acc(unsigned long t,unsigned long n, unsigned long l, unsigned long a_max) -{ - long a; - if (t >= n) { - if (t >= n+l) { - a = -a_max; - } else { - a = 0; - } - } else { - a = a_max; - } - return a; -} - -static AccDiff acc[ACC_END+1]; -StepperResult -stepper_move(unsigned int stepper_index, unsigned long *periodp, - unsigned long a_max,unsigned long v_max, long s_end) -{ - unsigned long start_period = *periodp; - unsigned long s; - unsigned long ds; - unsigned long l; - unsigned long da0; - unsigned long k1 = 0; - unsigned long n = (v_max+a_max-1)/a_max; - unsigned long a_speed_adj = v_max - (n-1)*a_max; - unsigned long s_res; - long d; - if (s_end >= 0) { - s_res = s_end/2; - } else { - s_res = (-s_end)/2; - } - d = s_res - (long)a_max*(n*n-1) - (long)a_speed_adj; - - acc[ACC_END].diff = 0; - acc[ACC_END].pos = UINT_MAX; - if (d < 0) { - l = 0; - n = isqrt(s_res/a_max); - if (n*(unsigned long long)n*a_max < s_res) n++; - a_speed_adj = a_max; - acc[ACC_LAST_UP].diff=0; - acc[ACC_FIRST_DOWN].diff=0; - } else { - l = (d+v_max-1)/v_max; - acc[ACC_LAST_UP].diff= a_speed_adj - a_max; - acc[ACC_FIRST_DOWN].diff= a_max - a_speed_adj; - } - acc[ACC_LAST_UP].pos = n-1; - acc[ACC_FIRST_DOWN].pos = n+l; - - s = a_max*(n*n-1) + a_speed_adj + l * (a_max*(n-1) + a_speed_adj); - ds = s-s_res; - - da0 = ds/(2*n+l-1); - acc[ACC_FIRST_UP].diff = -da0; - acc[ACC_LAST_DOWN].diff = da0; - acc[ACC_FIRST_UP].pos = 0; - acc[ACC_LAST_DOWN].pos = 2*n+l-1; - ds -= da0*(2*n+l-1); - - acc[ACC_K1_UP].diff = 0; - acc[ACC_K1_DOWN].diff = 0; - acc[ACC_K1_UP].pos = 0; - acc[ACC_K1_DOWN].pos = 2*n+l-1; - - acc[ACC_TOP].diff = 0; - acc[ACC_TOP].pos = n; - - if (ds > 0) { - k1 = (2*n+l -ds)/2; - if (k1 < n) { - - acc[ACC_K1_UP].diff = -1; - acc[ACC_K1_DOWN].diff = 1; - acc[ACC_K1_UP].pos = k1; - acc[ACC_K1_DOWN].pos = 2*n+l-1 - k1; - ds -= (2*(n-k1)+l-1); - } - if (ds > 0) { - acc[ACC_LAST_UP].diff--; - acc[ACC_TOP].diff = 1; - acc[ACC_TOP].pos = n+ds-1; - } - } -#if 0 - { - unsigned int k; - PRINTF("n=%ld l=%ld a_max=%ld v_max=%ld s_res=%ld\n", - n,l ,a_max, v_max, s_res); - for (k = 0; k < 7; k++) { - PRINTF(" %ld@%ld", acc[k].diff, acc[k].pos); - } - PRINTF("\n"); - } -#endif - { - StepperResult res; - unsigned int k; - unsigned long t = 0; - long da = 0; - long a_prev = ULONG_MAX; - for (k = 0; k < ACC_END; k++) { - long a; - da += acc[k].diff; - if (acc[k].pos != acc[k+1].pos) { /* Next position is different */ - if (t != acc[k].pos) { - a = base_acc(t,n,l,a_max); - if (s_end < 0) a = -a; - if (a_prev != a) { - res = stepper_add_acc(stepper_index, t+start_period, a); - if (res != STEPPER_OK) return res; - PRINTF("%d: %ld@%ld\n", stepper_index, a, t+start_period); - a_prev = a; - } - t = acc[k].pos; - } - a = da + base_acc(t,n,l,a_max); - if (s_end < 0) a = -a; - if (a_prev != a) { - res = stepper_add_acc(stepper_index, t+start_period, a); - if (res != STEPPER_OK) return res; - PRINTF("%d: %ld@%ld\n", stepper_index, a, t+start_period); - a_prev = a; - } - t++; - da = 0; - } - } - res = stepper_add_acc(stepper_index, t+start_period, 0); - PRINTF("%d: %d@%ld\n", stepper_index, 0, t+start_period); - if (res != STEPPER_OK) return res; - *periodp += t; - } - return STEPPER_OK; -} - diff --git a/platform/stepper-robot/stepper/stepper-move.h b/platform/stepper-robot/stepper/stepper-move.h deleted file mode 100644 index 5bea1cd3f..000000000 --- a/platform/stepper-robot/stepper/stepper-move.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __STEPPER_MOVE_H__9UFUHMYMYS__ -#define __STEPPER_MOVE_H__9UFUHMYMYS__ - -StepperResult -stepper_move(unsigned int stepper_index, unsigned long *periodp, - unsigned long a_max,unsigned long v_max, long s_end); - -#endif /* __STEPPER_MOVE_H__9UFUHMYMYS__ */ diff --git a/platform/stepper-robot/stepper/stepper-steps.h b/platform/stepper-robot/stepper/stepper-steps.h deleted file mode 100644 index 35f778454..000000000 --- a/platform/stepper-robot/stepper/stepper-steps.h +++ /dev/null @@ -1,103 +0,0 @@ -#include - -#ifndef MAX -#define MIN(a,b) (((a) > (b)) ? (b) : (a)) -#endif - -/* Pins for stepper 0 */ -#define STEPPER0_I00 AT91C_PIO_PA17 -#define STEPPER0_I01 AT91C_PIO_PA18 -#define STEPPER0_PHASE0 AT91C_PIO_PA19 - -#define STEPPER0_I10 AT91C_PIO_PA21 -#define STEPPER0_I11 AT91C_PIO_PA22 -#define STEPPER0_PHASE1 AT91C_PIO_PA23 - -/* Pins for stepper 1 */ -#define STEPPER1_I00 AT91C_PIO_PA24 -#define STEPPER1_I01 AT91C_PIO_PA25 -#define STEPPER1_PHASE0 AT91C_PIO_PA26 - -#define STEPPER1_I10 AT91C_PIO_PA27 -#define STEPPER1_I11 AT91C_PIO_PA28 -#define STEPPER1_PHASE1 AT91C_PIO_PA29 - -/* Common pins */ -#define STEPPER_INHIBIT AT91C_PIO_PA7 - - -#define STEPPER_IOMASK(s) (STEPPER##s##_I00 | STEPPER##s##_I01 | STEPPER##s##_PHASE0 \ - | STEPPER##s##_I10 | STEPPER##s##_I11 | STEPPER##s##_PHASE1) -#define STEPPER_PHASE(s,p,l) ((((l) < 2) ? (STEPPER##s##_I##p##1) : 0) | (((l) & 1) ? 0 : (STEPPER##s##_I##p##0))) - -#define STEPPER_STEP(s, l0, l1) (\ -((l0 >= 0) ? STEPPER_PHASE(s,0, l0):(STEPPER_PHASE(s,0, -(l0))|STEPPER##s##_PHASE0)) | \ -((l1 >= 0) ? STEPPER_PHASE(s,1, l1):(STEPPER_PHASE(s,1,-(l1))|STEPPER##s##_PHASE1))) - - -#define FULL_STEP_BOTH(s,l) {\ - STEPPER_STEP(s,(l),(l)), \ - STEPPER_STEP(s,(l),-(l)), \ - STEPPER_STEP(s,-(l),-(l)), \ - STEPPER_STEP(s,-(l),(l))} - - -#define FULL_STEP_SINGLE(s,l) {\ - STEPPER_STEP(s,0,(l)), \ - STEPPER_STEP(s,(l),0), \ - STEPPER_STEP(s,0,-(l)), \ - STEPPER_STEP(s,-(l),0)} - -#define HALF_STEP(s,l) {\ - STEPPER_STEP(s,0,(l)), \ - STEPPER_STEP(s,(l),(l)), \ - STEPPER_STEP(s,(l),0), \ - STEPPER_STEP(s,(l),-(l)), \ - STEPPER_STEP(s,0,-(l)), \ - STEPPER_STEP(s,-(l),-(l)), \ - STEPPER_STEP(s,-(l),0), \ - STEPPER_STEP(s,-(l),(l))} - - -#define MINI_STEP(s,l) {\ - STEPPER_STEP(s,0,(l)), \ - STEPPER_STEP(s,1,MIN((l),2)), \ - STEPPER_STEP(s,MIN((l),2),1), \ - STEPPER_STEP(s,(l),0), \ - STEPPER_STEP(s,MIN((l),2),-1), \ - STEPPER_STEP(s,1,-MIN((l),2)), \ - STEPPER_STEP(s,0,-(l)), \ - STEPPER_STEP(s,-1,-MIN((l),2)), \ - STEPPER_STEP(s,-MIN((l),2),-1), \ - STEPPER_STEP(s,-(l),0), \ - STEPPER_STEP(s,-MIN((l),2),1), \ - STEPPER_STEP(s,-1,MIN((l),2))} - -#define MICRO_STEP(s,l) {\ - STEPPER_STEP(s,0,(l)), \ - STEPPER_STEP(s,1,(l)), \ - STEPPER_STEP(s,MIN((l),2),(l)), \ - STEPPER_STEP(s,(l),(l)), \ - STEPPER_STEP(s,(l),MIN((l),2)), \ - STEPPER_STEP(s,(l),1), \ - STEPPER_STEP(s,(l),0), \ - STEPPER_STEP(s,(l),-1), \ - STEPPER_STEP(s,(l),-MIN((l),2)), \ - STEPPER_STEP(s,(l),-(l)), \ - STEPPER_STEP(s,MIN((l),2),-(l)), \ - STEPPER_STEP(s,1,-(l)), \ - STEPPER_STEP(s,0,-(l)), \ - STEPPER_STEP(s,-1,-(l)), \ - STEPPER_STEP(s,-MIN((l),2),-(l)), \ - STEPPER_STEP(s,-(l),-(l)), \ - STEPPER_STEP(s,-(l),-MIN((l),2)), \ - STEPPER_STEP(s,-(l),-1), \ - STEPPER_STEP(s,-(l),0), \ - STEPPER_STEP(s,-(l),1), \ - STEPPER_STEP(s,-(l),MIN((l),2)), \ - STEPPER_STEP(s,-(l),(l)), \ - STEPPER_STEP(s,-MIN((l),2),(l)), \ - STEPPER_STEP(s,-1,(l))} - -#define STEPPER_ENABLE() (*AT91C_PIOA_SODR = STEPPER_INHIBIT) -#define STEPPER_DISABLE() (*AT91C_PIOA_CODR = STEPPER_INHIBIT) diff --git a/platform/stepper-robot/stepper/stepper.c b/platform/stepper-robot/stepper/stepper.c deleted file mode 100644 index 9f6f3c00d..000000000 --- a/platform/stepper-robot/stepper/stepper.c +++ /dev/null @@ -1,360 +0,0 @@ -#include -#include - -#ifndef NUL -#define NULL 0 -#endif - -static StepperAccSeq *free_seq = NULL; - -StepperAccSeq * -stepper_allocate_seq() -{ - StepperAccSeq *seq; - if (!free_seq) return NULL; - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - seq = free_seq; - free_seq = seq->next; - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - return seq; -} - - -void -stepper_free_seq(StepperAccSeq *seq) -{ - StepperAccSeq *s; - if (!seq) return; - s = seq; - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - while(s->next) s = s->next; - s->next = free_seq; - free_seq = seq; - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; -} - -static void -stepper_state_init(StepperState *stepper) -{ - stepper->step_count = 0; - stepper->io_mask = 0; - stepper->acc_steps = NULL; - stepper->run_steps = NULL; - stepper->hold_steps = NULL; - stepper->current_step = 0; - stepper->sequence_length = 0; - - stepper->velocity = 0; - stepper->acceleration = 0; - stepper->step_full = 0; - stepper->step_frac = 0; - stepper->n_steps = 0; - -#ifdef TIMING_ERRORS - stepper->err_min = TIMER_FREQ; - stepper->err_max = -TIMER_FREQ; -#endif - -} - -void -stepper_init(AT91PS_TC timer, unsigned int id) -{ - unsigned int s; - stepper_context.flags = 0; - stepper_context.timer_channel = timer; - stepper_context.steps = NULL; - stepper_context.current_step = NULL; - stepper_context.period_count = 0; - stepper_context.user_callback = NULL; - - for (s = 0; s < NUM_STEPPERS; s++) { - stepper_state_init(&stepper_context.steppers[s]); - } - timer->TC_CMR = (AT91C_TC_WAVE | AT91C_TC_WAVESEL_UP_AUTO - | AT91C_TC_CLKS_TIMER_DIV3_CLOCK); - timer->TC_RC = TIMER_FREQ / PPS; - timer->TC_RA = 0xffff; - timer->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - *AT91C_PMC_PCER = (1 << id); - - AT91C_AIC_SMR[id] = AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE | 7; - AT91C_AIC_SVR[id] = (unsigned long)stepper_timer_interrupt; - *AT91C_AIC_IECR = (1 << id); - timer->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG; -} - -void -stepper_init_io(unsigned int stepper_index, uint32_t mask, - const uint32_t *acc, const uint32_t *run, - const uint32_t *hold, unsigned int nsteps) -{ - StepperState *state; - if (stepper_index >= NUM_STEPPERS) return; - state = &stepper_context.steppers[stepper_index]; - - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - - state->io_mask = mask; - state->acc_steps = acc; - state->run_steps = run; - state->hold_steps = hold; - state->current_step = 0; - state->sequence_length = nsteps; - *AT91C_PIOA_OWER = mask; - *AT91C_PIOA_MDDR = mask; - - *AT91C_PIOA_ODSR = ((*AT91C_PIOA_ODSR & ~mask) - | (state->hold_steps[0] & mask)); - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - *AT91C_PIOA_OER = mask; -} - -/** - Append an acceleration sequence - - Truncates the current acceleration sequence at the insertion time - and appends the new sequence at that position.. The insertion time - is the time of the first element of the new sequence. The - truncation takes place after any elements with the acceleration set - to STEPPER_ACC_INVALID (user callbacks) that has the same time as - the insertion time. All other elements with the same time is - replaced. - - \param stepper_index Index of the stepper the sequence is intended for. - \param new_seq A linked list of sequence elements to append. - */ -StepperResult -stepper_add_acc_seq(unsigned int stepper_index, StepperAccSeq *new_seq) -{ - StepperResult res = STEPPER_ERR_TOO_LATE; - StepperAccSeq **seqp; - StepperState *state; - if (stepper_index >= NUM_STEPPERS) return STEPPER_ERR_INDEX; - state = &stepper_context.steppers[stepper_index]; - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - seqp = &state->acceleration_sequence; - while(*seqp && ((*seqp)->period < new_seq->period || ((*seqp)->period == new_seq->period && (*seqp)->acceleration == STEPPER_ACC_INVALID))) { - seqp = &(*seqp)->next; - } - if (new_seq->period > stepper_context.period_count + 1) { - /* Replace tail of sequence */ - if (*seqp) stepper_free_seq(*seqp); - *seqp = new_seq; - res = STEPPER_OK; - } - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - return res; -} - -/** - Insert a callback mark - - Inserts a callback mark at the indicated period. This will cause - the callback procedure to be called just before that period, - usually near the beginning of the previous period. Does not - truncate the current sequence. - - \param stepper_index Index of the stepper the callbak is intended for. - \param period When the callback should be invoked - - \sa stepper_set_callback_proc -*/ - -StepperResult -stepper_insert_callback(unsigned int stepper_index, unsigned int period) -{ - StepperResult res = STEPPER_ERR_TOO_LATE; - StepperAccSeq **seqp; - StepperState *state; - if (stepper_index >= NUM_STEPPERS) return STEPPER_ERR_INDEX; - state = &stepper_context.steppers[stepper_index]; - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - seqp = &state->acceleration_sequence; - while(*seqp && (*seqp)->period < period) { - seqp = &(*seqp)->next; - } - if (period > stepper_context.period_count + 1) { - StepperAccSeq *new_seq = stepper_allocate_seq(); - if (!new_seq) { - res = STEPPER_ERR_MEM; - } else { - new_seq->next = *seqp; - *seqp = new_seq; - new_seq->period = period; - new_seq->acceleration = STEPPER_ACC_INVALID; - res = STEPPER_OK; - } - } - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - return res; -} - -StepperResult -stepper_add_acc(unsigned int stepper_index, unsigned int period, long acc) -{ - StepperAccSeq *seq = stepper_allocate_seq(); - /* printf("stepper_add_acc: %d %d %ld\n", stepper_index, period, acc); */ - if (!seq) return STEPPER_ERR_MEM; - seq->next = NULL; - seq->period = period; - seq->acceleration = acc; - return stepper_add_acc_seq(stepper_index, seq); -} - -void -stepper_set_callback_proc(StepperUserCallback callback) -{ - stepper_context.user_callback = callback; -} - -unsigned long -stepper_current_period() -{ - return stepper_context.period_count; -} - -long -stepper_current_step(unsigned int stepper_index) -{ - StepperState *state = &stepper_context.steppers[stepper_index]; - return state->step_count; -} - -long long -stepper_step_frac(unsigned int stepper_index) -{ - long long s; - StepperState *state = &stepper_context.steppers[stepper_index]; - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - s = state->step_full * DIST_SCALE + state->step_frac; - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - return s; -} - -long -stepper_current_velocity(unsigned int stepper_index) -{ - StepperState *state = &stepper_context.steppers[stepper_index]; - return state->velocity; -} - -/* Calculate the speed at given current given the current acceleration - sequence. */ -unsigned long -stepper_velocity(unsigned int stepper_index, unsigned long period) -{ - long a; - long v; - unsigned long t; - StepperState *state; - StepperAccSeq *seq; - state = &stepper_context.steppers[stepper_index]; - - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - seq = state->acceleration_sequence; - a = state->acceleration; - v = state->velocity; - t = stepper_context.period_count + 2; - - while(seq && seq->period < period) { - v += a * (seq->period - t); - t = seq->period; - a = seq->acceleration; - seq = seq->next; - } - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - v += a * (period - t); - return v; -} - -/** - Calculate the speed and position at specified period given the - current acceleration sequence. - - \param stepper_index Index of the stepper the callbak is intended for. - \param period The period to calculate for - \param Speed return - \param Position return. In fractional steps - -*/ -StepperResult -stepper_state_at(unsigned int stepper_index, unsigned long period, - long *velocity, long long *position) -{ - long a; - long v; - long long s; - unsigned long t; - long dt; - StepperState *state; - StepperAccSeq *seq; - state = &stepper_context.steppers[stepper_index]; - - stepper_context.timer_channel->TC_IDR = AT91C_TC_CPCS | AT91C_TC_CPAS; - if (period < stepper_context.period_count + 2) { - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - return STEPPER_ERR_TOO_LATE; - } - seq = state->acceleration_sequence; - a = state->acceleration; - v = state->velocity; - t = stepper_context.period_count + 2; - s = state->step_full * (long long)DIST_SCALE + state->step_frac; - while(seq && seq->period < period) { - dt = seq->period - t; - s += (a * (long long)dt + 2 * v) * dt; - v += a * (seq->period - t); - t = seq->period; - a = seq->acceleration; - seq = seq->next; - } - stepper_context.timer_channel->TC_IER = AT91C_TC_CPCS | AT91C_TC_CPAS; - dt = period - t; - *position = s + (a * (long long)dt + (DIST_SCALE/VEL_SCALE) * v) * dt; - *velocity = v + a * dt; - - return STEPPER_OK; -} - - -StepperResult -stepper_set_velocity(unsigned int stepper_index, unsigned long *periodp, - unsigned long max_acc, long final_speed) -{ - long start_period = *periodp; - long v = stepper_velocity(stepper_index, start_period); - /* printf("%ld @ %ld\n", v, start_period); */ - if (final_speed == v) { - return stepper_add_acc(stepper_index, start_period, 0); - } else { - StepperResult res; - long a = (final_speed > v) ? max_acc : -max_acc; - long t = ((long)(final_speed - v)) / a; - long diff = (final_speed - v) - t * a; - if (t > 0) { - res = stepper_add_acc(stepper_index, start_period, a); - if (res != STEPPER_OK) return res; - } - if (diff) { - res = stepper_add_acc(stepper_index, start_period+t, diff); - if (res != STEPPER_OK) return res; - t++; - } - *periodp = start_period+t; - return stepper_add_acc(stepper_index, start_period+t, 0); - } -} - -#ifdef TIMING_ERRORS -void -stepper_timing_errors(unsigned int stepper_index, long *min, long *max) -{ - StepperState *state; - state = &stepper_context.steppers[stepper_index]; - *min = state->err_min; - *max = state->err_max; - state->err_max = -TIMER_FREQ; - state->err_min = TIMER_FREQ; -} -#endif diff --git a/platform/stepper-robot/stepper/stepper.h b/platform/stepper-robot/stepper/stepper.h deleted file mode 100644 index 6e067641c..000000000 --- a/platform/stepper-robot/stepper/stepper.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __STEPPER_H__JPA916UOFT__ -#define __STEPPER_H__JPA916UOFT__ - -#include -#include -#include - -/* Define periods/second */ -#define PPS 128 - -/* Scaling factor for distance */ -#define DIST_SCALE (2 * PPS * PPS) - -/* Scaling factor for velocity */ -#define VEL_SCALE PPS - -typedef struct _StepperAccSeq StepperAccSeq; -struct _StepperAccSeq -{ - StepperAccSeq *next; - unsigned long period; - long acceleration; -}; - -#define STEPPER_ACC_INVALID LONG_MAX - -#define STEPPER_MAX_VELOCITY 4000 -#define STEPPER_MAX_ACCELRATION 4000 - -typedef void (*StepperUserCallback)(unsigned int stepper_index, - unsigned long period); - - -typedef unsigned int StepperResult; -#define STEPPER_OK 0 -#define STEPPER_ERR_MEM 1 -#define STEPPER_ERR_TOO_LATE 2 -#define STEPPER_ERR_INDEX 3 - -void -stepper_init(AT91PS_TC timer, unsigned int id); - -void -stepper_init_io(unsigned int stepper_index, uint32_t mask, - const uint32_t *acc, const uint32_t *run, - const uint32_t *hold, unsigned int nsteps); - -/* Returns true if the new sequence was actually added or false - if the index is illegal or the first step in the sequence is too soon */ - -StepperResult -stepper_add_acc_seq(unsigned int stepper_index, StepperAccSeq *new_seq); - -StepperResult -stepper_add_acc(unsigned int stepper_index, unsigned int period, long acc); - -StepperResult -stepper_insert_callback(unsigned int stepper_index, unsigned int period); - -void -stepper_set_callback_proc(StepperUserCallback callback); - -unsigned long -stepper_current_period(); - -long -stepper_current_step(unsigned int stepper_index); - -long long -stepper_step_frac(unsigned int stepper_index); - -long -stepper_current_velocity(unsigned int stepper_index); - -unsigned long -stepper_velocity(unsigned int stepper_index, unsigned long period); - -StepperResult -stepper_state_at(unsigned int stepper_index, unsigned long period, - long *velocity, long long *position); - -StepperResult -stepper_set_velocity(unsigned int stepper_index, unsigned long *periodp, - unsigned long max_acc, long final_speed); - -StepperAccSeq * -stepper_allocate_seq(); - -void -stepper_free_seq(StepperAccSeq *seq); - -#ifdef TIMING_ERRORS - -void -stepper_timing_errors(unsigned int stepper_index, long *min, long *max); -#endif - -#endif /* __STEPPER_H__JPA916UOFT__ */ diff --git a/platform/stepper-robot/sys-tst.c b/platform/stepper-robot/sys-tst.c deleted file mode 100644 index d8b7e6d88..000000000 --- a/platform/stepper-robot/sys-tst.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -volatile const char * volatile input_line = NULL; -volatile unsigned int input_line_len = 0; - -static void -recv_input(const char *str, unsigned int len) -{ - /* Assume that the line is handled before any new characters is written - to the buffer */ - input_line = str; - input_line_len = len; -} -PROCESS(blink_process, "LED blink process"); - -PROCESS_THREAD(blink_process, ev , data) -{ - static struct etimer timer; - PROCESS_BEGIN(); - etimer_set(&timer, CLOCK_SECOND/2); - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT || - ev== PROCESS_EVENT_TIMER); - if (ev == PROCESS_EVENT_EXIT) break; - leds_invert(LEDS_RED); -#if 0 - { - DISABLE_FIFOP_INT(); - printf("FSMSTATE: %04x",cc2420_getreg(CC2420_FSMSTATE)); - ENABLE_FIFOP_INT(); - if (SFD_IS_1) printf(" SFD"); - if (FIFO_IS_1) printf(" FIFO"); - if (FIFOP_IS_1) printf(" FIFOP"); - putchar('\n'); - } -#endif - etimer_reset(&timer); - } - printf("Ended process\n"); - PROCESS_END(); -} -PROCINIT(&etimer_process, &blink_process); -int -main() -{ - disableIRQ(); - disableFIQ(); - *AT91C_AIC_IDCR = 0xffffffff; - *AT91C_PMC_PCDR = 0xffffffff; - *AT91C_PMC_PCER = (1 << AT91C_ID_PIOA); - - dbg_setup_uart(); - printf("Initialising\n"); - dbg_set_input_handler(recv_input); - leds_arch_init(); - clock_init(); - - process_init(); - printf("Started\n"); - - procinit_init(); - enableIRQ(); - printf("Processes running\n"); - while(1) { - do { - /* Reset watchdog. */ - } while(process_run() > 0); - /* Idle! */ - /* Stop processor clock */ - *AT91C_PMC_SCDR |= AT91C_PMC_PCK; - } - return 0; -} diff --git a/platform/stepper-robot/usb-main.c b/platform/stepper-robot/usb-main.c deleted file mode 100644 index cf10c1f11..000000000 --- a/platform/stepper-robot/usb-main.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -unsigned int idle_count = 0; - -int -main() -{ - dbg_setup_uart(); - printf("Initialising\n"); - - clock_init(); - process_init(); - process_start(&etimer_process, NULL); - autostart_start(autostart_processes); - printf("Processes running\n"); - while(1) { - do { - } while(process_run() > 0); - idle_count++; - /* Idle! */ - /* Stop processor clock */ - *AT91C_PMC_SCDR |= AT91C_PMC_PCK; - } - return 0; -} diff --git a/platform/stepper-robot/usb-msc/Makefile b/platform/stepper-robot/usb-msc/Makefile deleted file mode 100644 index 83ad96b17..000000000 --- a/platform/stepper-robot/usb-msc/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -TARGET=stepper-robot - -all: usbmsctst - - -CONTIKI=../../.. - -CONTIKI_TARGET_MAIN=usb-main.c - -PROJECT_SOURCEFILES = - -USB_MASS_STORAGE_CLASS=1 - - -clean: stepper_robot_clean - -.PHONY: stepper_robot_clean - -stepper_robot_clean: - -include $(CONTIKI)/Makefile.include diff --git a/platform/stepper-robot/usb-msc/usbmsctst.c b/platform/stepper-robot/usb-msc/usbmsctst.c deleted file mode 100644 index 1746744ca..000000000 --- a/platform/stepper-robot/usb-msc/usbmsctst.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -PROCESS(usb_masstest_process, "USB massstorage test process"); - -#if 0 -extern unsigned int idle_count; -#endif - -PROCESS_THREAD(usb_masstest_process, ev , data) -{ - static unsigned int last_count; - PROCESS_BEGIN(); - static struct etimer timer; - usb_msc_bulk_setup(); - etimer_set(&timer, CLOCK_SECOND); -#if 0 - last_count = idle_count; -#endif - while(1) { - PROCESS_WAIT_EVENT(); - if (ev == PROCESS_EVENT_TIMER) { -#if 0 - printf("Idle count: %d\n", idle_count - last_count); - last_count = idle_count; -#endif - etimer_reset(&timer); - } - } - PROCESS_END(); -} - - -AUTOSTART_PROCESSES(&usb_masstest_process); diff --git a/platform/stk500/Makefile b/platform/stk500/Makefile deleted file mode 100644 index 3e1094a59..000000000 --- a/platform/stk500/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: contiki-stk500-main.out -upload: contiki-stk500-main.u - -CONTIKI=../.. -TARGET=stk500 - -include $(CONTIKI)/Makefile.include diff --git a/platform/stk500/Makefile.stk500 b/platform/stk500/Makefile.stk500 deleted file mode 100644 index 3d8fdc645..000000000 --- a/platform/stk500/Makefile.stk500 +++ /dev/null @@ -1,19 +0,0 @@ -CONTIKI_TARGET_DIRS = . dev apps loader -CONTIKI_TARGET_MAIN = contiki-stk500-main.o - -CONTIKI_SOURCEFILES += rs232.c contiki-stk500-main.c - -CONTIKI_NO_NET=1 -CONTIKIAVR=$(CONTIKI)/cpu/avr -CONTIKIBOARD=. - -//MCU=atmega8 -MCU=atmega8515 -//MCU=atmega644 -//MCU=atmega328p -//MCU=atmega16 -//MCU=atmega32 - -CONTIKI_PLAT_DEFS = -DF_CPU=8000000UL -DAUTO_CRC_PADDING=2 - -include $(CONTIKIAVR)/Makefile.avr diff --git a/platform/stk500/contiki-conf.h b/platform/stk500/contiki-conf.h deleted file mode 100644 index 6bb4a00a8..000000000 --- a/platform/stk500/contiki-conf.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#include - -/* Platform name, type, and MCU clock rate */ -#define PLATFORM_NAME "STK500" -#define PLATFORM_TYPE STK500 -#ifndef F_CPU -#define F_CPU 8000000UL -#endif - -#define CCIF -#define CLIF - -/* The AVR tick interrupt usually is done with an 8 bit counter around 128 Hz. - * 125 Hz needs slightly more overhead during the interrupt, as does a 32 bit - * clock_time_t. - */ - /* Clock ticks per second */ -#define CLOCK_CONF_SECOND 125 -#if 1 -/* 16 bit counter overflows every ~10 minutes */ -typedef unsigned short clock_time_t; -#define CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0) -#define INFINITE_TIME 0xffff -#define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */ -#define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */ -#else -typedef unsigned long clock_time_t; -#define CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0) -#define INFINITE_TIME 0xffffffff -#endif -/* These routines are not part of the contiki core but can be enabled in cpu/avr/clock.c */ -void clock_delay_msec(uint16_t howlong); -void clock_adjust_ticks(clock_time_t howmany); - -#define SLIP_PORT 0 - -#if UIP_CONF_IPV6 -#define RIMEADDR_CONF_SIZE 8 -#define UIP_CONF_ICMP6 1 -#define UIP_CONF_UDP 1 -#define UIP_CONF_TCP 1 -//#define UIP_CONF_IPV6_RPL 0 - -/* See uip-ds6.h */ -#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 -#define UIP_CONF_DS6_DEFRT_NBU 2 -#define UIP_CONF_DS6_PREFIX_NBU 3 -#define UIP_CONF_MAX_ROUTES 20 -#define UIP_CONF_DS6_ADDR_NBU 3 -#define UIP_CONF_DS6_MADDR_NBU 0 -#define UIP_CONF_DS6_AADDR_NBU 0 - -#define NETSTACK_CONF_NETWORK sicslowpan_driver -#define NETSTACK_CONF_MAC nullmac_driver -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#define NETSTACK_CONF_RDC sicslowmac_driver -#define NETSTACK_CONF_FRAMER framer_802154 -#define NETSTACK_CONF_RADIO rf230_driver -#define CHANNEL_802_15_4 26 -/* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */ -#define RF230_CONF_AUTOACK 1 -/* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */ -#define SICSLOWPAN_CONF_ACK_ALL 0 -/* Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode with CCA) */ -#define RF230_CONF_AUTORETRIES 2 -#define SICSLOWPAN_CONF_FRAG 1 -/* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */ -#define SICSLOWPAN_CONF_MAXAGE 3 -/* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */ -#define UIP_CONF_WAIT_TIMEOUT 5 - -#else -/* ip4 should build but is largely untested */ -#define RIMEADDR_CONF_SIZE 2 -#define NETSTACK_CONF_NETWORK rime_driver -#endif /* UIP_CONF_IPV6 */ - -typedef unsigned short uip_stats_t; - -/* These names are deprecated, use C99 names. */ -typedef uint8_t u8_t; -typedef int8_t s8_t; -typedef uint16_t u16_t; -typedef int16_t s16_t; -typedef uint32_t u32_t; -typedef int32_t s32_t; - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/stk500/contiki-stk500-main.c b/platform/stk500/contiki-stk500-main.c deleted file mode 100644 index 54169f19e..000000000 --- a/platform/stk500/contiki-stk500-main.c +++ /dev/null @@ -1,236 +0,0 @@ - -/* Copyright (c) 2008, Daniel Willmann - * 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 Contiki OS - * - * - */ - -#include "contiki.h" -#include "dev/rs232.h" - -#include -#include -#include -#include - -#define PRINTA(FORMAT,args...) printf_P(PSTR(FORMAT),##args) -#define DEBUG 0 -#if DEBUG -#define PRINTD PRINTA -#else -#define PRINTD(...) -#endif - -/* Test rtimers, also stack monitor and time stamps */ -#define TESTRTIMER 1 -#if TESTRTIMER -#define STAMPS 30 -#define STACKMONITOR 128 - -uint8_t rtimerflag=1; -uint16_t rtime; -struct rtimer rt; -void rtimercycle(void) {rtimerflag=1;} -#endif /* TESTRTIMER */ - -#if defined (__AVR_ATmega8__) -FUSES = - { - .low = 0xe0, - .high = 0xd9, - }; -#elif defined (__AVR_ATmega16__) -FUSES = - { - .low = 0xe0, - .high = 0x99, - }; -#elif defined (__AVR_ATmega644__) -FUSES = - { - .low = 0xe0, - .high = 0x99, - .extended = 0xff, - }; - -//MCU=atmega8515 -//MCU=atmega328p -//MCU=atmega32 -#endif - - -PROCESS(led_process, "LED process"); -PROCESS_THREAD(led_process, ev, data) -{ - static struct etimer etimer; - - PROCESS_BEGIN(); - while (1) { - PRINTD("LED1\r\n"); - PORTB |= (1< %d bytes\n",p-(uint16_t)&__bss_end); - break; - } - p+=4; - } while (p - * - * @(#)$$ - */ -#include "contiki-stk501.h" - -void -init_lowlevel(void) -{ - /* Configure default slip port with 115200 baud */ - rs232_init(RS232_PORT_0, USART_BAUD_115200, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); - - /* Second rs232 port for debugging */ - rs232_init(RS232_PORT_1, USART_BAUD_9600, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); - - /* Redirect stdout to second port */ - rs232_redirect_stdout (RS232_PORT_1); -} diff --git a/platform/stk501/contiki-stk501-default-init-net.c b/platform/stk501/contiki-stk501-default-init-net.c deleted file mode 100644 index 037edfb07..000000000 --- a/platform/stk501/contiki-stk501-default-init-net.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * Author: Simon Barner - * - * @(#)$$ - */ - -#include "contiki-stk501.h" - -#if UIP_CONF_IPV6 -#warning ********Explcit IPV4 code bypassed*********** -#else - -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(10,100,0,0, 255,255,0,0, slip_send)}; -#endif - -void -init_net(void) -{ -#if !UIP_CONF_IPV6 - uip_ipaddr_t hostaddr; - - rs232_set_input (SLIP_PORT, slip_input_byte); - process_start(&slip_process, NULL); - - uip_ipaddr(&hostaddr, 10, 100, 0, 2); - uip_sethostaddr(&hostaddr); - - uip_fw_register(&slipif); - // uip_fw_default(&slipif); -#endif /* UIP_CONF_IPV6 */ -} diff --git a/platform/stk501/contiki-stk501-main.c b/platform/stk501/contiki-stk501-main.c deleted file mode 100644 index 3223bbfae..000000000 --- a/platform/stk501/contiki-stk501-main.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - */ - -/** - * \file - * Sample Contiki kernel for STK 501 development board - * - * \author - * Simon Barner -#include -#include "net/uip_arp.h" - -#include "contiki-stk501.h" -//#include "../core/cfs/cfs-eeprom.h" -#include "cfs/cfs.h" -#include "dev/eeprom.h" -#include "lib/mmem.h" -#include "loader/symbols-def.h" -#include "loader/symtab.h" -#include "../apps/codeprop/codeprop.h" -#include "sys/mt.h" - -/* Uncomment to enable demonstration of multi-threading libary */ -/* #define MT_DEMO */ - -#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) - -//TODO: What happened to cfs_eeprom_process? -//PROCINIT(&etimer_process, &tcpip_process, &uip_fw_process, &cfs_eeprom_process); -#if UIP_CONF_IPV6 -PROCINIT(&etimer_process, &tcpip_process); -#else -PROCINIT(&etimer_process, &tcpip_process, &uip_fw_process); -#endif - -#ifdef MT_DEMO -static struct mt_thread threads[3]; - -static -void thread_handler1 (void* data) { - while (1) { - PRINTF ("Thread 1. Data: 0x%x, %d\n", data, *(uint8_t*)data ); - mt_yield (); - } -} - -static -void thread_handler2 (void* data) { - while (1) { - PRINTF ("Thread 2. Data: 0x%x, %d\n", data, *(uint8_t*)data ); - mt_yield (); - } -} -#endif - -PROCESS(contiki_stk501_main_init_process, "Contiki STK501 init process"); -PROCESS_THREAD(contiki_stk501_main_init_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Network support (uIP) */ - init_net(); - - /* Initalize heap allocator */ - mmem_init (); - - /* Code propagator */ - /* TODO: The core elfloader-avr.c has 16/32 bit pointer problems so this won't build */ -//process_start(&codeprop_process, NULL); - - /* Multi-threading support */ -#ifdef MT_DEMO - mt_init (); -#endif - - PROCESS_END(); -} - -#ifdef MT_DEMO -static uint8_t d1=1, d2=2, d3=3; -#endif - -int -main(void) -{ - /* - * GCC depends on register r1 set to 0. - */ - asm volatile ("clr r1"); - - /* Initialize hardware */ - init_lowlevel(); - - /* Clock */ - clock_init(); - - /* Process subsystem */ - process_init(); - - /* Register initial processes */ - procinit_init(); - - /* Perform rest of initializations */ - process_start(&contiki_stk501_main_init_process, NULL); - - PRINTF("Initialized.\n"); - -#ifdef MT_DEMO - mt_start (&threads[0], thread_handler1, &d1); - mt_start (&threads[1], thread_handler2, &d2); - mt_start (&threads[2], thread_handler2, &d3); - - uint8_t i; -#endif - - /* Main scheduler loop */ - while(1) { - - process_run(); - -#ifdef MT_DEMO - for (i=0; i<3; ++i) { - mt_exec (&threads[i]); - } -#endif - } - - return 0; -} diff --git a/platform/stk501/contiki-stk501.h b/platform/stk501/contiki-stk501.h deleted file mode 100644 index 17a2bc98d..000000000 --- a/platform/stk501/contiki-stk501.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2006, Technical University of Munich - * 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. - * - * 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 file is part of the Contiki operating system. - * - * @(#)$$ - */ - -/** - * \file - * Sample Contiki kernel for STK 501 development board - * - * \author - * Simon Barner @@ -43,4 +43,4 @@ typedef unsigned int uip_stats_t; #define USB_EP2_SIZE 64 #define RAND_MAX 0x7fff -#endif /* __CONTIKI_CONF_H__CDBB4VIH3I__ */ +#endif /* CONTIKI_CONF_H_CDBB4VIH3I__ */ diff --git a/platform/win32/contiki-conf.h b/platform/win32/contiki-conf.h index d145d6b00..11e80ab49 100644 --- a/platform/win32/contiki-conf.h +++ b/platform/win32/contiki-conf.h @@ -1,5 +1,5 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #ifdef __CYGWIN__ #include @@ -183,4 +183,4 @@ typedef unsigned short uip_stats_t; #define WWW_CONF_WEBPAGE_HEIGHT 30 #endif /* PLATFORM_BUILD */ -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/platform/win32/ctk/ctk-console.h b/platform/win32/ctk/ctk-console.h index adcabcb71..5bb7d9c67 100644 --- a/platform/win32/ctk/ctk-console.h +++ b/platform/win32/ctk/ctk-console.h @@ -31,8 +31,8 @@ * Author: Oliver Schmidt * */ -#ifndef __CTK_CONSOLE_H__ -#define __CTK_CONSOLE_H__ +#ifndef CTK_CONSOLE_H_ +#define CTK_CONSOLE_H_ #define cputc console_cputc #define cputs console_cputs @@ -64,4 +64,4 @@ void textcolor(unsigned char c); char ctk_arch_getkey(void); unsigned char ctk_arch_keyavail(void); -#endif /* __CTK_CONSOLE_H__ */ +#endif /* CTK_CONSOLE_H_ */ diff --git a/platform/win32/loader/dll-loader.h b/platform/win32/loader/dll-loader.h index f459aefeb..a002f00b5 100644 --- a/platform/win32/loader/dll-loader.h +++ b/platform/win32/loader/dll-loader.h @@ -31,8 +31,8 @@ * Author: Oliver Schmidt * */ -#ifndef __DLL_LOADER_H__ -#define __DLL_LOADER_H__ +#ifndef DLL_LOADER_H_ +#define DLL_LOADER_H_ #define LOADER_LOAD(name, arg) dll_loader_load(name, arg) #define LOADER_UNLOAD() dll_loader_unload((void *)autostart_processes) @@ -44,4 +44,4 @@ CCIF void dll_loader_unload(void *addr); CCIF struct dsc *dll_loader_load_dsc(char *name); CCIF void __stdcall dll_loader_unload_dsc(void *addr); -#endif /* __DLL_LOADER_H__ */ +#endif /* DLL_LOADER_H_ */ diff --git a/platform/win32/loader/unload.h b/platform/win32/loader/unload.h index 9dcfbda15..d70a7b706 100644 --- a/platform/win32/loader/unload.h +++ b/platform/win32/loader/unload.h @@ -32,11 +32,11 @@ * */ -#ifndef __UNLOAD_H__ -#define __UNLOAD_H__ +#ifndef UNLOAD_H_ +#define UNLOAD_H_ #define LOADER_UNLOAD unload void unload(void); -#endif /* __UNLOAD_H__ */ +#endif /* UNLOAD_H_ */ diff --git a/platform/wismote/Makefile.wismote b/platform/wismote/Makefile.wismote index cc87bd446..0c076652d 100644 --- a/platform/wismote/Makefile.wismote +++ b/platform/wismote/Makefile.wismote @@ -5,12 +5,12 @@ CONTIKI_TARGET_SOURCEFILES += contiki-wismote-platform.c \ #ARCH=spi.c ds2411.c xmem.c i2c.c node-id.c sensors.c cfs-coffee.c \ cc2520.c cc2520-arch.c cc2520-arch-sfd.c \ sky-sensors.c uip-ipchksum.c \ - checkpoint-arch.c uart1.c slip_uart1.c uart1-putchar.c + uart1.c slip_uart1.c uart1-putchar.c ARCH=spi.c i2c.c node-id.c sensors.c cfs-coffee.c sht15.c \ cc2520.c cc2520-arch.c cc2520-arch-sfd.c \ sky-sensors.c uip-ipchksum.c \ - checkpoint-arch.c uart1.c slip_uart1.c uart1-putchar.c + uart1.c slip_uart1.c uart1-putchar.c CONTIKI_TARGET_DIRS = . dev apps net diff --git a/platform/wismote/checkpoint-arch.c b/platform/wismote/checkpoint-arch.c deleted file mode 100644 index 12f71bb89..000000000 --- a/platform/wismote/checkpoint-arch.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Checkpoint library implementation for the Tmote Sky platform. - * \author - * Fredrik Osterlind - */ - -#include "contiki.h" -#include "lib/checkpoint.h" - -#include "sys/rtimer.h" -#include "sys/mt.h" -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "dev/leds.h" -#include "dev/watchdog.h" - -#include - -#define DEBUG 0 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define COMMAND_ROLLBACK 1 -#define COMMAND_CHECKPOINT 2 -#define COMMAND_TBR 3 - -#define DATA_AS_HEX 0 /* If false, store binary data */ - -#define INCLUDE_RAM 1 /* Less then 10240 bytes */ -#define INCLUDE_TIMERS 1 /* 16 bytes */ -#define INCLUDE_LEDS 1 /* 1 bytes */ - -/* 10kb memory */ -#define RAM_START 0x1100 -#define RAM_END 0x3900 - -#define STOP_TIMERS() TACTL &= ~(MC1); TBCTL &= ~(MC1); watchdog_stop(); -#define START_TIMERS() watchdog_start(); TACTL |= MC1; TBCTL |= MC1; - -static struct mt_thread checkpoint_thread; -static uint8_t preset_cmd; -static int preset_fd; - -typedef union { - unsigned char u8[2]; - unsigned short u16; -} word_union_t; - -/*---------------------------------------------------------------------------*/ -static void -write_byte(int fd, uint8_t c) -{ -#if DATA_AS_HEX - uint8_t hex[2]; - sprintf(hex, "%02x", c); - if(cfs_write(fd, hex, 2) != 2) { - printf("err #1\n"); - } -#else /* DATA_AS_HEX */ - if(cfs_write(fd, &c, 1) != 1) { - printf("err #2\n"); - } -#endif /* DATA_AS_HEX */ -}/*---------------------------------------------------------------------------*/ -#if 0 -static void -write_array(int fd, unsigned char *mem, uint16_t len) -{ -#if DATA_AS_HEX - int i; - for(i = 0; i < len; i++) { - write_byte(fd, mem[i]); - } -#else /* DATA_AS_HEX */ - cfs_write(fd, mem, len); -#endif /* DATA_AS_HEX */ -} -#endif /* 0 */ -/*---------------------------------------------------------------------------*/ -static void -write_word(int fd, uint16_t w) -{ - word_union_t tmp; - tmp.u16 = w; - write_byte(fd, tmp.u8[0]); - write_byte(fd, tmp.u8[1]); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -read_byte(int fd) -{ -#if DATA_AS_HEX - uint8_t hex[2]; - - cfs_read(fd, hex, 2); - - if(hex[0] >= 'A' && hex[0] <= 'F') { - hex[0] = (hex[0] - 'A' + 0xa); - } else if(hex[0] >= 'a' && hex[0] <= 'f') { - hex[0] = (hex[0] - 'a' + 0xa); - } else { - hex[0] = (hex[0] - '0'); - } - if(hex[1] >= 'A' && hex[1] <= 'F') { - hex[1] = (hex[1] - 'A' + 0xa); - } else if(hex[1] >= 'a' && hex[1] <= 'f') { - hex[1] = (hex[1] - 'a' + 0xa); - } else { - hex[1] = (hex[1] - '0'); - } - return (uint8_t)((hex[0]<<4)&0xf0) | (hex[1]&0x0f); -#else /* DATA_AS_HEX */ - uint8_t c; - cfs_read(fd, &c, 1); - return c; -#endif /* DATA_AS_HEX */ -} -/*---------------------------------------------------------------------------*/ -static uint16_t -read_word(int fd) -{ - word_union_t tmp; - tmp.u8[0] = read_byte(fd); - tmp.u8[1] = read_byte(fd); - return tmp.u16; -} -/*---------------------------------------------------------------------------*/ -static void -thread_checkpoint(int fd) -{ -#if INCLUDE_RAM - unsigned char *addr; - uint16_t size = 0; - unsigned char *thread_mem_start = (unsigned char *)&checkpoint_thread.thread.stack; - unsigned char *thread_mem_end = thread_mem_start + sizeof(checkpoint_thread.thread.stack) - 1; - unsigned char *coffee_mem_start = cfs_coffee_get_protected_mem(&size); - unsigned char *coffee_mem_end = coffee_mem_start + size - 1; -#endif /* INCLUDE_RAM */ - - /*printf("protected thread memory: %u, size=%u\n", (uint16_t) thread_mem_start, sizeof(checkpoint_thread.thread.stack));*/ - /*printf("protected coffee memory: %u, size=%u\n", (uint16_t) coffee_mem_start, size);*/ - - /* RAM */ -#if INCLUDE_RAM - for(addr = (unsigned char *)RAM_START; - addr < (unsigned char *)RAM_END; - addr++) { - - if((addr >= thread_mem_start && addr <= thread_mem_end)) { - /* Writing dummy memory */ - /*write_byte(fd, 1);*/ - continue; - } - - if((addr >= coffee_mem_start && addr <= coffee_mem_end)) { - /* Writing dummy memory */ - /*write_byte(fd, 2);*/ - continue; - } - - /* TODO Use write_array() */ - write_byte(fd, *addr); - - if(((int)addr % 512) == 0) { - PRINTF("."); - } - } - -#endif /* INCLUDE_RAM */ - - /* Timers */ -#if INCLUDE_TIMERS -/* write_word(fd, TACTL); - write_word(fd, TACCTL1); - write_word(fd, TACCR1); - write_word(fd, TAR); - - write_word(fd, TBCTL); - write_word(fd, TBCCTL1); - write_word(fd, TBCCR1); - write_word(fd, TBR);*/ -#endif /* INCLUDE_TIMERS */ - - /* LEDs */ -#if INCLUDE_LEDS - write_byte(fd, leds_arch_get()); -#endif /* INCLUDE_LEDS */ - - /* Radio */ - /* ADC */ - /* ... */ - - write_byte(fd, -1); /* Coffee padding byte */ -} -/*---------------------------------------------------------------------------*/ -static void -thread_rollback(int fd) -{ -#if INCLUDE_RAM - unsigned char *addr; - uint16_t size = 0; - unsigned char *thread_mem_start = (unsigned char *)&checkpoint_thread.thread.stack; - unsigned char *thread_mem_end = thread_mem_start + sizeof(checkpoint_thread.thread.stack) - 1; - unsigned char *coffee_mem_start = cfs_coffee_get_protected_mem(&size); - unsigned char *coffee_mem_end = coffee_mem_start + size - 1; -#endif /* INCLUDE_RAM */ - - /*printf("protected thread memory: %u, size=%u\n", (uint16_t) thread_mem_start, sizeof(checkpoint_thread.thread.stack));*/ - /*printf("protected coffee memory: %u, size=%u\n", (uint16_t) coffee_mem_start, size);*/ - - /* RAM */ -#if INCLUDE_RAM - for(addr = (unsigned char *)RAM_START; - addr < (unsigned char *)RAM_END; - addr++) { - if((addr >= thread_mem_start && addr <= thread_mem_end)) { - /* Ignoring incoming memory */ - /*read_byte(fd);*/ - continue; - } - - if((addr >= coffee_mem_start && addr <= coffee_mem_end)) { - /* Ignoring incoming memory */ - /*read_byte(fd);*/ - continue; - } - - *addr = read_byte(fd); - - if(((int)addr % 512) == 0) { - PRINTF("."); - } - } - -#endif /* INCLUDE_RAM */ - - /* Timers */ -#if INCLUDE_TIMERS -/* TACTL = read_word(fd); - TACCTL1 = read_word(fd); - TACCR1 = read_word(fd); - TAR = read_word(fd); - - TBCTL = read_word(fd); - TBCCTL1 = read_word(fd); - TBCCR1 = read_word(fd); - TBR = read_word(fd);*/ -#endif /* INCLUDE_TIMERS */ - - /* LEDs */ -#if INCLUDE_LEDS - leds_arch_set(read_byte(fd)); -#endif /* INCLUDE_LEDS */ - - /* Radio */ - /* ADC */ - /* ... */ - - read_byte(fd); /* Coffee padding byte */ -} -/*---------------------------------------------------------------------------*/ -static void -thread_loop(void *data) -{ - uint8_t cmd; - int fd; - - while(1) { - /* Store command and file descriptor on stack */ - cmd = preset_cmd; - fd = preset_fd; - - /* Handle command */ - if(cmd == COMMAND_ROLLBACK) { - PRINTF("Rolling back"); - thread_rollback(fd); - PRINTF(" done!\n"); - } else if(cmd == COMMAND_CHECKPOINT) { - PRINTF("Checkpointing"); - thread_checkpoint(fd); - PRINTF(" done!\n"); - } else if(cmd == COMMAND_TBR) { - PRINTF("Writing TBR"); - // write_word(fd, TBR); - PRINTF(" done!\n"); - } else { - printf("Error: unknown command: %u\n", cmd); - } - - /* Return to main Contiki thread */ - mt_yield(); - } -} -/*---------------------------------------------------------------------------*/ -int -checkpoint_arch_size() -{ - return 10258; -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_checkpoint(int fd) -{ -// STOP_TIMERS(); - - preset_cmd = COMMAND_CHECKPOINT; - preset_fd = fd; - mt_exec(&checkpoint_thread); - -// START_TIMERS(); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_rollback(int fd) -{ - //STOP_TIMERS(); - - preset_cmd = COMMAND_ROLLBACK; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - //START_TIMERS(); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_init(void) -{ - mt_init(); - mt_start(&checkpoint_thread, thread_loop, NULL); - - /*mt_stop(&checkpoint_thread);*/ - /*mt_remove();*/ -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/wismote/dev/acc-sensor.h b/platform/wismote/dev/acc-sensor.h index 89df783a8..4cd1ea6a7 100644 --- a/platform/wismote/dev/acc-sensor.h +++ b/platform/wismote/dev/acc-sensor.h @@ -32,8 +32,8 @@ * Created : 2005-11-01 */ -#ifndef __ACC_SENSOR_H__ -#define __ACC_SENSOR_H__ +#ifndef ACC_SENSOR_H_ +#define ACC_SENSOR_H_ #include "lib/sensors.h" @@ -41,4 +41,4 @@ extern const struct sensors_sensor acc_sensor; #define ACC_SENSOR "Acc" -#endif /* __ACC_SENSOR_H__ */ +#endif /* ACC_SENSOR_H_ */ diff --git a/platform/wismote/dev/ext-sensor.h b/platform/wismote/dev/ext-sensor.h index e9248144d..0a1122840 100644 --- a/platform/wismote/dev/ext-sensor.h +++ b/platform/wismote/dev/ext-sensor.h @@ -32,8 +32,8 @@ * Created : 2005-11-01 */ -#ifndef __EXT_SENSOR_H__ -#define __EXT_SENSOR_H__ +#ifndef EXT_SENSOR_H_ +#define EXT_SENSOR_H_ #include "lib/sensors.h" @@ -46,4 +46,4 @@ extern const struct sensors_sensor ext_sensor; #define EXT_SENSOR "Ext" -#endif /* __EXT_SENSOR_H__ */ +#endif /* EXT_SENSOR_H_ */ diff --git a/platform/wismote/dev/light-sensor.h b/platform/wismote/dev/light-sensor.h index 486e6a8bb..411c6fa33 100644 --- a/platform/wismote/dev/light-sensor.h +++ b/platform/wismote/dev/light-sensor.h @@ -36,8 +36,8 @@ * $Revision: 1.2 $ */ -#ifndef __LIGHT_SENSOR_H__ -#define __LIGHT_SENSOR_H__ +#ifndef LIGHT_SENSOR_H_ +#define LIGHT_SENSOR_H_ #include "lib/sensors.h" @@ -47,4 +47,4 @@ extern const struct sensors_sensor light_sensor; #define LIGHT_SENSOR_TOTAL_SOLAR 1 -#endif /* __LIGHT-SENSOR_H__ */ +#endif /* LIGHT-SENSOR_H_ */ diff --git a/platform/wismote/dev/light.h b/platform/wismote/dev/light.h index 8ea84b997..52962b162 100644 --- a/platform/wismote/dev/light.h +++ b/platform/wismote/dev/light.h @@ -29,12 +29,12 @@ * This file is part of the Contiki operating system. * */ -#ifndef __LIGHT_H__ -#define __LIGHT_H__ +#ifndef LIGHT_H_ +#define LIGHT_H_ void sensors_light_init(void); unsigned sensors_light1(void); unsigned sensors_light2(void); -#endif /* __LIGHT_H__ */ +#endif /* LIGHT_H_ */ diff --git a/platform/wismote/dev/sky-sensors.h b/platform/wismote/dev/sky-sensors.h index ec3136e2b..f0cdcd1f3 100644 --- a/platform/wismote/dev/sky-sensors.h +++ b/platform/wismote/dev/sky-sensors.h @@ -36,10 +36,10 @@ * $Revision: 1.1 $ */ -#ifndef __SKY_SENSORS_H__ -#define __SKY_SENSORS_H__ +#ifndef SKY_SENSORS_H_ +#define SKY_SENSORS_H_ void sky_sensors_activate(uint8_t); void sky_sensors_deactivate(uint8_t); -#endif /* __SKY_SENSORS_H__ */ +#endif /* SKY_SENSORS_H_ */ diff --git a/platform/wismote/platform-conf.h b/platform/wismote/platform-conf.h index c2a7e6be0..18fe67de5 100644 --- a/platform/wismote/platform-conf.h +++ b/platform/wismote/platform-conf.h @@ -32,8 +32,8 @@ * Platform configuration for the wismote platform. */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -197,4 +197,4 @@ typedef unsigned long off_t; #define CC2520_SPI_DISABLE() do{clock_delay(5);UCB0CTL1 |= UCSWRST;clock_delay(1); P3OUT |= BIT0;clock_delay(5);}while(0) #define CC2520_SPI_IS_ENABLED() ((CC2520_CSN_PORT(OUT) & BV(CC2520_CSN_PIN)) != BV(CC2520_CSN_PIN)) -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/z1/Makefile.common b/platform/z1/Makefile.common index da194f9f7..bf2eb95e9 100644 --- a/platform/z1/Makefile.common +++ b/platform/z1/Makefile.common @@ -14,7 +14,7 @@ ARCH=msp430.c leds.c watchdog.c xmem.c \ spi.c cc2420.c cc2420-aes.c cc2420-arch.c cc2420-arch-sfd.c\ node-id.c sensors.c button-sensor.c cfs-coffee.c \ radio-sensor.c uart0.c uart0-putchar.c uip-ipchksum.c \ - checkpoint-arch.c slip.c slip_uart0.c \ + slip.c slip_uart0.c \ z1-phidgets.c sht11.c sht11-sensor.c light-sensor.c \ battery-sensor.c sky-sensors.c tmp102.c temperature-sensor.c light-ziglet.c \ relay-phidget.c tlc59116.c diff --git a/platform/z1/checkpoint-arch.c b/platform/z1/checkpoint-arch.c deleted file mode 100644 index f9fff0324..000000000 --- a/platform/z1/checkpoint-arch.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (c) 2009, 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. 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 file is part of the Contiki operating system. - * - */ - -/** - * \file - * Checkpoint library implementation for the Tmote Sky platform. - * \author - * Fredrik Osterlind - */ - -#include "contiki.h" -#include "lib/checkpoint.h" - -#include "sys/rtimer.h" -#include "sys/mt.h" -#include "cfs/cfs.h" -#include "cfs/cfs-coffee.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include - -#define DEBUG 1 -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define COMMAND_ROLLBACK 1 -#define COMMAND_CHECKPOINT 2 -#define COMMAND_TBR 3 - -#define DATA_AS_HEX 0 /* If false, store binary data */ - -#define INCLUDE_RAM 1 /* Less then 10240 bytes */ -#define INCLUDE_TIMERS 1 /* 16 bytes */ -#define INCLUDE_LEDS 1 /* 1 bytes */ - -// 8kB memory -#define RAM_START 0x1100 -#define RAM_END 0x30FF - -#define STOP_TIMERS() TACTL &= ~(MC1); TBCTL &= ~(MC1); watchdog_stop(); -#define START_TIMERS() watchdog_start(); TACTL |= MC1; TBCTL |= MC1; - -static struct mt_thread checkpoint_thread; -static uint8_t preset_cmd; -static int preset_fd; - -typedef union { - unsigned char u8[2]; - unsigned short u16; -} word_union_t; - -/*---------------------------------------------------------------------------*/ -static void -write_byte(int fd, uint8_t c) -{ -#if DATA_AS_HEX - uint8_t hex[2]; - sprintf(hex, "%02x", c); - if(cfs_write(fd, hex, 2) != 2) { - printf("err #1\n"); - } -#else /* DATA_AS_HEX */ - if(cfs_write(fd, &c, 1) != 1) { - printf("err #2\n"); - } -#endif /* DATA_AS_HEX */ -}/*---------------------------------------------------------------------------*/ -#if 0 -static void -write_array(int fd, unsigned char *mem, uint16_t len) -{ -#if DATA_AS_HEX - int i; - for(i = 0; i < len; i++) { - write_byte(fd, mem[i]); - } -#else /* DATA_AS_HEX */ - cfs_write(fd, mem, len); -#endif /* DATA_AS_HEX */ -} -#endif /* 0 */ -/*---------------------------------------------------------------------------*/ -static void -write_word(int fd, uint16_t w) -{ - word_union_t tmp; - tmp.u16 = w; - write_byte(fd, tmp.u8[0]); - write_byte(fd, tmp.u8[1]); -} -/*---------------------------------------------------------------------------*/ -static uint8_t -read_byte(int fd) -{ -#if DATA_AS_HEX - uint8_t hex[2]; - - cfs_read(fd, hex, 2); - - if(hex[0] >= 'A' && hex[0] <= 'F') { - hex[0] = (hex[0] - 'A' + 0xa); - } else if(hex[0] >= 'a' && hex[0] <= 'f') { - hex[0] = (hex[0] - 'a' + 0xa); - } else { - hex[0] = (hex[0] - '0'); - } - if(hex[1] >= 'A' && hex[1] <= 'F') { - hex[1] = (hex[1] - 'A' + 0xa); - } else if(hex[1] >= 'a' && hex[1] <= 'f') { - hex[1] = (hex[1] - 'a' + 0xa); - } else { - hex[1] = (hex[1] - '0'); - } - return (uint8_t)((hex[0]<<4)&0xf0) | (hex[1]&0x0f); -#else /* DATA_AS_HEX */ - uint8_t c; - cfs_read(fd, &c, 1); - return c; -#endif /* DATA_AS_HEX */ -} -/*---------------------------------------------------------------------------*/ -static uint16_t -read_word(int fd) -{ - word_union_t tmp; - tmp.u8[0] = read_byte(fd); - tmp.u8[1] = read_byte(fd); - return tmp.u16; -} -/*---------------------------------------------------------------------------*/ -static void -thread_checkpoint(int fd) -{ -#if INCLUDE_RAM - unsigned char *addr; - uint16_t size = 0; - unsigned char *thread_mem_start = (unsigned char *)&checkpoint_thread.thread.stack; - unsigned char *thread_mem_end = thread_mem_start + sizeof(checkpoint_thread.thread.stack) - 1; - unsigned char *coffee_mem_start = cfs_coffee_get_protected_mem(&size); - unsigned char *coffee_mem_end = coffee_mem_start + size - 1; -#endif /* INCLUDE_RAM */ - - /*printf("protected thread memory: %u, size=%u\n", (uint16_t) thread_mem_start, sizeof(checkpoint_thread.thread.stack));*/ - /*printf("protected coffee memory: %u, size=%u\n", (uint16_t) coffee_mem_start, size);*/ - - /* RAM */ -#if INCLUDE_RAM - for(addr = (unsigned char *)RAM_START; - addr < (unsigned char *)RAM_END; - addr++) { - - if((addr >= thread_mem_start && addr <= thread_mem_end)) { - /* Writing dummy memory */ - /*write_byte(fd, 1);*/ - continue; - } - - if((addr >= coffee_mem_start && addr <= coffee_mem_end)) { - /* Writing dummy memory */ - /*write_byte(fd, 2);*/ - continue; - } - - /* TODO Use write_array() */ - write_byte(fd, *addr); - - if(((int)addr % 512) == 0) { - PRINTF("."); - } - } - -#endif /* INCLUDE_RAM */ - - /* Timers */ -#if INCLUDE_TIMERS - write_word(fd, TACTL); - write_word(fd, TACCTL1); - write_word(fd, TACCR1); - write_word(fd, TAR); - - write_word(fd, TBCTL); - write_word(fd, TBCCTL1); - write_word(fd, TBCCR1); - write_word(fd, TBR); -#endif /* INCLUDE_TIMERS */ - - /* LEDs */ -#if INCLUDE_LEDS - write_byte(fd, leds_arch_get()); -#endif /* INCLUDE_LEDS */ - - /* Radio */ - /* ADC */ - /* ... */ - - write_byte(fd, -1); /* Coffee padding byte */ -} -/*---------------------------------------------------------------------------*/ -static void -thread_rollback(int fd) -{ -#if INCLUDE_RAM - unsigned char *addr; - uint16_t size = 0; - unsigned char *thread_mem_start = (unsigned char *)&checkpoint_thread.thread.stack; - unsigned char *thread_mem_end = thread_mem_start + sizeof(checkpoint_thread.thread.stack) - 1; - unsigned char *coffee_mem_start = cfs_coffee_get_protected_mem(&size); - unsigned char *coffee_mem_end = coffee_mem_start + size - 1; -#endif /* INCLUDE_RAM */ - - /*printf("protected thread memory: %u, size=%u\n", (uint16_t) thread_mem_start, sizeof(checkpoint_thread.thread.stack));*/ - /*printf("protected coffee memory: %u, size=%u\n", (uint16_t) coffee_mem_start, size);*/ - - /* RAM */ -#if INCLUDE_RAM - for(addr = (unsigned char *)RAM_START; - addr < (unsigned char *)RAM_END; - addr++) { - if((addr >= thread_mem_start && addr <= thread_mem_end)) { - /* Ignoring incoming memory */ - /*read_byte(fd);*/ - continue; - } - - if((addr >= coffee_mem_start && addr <= coffee_mem_end)) { - /* Ignoring incoming memory */ - /*read_byte(fd);*/ - continue; - } - - *addr = read_byte(fd); - - if(((int)addr % 512) == 0) { - PRINTF("."); - } - } - -#endif /* INCLUDE_RAM */ - - /* Timers */ -#if INCLUDE_TIMERS - TACTL = read_word(fd); - TACCTL1 = read_word(fd); - TACCR1 = read_word(fd); - TAR = read_word(fd); - - TBCTL = read_word(fd); - TBCCTL1 = read_word(fd); - TBCCR1 = read_word(fd); - TBR = read_word(fd); -#endif /* INCLUDE_TIMERS */ - - /* LEDs */ -#if INCLUDE_LEDS - leds_arch_set(read_byte(fd)); -#endif /* INCLUDE_LEDS */ - - /* Radio */ - /* ADC */ - /* ... */ - - read_byte(fd); /* Coffee padding byte */ -} -/*---------------------------------------------------------------------------*/ -static void -thread_loop(void *data) -{ - uint8_t cmd; - int fd; - - while(1) { - /* Store command and file descriptor on stack */ - cmd = preset_cmd; - fd = preset_fd; - - /* Handle command */ - if(cmd == COMMAND_ROLLBACK) { - PRINTF("Rolling back"); - thread_rollback(fd); - PRINTF(" done!\n"); - } else if(cmd == COMMAND_CHECKPOINT) { - PRINTF("Checkpointing"); - thread_checkpoint(fd); - PRINTF(" done!\n"); - } else if(cmd == COMMAND_TBR) { - PRINTF("Writing TBR"); - write_word(fd, TBR); - PRINTF(" done!\n"); - } else { - printf("Error: unknown command: %u\n", cmd); - } - - /* Return to main Contiki thread */ - mt_yield(); - } -} -/*---------------------------------------------------------------------------*/ -int -checkpoint_arch_size() -{ - return 10258; -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_checkpoint(int fd) -{ - STOP_TIMERS(); - - preset_cmd = COMMAND_CHECKPOINT; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - START_TIMERS(); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_rollback(int fd) -{ - STOP_TIMERS(); - - preset_cmd = COMMAND_ROLLBACK; - preset_fd = fd; - mt_exec(&checkpoint_thread); - - START_TIMERS(); -} -/*---------------------------------------------------------------------------*/ -void -checkpoint_arch_init(void) -{ - mt_init(); - mt_start(&checkpoint_thread, thread_loop, NULL); - - /*mt_stop(&checkpoint_thread);*/ - /*mt_remove();*/ -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/z1/dev/adxl345.h b/platform/z1/dev/adxl345.h index c0cc6e7f6..082572715 100644 --- a/platform/z1/dev/adxl345.h +++ b/platform/z1/dev/adxl345.h @@ -38,8 +38,8 @@ * Enric Calvo, Zolertia */ -#ifndef __ADXL345_H__ -#define __ADXL345_H__ +#ifndef ADXL345_H_ +#define ADXL345_H_ #include #include "dev/i2cmaster.h" @@ -290,4 +290,4 @@ extern process_event_t int1_event, int2_event; // static ? /* -------------------------------------------------------------------------- */ -#endif /* ifndef __ADXL345_H__ */ +#endif /* ifndef ADXL345_H_ */ diff --git a/platform/z1/dev/i2cmaster.h b/platform/z1/dev/i2cmaster.h index 25bd7c233..29ee9a653 100644 --- a/platform/z1/dev/i2cmaster.h +++ b/platform/z1/dev/i2cmaster.h @@ -38,8 +38,8 @@ * Marcus Lundén, SICS */ -#ifndef __I2CMASTER_H__ -#define __I2CMASTER_H__ +#ifndef I2CMASTER_H_ +#define I2CMASTER_H_ #include "contiki.h" @@ -87,4 +87,4 @@ uint8_t i2c_busy(void); #define PRINTFDEBUG(...) #endif -#endif /* #ifdef __I2CMASTER_H__ */ +#endif /* #ifdef I2CMASTER_H_ */ diff --git a/platform/z1/dev/light-sensor.h b/platform/z1/dev/light-sensor.h index 486e6a8bb..411c6fa33 100644 --- a/platform/z1/dev/light-sensor.h +++ b/platform/z1/dev/light-sensor.h @@ -36,8 +36,8 @@ * $Revision: 1.2 $ */ -#ifndef __LIGHT_SENSOR_H__ -#define __LIGHT_SENSOR_H__ +#ifndef LIGHT_SENSOR_H_ +#define LIGHT_SENSOR_H_ #include "lib/sensors.h" @@ -47,4 +47,4 @@ extern const struct sensors_sensor light_sensor; #define LIGHT_SENSOR_TOTAL_SOLAR 1 -#endif /* __LIGHT-SENSOR_H__ */ +#endif /* LIGHT-SENSOR_H_ */ diff --git a/platform/z1/dev/light-ziglet.h b/platform/z1/dev/light-ziglet.h index c6ef71b7a..6b100c551 100644 --- a/platform/z1/dev/light-ziglet.h +++ b/platform/z1/dev/light-ziglet.h @@ -38,8 +38,8 @@ * Marcus Lundén, SICS */ -#ifndef __LIGHT_ZIGLET_H__ -#define __LIGHT_ZIGLET_H__ +#ifndef LIGHT_ZIGLET_H_ +#define LIGHT_ZIGLET_H_ #include #include "i2cmaster.h" @@ -121,7 +121,7 @@ uint16_t light_ziglet_on(void); #define M8T 0x0000 /* -------------------------------------------------------------------------- */ -#endif /* ifndef __LIGHT_ZIGLET_H__ */ +#endif /* ifndef LIGHT_ZIGLET_H_ */ diff --git a/platform/z1/dev/light.h b/platform/z1/dev/light.h index 8ea84b997..52962b162 100644 --- a/platform/z1/dev/light.h +++ b/platform/z1/dev/light.h @@ -29,12 +29,12 @@ * This file is part of the Contiki operating system. * */ -#ifndef __LIGHT_H__ -#define __LIGHT_H__ +#ifndef LIGHT_H_ +#define LIGHT_H_ void sensors_light_init(void); unsigned sensors_light1(void); unsigned sensors_light2(void); -#endif /* __LIGHT_H__ */ +#endif /* LIGHT_H_ */ diff --git a/platform/z1/dev/potentiometer-sensor.h b/platform/z1/dev/potentiometer-sensor.h index 93e5a968a..d9d8b983d 100644 --- a/platform/z1/dev/potentiometer-sensor.h +++ b/platform/z1/dev/potentiometer-sensor.h @@ -34,8 +34,8 @@ * $Revision: 1.0 $ */ -#ifndef __POTENTIOMETER_SENSOR_H__ -#define __POTENTIOMETER_SENSOR_H__ +#ifndef POTENTIOMETER_SENSOR_H_ +#define POTENTIOMETER_SENSOR_H_ #include "lib/sensors.h" @@ -43,4 +43,4 @@ extern const struct sensors_sensor potentiometer_sensor; #define POTENTIOMETER_SENSOR "Potentiometer" -#endif /* __POTENTIOMETER_SENSOR_H__ */ +#endif /* POTENTIOMETER_SENSOR_H_ */ diff --git a/platform/z1/dev/relay-phidget.h b/platform/z1/dev/relay-phidget.h index 431b97bb4..9cc4b3475 100644 --- a/platform/z1/dev/relay-phidget.h +++ b/platform/z1/dev/relay-phidget.h @@ -37,8 +37,8 @@ * */ -#ifndef __RELAY_PHIDGET_H__ -#define __RELAY_PHIDGETS_H__ +#ifndef RELAY_PHIDGET_H_ +#define RELAY_PHIDGETS_H_ void relay_enable(uint8_t pin); @@ -47,4 +47,4 @@ void relay_off(); uint8_t relay_toogle(); -#endif /* __RELAY_PHIDGET_H__ */ +#endif /* RELAY_PHIDGET_H_ */ diff --git a/platform/z1/dev/sky-sensors.h b/platform/z1/dev/sky-sensors.h index 4a5e8d9e1..df2aeea48 100644 --- a/platform/z1/dev/sky-sensors.h +++ b/platform/z1/dev/sky-sensors.h @@ -36,11 +36,11 @@ * $Revision: 1.2 $ */ -#ifndef __SKY_SENSORS_H__ -#define __SKY_SENSORS_H__ +#ifndef SKY_SENSORS_H_ +#define SKY_SENSORS_H_ int sky_sensors_status(uint16_t input, int type); int sky_sensors_configure(uint16_t input, uint8_t reference, int type, int value); -#endif /* __SKY_SENSORS_H__ */ +#endif /* SKY_SENSORS_H_ */ diff --git a/platform/z1/dev/temperature-sensor.h b/platform/z1/dev/temperature-sensor.h index 6ac9b77d2..05eafe852 100644 --- a/platform/z1/dev/temperature-sensor.h +++ b/platform/z1/dev/temperature-sensor.h @@ -37,8 +37,8 @@ * Niclas Finne */ -#ifndef __TEMPERATURE_SENSOR_H__ -#define __TEMPERATURE_SENSOR_H__ +#ifndef TEMPERATURE_SENSOR_H_ +#define TEMPERATURE_SENSOR_H_ #include "lib/sensors.h" @@ -46,4 +46,4 @@ extern const struct sensors_sensor temperature_sensor; #define TEMPERATURE_SENSOR "Temperature" -#endif /* __TEMPERATURE_SENSOR_H__ */ +#endif /* TEMPERATURE_SENSOR_H_ */ diff --git a/platform/z1/dev/tlc59116.h b/platform/z1/dev/tlc59116.h index 39708de77..694569b06 100644 --- a/platform/z1/dev/tlc59116.h +++ b/platform/z1/dev/tlc59116.h @@ -38,8 +38,8 @@ * Jelmer Tiete, VUB */ -#ifndef __TLC59116_H__ -#define __TLC59116_H__ +#ifndef TLC59116_H_ +#define TLC59116_H_ #include #include "dev/i2cmaster.h" @@ -139,4 +139,4 @@ void tlc59116_led(uint8_t led, uint8_t pwm); /* More registers follow, but not used in this implementation */ /* -------------------------------------------------------------------------- */ -#endif /* ifndef __TLC59116_H__ */ +#endif /* ifndef TLC59116_H_ */ diff --git a/platform/z1/dev/tmp102.h b/platform/z1/dev/tmp102.h index 3265e976d..777577747 100644 --- a/platform/z1/dev/tmp102.h +++ b/platform/z1/dev/tmp102.h @@ -38,8 +38,8 @@ * Marcus Lundén, SICS */ -#ifndef __TMP102_H__ -#define __TMP102_H__ +#ifndef TMP102_H_ +#define TMP102_H_ #include #include "i2cmaster.h" @@ -100,7 +100,7 @@ int16_t tmp102_read_temp_x100(); /* -------------------------------------------------------------------------- */ -#endif /* ifndef __TMP102_H__ */ +#endif /* ifndef TMP102_H_ */ diff --git a/platform/z1/dev/z1-phidgets.h b/platform/z1/dev/z1-phidgets.h index 8edf3498d..f56356508 100644 --- a/platform/z1/dev/z1-phidgets.h +++ b/platform/z1/dev/z1-phidgets.h @@ -36,8 +36,8 @@ * Updated : $Date: 2010/08/27 12:58:57 $ * $Revision: 1.2 $ */ -#ifndef __Z1_PHIDGETS_H__ -#define __Z1_PHIDGETS_H__ +#ifndef Z1_PHIDGETS_H_ +#define Z1_PHIDGETS_H_ #define PHIDGET5V_1 0 #define PHIDGET5V_2 1 @@ -46,4 +46,4 @@ extern const struct sensors_sensor phidgets; -#endif /* __Z1_PHIDGETS_H__ */ +#endif /* Z1_PHIDGETS_H_ */ diff --git a/platform/z1/platform-conf.h b/platform/z1/platform-conf.h index ed46991b5..28a17d17d 100644 --- a/platform/z1/platform-conf.h +++ b/platform/z1/platform-conf.h @@ -34,8 +34,8 @@ * Joakim Eriksson */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -227,4 +227,4 @@ typedef unsigned long off_t; #define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) #define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/platform/z1sp/dev/potentiometer-sensor.h b/platform/z1sp/dev/potentiometer-sensor.h index 93e5a968a..d9d8b983d 100644 --- a/platform/z1sp/dev/potentiometer-sensor.h +++ b/platform/z1sp/dev/potentiometer-sensor.h @@ -34,8 +34,8 @@ * $Revision: 1.0 $ */ -#ifndef __POTENTIOMETER_SENSOR_H__ -#define __POTENTIOMETER_SENSOR_H__ +#ifndef POTENTIOMETER_SENSOR_H_ +#define POTENTIOMETER_SENSOR_H_ #include "lib/sensors.h" @@ -43,4 +43,4 @@ extern const struct sensors_sensor potentiometer_sensor; #define POTENTIOMETER_SENSOR "Potentiometer" -#endif /* __POTENTIOMETER_SENSOR_H__ */ +#endif /* POTENTIOMETER_SENSOR_H_ */ diff --git a/platform/z1sp/platform-conf.h b/platform/z1sp/platform-conf.h index aae55d639..677942302 100644 --- a/platform/z1sp/platform-conf.h +++ b/platform/z1sp/platform-conf.h @@ -34,8 +34,8 @@ * Joakim Eriksson */ -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ +#ifndef PLATFORM_CONF_H_ +#define PLATFORM_CONF_H_ /* * Definitions below are dictated by the hardware and not really @@ -225,4 +225,4 @@ typedef unsigned long off_t; #define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) #define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) -#endif /* __PLATFORM_CONF_H__ */ +#endif /* PLATFORM_CONF_H_ */ diff --git a/regression-tests/01-compile-base/Makefile b/regression-tests/01-compile-base/Makefile index f3f736f82..a0e572144 100644 --- a/regression-tests/01-compile-base/Makefile +++ b/regression-tests/01-compile-base/Makefile @@ -3,7 +3,6 @@ TOOLSDIR=../../tools EXAMPLES = \ hello-world/avr-raven \ -hello-world/esb \ hello-world/exp5438 \ hello-world/micaz \ hello-world/minimal-net \ diff --git a/regression-tests/02-hello-world/04-hello-world-esb.csc b/regression-tests/02-hello-world/04-hello-world-esb.csc deleted file mode 100644 index a0152058a..000000000 --- a/regression-tests/02-hello-world/04-hello-world-esb.csc +++ /dev/null @@ -1,83 +0,0 @@ - - - - Hello World (ESB) - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.ESBMoteType - esb1 - ESB Mote Type #esb1 - [CONTIKI_DIR]/examples/hello-world/hello-world.c - make hello-world.esb TARGET=esb - [CONTIKI_DIR]/examples/hello-world/hello-world.esb - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.ESBLED - org.contikios.cooja.mspmote.interfaces.ESBButton - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.TR1001Radio - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - - - - - org.contikios.cooja.interfaces.Position - 57.296459690977144 - 73.20759478605089 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - esb1 - - - - org.contikios.cooja.plugins.LogListener - - - - 623 - 1 - 270 - 29 - 256 - - - org.contikios.cooja.plugins.ScriptRunner - - [CONFIG_DIR]/hello-world.js - true - - 600 - 0 - 453 - 337 - 25 - - - org.contikios.cooja.plugins.SimControl - 280 - 2 - 160 - 20 - 23 - - - diff --git a/regression-tests/03-base/04-sky-checkpointing.csc b/regression-tests/03-base/04-sky-checkpointing.csc deleted file mode 100644 index 3b4b18108..000000000 --- a/regression-tests/03-base/04-sky-checkpointing.csc +++ /dev/null @@ -1,196 +0,0 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - My simulation - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - ../../examples/sky-shell/sky-checkpoint.c - make clean TARGET=sky -make sky-checkpoint.sky TARGET=sky - ../../examples/sky-shell/sky-checkpoint.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.SkySerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 3.537694077190867 - 25.877706916818877 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - - - - org.contikios.cooja.plugins.SimControl - 248 - 3 - 200 - 0 - 0 - false - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 246 - 2 - 210 - 2 - 199 - false - - - org.contikios.cooja.plugins.LogListener - - - - 849 - 1 - 246 - 0 - 409 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 604 - 0 - 409 - 246 - 0 - false - - - diff --git a/regression-tests/04-rime/01-cooja-collect.csc b/regression-tests/04-rime/01-cooja-collect.csc index 7263f06b8..f4533eeff 100644 --- a/regression-tests/04-rime/01-cooja-collect.csc +++ b/regression-tests/04-rime/01-cooja-collect.csc @@ -1,17 +1,13 @@ - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - /home/user/contikiprojects/sics.se/mobility - [CONTIKI_DIR]/tools/cooja/apps/collect-view - /home/user/contikiprojects/sics.se/powertracker - /home/user/nes/papers/smartip-paper/code/cooja_qr + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker Rime collect test - 0 1 10000000 @@ -26,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype949 + mtype929 Contiki Mote Type #1 - [CONTIKI_DIR]/examples/rime/example-collect.c + [CONTIKI_DIR]/examples/rime/example-collect.c make example-collect.cooja TARGET=cooja org.contikios.cooja.interfaces.Position org.contikios.cooja.interfaces.Battery @@ -59,7 +55,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 1 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -72,7 +72,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 2 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -85,7 +89,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 3 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -98,7 +106,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 4 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -111,7 +123,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 5 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -124,7 +140,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 6 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -137,7 +157,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 7 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -150,7 +174,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 8 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -163,7 +191,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 9 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -176,7 +208,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 10 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -189,7 +225,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 11 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -202,7 +242,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 12 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -215,7 +259,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 13 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -228,7 +276,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 14 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -241,7 +293,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 15 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -254,7 +310,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 16 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -267,7 +327,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 17 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -280,7 +344,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 18 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -293,7 +361,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 19 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -306,7 +378,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 20 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -319,7 +395,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 21 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -332,7 +412,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 22 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -345,7 +429,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 23 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -358,7 +446,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 24 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -371,7 +463,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 25 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -384,7 +480,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 26 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -397,7 +497,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 27 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -410,7 +514,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 28 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -423,7 +531,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 29 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -436,7 +548,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 30 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -449,7 +565,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 31 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -462,7 +582,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 32 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -475,7 +599,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 33 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -488,7 +616,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 34 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -501,7 +633,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 35 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -514,7 +650,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 36 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -527,7 +667,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 37 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -540,7 +684,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 38 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -553,7 +701,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 39 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -566,7 +718,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 40 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -579,7 +735,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 41 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -592,7 +752,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 42 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -605,7 +769,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 43 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -618,7 +786,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 44 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -631,7 +803,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 45 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -644,7 +820,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 46 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -657,7 +837,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 47 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -670,7 +854,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 48 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -683,7 +871,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 49 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -696,7 +888,11 @@ org.contikios.cooja.contikimote.interfaces.ContikiMoteID 50 - mtype949 + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype929 @@ -724,6 +920,8 @@ org.contikios.cooja.plugins.LogListener ID:1 + + 933 2 diff --git a/regression-tests/04-rime/02-cooja-rucb.csc b/regression-tests/04-rime/02-cooja-rucb.csc index e51e90f27..08a177fee 100644 --- a/regression-tests/04-rime/02-cooja-rucb.csc +++ b/regression-tests/04-rime/02-cooja-rucb.csc @@ -1,184 +1,181 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - My simulation - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 25.0 - 40.0 - 0.99 - 1.0 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype296 - Contiki Mote #1 - [CONTIKI_DIR]/examples/rime/example-rucb.c - make example-rucb.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - false - Rime - - - org.contikios.cooja.contikimote.ContikiMote - mtype296 - - org.contikios.cooja.interfaces.Position - 0.0 - 50.00000000000001 - 0.0 - - - org.contikios.cooja.interfaces.Battery - false - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 51 - - - - org.contikios.cooja.contikimote.ContikiMote - mtype296 - - org.contikios.cooja.interfaces.Position - 14.102564102564104 - 45.28301886792453 - 0.0 - - - org.contikios.cooja.interfaces.Battery - false - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 52 - - - - org.contikios.cooja.contikimote.ContikiMote - mtype296 - - org.contikios.cooja.interfaces.Position - -32.16814655285737 - 42.92182758760039 - 0.0 - - - org.contikios.cooja.interfaces.Battery - false - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 53 - - - - org.contikios.cooja.contikimote.ContikiMote - mtype296 - - org.contikios.cooja.interfaces.Position - -1.5917258339289355 - 37.3750708005199 - 0.0 - - - org.contikios.cooja.interfaces.Battery - false - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 54 - - - - org.contikios.cooja.contikimote.ContikiMote - mtype296 - - org.contikios.cooja.interfaces.Position - 26.334899854939632 - 53.05390331866741 - 0.0 - - - org.contikios.cooja.interfaces.Battery - false - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 55 - - - - - org.contikios.cooja.plugins.SimControl - 265 - 3 - 200 - 0 - 0 - false - - - org.contikios.cooja.plugins.LogListener - - - - 798 - 2 - 289 - 0 - 354 - false - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 265 - 0 - 155 - 0 - 200 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 534 - 1 - 354 - 264 - 0 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 25.0 + 40.0 + 0.99 + 1.0 + + + 40000 + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype965 + Contiki Mote #1 + [CONTIKI_DIR]/examples/rime/example-rucb.c + make example-rucb.cooja TARGET=cooja + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.interfaces.Mote2MoteRelations + false + + + + org.contikios.cooja.interfaces.Position + 0.0 + 50.00000000000001 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 51 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype965 + + + + org.contikios.cooja.interfaces.Position + 14.102564102564104 + 45.28301886792453 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 52 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype965 + + + + org.contikios.cooja.interfaces.Position + -32.16814655285737 + 42.92182758760039 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 53 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype965 + + + + org.contikios.cooja.interfaces.Position + -1.5917258339289355 + 37.3750708005199 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 54 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype965 + + + + org.contikios.cooja.interfaces.Position + 26.334899854939632 + 53.05390331866741 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 55 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype965 + + + + org.contikios.cooja.plugins.SimControl + 265 + 3 + 200 + 0 + 0 + + + org.contikios.cooja.plugins.LogListener + + + + + + 798 + 2 + 289 + 0 + 354 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 3.931419201604973 0.0 0.0 3.931419201604973 137.46646903794633 -127.75710261680608 + + 265 + 0 + 155 + 0 + 200 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 534 + 1 + 354 + 264 + 0 + + + diff --git a/regression-tests/04-rime/03-sky-abc.csc b/regression-tests/04-rime/03-sky-abc.csc index e609e4273..72934b701 100644 --- a/regression-tests/04-rime/03-sky-abc.csc +++ b/regression-tests/04-rime/03-sky-abc.csc @@ -1,136 +1,137 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - My simulation - 0 - generated - 5000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 0.95 - 1.0 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/rime/example-abc.c - make clean TARGET=sky -make example-abc.sky TARGET=sky - [CONTIKI_DIR]/examples/rime/example-abc.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.SkySerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 33.53152221759984 - 15.078801911773077 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 54.67966631314053 - 31.0253850381183 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - - - - org.contikios.cooja.plugins.SimControl - 313 - 3 - 199 - -1 - 0 - false - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 312 - 2 - 123 - 0 - 198 - false - - - org.contikios.cooja.plugins.LogListener - - - - 311 - 0 - 377 - 1 - 320 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 601 - 1 - 697 - 312 - 0 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 5000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 0.95 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + [CONTIKI_DIR]/examples/rime/example-abc.c + make clean TARGET=sky +make example-abc.sky TARGET=sky + [CONTIKI_DIR]/examples/rime/example-abc.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + + + + + org.contikios.cooja.interfaces.Position + 33.53152221759984 + 15.078801911773077 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 54.67966631314053 + 31.0253850381183 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky1 + + + + org.contikios.cooja.plugins.SimControl + 313 + 3 + 199 + 0 + 0 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 3.93358704057683 0.0 0.0 3.93358704057683 -23.493194019199933 -56.677416151212064 + + 312 + 2 + 123 + 0 + 198 + + + org.contikios.cooja.plugins.LogListener + + + + + + 311 + 0 + 377 + 1 + 320 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 601 + 1 + 697 + 312 + 0 + + + diff --git a/regression-tests/04-rime/04-sky-deluge.csc b/regression-tests/04-rime/04-sky-deluge.csc index 76d0471d8..ce5a6581a 100644 --- a/regression-tests/04-rime/04-sky-deluge.csc +++ b/regression-tests/04-rime/04-sky-deluge.csc @@ -1,157 +1,155 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - Deluge - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/sky/test-deluge.c - make clean TARGET=sky -make APPS=deluge test-deluge.sky TARGET=sky - [CONTIKI_DIR]/examples/sky/test-deluge.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.SkySerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 22.464792491653174 - 11.3235347656354 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 16.167564578306468 - 29.89745599030348 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 63.42409596590043 - 12.470791515046386 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - - - - org.contikios.cooja.plugins.SimControl - 282 - 4 - 212 - 0 - 0 - false - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 283 - 2 - 144 - -1 - 212 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 1 - 357 - 281 - 1 - false - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - - 109 - 9 - - 882 - 3 - 149 - -1 - 357 - false - - - org.contikios.cooja.plugins.LogListener - - - - 882 - 0 - 195 - -1 - 504 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + Deluge + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + [CONTIKI_DIR]/examples/sky/test-deluge.c + make clean TARGET=sky +make APPS=deluge test-deluge.sky TARGET=sky + [CONTIKI_DIR]/examples/sky/test-deluge.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + + + + + org.contikios.cooja.interfaces.Position + 22.464792491653174 + 11.3235347656354 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 16.167564578306468 + 29.89745599030348 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 63.42409596590043 + 12.470791515046386 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 5 + + sky1 + + + + org.contikios.cooja.plugins.SimControl + 282 + 4 + 212 + 0 + 0 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 4.405003166995177 0.0 0.0 4.405003166995177 -40.3007583818182 -45.78929741329485 + + 283 + 2 + 144 + -1 + 212 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 1 + 357 + 281 + 1 + + + org.contikios.cooja.plugins.TimeLine + + 0 + 1 + 2 + + 500.0 + + 882 + 3 + 149 + -1 + 357 + + + org.contikios.cooja.plugins.LogListener + + + + + + 882 + 0 + 195 + -1 + 504 + + + diff --git a/regression-tests/04-rime/05-sky-runicast.csc b/regression-tests/04-rime/05-sky-runicast.csc index ff5078474..605ba245a 100644 --- a/regression-tests/04-rime/05-sky-runicast.csc +++ b/regression-tests/04-rime/05-sky-runicast.csc @@ -1,208 +1,212 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - My simulation - 0 - 1 - 10000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 0.0 - 0.9 - 1.0 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/rime/example-runicast.c - make clean TARGET=sky -make example-runicast.sky TARGET=sky - [CONTIKI_DIR]/examples/rime/example-runicast.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.SkySerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 3.0783332685337617 - 38.39795740836801 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 1.1986251808192212 - 53.65838347315817 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 34.432838059195255 - 38.26541658684913 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 150.85510197745134 - 141.37553211643905 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - - - - org.contikios.cooja.plugins.SimControl - 265 - 4 - 200 - 0 - 0 - false - - - org.contikios.cooja.plugins.LogListener - - received - - 539 - 0 - 319 - 0 - 325 - false - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 263 - 2 - 125 - 1 - 200 - false - - - org.contikios.cooja.plugins.RadioLogger - 276 - 1 - 324 - 264 - 1 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 503 - 3 - 643 - 539 - 1 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 1 + 10000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 0.0 + 0.9 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + [CONTIKI_DIR]/examples/rime/example-runicast.c + make clean TARGET=sky +make example-runicast.sky TARGET=sky + [CONTIKI_DIR]/examples/rime/example-runicast.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + + + + + org.contikios.cooja.interfaces.Position + 3.0783332685337617 + 38.39795740836801 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 1.1986251808192212 + 53.65838347315817 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 34.432838059195255 + 38.26541658684913 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 150.85510197745134 + 141.37553211643905 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 4 + + sky1 + + + + org.contikios.cooja.plugins.SimControl + 265 + 4 + 200 + 0 + 0 + + + org.contikios.cooja.plugins.LogListener + + received + + + + 539 + 0 + 319 + 0 + 325 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 0.6259856679816412 0.0 0.0 0.6259856679816412 77.4082730178659 -21.226329635441804 + + 263 + 2 + 125 + 1 + 200 + + + org.contikios.cooja.plugins.RadioLogger + + 150 + + false + false + + 276 + 1 + 324 + 264 + 1 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 503 + 3 + 643 + 539 + 1 + + + diff --git a/regression-tests/04-rime/06-sky-trickle.csc b/regression-tests/04-rime/06-sky-trickle.csc index 54a4b7360..33baa35aa 100644 --- a/regression-tests/04-rime/06-sky-trickle.csc +++ b/regression-tests/04-rime/06-sky-trickle.csc @@ -1,263 +1,256 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - My simulation - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 41.0 - 55.0 - 1.0 - 1.0 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/rime/example-trickle.c - make clean TARGET=sky -make example-trickle.sky TARGET=sky - [CONTIKI_DIR]/examples/rime/example-trickle.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.SkySerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 21.25615651441164 - 15.906616513243888 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 29.258648178869528 - 64.81243553163958 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 53.58390840870132 - 99.01827951434828 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 4.089137066756255 - 57.26244252237209 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 84.2311285004563 - 14.6212837520458 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 40.97868508483131 - 69.00112748842623 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 34.348646576361716 - 33.331938472933615 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 76.46661251540715 - 62.393168145801916 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 87.91615665417679 - 41.2939192052263 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 9 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 25.396991214895582 - 87.22076662391413 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 10 - - - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 310 - 2 - 169 - 2 - 199 - false - - - org.contikios.cooja.plugins.SimControl - 313 - 3 - 199 - 1 - 0 - false - - - org.contikios.cooja.plugins.LogListener - - - - 310 - 1 - 331 - 3 - 368 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 314 - 0 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 41.0 + 55.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + [CONTIKI_DIR]/examples/rime/example-trickle.c + make clean TARGET=sky +make example-trickle.sky TARGET=sky + [CONTIKI_DIR]/examples/rime/example-trickle.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + + + + + org.contikios.cooja.interfaces.Position + 21.25615651441164 + 15.906616513243888 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 29.258648178869528 + 64.81243553163958 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 53.58390840870132 + 99.01827951434828 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 4.089137066756255 + 57.26244252237209 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 4 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 84.2311285004563 + 14.6212837520458 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 5 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 40.97868508483131 + 69.00112748842623 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 6 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 34.348646576361716 + 33.331938472933615 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 7 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 76.46661251540715 + 62.393168145801916 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 8 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 87.91615665417679 + 41.2939192052263 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 9 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 25.396991214895582 + 87.22076662391413 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 10 + + sky1 + + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 1.2387343127698363 0.0 0.0 1.2387343127698363 92.01494285570652 -13.3846131531305 + + 310 + 2 + 169 + 2 + 199 + + + org.contikios.cooja.plugins.SimControl + 313 + 3 + 199 + 1 + 0 + + + org.contikios.cooja.plugins.LogListener + + + + + + 310 + 1 + 331 + 3 + 368 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 0 + 700 + 314 + 0 + + + diff --git a/regression-tests/04-rime/07-sky-collect.csc b/regression-tests/04-rime/07-sky-collect.csc index c4b0def18..58dc38e75 100644 --- a/regression-tests/04-rime/07-sky-collect.csc +++ b/regression-tests/04-rime/07-sky-collect.csc @@ -1,252 +1,245 @@ - - - ../apps/mrm - ../apps/mspsim - ../apps/avrora - ../apps/native_gateway - - My simulation - 0 - generated - 10000000 - - org.contikios.cooja.radiomediums.UDGM - 30.0 - 40.0 - 0.9 - 0.9 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/sky/sky-collect.c - make clean TARGET=sky -make sky-collect.sky TARGET=sky - [CONTIKI_DIR]/examples/sky/sky-collect.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.SkySerial - org.contikios.cooja.mspmote.interfaces.SkyLED - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 9.333811152651393 - 89.28114548870677 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 33.040227185226826 - 54.184283361563054 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - -2.2559922410521516 - 50.71648775308175 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 12.959353575718179 - 43.874396471224806 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 15.917348901177405 - 66.93526904376517 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 26.735174243053933 - 35.939375910459084 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - - - org.contikios.cooja.mspmote.SkyMote - sky1 - - - org.contikios.cooja.interfaces.Position - 41.5254792748469 - 28.370611308140152 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - - - - org.contikios.cooja.plugins.SimControl - 265 - 3 - 200 - 0 - 0 - false - - - org.contikios.cooja.plugins.Visualizer - - Mote IDs - Radio environment (UDGM) - - 264 - 1 - 185 - 0 - 200 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 2 - 385 - 266 - 0 - false - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - - 109 - 9 - - 866 - 0 - 152 - 0 - 384 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 10000000 + + org.contikios.cooja.radiomediums.UDGM + 30.0 + 40.0 + 0.9 + 0.9 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + [CONTIKI_DIR]/examples/sky/sky-collect.c + make clean TARGET=sky +make sky-collect.sky TARGET=sky + [CONTIKI_DIR]/examples/sky/sky-collect.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + + + + + org.contikios.cooja.interfaces.Position + 9.333811152651393 + 89.28114548870677 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 33.040227185226826 + 54.184283361563054 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + -2.2559922410521516 + 50.71648775308175 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 12.959353575718179 + 43.874396471224806 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 4 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 15.917348901177405 + 66.93526904376517 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 5 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 26.735174243053933 + 35.939375910459084 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 6 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 41.5254792748469 + 28.370611308140152 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 7 + + sky1 + + + + org.contikios.cooja.plugins.SimControl + 265 + 3 + 200 + 0 + 0 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 1.9551775516837413 0.0 0.0 1.9551775516837413 87.61059024269439 -50.01503690267507 + + 264 + 1 + 185 + 0 + 200 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 2 + 385 + 266 + 0 + + + org.contikios.cooja.plugins.TimeLine + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + + 500.0 + + 866 + 0 + 152 + 0 + 384 + + + diff --git a/regression-tests/04-rime/08-sky-collect.csc b/regression-tests/04-rime/08-sky-collect.csc index cb63062a7..ead2dda9c 100644 --- a/regression-tests/04-rime/08-sky-collect.csc +++ b/regression-tests/04-rime/08-sky-collect.csc @@ -1,441 +1,447 @@ - - - - My simulation - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 50.0 - 1.0 - 1.0 - - - 400000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #1 - [CONTIKI_DIR]/examples/rime/example-collect.c - make clean TARGET=sky -make example-collect.sky TARGET=sky - [CONTIKI_DIR]/examples/rime/example-collect.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 87.29845932913939 - 60.286214311723164 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 94.30809966340686 - 22.50388779326399 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 82.40423567500785 - 39.56979106929553 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 26.185019854469438 - 4.800834369523899 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 1.9530156130507015 - 78.3175061800706 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 48.35216700543414 - 80.36988713780997 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 24.825985087266833 - 74.27809432062487 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 8.356165164293616 - 94.33967355724187 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 45.11740613004886 - 31.7059041432301 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 9 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 68.9908548386292 - 55.01991960639596 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 10 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 13.181122543889046 - 55.9636533130127 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 11 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 2.1749985906538427 - 78.39666095789707 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 12 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 37.79795217518357 - 7.164284163506062 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 13 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 64.4595177394984 - 72.115414337433 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 14 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 81.85663737096085 - 89.31412706434035 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 15 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 44.74952276297882 - 18.78566116347574 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 16 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 96.11333426285873 - 90.64560410751824 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 17 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 21.651464136783527 - 7.1381043251259495 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 18 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 83.6006916200628 - 26.97170140682981 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 19 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 1.3446070721664705 - 7.340373220385176 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 20 - - sky1 - - - - org.contikios.cooja.plugins.SimControl - 247 - 3 - 227 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.685403700540615 0.0 0.0 1.685403700540615 23.872012513439184 -0.545889466623605 - - 224 - 2 - 225 - 247 - 1 - - - org.contikios.cooja.plugins.LogListener - - - - - 469 - 0 - 473 - 0 - 226 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 1 - 700 - 469 - 0 - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 50.0 + 1.0 + 1.0 + + + 400000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + [CONTIKI_DIR]/examples/rime/example-collect.c + make clean TARGET=sky +make example-collect.sky TARGET=sky + [CONTIKI_DIR]/examples/rime/example-collect.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + + + org.contikios.cooja.interfaces.Position + 87.29845932913939 + 60.286214311723164 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 94.30809966340686 + 22.50388779326399 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 82.40423567500785 + 39.56979106929553 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 26.185019854469438 + 4.800834369523899 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 4 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 1.9530156130507015 + 78.3175061800706 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 5 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 48.35216700543414 + 80.36988713780997 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 6 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 24.825985087266833 + 74.27809432062487 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 7 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 8.356165164293616 + 94.33967355724187 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 8 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 45.11740613004886 + 31.7059041432301 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 9 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 68.9908548386292 + 55.01991960639596 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 10 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 13.181122543889046 + 55.9636533130127 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 11 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 2.1749985906538427 + 78.39666095789707 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 12 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 37.79795217518357 + 7.164284163506062 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 13 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 64.4595177394984 + 72.115414337433 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 14 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 81.85663737096085 + 89.31412706434035 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 15 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 44.74952276297882 + 18.78566116347574 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 16 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 96.11333426285873 + 90.64560410751824 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 17 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 21.651464136783527 + 7.1381043251259495 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 18 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 83.6006916200628 + 26.97170140682981 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 19 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 1.3446070721664705 + 7.340373220385176 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 20 + + sky1 + + + + org.contikios.cooja.plugins.SimControl + 247 + 0 + 227 + 0 + 0 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 1.685403700540615 0.0 0.0 1.685403700540615 23.872012513439184 -0.545889466623605 + + 224 + 3 + 225 + 247 + 1 + + + org.contikios.cooja.plugins.LogListener + + + + + + 469 + 1 + 473 + 0 + 226 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 2 + 700 + 469 + 0 + + + diff --git a/regression-tests/04-rime/09-cooja-trickle.csc b/regression-tests/04-rime/09-cooja-trickle.csc index 484b49506..e369b38fc 100644 --- a/regression-tests/04-rime/09-cooja-trickle.csc +++ b/regression-tests/04-rime/09-cooja-trickle.csc @@ -22,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype346 + mtype896 Cooja Mote Type #1 - [CONFIG_DIR]/code/trickle-node.c + [CONTIKI_DIR]/regression-tests/04-rime/code/trickle-node.c make trickle-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position org.contikios.cooja.interfaces.Battery @@ -59,7 +59,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -76,7 +76,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -93,7 +93,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -110,7 +110,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -127,7 +127,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -144,7 +144,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -161,7 +161,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -178,7 +178,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -195,7 +195,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -212,7 +212,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -229,7 +229,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -246,7 +246,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -263,7 +263,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -280,7 +280,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -297,7 +297,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -314,7 +314,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -331,7 +331,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -348,7 +348,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -365,7 +365,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -382,7 +382,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -399,7 +399,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -416,7 +416,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -433,7 +433,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -450,7 +450,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -467,7 +467,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -484,7 +484,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -501,7 +501,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -518,7 +518,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -535,7 +535,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -552,7 +552,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -569,7 +569,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -586,7 +586,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -603,7 +603,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -620,7 +620,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -637,7 +637,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -654,7 +654,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -671,7 +671,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -688,7 +688,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -705,7 +705,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -722,7 +722,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -739,7 +739,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -756,7 +756,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -773,7 +773,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -790,7 +790,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -807,7 +807,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -824,7 +824,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -841,7 +841,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -858,7 +858,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -875,7 +875,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -892,7 +892,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -909,7 +909,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -926,7 +926,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -943,7 +943,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -960,7 +960,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -977,7 +977,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -994,7 +994,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1011,7 +1011,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1028,7 +1028,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1045,7 +1045,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1062,7 +1062,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1079,7 +1079,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1096,7 +1096,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1113,7 +1113,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1130,7 +1130,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1147,7 +1147,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1164,7 +1164,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1181,7 +1181,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1198,7 +1198,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1215,7 +1215,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1232,7 +1232,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1249,7 +1249,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1266,7 +1266,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1283,7 +1283,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1300,7 +1300,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1317,7 +1317,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1334,7 +1334,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1351,7 +1351,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1368,7 +1368,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1385,7 +1385,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1402,7 +1402,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1419,7 +1419,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1436,7 +1436,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1453,7 +1453,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1470,7 +1470,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1487,7 +1487,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1504,7 +1504,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1521,7 +1521,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1538,7 +1538,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1555,7 +1555,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1572,7 +1572,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1589,7 +1589,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1606,7 +1606,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1623,7 +1623,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1640,7 +1640,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1657,7 +1657,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1674,7 +1674,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1691,7 +1691,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1708,7 +1708,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1725,7 +1725,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1742,7 +1742,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1759,7 +1759,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1776,7 +1776,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1793,7 +1793,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1810,7 +1810,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1827,7 +1827,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1844,7 +1844,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1861,7 +1861,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1878,7 +1878,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1895,7 +1895,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1912,7 +1912,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1929,7 +1929,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1946,7 +1946,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1963,7 +1963,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1980,7 +1980,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -1997,7 +1997,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2014,7 +2014,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2031,7 +2031,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2048,7 +2048,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2065,7 +2065,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2082,7 +2082,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2099,7 +2099,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2116,7 +2116,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2133,7 +2133,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2150,7 +2150,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2167,7 +2167,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2184,7 +2184,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2201,7 +2201,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2218,7 +2218,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2235,7 +2235,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2252,7 +2252,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2269,7 +2269,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2286,7 +2286,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2303,7 +2303,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2320,7 +2320,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2337,7 +2337,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2354,7 +2354,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2371,7 +2371,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2388,7 +2388,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2405,7 +2405,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2422,7 +2422,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2439,7 +2439,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2456,7 +2456,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2473,7 +2473,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2490,7 +2490,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2507,7 +2507,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2524,7 +2524,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2541,7 +2541,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2558,7 +2558,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2575,7 +2575,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2592,7 +2592,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2609,7 +2609,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2626,7 +2626,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2643,7 +2643,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2660,7 +2660,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2677,7 +2677,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2694,7 +2694,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2711,7 +2711,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2728,7 +2728,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2745,7 +2745,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2762,7 +2762,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2779,7 +2779,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2796,7 +2796,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2813,7 +2813,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2830,7 +2830,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2847,7 +2847,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2864,7 +2864,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2881,7 +2881,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2898,7 +2898,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2915,7 +2915,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2932,7 +2932,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2949,7 +2949,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2966,7 +2966,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -2983,7 +2983,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3000,7 +3000,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3017,7 +3017,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3034,7 +3034,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3051,7 +3051,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3068,7 +3068,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3085,7 +3085,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3102,7 +3102,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3119,7 +3119,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3136,7 +3136,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3153,7 +3153,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3170,7 +3170,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3187,7 +3187,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3204,7 +3204,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3221,7 +3221,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3238,7 +3238,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3255,7 +3255,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3272,7 +3272,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3289,7 +3289,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3306,7 +3306,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3323,7 +3323,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3340,7 +3340,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3357,7 +3357,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3374,7 +3374,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3391,7 +3391,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3408,7 +3408,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3425,7 +3425,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3442,7 +3442,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype346 + mtype896 @@ -3472,6 +3472,7 @@ Hello, world + 1200 1 diff --git a/regression-tests/04-rime/10-cooja-mesh.csc b/regression-tests/04-rime/10-cooja-mesh.csc index cf145c8c5..2a85264b6 100644 --- a/regression-tests/04-rime/10-cooja-mesh.csc +++ b/regression-tests/04-rime/10-cooja-mesh.csc @@ -22,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype140 + mtype812 Cooja Mote Type #1 - [CONFIG_DIR]/code/mesh-node.c + [CONTIKI_DIR]/regression-tests/04-rime/code/mesh-node.c make mesh-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position org.contikios.cooja.interfaces.Battery @@ -59,7 +59,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -76,7 +76,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -93,7 +93,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -110,7 +110,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -127,7 +127,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -144,7 +144,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -161,7 +161,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -178,7 +178,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -195,7 +195,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -212,7 +212,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -229,7 +229,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -246,7 +246,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -263,7 +263,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -280,7 +280,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -297,7 +297,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -314,7 +314,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -331,7 +331,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -348,7 +348,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -365,7 +365,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -382,7 +382,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -399,7 +399,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -416,7 +416,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -433,7 +433,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -450,7 +450,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -467,7 +467,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -484,7 +484,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -501,7 +501,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -518,7 +518,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -535,7 +535,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -552,7 +552,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -569,7 +569,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -586,7 +586,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -603,7 +603,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -620,7 +620,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -637,7 +637,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -654,7 +654,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -671,7 +671,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -688,7 +688,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -705,7 +705,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -722,7 +722,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -739,7 +739,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -756,7 +756,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -773,7 +773,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -790,7 +790,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -807,7 +807,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -824,7 +824,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -841,7 +841,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -858,7 +858,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -875,7 +875,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -892,7 +892,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -909,7 +909,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -926,7 +926,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -943,7 +943,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -960,7 +960,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -977,7 +977,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -994,7 +994,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1011,7 +1011,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1028,7 +1028,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1045,7 +1045,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1062,7 +1062,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1079,7 +1079,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1096,7 +1096,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1113,7 +1113,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1130,7 +1130,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1147,7 +1147,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1164,7 +1164,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1181,7 +1181,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1198,7 +1198,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1215,7 +1215,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1232,7 +1232,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1249,7 +1249,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1266,7 +1266,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1283,7 +1283,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1300,7 +1300,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1317,7 +1317,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1334,7 +1334,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1351,7 +1351,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1368,7 +1368,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1385,7 +1385,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1402,7 +1402,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1419,7 +1419,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1436,7 +1436,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1453,7 +1453,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1470,7 +1470,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1487,7 +1487,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1504,7 +1504,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1521,7 +1521,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1538,7 +1538,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1555,7 +1555,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1572,7 +1572,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1589,7 +1589,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1606,7 +1606,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1623,7 +1623,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1640,7 +1640,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1657,7 +1657,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1674,7 +1674,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1691,7 +1691,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1708,7 +1708,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1725,7 +1725,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1742,7 +1742,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1759,7 +1759,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1776,7 +1776,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1793,7 +1793,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1810,7 +1810,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1827,7 +1827,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1844,7 +1844,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1861,7 +1861,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1878,7 +1878,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1895,7 +1895,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1912,7 +1912,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1929,7 +1929,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1946,7 +1946,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1963,7 +1963,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1980,7 +1980,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -1997,7 +1997,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2014,7 +2014,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2031,7 +2031,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2048,7 +2048,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2065,7 +2065,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2082,7 +2082,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2099,7 +2099,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2116,7 +2116,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2133,7 +2133,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2150,7 +2150,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2167,7 +2167,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2184,7 +2184,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2201,7 +2201,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2218,7 +2218,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2235,7 +2235,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2252,7 +2252,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2269,7 +2269,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2286,7 +2286,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2303,7 +2303,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2320,7 +2320,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2337,7 +2337,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2354,7 +2354,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2371,7 +2371,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2388,7 +2388,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2405,7 +2405,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2422,7 +2422,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2439,7 +2439,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2456,7 +2456,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2473,7 +2473,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2490,7 +2490,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2507,7 +2507,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2524,7 +2524,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2541,7 +2541,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2558,7 +2558,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2575,7 +2575,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2592,7 +2592,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2609,7 +2609,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2626,7 +2626,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2643,7 +2643,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2660,7 +2660,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2677,7 +2677,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2694,7 +2694,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2711,7 +2711,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2728,7 +2728,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2745,7 +2745,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2762,7 +2762,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2779,7 +2779,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2796,7 +2796,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2813,7 +2813,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2830,7 +2830,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2847,7 +2847,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2864,7 +2864,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2881,7 +2881,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2898,7 +2898,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2915,7 +2915,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2932,7 +2932,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2949,7 +2949,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2966,7 +2966,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -2983,7 +2983,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3000,7 +3000,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3017,7 +3017,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3034,7 +3034,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3051,7 +3051,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3068,7 +3068,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3085,7 +3085,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3102,7 +3102,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3119,7 +3119,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3136,7 +3136,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3153,7 +3153,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3170,7 +3170,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3187,7 +3187,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3204,7 +3204,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3221,7 +3221,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3238,7 +3238,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3255,7 +3255,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3272,7 +3272,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3289,7 +3289,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3306,7 +3306,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3323,7 +3323,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3340,7 +3340,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3357,7 +3357,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3374,7 +3374,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3391,7 +3391,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3408,7 +3408,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3425,7 +3425,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3442,7 +3442,7 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype140 + mtype812 @@ -3473,6 +3473,7 @@ + 1200 3 diff --git a/regression-tests/06-shell/03-sky-shell-sendcmd.csc b/regression-tests/06-shell/03-sky-shell-sendcmd.csc index 98fef3bc0..605c6cdc3 100644 --- a/regression-tests/06-shell/03-sky-shell-sendcmd.csc +++ b/regression-tests/06-shell/03-sky-shell-sendcmd.csc @@ -22,10 +22,10 @@ org.contikios.cooja.mspmote.SkyMoteType sky1 Sky Mote Type #sky1 - [CONTIKI_DIR]/examples/sky-shell/sky-checkpoint.c + [CONTIKI_DIR]/examples/sky-shell/sky-shell.c make clean TARGET=sky -make sky-checkpoint.sky TARGET=sky - [CONTIKI_DIR]/examples/sky-shell/sky-checkpoint.sky +make sky-shell.sky TARGET=sky + [CONTIKI_DIR]/examples/sky-shell/sky-shell.sky org.contikios.cooja.interfaces.Position org.contikios.cooja.interfaces.IPAddress org.contikios.cooja.interfaces.Mote2MoteRelations diff --git a/regression-tests/09-collect-lossy/01-sky-shell-collect-lossy.csc b/regression-tests/09-collect-lossy/01-sky-shell-collect-lossy.csc index afb4eab72..abbe506eb 100644 --- a/regression-tests/09-collect-lossy/01-sky-shell-collect-lossy.csc +++ b/regression-tests/09-collect-lossy/01-sky-shell-collect-lossy.csc @@ -1,14 +1,13 @@ - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - /home/user/contikiprojects/sics.se/mobility + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker My simulation - 0 123456 1000000 @@ -38,7 +37,7 @@ org.contikios.cooja.mspmote.interfaces.SkyButton org.contikios.cooja.mspmote.interfaces.SkyFlash org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio + org.contikios.cooja.mspmote.interfaces.Msp802154Radio org.contikios.cooja.mspmote.interfaces.MspSerial org.contikios.cooja.mspmote.interfaces.SkyLED org.contikios.cooja.mspmote.interfaces.MspDebugOutput @@ -328,7 +327,7 @@ org.contikios.cooja.plugins.SimControl 318 - 0 + 1 172 0 0 @@ -351,6 +350,8 @@ org.contikios.cooja.plugins.LogListener timedout + + 1440 3 @@ -530,7 +531,7 @@ while(true) { true 600 - 1 + 0 775 304 5 diff --git a/regression-tests/11-ipv6/01-cooja-ipv6-udp.csc b/regression-tests/11-ipv6/01-cooja-ipv6-udp.csc index 4071f5853..8681e4ded 100644 --- a/regression-tests/11-ipv6/01-cooja-ipv6-udp.csc +++ b/regression-tests/11-ipv6/01-cooja-ipv6-udp.csc @@ -1,174 +1,183 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - - My simulation - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype783 - Receiver - [CONTIKI_DIR]/examples/udp-ipv6/udp-server.c - make TARGET=cooja clean -make udp-server.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.MoteAttributes - false - - - org.contikios.cooja.contikimote.ContikiMoteType - mtype512 - Sender - [CONTIKI_DIR]/examples/udp-ipv6/udp-client.c - make udp-client.cooja TARGET=cooja - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.Battery - org.contikios.cooja.contikimote.interfaces.ContikiVib - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - org.contikios.cooja.contikimote.interfaces.ContikiRS232 - org.contikios.cooja.contikimote.interfaces.ContikiBeeper - org.contikios.cooja.contikimote.interfaces.ContikiIPAddress - org.contikios.cooja.contikimote.interfaces.ContikiRadio - org.contikios.cooja.contikimote.interfaces.ContikiButton - org.contikios.cooja.contikimote.interfaces.ContikiPIR - org.contikios.cooja.contikimote.interfaces.ContikiClock - org.contikios.cooja.contikimote.interfaces.ContikiLED - org.contikios.cooja.contikimote.interfaces.ContikiCFS - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.MoteAttributes - false - - - - org.contikios.cooja.interfaces.Position - 98.76075470611741 - 30.469519951198897 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 1 - - mtype783 - - - - org.contikios.cooja.interfaces.Position - 58.59043340181549 - 22.264557758786697 - 0.0 - - - org.contikios.cooja.contikimote.interfaces.ContikiMoteID - 2 - - mtype512 - - - - org.contikios.cooja.plugins.SimControl - 248 - 2 - 200 - 0 - 0 - false - - - org.contikios.cooja.plugins.LogListener - - ID:1 - - 851 - 1 - 187 - 1 - 521 - false - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.TrafficVisualizerSkin - 2.565713585691764 0.0 0.0 2.565713585691764 -91.30090099174814 -28.413835696190525 - - 246 - 3 - 121 - 1 - 201 - false - - - org.contikios.cooja.plugins.RadioLogger - - 150 - - 246 - 4 - 198 - 0 - 323 - false - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 520 - 250 - -1 - false - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype350 + Receiver + [CONTIKI_DIR]/examples/udp-ipv6/udp-server.c + make TARGET=cooja clean +make udp-server.cooja TARGET=cooja + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.MoteAttributes + false + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype981 + Sender + [CONTIKI_DIR]/examples/udp-ipv6/udp-client.c + make udp-client.cooja TARGET=cooja + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.MoteAttributes + false + + + + org.contikios.cooja.interfaces.Position + 98.76075470611741 + 30.469519951198897 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype350 + + + + org.contikios.cooja.interfaces.Position + 58.59043340181549 + 22.264557758786697 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype981 + + + + org.contikios.cooja.plugins.SimControl + 248 + 2 + 200 + 0 + 0 + + + org.contikios.cooja.plugins.LogListener + + ID:1 + + + + 851 + 1 + 187 + 1 + 521 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.TrafficVisualizerSkin + 2.565713585691764 0.0 0.0 2.565713585691764 -91.30090099174814 -28.413835696190525 + + 246 + 3 + 121 + 1 + 201 + + + org.contikios.cooja.plugins.RadioLogger + + 133 + + false + false + + 246 + 4 + 198 + 0 + 323 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 0 + 520 + 250 + -1 + + + diff --git a/regression-tests/11-ipv6/04-exp5438-udp-fragmentation-contikimac.csc b/regression-tests/11-ipv6/04-exp5438-udp-fragmentation-contikimac.csc index 8c7d90ee7..2608365e9 100644 --- a/regression-tests/11-ipv6/04-exp5438-udp-fragmentation-contikimac.csc +++ b/regression-tests/11-ipv6/04-exp5438-udp-fragmentation-contikimac.csc @@ -115,6 +115,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=contikimac_driver TARGET=exp + 1200 5 @@ -153,7 +154,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=contikimac_driver TARGET=exp org.contikios.cooja.plugins.ScriptRunner - [CONFIG_DIR]/fragmentation-should-receive-all.js + [CONTIKI_DIR]/regression-tests/11-ipv6/fragmentation-should-receive-all.js true 618 diff --git a/regression-tests/11-ipv6/05-exp5438-udp-fragmentation-nullrdc.csc b/regression-tests/11-ipv6/05-exp5438-udp-fragmentation-nullrdc.csc index 491b0f6c2..5a3025135 100644 --- a/regression-tests/11-ipv6/05-exp5438-udp-fragmentation-nullrdc.csc +++ b/regression-tests/11-ipv6/05-exp5438-udp-fragmentation-nullrdc.csc @@ -115,6 +115,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=nullrdc_driver TARGET=exp543 + 1200 5 @@ -153,7 +154,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=nullrdc_driver TARGET=exp543 org.contikios.cooja.plugins.ScriptRunner - [CONFIG_DIR]/fragmentation-should-receive-all.js + [CONTIKI_DIR]/regression-tests/11-ipv6/fragmentation-should-receive-all.js true 618 diff --git a/regression-tests/11-ipv6/06-exp5438-udp-fragmentation-contikimac-large-sender.csc b/regression-tests/11-ipv6/06-exp5438-udp-fragmentation-contikimac-large-sender.csc index 886597866..ae2485746 100644 --- a/regression-tests/11-ipv6/06-exp5438-udp-fragmentation-contikimac-large-sender.csc +++ b/regression-tests/11-ipv6/06-exp5438-udp-fragmentation-contikimac-large-sender.csc @@ -115,6 +115,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=contikimac_driver TARGET=exp + 1200 5 @@ -153,7 +154,8 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=contikimac_driver TARGET=exp org.contikios.cooja.plugins.ScriptRunner - [CONFIG_DIR]/fragmentation-should-receive-none.js true + [CONTIKI_DIR]/regression-tests/11-ipv6/fragmentation-should-receive-none.js + true 618 1 diff --git a/regression-tests/11-ipv6/07-exp5438-udp-fragmentation-nullrdc-large-sender.csc b/regression-tests/11-ipv6/07-exp5438-udp-fragmentation-nullrdc-large-sender.csc index efe3de2df..cc982ba44 100644 --- a/regression-tests/11-ipv6/07-exp5438-udp-fragmentation-nullrdc-large-sender.csc +++ b/regression-tests/11-ipv6/07-exp5438-udp-fragmentation-nullrdc-large-sender.csc @@ -115,6 +115,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=nullrdc_driver TARGET=exp543 + 1200 5 @@ -153,7 +154,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=nullrdc_driver TARGET=exp543 org.contikios.cooja.plugins.ScriptRunner - [CONFIG_DIR]/fragmentation-should-receive-none.js + [CONTIKI_DIR]/regression-tests/11-ipv6/fragmentation-should-receive-none.js true 618 diff --git a/regression-tests/11-ipv6/08-exp5438-udp-fragmentation-contikimac-too-large-sender.csc b/regression-tests/11-ipv6/08-exp5438-udp-fragmentation-contikimac-too-large-sender.csc index 401807349..e9b559d90 100644 --- a/regression-tests/11-ipv6/08-exp5438-udp-fragmentation-contikimac-too-large-sender.csc +++ b/regression-tests/11-ipv6/08-exp5438-udp-fragmentation-contikimac-too-large-sender.csc @@ -115,6 +115,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=contikimac_driver TARGET=exp + 1200 5 @@ -153,7 +154,7 @@ make udp-receiver.exp5438 DEFINES=NETSTACK_CONF_RDC=contikimac_driver TARGET=exp org.contikios.cooja.plugins.ScriptRunner - [CONFIG_DIR]/fragmentation-should-receive-none.js + [CONTIKI_DIR]/regression-tests/11-ipv6/fragmentation-should-receive-none.js true 618 diff --git a/regression-tests/11-ipv6/16-sky-ipv6-rpl-collect.csc b/regression-tests/11-ipv6/16-sky-ipv6-rpl-collect.csc index b9a2e2539..9b76c6739 100644 --- a/regression-tests/11-ipv6/16-sky-ipv6-rpl-collect.csc +++ b/regression-tests/11-ipv6/16-sky-ipv6-rpl-collect.csc @@ -1,625 +1,623 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - /home/user/contikiprojects/sics.se/mobility - [CONTIKI_DIR]/tools/cooja/apps/collect-view - /home/user/contikiprojects/sics.se/powertracker - - My simulation - 0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 100.0 - 0.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Sky Mote Type #sky1 - [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sink.c - make udp-sink.sky TARGET=sky - [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sink.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - Sky Mote Type #sky2 - [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sender.c - make udp-sender.sky TARGET=sky - [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sender.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 242.83184008074136 - -88.93434685786869 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 223.5175954004352 - -69.05842098947238 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 250.51864863077387 - -59.2420165357677 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 294.4736028715864 - -63.23792146675066 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 188.6638305152632 - -41.28432709660093 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 222.54731411389315 - -32.869043991280165 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 273.694897230475 - -29.672320046493798 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 321.64575640227054 - -33.66822497747676 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 159.4120162043624 - -2.500166515809672 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 9 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 196.97352255560222 - -0.10262355721989598 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 10 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 252.91619158936365 - 1.495738415173288 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 11 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 301.66623174735577 - -0.10262355721989598 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 12 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 346.4203669743649 - 1.495738415173288 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 13 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 124.24805281171236 - 22.27444405628468 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 14 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 180.1907218454738 - 35.86052082162674 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 15 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 224.14567608628633 - 30.266253918250598 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 16 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 276.0924401890648 - 35.86052082162674 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 17 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 351.2154528915445 - 37.45888279401993 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 18 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 89.08408941906231 - 47.04905462837903 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 19 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 180.1907218454738 - 75.02038914525976 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 20 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 245.7235627135943 - 66.22939829709723 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 21 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 290.4776979406035 - 67.82776026949043 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 22 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 370.3957965602627 - 64.63103632470406 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 23 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 93.07999435004527 - 82.21301802102909 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 24 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 204.16615143137156 - 106.18844760692684 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 25 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 259 - 3 - 184 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.AttributeVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - 1.836243522352668 0.0 0.0 1.836243522352668 -93.43273668589363 192.8080782058222 - - 666 - 4 - 510 - 764 - 5 - - - org.contikios.cooja.plugins.LogListener - - - - 1347 - 2 - 150 - 0 - 438 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - - 109 - 52818.041078329756 - - 1347 - 1 - 233 - 0 - 588 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 416 - 8 - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 123456 + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 100.0 + 0.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #sky1 + [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sink.c + make udp-sink.sky TARGET=sky + [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sink.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + org.contikios.cooja.mspmote.SkyMoteType + sky2 + Sky Mote Type #sky2 + [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sender.c + make udp-sender.sky TARGET=sky + [CONTIKI_DIR]/examples/ipv6/rpl-collect/udp-sender.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + + + org.contikios.cooja.interfaces.Position + 242.83184008074136 + -88.93434685786869 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 223.5175954004352 + -69.05842098947238 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 250.51864863077387 + -59.2420165357677 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 294.4736028715864 + -63.23792146675066 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 4 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 188.6638305152632 + -41.28432709660093 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 5 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 222.54731411389315 + -32.869043991280165 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 6 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 273.694897230475 + -29.672320046493798 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 7 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 321.64575640227054 + -33.66822497747676 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 8 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 159.4120162043624 + -2.500166515809672 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 9 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 196.97352255560222 + -0.10262355721989598 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 10 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 252.91619158936365 + 1.495738415173288 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 11 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 301.66623174735577 + -0.10262355721989598 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 12 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 346.4203669743649 + 1.495738415173288 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 13 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 124.24805281171236 + 22.27444405628468 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 14 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 180.1907218454738 + 35.86052082162674 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 15 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 224.14567608628633 + 30.266253918250598 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 16 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 276.0924401890648 + 35.86052082162674 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 17 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 351.2154528915445 + 37.45888279401993 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 18 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 89.08408941906231 + 47.04905462837903 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 19 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 180.1907218454738 + 75.02038914525976 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 20 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 245.7235627135943 + 66.22939829709723 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 21 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 290.4776979406035 + 67.82776026949043 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 22 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 370.3957965602627 + 64.63103632470406 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 23 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 93.07999435004527 + 82.21301802102909 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 24 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 204.16615143137156 + 106.18844760692684 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 25 + + sky2 + + + + org.contikios.cooja.plugins.SimControl + 259 + 3 + 184 + 0 + 0 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.AttributeVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 1.836243522352668 0.0 0.0 1.836243522352668 -93.43273668589363 192.8080782058222 + + 666 + 4 + 510 + 764 + 5 + + + org.contikios.cooja.plugins.LogListener + + + + + + 1347 + 2 + 150 + 0 + 438 + + + org.contikios.cooja.plugins.TimeLine + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + + 52818.041078329756 + + 1347 + 1 + 233 + 0 + 588 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 0 + 700 + 416 + 8 + + + diff --git a/regression-tests/11-ipv6/code/receiver/Makefile b/regression-tests/11-ipv6/code/receiver/Makefile index aafcd9278..0decf131d 100644 --- a/regression-tests/11-ipv6/code/receiver/Makefile +++ b/regression-tests/11-ipv6/code/receiver/Makefile @@ -1,6 +1,5 @@ CONTIKI=../../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL -DPROJECT_CONF_H=\"project-conf.h\" diff --git a/regression-tests/11-ipv6/code/sender/Makefile b/regression-tests/11-ipv6/code/sender/Makefile index aafcd9278..0decf131d 100644 --- a/regression-tests/11-ipv6/code/sender/Makefile +++ b/regression-tests/11-ipv6/code/sender/Makefile @@ -1,6 +1,5 @@ CONTIKI=../../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL -DPROJECT_CONF_H=\"project-conf.h\" diff --git a/regression-tests/11-ipv6/03-sky-ipv6-udp-fragmentation.csc b/regression-tests/11-ipv6/x03-sky-ipv6-udp-fragmentation.csc similarity index 89% rename from regression-tests/11-ipv6/03-sky-ipv6-udp-fragmentation.csc rename to regression-tests/11-ipv6/x03-sky-ipv6-udp-fragmentation.csc index 2721a2b6f..f035a84cf 100644 --- a/regression-tests/11-ipv6/03-sky-ipv6-udp-fragmentation.csc +++ b/regression-tests/11-ipv6/x03-sky-ipv6-udp-fragmentation.csc @@ -1,171 +1,179 @@ - - - - My simulation - 0 - generated - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 50.0 - 100.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - UDP client - [CONTIKI_DIR]/examples/udp-ipv6/udp-client.c - make clean TARGET=sky -make udp-client.sky TARGET=sky DEFINES=UDP_CONNECTION_ADDR=fe80::212:7402:2:202,SICSLOWPAN_CONF_FRAG=1,SEND_TOO_LARGE_PACKET_TO_TEST_FRAGMENTATION=1 - [CONTIKI_DIR]/examples/udp-ipv6/udp-client.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - UDP server - [CONTIKI_DIR]/examples/udp-ipv6/udp-server.c - make udp-server.sky TARGET=sky DEFINES=SICSLOWPAN_CONF_FRAG=1 - [CONTIKI_DIR]/examples/udp-ipv6/udp-server.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 56.49442624080769 - 69.16564756567392 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 70.13661699393737 - 61.114518596613784 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 248 - 4 - 200 - 0 - 0 - - - org.contikios.cooja.plugins.LogListener - - - - - - 683 - 1 - 550 - 12 - 417 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.AddressVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - 6.1185311939665725 0.0 0.0 6.1185311939665725 -264.82328143448046 -341.0405575126179 - - 250 - 2 - 183 - 6 - 214 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 572 - 0 - 552 - 704 - 417 - - - org.contikios.cooja.plugins.RadioLogger - - 183 - - - 1008 - 3 - 406 - 261 - 7 - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + UDP client + [CONTIKI_DIR]/examples/udp-ipv6/udp-client.c + make clean TARGET=sky +make udp-client.sky TARGET=sky DEFINES=UDP_CONNECTION_ADDR=fe80::212:7402:2:202,SICSLOWPAN_CONF_FRAG=1,SEND_TOO_LARGE_PACKET_TO_TEST_FRAGMENTATION=1 + [CONTIKI_DIR]/examples/udp-ipv6/udp-client.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + org.contikios.cooja.mspmote.SkyMoteType + sky2 + UDP server + [CONTIKI_DIR]/examples/udp-ipv6/udp-server.c + make udp-server.sky TARGET=sky DEFINES=SICSLOWPAN_CONF_FRAG=1 + [CONTIKI_DIR]/examples/udp-ipv6/udp-server.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + + + org.contikios.cooja.interfaces.Position + 56.49442624080769 + 69.16564756567392 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 70.13661699393737 + 61.114518596613784 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky2 + + + + org.contikios.cooja.plugins.SimControl + 248 + 0 + 200 + 0 + 0 + + + org.contikios.cooja.plugins.LogListener + + + + + + 683 + 2 + 550 + 12 + 417 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.AddressVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + org.contikios.cooja.plugins.skins.GridVisualizerSkin + org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin + 6.1185311939665725 0.0 0.0 6.1185311939665725 -264.82328143448046 -341.0405575126179 + + 250 + 3 + 183 + 6 + 214 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 572 + 1 + 552 + 704 + 417 + + + org.contikios.cooja.plugins.RadioLogger + + 183 + + false + false + + + 1008 + 4 + 406 + 261 + 7 + + + diff --git a/regression-tests/12-rpl/01-rpl-up-route.csc b/regression-tests/12-rpl/01-rpl-up-route.csc index debdc6559..7c515b24b 100644 --- a/regression-tests/12-rpl/01-rpl-up-route.csc +++ b/regression-tests/12-rpl/01-rpl-up-route.csc @@ -22,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype456 + mtype488 Sender - [CONFIG_DIR]/code/sender-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/sender-node.c make TARGET=cooja clean make sender-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -47,9 +47,9 @@ make sender-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype452 + mtype32 RPL root - [CONFIG_DIR]/code/root-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/root-node.c make TARGET=cooja clean make root-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -72,9 +72,9 @@ make root-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype904 + mtype352 Receiver - [CONFIG_DIR]/code/receiver-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/receiver-node.c make TARGET=cooja clean make receiver-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -110,7 +110,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype352 @@ -127,7 +127,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype456 + mtype488 @@ -144,7 +144,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype352 @@ -161,7 +161,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype352 @@ -178,7 +178,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype352 @@ -195,7 +195,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype352 @@ -212,7 +212,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype352 @@ -229,7 +229,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype452 + mtype32 @@ -260,6 +260,7 @@ make receiver-node.cooja TARGET=cooja + 1184 3 diff --git a/regression-tests/12-rpl/02-rpl-root-reboot.csc b/regression-tests/12-rpl/02-rpl-root-reboot.csc index 3f1b83328..eda75d60b 100644 --- a/regression-tests/12-rpl/02-rpl-root-reboot.csc +++ b/regression-tests/12-rpl/02-rpl-root-reboot.csc @@ -22,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype748 + mtype958 Sender - [CONFIG_DIR]/code/sender-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/sender-node.c make TARGET=cooja clean make sender-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -47,9 +47,9 @@ make sender-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype442 + mtype837 RPL root - [CONFIG_DIR]/code/root-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/root-node.c make TARGET=cooja clean make root-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -72,9 +72,9 @@ make root-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype236 + mtype358 Receiver - [CONFIG_DIR]/code/receiver-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/receiver-node.c make TARGET=cooja clean make receiver-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -110,7 +110,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype236 + mtype358 @@ -127,7 +127,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype748 + mtype958 @@ -144,7 +144,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype236 + mtype358 @@ -161,7 +161,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype236 + mtype358 @@ -178,7 +178,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype236 + mtype358 @@ -195,7 +195,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype236 + mtype358 @@ -212,7 +212,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype236 + mtype358 @@ -229,7 +229,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype442 + mtype837 @@ -260,6 +260,7 @@ make receiver-node.cooja TARGET=cooja + 1184 3 diff --git a/regression-tests/12-rpl/03-rpl-28-hours.csc b/regression-tests/12-rpl/03-rpl-28-hours.csc index b5dd2a0a7..d107f13b4 100644 --- a/regression-tests/12-rpl/03-rpl-28-hours.csc +++ b/regression-tests/12-rpl/03-rpl-28-hours.csc @@ -22,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype391 + mtype110 Sender - [CONFIG_DIR]/code/sender-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/sender-node.c make TARGET=cooja clean make sender-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -47,9 +47,9 @@ make sender-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype250 + mtype792 RPL root - [CONFIG_DIR]/code/root-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/root-node.c make TARGET=cooja clean make root-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -72,9 +72,9 @@ make root-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype822 + mtype964 Receiver - [CONFIG_DIR]/code/receiver-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/receiver-node.c make TARGET=cooja clean make receiver-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -110,7 +110,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype822 + mtype964 @@ -127,7 +127,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype391 + mtype110 @@ -144,7 +144,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype822 + mtype964 @@ -161,7 +161,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype822 + mtype964 @@ -178,7 +178,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype250 + mtype792 @@ -209,6 +209,7 @@ make receiver-node.cooja TARGET=cooja + 1184 3 diff --git a/regression-tests/12-rpl/04-rpl-large-network.csc b/regression-tests/12-rpl/04-rpl-large-network.csc index 80840cac4..50b1cfad4 100644 --- a/regression-tests/12-rpl/04-rpl-large-network.csc +++ b/regression-tests/12-rpl/04-rpl-large-network.csc @@ -22,9 +22,9 @@ org.contikios.cooja.contikimote.ContikiMoteType - mtype456 + mtype710 Sender - [CONFIG_DIR]/code/sender-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/sender-node.c make TARGET=cooja clean make sender-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -47,9 +47,9 @@ make sender-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype452 + mtype709 RPL root - [CONFIG_DIR]/code/root-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/root-node.c make TARGET=cooja clean make root-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -72,9 +72,9 @@ make root-node.cooja TARGET=cooja org.contikios.cooja.contikimote.ContikiMoteType - mtype904 + mtype332 Receiver - [CONFIG_DIR]/code/receiver-node.c + [CONTIKI_DIR]/regression-tests/12-rpl/code/receiver-node.c make TARGET=cooja clean make receiver-node.cooja TARGET=cooja org.contikios.cooja.interfaces.Position @@ -110,7 +110,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -127,7 +127,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype456 + mtype710 @@ -144,7 +144,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype452 + mtype709 @@ -161,7 +161,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -178,7 +178,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -195,7 +195,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -212,7 +212,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -229,7 +229,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -246,7 +246,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -263,7 +263,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -280,7 +280,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -297,7 +297,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -314,7 +314,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -331,7 +331,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -348,7 +348,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -365,7 +365,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -382,7 +382,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -399,7 +399,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -416,7 +416,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -433,7 +433,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -450,7 +450,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -467,7 +467,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -484,7 +484,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -501,7 +501,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -518,7 +518,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -535,7 +535,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -552,7 +552,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -569,7 +569,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -586,7 +586,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -603,7 +603,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -620,7 +620,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -637,7 +637,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -654,7 +654,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -671,7 +671,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -688,7 +688,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -705,7 +705,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -722,7 +722,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -739,7 +739,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -756,7 +756,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -773,7 +773,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -790,7 +790,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -807,7 +807,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -824,7 +824,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -841,7 +841,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -858,7 +858,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -875,7 +875,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -892,7 +892,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -909,7 +909,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -926,7 +926,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -943,7 +943,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -960,7 +960,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -977,7 +977,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -994,7 +994,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1011,7 +1011,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1028,7 +1028,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1045,7 +1045,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1062,7 +1062,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1079,7 +1079,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1096,7 +1096,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1113,7 +1113,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1130,7 +1130,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1147,7 +1147,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1164,7 +1164,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1181,7 +1181,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1198,7 +1198,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1215,7 +1215,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1232,7 +1232,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1249,7 +1249,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1266,7 +1266,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1283,7 +1283,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1300,7 +1300,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1317,7 +1317,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1334,7 +1334,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1351,7 +1351,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1368,7 +1368,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1385,7 +1385,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1402,7 +1402,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1419,7 +1419,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1436,7 +1436,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1453,7 +1453,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1470,7 +1470,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1487,7 +1487,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1504,7 +1504,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1521,7 +1521,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1538,7 +1538,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1555,7 +1555,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1572,7 +1572,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1589,7 +1589,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1606,7 +1606,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1623,7 +1623,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1640,7 +1640,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1657,7 +1657,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1674,7 +1674,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1691,7 +1691,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1708,7 +1708,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1725,7 +1725,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1742,7 +1742,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1759,7 +1759,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1776,7 +1776,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1793,7 +1793,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1810,7 +1810,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1827,7 +1827,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1844,7 +1844,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1861,7 +1861,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1878,7 +1878,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1895,7 +1895,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1912,7 +1912,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1929,7 +1929,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1946,7 +1946,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1963,7 +1963,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1980,7 +1980,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -1997,7 +1997,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2014,7 +2014,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2031,7 +2031,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2048,7 +2048,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2065,7 +2065,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2082,7 +2082,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2099,7 +2099,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2116,7 +2116,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2133,7 +2133,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2150,7 +2150,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2167,7 +2167,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2184,7 +2184,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2201,7 +2201,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2218,7 +2218,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2235,7 +2235,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2252,7 +2252,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2269,7 +2269,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2286,7 +2286,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2303,7 +2303,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2320,7 +2320,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2337,7 +2337,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2354,7 +2354,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2371,7 +2371,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2388,7 +2388,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2405,7 +2405,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2422,7 +2422,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2439,7 +2439,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2456,7 +2456,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2473,7 +2473,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2490,7 +2490,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2507,7 +2507,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2524,7 +2524,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2541,7 +2541,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2558,7 +2558,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2575,7 +2575,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2592,7 +2592,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2609,7 +2609,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2626,7 +2626,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2643,7 +2643,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2660,7 +2660,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2677,7 +2677,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2694,7 +2694,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2711,7 +2711,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2728,7 +2728,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2745,7 +2745,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2762,7 +2762,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2779,7 +2779,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2796,7 +2796,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2813,7 +2813,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2830,7 +2830,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2847,7 +2847,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2864,7 +2864,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2881,7 +2881,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2898,7 +2898,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2915,7 +2915,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2932,7 +2932,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2949,7 +2949,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2966,7 +2966,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -2983,7 +2983,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3000,7 +3000,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3017,7 +3017,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3034,7 +3034,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3051,7 +3051,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3068,7 +3068,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3085,7 +3085,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3102,7 +3102,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3119,7 +3119,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3136,7 +3136,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3153,7 +3153,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3170,7 +3170,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3187,7 +3187,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3204,7 +3204,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3221,7 +3221,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3238,7 +3238,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3255,7 +3255,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3272,7 +3272,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3289,7 +3289,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3306,7 +3306,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3323,7 +3323,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3340,7 +3340,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3357,7 +3357,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3374,7 +3374,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3391,7 +3391,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3408,7 +3408,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3425,7 +3425,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3442,7 +3442,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3459,7 +3459,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3476,7 +3476,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3493,7 +3493,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3510,7 +3510,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3527,7 +3527,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3544,7 +3544,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3561,7 +3561,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3578,7 +3578,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3595,7 +3595,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3612,7 +3612,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3629,7 +3629,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3646,7 +3646,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3663,7 +3663,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3680,7 +3680,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3697,7 +3697,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3714,7 +3714,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3731,7 +3731,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3748,7 +3748,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3765,7 +3765,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3782,7 +3782,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3799,7 +3799,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3816,7 +3816,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3833,7 +3833,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3850,7 +3850,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3867,7 +3867,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3884,7 +3884,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3901,7 +3901,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3918,7 +3918,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3935,7 +3935,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3952,7 +3952,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3969,7 +3969,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -3986,7 +3986,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4003,7 +4003,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4020,7 +4020,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4037,7 +4037,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4054,7 +4054,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4071,7 +4071,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4088,7 +4088,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4105,7 +4105,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4122,7 +4122,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4139,7 +4139,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4156,7 +4156,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4173,7 +4173,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4190,7 +4190,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4207,7 +4207,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4224,7 +4224,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4241,7 +4241,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4258,7 +4258,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4275,7 +4275,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4292,7 +4292,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4309,7 +4309,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4326,7 +4326,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4343,7 +4343,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4360,7 +4360,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4377,7 +4377,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4394,7 +4394,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4411,7 +4411,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4428,7 +4428,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4445,7 +4445,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4462,7 +4462,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4479,7 +4479,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4496,7 +4496,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4513,7 +4513,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4530,7 +4530,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4547,7 +4547,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4564,7 +4564,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4581,7 +4581,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4598,7 +4598,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4615,7 +4615,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4632,7 +4632,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4649,7 +4649,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4666,7 +4666,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4683,7 +4683,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4700,7 +4700,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4717,7 +4717,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4734,7 +4734,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4751,7 +4751,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4768,7 +4768,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4785,7 +4785,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4802,7 +4802,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4819,7 +4819,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4836,7 +4836,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4853,7 +4853,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4870,7 +4870,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4887,7 +4887,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4904,7 +4904,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4921,7 +4921,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4938,7 +4938,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4955,7 +4955,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4972,7 +4972,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -4989,7 +4989,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5006,7 +5006,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5023,7 +5023,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5040,7 +5040,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5057,7 +5057,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5074,7 +5074,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5091,7 +5091,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5108,7 +5108,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5125,7 +5125,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5142,7 +5142,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5159,7 +5159,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5176,7 +5176,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5193,7 +5193,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5210,7 +5210,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5227,7 +5227,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5244,7 +5244,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5261,7 +5261,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5278,7 +5278,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5295,7 +5295,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5312,7 +5312,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5329,7 +5329,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5346,7 +5346,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5363,7 +5363,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5380,7 +5380,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5397,7 +5397,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5414,7 +5414,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5431,7 +5431,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5448,7 +5448,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5465,7 +5465,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5482,7 +5482,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5499,7 +5499,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5516,7 +5516,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5533,7 +5533,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5550,7 +5550,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5567,7 +5567,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5584,7 +5584,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5601,7 +5601,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5618,7 +5618,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5635,7 +5635,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5652,7 +5652,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5669,7 +5669,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5686,7 +5686,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5703,7 +5703,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5720,7 +5720,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5737,7 +5737,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5754,7 +5754,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5771,7 +5771,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5788,7 +5788,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5805,7 +5805,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5822,7 +5822,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5839,7 +5839,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5856,7 +5856,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5873,7 +5873,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5890,7 +5890,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5907,7 +5907,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5924,7 +5924,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5941,7 +5941,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5958,7 +5958,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5975,7 +5975,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -5992,7 +5992,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6009,7 +6009,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6026,7 +6026,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6043,7 +6043,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6060,7 +6060,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6077,7 +6077,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6094,7 +6094,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6111,7 +6111,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6128,7 +6128,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6145,7 +6145,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6162,7 +6162,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6179,7 +6179,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6196,7 +6196,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6213,7 +6213,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6230,7 +6230,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6247,7 +6247,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6264,7 +6264,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6281,7 +6281,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6298,7 +6298,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6315,7 +6315,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6332,7 +6332,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6349,7 +6349,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6366,7 +6366,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6383,7 +6383,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6400,7 +6400,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6417,7 +6417,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6434,7 +6434,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6451,7 +6451,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6468,7 +6468,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6485,7 +6485,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6502,7 +6502,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6519,7 +6519,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6536,7 +6536,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6553,7 +6553,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6570,7 +6570,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6587,7 +6587,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6604,7 +6604,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6621,7 +6621,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6638,7 +6638,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6655,7 +6655,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6672,7 +6672,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6689,7 +6689,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6706,7 +6706,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6723,7 +6723,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6740,7 +6740,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6757,7 +6757,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6774,7 +6774,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6791,7 +6791,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6808,7 +6808,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6825,7 +6825,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6842,7 +6842,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6859,7 +6859,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6876,7 +6876,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6893,7 +6893,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6910,7 +6910,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6927,7 +6927,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6944,7 +6944,7 @@ make receiver-node.cooja TARGET=cooja org.contikios.cooja.contikimote.interfaces.ContikiRadio 250.0 - mtype904 + mtype332 @@ -6975,6 +6975,7 @@ make receiver-node.cooja TARGET=cooja + 1184 0 diff --git a/regression-tests/12-rpl/code/Makefile b/regression-tests/12-rpl/code/Makefile index dd6dc3f12..cfe24a53b 100644 --- a/regression-tests/12-rpl/code/Makefile +++ b/regression-tests/12-rpl/code/Makefile @@ -1,7 +1,6 @@ all: sender-node receiver-node root-node CONTIKI=../../.. -WITH_UIP6=1 UIP_CONF_IPV6=1 CFLAGS+= -DUIP_CONF_IPV6_RPL diff --git a/regression-tests/13-ipv6-apps/01-sky-servreg-hack.csc b/regression-tests/13-ipv6-apps/01-sky-servreg-hack.csc index 669110acc..e5073c1f9 100644 --- a/regression-tests/13-ipv6-apps/01-sky-servreg-hack.csc +++ b/regression-tests/13-ipv6-apps/01-sky-servreg-hack.csc @@ -1,316 +1,316 @@ - - - [CONTIKI_DIR]/tools/cooja/apps/mrm - [CONTIKI_DIR]/tools/cooja/apps/mspsim - [CONTIKI_DIR]/tools/cooja/apps/avrora - [CONTIKI_DIR]/tools/cooja/apps/native_gateway - [CONTIKI_DIR]/tools/cooja/apps/serial_socket - /home/user/contikiprojects/sics.se/mobility - - Servreg hack test - 0 - 123456 - 1000000 - - org.contikios.cooja.radiomediums.UDGM - 40.0 - 40.0 - 1.0 - 1.0 - - - 40000 - - - org.contikios.cooja.mspmote.SkyMoteType - sky1 - Servreg server - [CONTIKI_DIR]/examples/servreg-hack/example-servreg-server.c - make example-servreg-server.sky TARGET=sky - [CONTIKI_DIR]/examples/servreg-hack/example-servreg-server.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - org.contikios.cooja.mspmote.SkyMoteType - sky2 - Servreg hack client - [CONTIKI_DIR]/examples/servreg-hack/example-servreg-client.c - make example-servreg-client.sky TARGET=sky - [CONTIKI_DIR]/examples/servreg-hack/example-servreg-client.sky - org.contikios.cooja.interfaces.Position - org.contikios.cooja.interfaces.RimeAddress - org.contikios.cooja.interfaces.IPAddress - org.contikios.cooja.interfaces.Mote2MoteRelations - org.contikios.cooja.interfaces.MoteAttributes - org.contikios.cooja.mspmote.interfaces.MspClock - org.contikios.cooja.mspmote.interfaces.MspMoteID - org.contikios.cooja.mspmote.interfaces.SkyButton - org.contikios.cooja.mspmote.interfaces.SkyFlash - org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem - org.contikios.cooja.mspmote.interfaces.SkyByteRadio - org.contikios.cooja.mspmote.interfaces.MspSerial - org.contikios.cooja.mspmote.interfaces.SkyLED - org.contikios.cooja.mspmote.interfaces.MspDebugOutput - org.contikios.cooja.mspmote.interfaces.SkyTemperature - - - - - org.contikios.cooja.interfaces.Position - 45.693987609497896 - 26.353051242505675 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 1 - - sky1 - - - - - org.contikios.cooja.interfaces.Position - 18.451397050087735 - 55.93074152489276 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 2 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 45.082598269523864 - 52.7178388400784 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 3 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 11.116935333105516 - 49.070534908051414 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 4 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 85.11866272622683 - 30.030092430999066 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 5 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 30.71302161006234 - 13.877842534368446 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 6 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 44.43705509785284 - 69.81167027376168 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 7 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 64.10992023465046 - 20.589540162635835 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 8 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 32.29787406276132 - 18.754900913594753 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 9 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 25.28398611019028 - 69.27186586570369 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 10 - - sky2 - - - - - org.contikios.cooja.interfaces.Position - 19.3359466030565 - 17.321986704081503 - 0.0 - - - org.contikios.cooja.mspmote.interfaces.MspMoteID - 11 - - sky2 - - - - org.contikios.cooja.plugins.SimControl - 318 - 1 - 172 - 0 - 0 - - - org.contikios.cooja.plugins.Visualizer - - org.contikios.cooja.plugins.skins.IDVisualizerSkin - org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin - org.contikios.cooja.plugins.skins.AttributeVisualizerSkin - org.contikios.cooja.plugins.skins.UDGMVisualizerSkin - org.contikios.cooja.plugins.skins.GridVisualizerSkin - 3.56257040103728 0.0 0.0 3.56257040103728 -26.423046586149052 -28.07489060373735 - - 300 - 2 - 300 - 1140 - 0 - - - org.contikios.cooja.plugins.LogListener - - - - 1440 - 3 - 324 - 2 - 270 - - - org.contikios.cooja.plugins.TimeLine - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - - 125 - 1633.2339825135305 - - 1440 - 4 - 238 - 0 - 595 - - - org.contikios.cooja.plugins.ScriptRunner - - - true - - 600 - 0 - 700 - 526 - 6 - - - + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + Servreg hack test + 123456 + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 40.0 + 40.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.mspmote.SkyMoteType + sky1 + Servreg server + [CONTIKI_DIR]/examples/servreg-hack/example-servreg-server.c + make example-servreg-server.sky TARGET=sky + [CONTIKI_DIR]/examples/servreg-hack/example-servreg-server.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + org.contikios.cooja.mspmote.SkyMoteType + sky2 + Servreg hack client + [CONTIKI_DIR]/examples/servreg-hack/example-servreg-client.c + make example-servreg-client.sky TARGET=sky + [CONTIKI_DIR]/examples/servreg-hack/example-servreg-client.sky + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.interfaces.IPAddress + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + org.contikios.cooja.mspmote.interfaces.MspClock + org.contikios.cooja.mspmote.interfaces.MspMoteID + org.contikios.cooja.mspmote.interfaces.SkyButton + org.contikios.cooja.mspmote.interfaces.SkyFlash + org.contikios.cooja.mspmote.interfaces.SkyCoffeeFilesystem + org.contikios.cooja.mspmote.interfaces.Msp802154Radio + org.contikios.cooja.mspmote.interfaces.MspSerial + org.contikios.cooja.mspmote.interfaces.SkyLED + org.contikios.cooja.mspmote.interfaces.MspDebugOutput + org.contikios.cooja.mspmote.interfaces.SkyTemperature + + + + + org.contikios.cooja.interfaces.Position + 45.693987609497896 + 26.353051242505675 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 1 + + sky1 + + + + + org.contikios.cooja.interfaces.Position + 18.451397050087735 + 55.93074152489276 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 2 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 45.082598269523864 + 52.7178388400784 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 3 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 11.116935333105516 + 49.070534908051414 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 4 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 85.11866272622683 + 30.030092430999066 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 5 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 30.71302161006234 + 13.877842534368446 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 6 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 44.43705509785284 + 69.81167027376168 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 7 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 64.10992023465046 + 20.589540162635835 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 8 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 32.29787406276132 + 18.754900913594753 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 9 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 25.28398611019028 + 69.27186586570369 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 10 + + sky2 + + + + + org.contikios.cooja.interfaces.Position + 19.3359466030565 + 17.321986704081503 + 0.0 + + + org.contikios.cooja.mspmote.interfaces.MspMoteID + 11 + + sky2 + + + + org.contikios.cooja.plugins.SimControl + 318 + 1 + 172 + 0 + 0 + + + org.contikios.cooja.plugins.Visualizer + + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin + org.contikios.cooja.plugins.skins.AttributeVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + org.contikios.cooja.plugins.skins.GridVisualizerSkin + 3.56257040103728 0.0 0.0 3.56257040103728 -26.423046586149052 -28.07489060373735 + + 300 + 2 + 300 + 1140 + 0 + + + org.contikios.cooja.plugins.LogListener + + + + + + 1440 + 3 + 324 + 2 + 270 + + + org.contikios.cooja.plugins.TimeLine + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + 1633.2339825135305 + + 1440 + 4 + 238 + 0 + 595 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 600 + 0 + 700 + 526 + 6 + + + diff --git a/tools/cooja/config/cooja_default.config b/tools/cooja/config/cooja_default.config index f8d9ded5d..b28337631 100644 --- a/tools/cooja/config/cooja_default.config +++ b/tools/cooja/config/cooja_default.config @@ -3,6 +3,8 @@ org.contikios.cooja.contikimote.interfaces.ContikiRadio.RADIO_TRANSMISSION_RATE_ org.contikios.cooja.contikimote.ContikiMoteType.MOTE_INTERFACES = org.contikios.cooja.interfaces.Position org.contikios.cooja.interfaces.Battery org.contikios.cooja.contikimote.interfaces.ContikiVib org.contikios.cooja.contikimote.interfaces.ContikiMoteID org.contikios.cooja.contikimote.interfaces.ContikiRS232 org.contikios.cooja.contikimote.interfaces.ContikiBeeper org.contikios.cooja.interfaces.RimeAddress org.contikios.cooja.contikimote.interfaces.ContikiIPAddress org.contikios.cooja.contikimote.interfaces.ContikiRadio org.contikios.cooja.contikimote.interfaces.ContikiButton org.contikios.cooja.contikimote.interfaces.ContikiPIR org.contikios.cooja.contikimote.interfaces.ContikiClock org.contikios.cooja.contikimote.interfaces.ContikiLED org.contikios.cooja.contikimote.interfaces.ContikiCFS org.contikios.cooja.interfaces.Mote2MoteRelations org.contikios.cooja.interfaces.MoteAttributes org.contikios.cooja.contikimote.ContikiMoteType.C_SOURCES = org.contikios.cooja.Cooja.MOTETYPES = org.contikios.cooja.motes.ImportAppMoteType org.contikios.cooja.motes.DisturberMoteType org.contikios.cooja.contikimote.ContikiMoteType -org.contikios.cooja.Cooja.PLUGINS = org.contikios.cooja.plugins.Visualizer org.contikios.cooja.plugins.LogListener org.contikios.cooja.plugins.TimeLine org.contikios.cooja.plugins.MoteInformation org.contikios.cooja.plugins.MoteInterfaceViewer org.contikios.cooja.plugins.VariableWatcher org.contikios.cooja.plugins.EventListener org.contikios.cooja.plugins.RadioLogger org.contikios.cooja.plugins.ScriptRunner org.contikios.cooja.plugins.Notes org.contikios.cooja.plugins.BufferListener +org.contikios.cooja.Cooja.PLUGINS = org.contikios.cooja.plugins.Visualizer org.contikios.cooja.plugins.LogListener org.contikios.cooja.plugins.TimeLine org.contikios.cooja.plugins.MoteInformation org.contikios.cooja.plugins.MoteInterfaceViewer org.contikios.cooja.plugins.VariableWatcher org.contikios.cooja.plugins.EventListener org.contikios.cooja.plugins.RadioLogger org.contikios.cooja.plugins.ScriptRunner org.contikios.cooja.plugins.Notes org.contikios.cooja.plugins.BufferListener org.contikios.cooja.plugins.DGRMConfigurator org.contikios.cooja.Cooja.POSITIONERS = org.contikios.cooja.positioners.RandomPositioner org.contikios.cooja.positioners.LinearPositioner org.contikios.cooja.positioners.EllipsePositioner org.contikios.cooja.positioners.ManualPositioner org.contikios.cooja.Cooja.RADIOMEDIUMS = org.contikios.cooja.radiomediums.UDGM org.contikios.cooja.radiomediums.UDGMConstantLoss org.contikios.cooja.radiomediums.DirectedGraphMedium org.contikios.cooja.radiomediums.SilentRadioMedium +org.contikios.cooja.plugins.Visualizer.SKINS = org.contikios.cooja.plugins.skins.DGRMVisualizerSkin + diff --git a/tools/cooja/examples/project_new_interface/dummy_intf.h b/tools/cooja/examples/project_new_interface/dummy_intf.h index 0f8ec70cd..f6aeea4e7 100644 --- a/tools/cooja/examples/project_new_interface/dummy_intf.h +++ b/tools/cooja/examples/project_new_interface/dummy_intf.h @@ -28,12 +28,12 @@ * */ -#ifndef __DUMMY_INTF_H__ -#define __DUMMY_INTF_H__ +#ifndef DUMMY_INTF_H_ +#define DUMMY_INTF_H_ // Interface needs to include something? #define DUMMY_NR_1 1 #define DUMMY_NR_2 2 -#endif /* __DUMMY_INTF_H__ */ +#endif /* DUMMY_INTF_H_ */ diff --git a/tools/cooja/java/org/contikios/cooja/Cooja.java b/tools/cooja/java/org/contikios/cooja/Cooja.java index b8c7d57dc..997d705dd 100644 --- a/tools/cooja/java/org/contikios/cooja/Cooja.java +++ b/tools/cooja/java/org/contikios/cooja/Cooja.java @@ -665,7 +665,7 @@ public class Cooja extends Observable { /** * Enables/disables menues and menu items depending on whether a simulation is loaded etc. */ - private void updateGUIComponentState() { + void updateGUIComponentState() { if (!isVisualized()) { return; } @@ -2639,7 +2639,6 @@ public class Cooja extends Observable { mySimulation.addMote(newMote); } } - updateGUIComponentState(); } else { logger.warn("No simulation active"); diff --git a/tools/cooja/java/org/contikios/cooja/Simulation.java b/tools/cooja/java/org/contikios/cooja/Simulation.java index 0f9943628..6cf7777fe 100644 --- a/tools/cooja/java/org/contikios/cooja/Simulation.java +++ b/tools/cooja/java/org/contikios/cooja/Simulation.java @@ -841,6 +841,7 @@ public class Simulation extends Observable implements Runnable { setChanged(); notifyObservers(mote); + cooja.updateGUIComponentState(); } }; diff --git a/tools/cooja/java/org/contikios/cooja/dialogs/SerialUI.java b/tools/cooja/java/org/contikios/cooja/dialogs/SerialUI.java index 08f0457e4..bcc1a0734 100644 --- a/tools/cooja/java/org/contikios/cooja/dialogs/SerialUI.java +++ b/tools/cooja/java/org/contikios/cooja/dialogs/SerialUI.java @@ -102,7 +102,7 @@ public abstract class SerialUI extends Log implements SerialPort { if (data == '\n') { /* Notify observers of new log */ lastLogMessage = newMessage.toString(); - lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}]", ""); + lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}\\p{Blank}]", ""); newMessage.setLength(0); this.setChanged(); this.notifyObservers(getMote()); @@ -111,7 +111,7 @@ public abstract class SerialUI extends Log implements SerialPort { if (newMessage.length() > MAX_LENGTH) { /*logger.warn("Dropping too large log message (>" + MAX_LENGTH + " bytes).");*/ lastLogMessage = "# [1024 bytes, no line ending]: " + newMessage.substring(0, 20) + "..."; - lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}]", ""); + lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}\\p{Blank}]", ""); newMessage.setLength(0); this.setChanged(); this.notifyObservers(getMote()); diff --git a/tools/cooja/java/org/contikios/cooja/plugins/RadioLogger.java b/tools/cooja/java/org/contikios/cooja/plugins/RadioLogger.java index 2729d507f..f73a4af8c 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/RadioLogger.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/RadioLogger.java @@ -144,6 +144,8 @@ public class RadioLogger extends VisPlugin { private HashMap analyzerMap = new HashMap(); private String analyzerName = null; private ArrayList analyzers = null; + private IEEE802154Analyzer analyzerWithPcap; + private File pcapFile; private JTextField searchField = new JTextField(30); @@ -174,8 +176,9 @@ public class RadioLogger extends VisPlugin { lowpanAnalyzers.add(new IPv6PacketAnalyzer()); lowpanAnalyzers.add(new ICMPv6Analyzer()); + analyzerWithPcap = new IEEE802154Analyzer(true); ArrayList lowpanAnalyzersPcap = new ArrayList(); - lowpanAnalyzersPcap.add(new IEEE802154Analyzer(true)); + lowpanAnalyzersPcap.add(analyzerWithPcap); lowpanAnalyzersPcap.add(new IPHCPacketAnalyzer()); lowpanAnalyzersPcap.add(new IPv6PacketAnalyzer()); lowpanAnalyzersPcap.add(new ICMPv6Analyzer()); @@ -801,6 +804,14 @@ public class RadioLogger extends VisPlugin { } } + if (pcapFile != null) { + element = new Element("pcap_file"); + File file = simulation.getCooja().createPortablePath(pcapFile); + element.setText(pcapFile.getPath().replaceAll("\\\\", "/")); + element.setAttribute("EXPORT", "discard"); + config.add(element); + } + return config; } @@ -833,6 +844,9 @@ public class RadioLogger extends VisPlugin { } }); } + } else if (name.equals("pcap_file")) { + pcapFile = simulation.getCooja().restorePortablePath(new File(element.getText())); + analyzerWithPcap.setPcapFile(pcapFile); } } return true; diff --git a/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java b/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java index 47387c9f3..69f5022e9 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java @@ -212,12 +212,11 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { /* Register external visualizers */ String[] skins = gui.getProjectConfig().getStringArrayValue(Visualizer.class, "SKINS"); - if (skins != null) { - for (String skinClass: skins) { - Class skin = gui.tryLoadClass(this, VisualizerSkin.class, skinClass); - if (registerVisualizerSkin(skin)) { - logger.info("Registered external visualizer: " + skinClass); - } + + for (String skinClass: skins) { + Class skin = gui.tryLoadClass(this, VisualizerSkin.class, skinClass); + if (registerVisualizerSkin(skin)) { + logger.info("Registered external visualizer: " + skinClass); } } diff --git a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IEEE802154Analyzer.java b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IEEE802154Analyzer.java index db5718a76..d15903d51 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IEEE802154Analyzer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IEEE802154Analyzer.java @@ -1,6 +1,7 @@ package org.contikios.cooja.plugins.analyzers; import java.io.IOException; +import java.io.File; import org.contikios.cooja.util.StringUtils; @@ -36,6 +37,17 @@ public class IEEE802154Analyzer extends PacketAnalyzer { } } + public void setPcapFile(File pcapFile) { + if (pcapExporter != null) { + try { + pcapExporter.openPcap(pcapFile); + } catch (IOException e) { + System.err.println("Could not open pcap file"); + e.printStackTrace(); + } + } + } + public boolean matchPacket(Packet packet) { return packet.level == MAC_LEVEL; } diff --git a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/PcapExporter.java b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/PcapExporter.java index 25b78caee..0e8a4244a 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/PcapExporter.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/PcapExporter.java @@ -5,6 +5,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; +import java.io.File; public class PcapExporter { @@ -13,8 +14,15 @@ public class PcapExporter { public PcapExporter() throws IOException { } - public void openPcap() throws IOException { - out = new DataOutputStream(new FileOutputStream("radiolog-" + System.currentTimeMillis() + ".pcap")); + public void openPcap(File pcapFile) throws IOException { + if ( out != null ) { + closePcap(); + } + if ( pcapFile == null ) { + /* pcap file not specified, use default file name */ + pcapFile = new File("radiolog-" + System.currentTimeMillis() + ".pcap"); + } + out = new DataOutputStream(new FileOutputStream(pcapFile)); /* pcap header */ out.writeInt(0xa1b2c3d4); out.writeShort(0x0002); @@ -24,22 +32,24 @@ public class PcapExporter { out.writeInt(4096); out.writeInt(195); /* 195 for LINKTYPE_IEEE802_15_4 */ out.flush(); - System.out.println("Opened pcap file!"); + System.out.println("Opened pcap file " + pcapFile); } public void closePcap() throws IOException { out.close(); + out = null; } public void exportPacketData(byte[] data) throws IOException { if (out == null) { - openPcap(); + /* pcap file never set, open default */ + openPcap(null); } try { /* pcap packet header */ out.writeInt((int) System.currentTimeMillis() / 1000); out.writeInt((int) ((System.currentTimeMillis() % 1000) * 1000)); out.writeInt(data.length); - out.writeInt(data.length+2); + out.writeInt(data.length); /* and the data */ out.write(data); out.flush(); diff --git a/tools/cooja/java/org/contikios/cooja/radiomediums/DirectedGraphMedium.java b/tools/cooja/java/org/contikios/cooja/radiomediums/DirectedGraphMedium.java index 61f31d9d4..c9bac3f0d 100644 --- a/tools/cooja/java/org/contikios/cooja/radiomediums/DirectedGraphMedium.java +++ b/tools/cooja/java/org/contikios/cooja/radiomediums/DirectedGraphMedium.java @@ -45,9 +45,7 @@ import org.contikios.cooja.Mote; import org.contikios.cooja.RadioConnection; import org.contikios.cooja.Simulation; import org.contikios.cooja.interfaces.Radio; -import org.contikios.cooja.plugins.DGRMConfigurator; import org.contikios.cooja.plugins.Visualizer; -import org.contikios.cooja.plugins.skins.DGRMVisualizerSkin; /** * Directed Graph Radio Medium. @@ -77,7 +75,6 @@ public class DirectedGraphMedium extends AbstractRadioMedium { public DirectedGraphMedium() { /* Do not initialize radio medium: use only for hash table */ super(null); - Visualizer.registerVisualizerSkin(DGRMVisualizerSkin.class); } public DirectedGraphMedium(Simulation simulation) { @@ -86,18 +83,10 @@ public class DirectedGraphMedium extends AbstractRadioMedium { random = simulation.getRandomGenerator(); requestEdgeAnalysis(); - - /* Register plugin and visualizer skin */ - simulation.getCooja().registerPlugin(DGRMConfigurator.class); - Visualizer.registerVisualizerSkin(DGRMVisualizerSkin.class); } public void removed() { super.removed(); - - /* Unregister plugin and visualizer skin */ - simulation.getCooja().unregisterPlugin(DGRMConfigurator.class); - Visualizer.unregisterVisualizerSkin(DGRMVisualizerSkin.class); } public void addEdge(Edge e) { diff --git a/tools/sky/uip6-bridge/bridge-conf.h b/tools/sky/uip6-bridge/bridge-conf.h index d96707863..86244d28d 100644 --- a/tools/sky/uip6-bridge/bridge-conf.h +++ b/tools/sky/uip6-bridge/bridge-conf.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __BRIDGE_CONF_H__ -#define __BRIDGE_CONF_H__ +#ifndef BRIDGE_CONF_H_ +#define BRIDGE_CONF_H_ #undef UIP_CONF_ROUTER @@ -51,4 +51,4 @@ #undef UIP_CONF_BUFFER_SIZE #define UIP_CONF_BUFFER_SIZE 256 -#endif /* __BRIDGE_CONF_H__ */ +#endif /* BRIDGE_CONF_H_ */ diff --git a/tools/sky/uip6-bridge/dev/slip.h b/tools/sky/uip6-bridge/dev/slip.h index 755b1d4c4..099c35111 100644 --- a/tools/sky/uip6-bridge/dev/slip.h +++ b/tools/sky/uip6-bridge/dev/slip.h @@ -31,8 +31,8 @@ * */ -#ifndef __SLIP_H__ -#define __SLIP_H__ +#ifndef SLIP_H_ +#define SLIP_H_ #include "contiki.h" @@ -89,4 +89,4 @@ void slip_set_tcpip_input_callback(void (*callback)(void)); void slip_arch_init(unsigned long ubr); void slip_arch_writeb(unsigned char c); -#endif /* __SLIP_H__ */ +#endif /* SLIP_H_ */ diff --git a/tools/stm32w/stm32w_flasher/py_files/rs232_interface.py b/tools/stm32w/stm32w_flasher/py_files/rs232_interface.py index ae9c9d3b0..a5b2f9f94 100644 --- a/tools/stm32w/stm32w_flasher/py_files/rs232_interface.py +++ b/tools/stm32w/stm32w_flasher/py_files/rs232_interface.py @@ -4,6 +4,7 @@ import ftdi import os +import pyudev import serial import struct import subprocess @@ -62,10 +63,8 @@ class FTDI_Interface(object): return returnValue def getFTDIIdFromDevPort(self, port): - command = (('for udi in `hal-find-by-capability --capability serial`\n do\n parent=`hal-get-property --udi ${udi} --key "info.parent"`\n device=`hal-get-property --udi ${udi} --key "linux.device_file"`\n grandpa=`hal-get-property --udi ${parent} --key "info.parent"`\n serial=`hal-get-property --udi ${grandpa} --key "usb_device.serial" 2>/dev/null`\n if [ "${device}" = "' + port) + '" ]\n then\n printf "%s" "${serial}"\n break\n fi\n done ') - p = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE) - out = p.communicate() - return (out[0]) + device = pyudev.Device.from_device_file(pyudev.Context(), port) + return device['ID_SERIAL'] def guessResetDirection(self, h): if (self.resetValue is None or self.nBootValue is None): @@ -1020,16 +1019,14 @@ def getAvailableSerialPorts(refreshList=True): global rs232PortsList if (refreshList or rs232PortsList is None): returnValue = {} + context = pyudev.Context() id = [{ 'vendor': FT232R_VENDOR , 'product': FT232R_PRODUCT , 'type': 'FTDI' }, { 'vendor': STM32F103_VENDOR , 'product': STM32F103_PRODUCT , 'type': 'STM32' }, { 'vendor': STM32F103_VENDOR , 'product': STM32F103_PRODUCT_OLD , 'type': 'STM32' }] - for i in range(len(id)): - command = (((('for udi in `hal-find-by-capability --capability serial`\n do\n parent=`hal-get-property --udi ${udi} --key "info.parent"`\n device=`hal-get-property --udi ${udi} --key "linux.device_file"`\n serial=`hal-get-property --udi ${parent} --key "usb.serial" 2>/dev/null`\n vendor=`hal-get-property --udi ${parent} --key "usb.vendor_id" 2>/dev/null`\n product=`hal-get-property --udi ${parent} --key "usb.product_id" 2>/dev/null`\n if [ "${vendor}" = "' + str(((id[i])['vendor']))) + '" ] && [ "${product}" = "') + str(((id[i])['product']))) + '" ]\n then\n printf "%s %s\n" "${device}" "${serial}"\n fi\n done') - p = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE) - out = p.communicate() - for line in (out[0]).splitlines(): - device_serial = line.split(' ') - returnValue[(device_serial[0])] = [((id[i])['type']), (device_serial[1])] - continue - continue + for device in context.list_devices(subsystem='tty', ID_BUS='usb'): + for serialId in id: + #device['ID_VENDOR_ID'] (VID) and device['ID_MODEL_ID'] (PID) are in hex, but without the 0x prefix + if (int(device['ID_VENDOR_ID'], 16) == serialId['vendor']) and (int(device['ID_MODEL_ID'], 16) == serialId['product']): + #e.g. returnValue[/dev/ttyACM0] = [STM32, serial number] + returnValue[(device.device_node)] = [(serialId['type']), (device['ID_SERIAL'])] rs232PortsList = returnValue return rs232PortsList diff --git a/tools/stm32w/stm32w_flasher/py_files/stm32w_flasher.py b/tools/stm32w/stm32w_flasher/py_files/stm32w_flasher.py index 4f486408a..e3d2f3fa5 100755 --- a/tools/stm32w/stm32w_flasher/py_files/stm32w_flasher.py +++ b/tools/stm32w/stm32w_flasher/py_files/stm32w_flasher.py @@ -12,10 +12,11 @@ import optparse, os, sys, time try: import serial import ftdi + import pyudev except: - print 'Python modules serial and ftdi could not be loaded.' + print 'Python modules serial, ftdi and pyudev could not be loaded.' print 'Please install these dependencies:' - print '(On Ubuntu) $ sudo apt-get install python-serial python-ftdi' + print '(On Ubuntu) $ sudo apt-get install python-serial python-ftdi python-pyudev' sys.exit(-1) from messages import infoMessage, errorMessage diff --git a/tools/stm32w/uip6_bridge/bridge-conf.h b/tools/stm32w/uip6_bridge/bridge-conf.h index 30deec66e..22ef7a556 100644 --- a/tools/stm32w/uip6_bridge/bridge-conf.h +++ b/tools/stm32w/uip6_bridge/bridge-conf.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef __BRIDGE_CONF_H__ -#define __BRIDGE_CONF_H__ +#ifndef BRIDGE_CONF_H_ +#define BRIDGE_CONF_H_ #undef WITH_RIME #define WITH_RIME 0 @@ -61,4 +61,4 @@ #define RADIO_RXBUFS 15 -#endif /* __BRIDGE_CONF_H__ */ +#endif /* BRIDGE_CONF_H_ */ diff --git a/tools/stm32w/uip6_bridge/dev/slip.h b/tools/stm32w/uip6_bridge/dev/slip.h index 755b1d4c4..099c35111 100644 --- a/tools/stm32w/uip6_bridge/dev/slip.h +++ b/tools/stm32w/uip6_bridge/dev/slip.h @@ -31,8 +31,8 @@ * */ -#ifndef __SLIP_H__ -#define __SLIP_H__ +#ifndef SLIP_H_ +#define SLIP_H_ #include "contiki.h" @@ -89,4 +89,4 @@ void slip_set_tcpip_input_callback(void (*callback)(void)); void slip_arch_init(unsigned long ubr); void slip_arch_writeb(unsigned char c); -#endif /* __SLIP_H__ */ +#endif /* SLIP_H_ */ diff --git a/tools/stm32w/wpcapslip6/contiki-conf.h b/tools/stm32w/wpcapslip6/contiki-conf.h index 1ca2c97c2..020cbdfec 100644 --- a/tools/stm32w/wpcapslip6/contiki-conf.h +++ b/tools/stm32w/wpcapslip6/contiki-conf.h @@ -1,5 +1,5 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include #define CCIF #define CLIF @@ -17,4 +17,4 @@ typedef unsigned short uip_stats_t; typedef unsigned long clock_time_t; #define CLOCK_CONF_SECOND 1000 -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/tools/stm32w/wpcapslip6/rtimer-arch.h b/tools/stm32w/wpcapslip6/rtimer-arch.h index 1b5322b4b..66f7b72c9 100644 --- a/tools/stm32w/wpcapslip6/rtimer-arch.h +++ b/tools/stm32w/wpcapslip6/rtimer-arch.h @@ -1,5 +1,5 @@ -#ifndef __RTIMER_ARCH_H__ -#define __RTIMER_ARCH_H__ +#ifndef RTIMER_ARCH_H_ +#define RTIMER_ARCH_H_ -#endif /* __RTIMER_ARCH_H__ */ +#endif /* RTIMER_ARCH_H_ */ diff --git a/tools/wpcapslip/contiki-conf.h b/tools/wpcapslip/contiki-conf.h index 1ca2c97c2..020cbdfec 100644 --- a/tools/wpcapslip/contiki-conf.h +++ b/tools/wpcapslip/contiki-conf.h @@ -1,5 +1,5 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ +#ifndef CONTIKI_CONF_H_ +#define CONTIKI_CONF_H_ #include #define CCIF #define CLIF @@ -17,4 +17,4 @@ typedef unsigned short uip_stats_t; typedef unsigned long clock_time_t; #define CLOCK_CONF_SECOND 1000 -#endif /* __CONTIKI_CONF_H__ */ +#endif /* CONTIKI_CONF_H_ */ diff --git a/tools/z80/hex2bin/src/ihx2bin.h b/tools/z80/hex2bin/src/ihx2bin.h index ee2cc29ae..e84071868 100644 --- a/tools/z80/hex2bin/src/ihx2bin.h +++ b/tools/z80/hex2bin/src/ihx2bin.h @@ -35,8 +35,8 @@ * @author Takahide Matsutsuka */ -#ifndef __IHX2BIN_H__ -#define __IHX2BIN_H__ +#ifndef IHX2BIN_H_ +#define IHX2BIN_H_ #define DEF_MAX 1024 #define DEF_NAMELEN 256 @@ -61,4 +61,4 @@ struct ConvertInfo { // int ihx2bin(FILE* dst, const char *src, unsigned char verbose); int ihx2bin(struct ConvertInfo* info); -#endif /* __IHX2BIN_H__ */ +#endif /* IHX2BIN_H_ */