Mercurial > ecos
comparison packages/hal/arm/sa11x0/ipaq/current/src/atmel_support.c @ 208:e0c0827131d1 ecos
Merge from eCos master repository on 2002-05-20-20:11:54-BST
| author | jlarmour |
|---|---|
| date | Mon, 20 May 2002 22:19:26 +0000 |
| parents | b939e9cada46 |
| children | d2c90368aeef |
comparison
equal
deleted
inserted
replaced
| 207:74c807ddde34 | 208:e0c0827131d1 |
|---|---|
| 3 // atmel_support.c | 3 // atmel_support.c |
| 4 // | 4 // |
| 5 // SA1110/iPAQ - Atmel micro-controller support routines | 5 // SA1110/iPAQ - Atmel micro-controller support routines |
| 6 // | 6 // |
| 7 //========================================================================== | 7 //========================================================================== |
| 8 //####COPYRIGHTBEGIN#### | 8 //####ECOSGPLCOPYRIGHTBEGIN#### |
| 9 // | 9 // ------------------------------------------- |
| 10 // ------------------------------------------- | 10 // This file is part of eCos, the Embedded Configurable Operating System. |
| 11 // The contents of this file are subject to the Red Hat eCos Public License | 11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
| 12 // Version 1.1 (the "License"); you may not use this file except in | 12 // |
| 13 // compliance with the License. You may obtain a copy of the License at | 13 // eCos is free software; you can redistribute it and/or modify it under |
| 14 // http://www.redhat.com/ | 14 // the terms of the GNU General Public License as published by the Free |
| 15 // | 15 // Software Foundation; either version 2 or (at your option) any later version. |
| 16 // Software distributed under the License is distributed on an "AS IS" | 16 // |
| 17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | 17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
| 18 // License for the specific language governing rights and limitations under | 18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 19 // the License. | 19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 20 // | 20 // for more details. |
| 21 // The Original Code is eCos - Embedded Configurable Operating System, | 21 // |
| 22 // released September 30, 1998. | 22 // You should have received a copy of the GNU General Public License along |
| 23 // | 23 // with eCos; if not, write to the Free Software Foundation, Inc., |
| 24 // The Initial Developer of the Original Code is Red Hat. | 24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 25 // Portions created by Red Hat are | 25 // |
| 26 // Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. | 26 // As a special exception, if other files instantiate templates or use macros |
| 27 // All Rights Reserved. | 27 // or inline functions from this file, or you compile this file and link it |
| 28 // ------------------------------------------- | 28 // with other works to produce a work based on this file, this file does not |
| 29 // | 29 // by itself cause the resulting work to be covered by the GNU General Public |
| 30 //####COPYRIGHTEND#### | 30 // License. However the source code for this file must still be made available |
| 31 // in accordance with section (3) of the GNU General Public License. | |
| 32 // | |
| 33 // This exception does not invalidate any other reasons why a work based on | |
| 34 // this file might be covered by the GNU General Public License. | |
| 35 // | |
| 36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. | |
| 37 // at http://sources.redhat.com/ecos/ecos-license | |
| 38 // ------------------------------------------- | |
| 39 //####ECOSGPLCOPYRIGHTEND#### | |
| 31 //========================================================================== | 40 //========================================================================== |
| 32 //#####DESCRIPTIONBEGIN#### | 41 //#####DESCRIPTIONBEGIN#### |
| 33 // | 42 // |
| 34 // Author(s): gthomas | 43 // Author(s): gthomas |
| 35 // Contributors: gthomas | 44 // Contributors: gthomas |
| 61 static cyg_interrupt atmel_interrupt; | 70 static cyg_interrupt atmel_interrupt; |
| 62 static cyg_handle_t atmel_interrupt_handle; | 71 static cyg_handle_t atmel_interrupt_handle; |
| 63 #endif | 72 #endif |
| 64 | 73 |
| 65 #include <cyg/hal/atmel_support.h> // Interfaces, commands | 74 #include <cyg/hal/atmel_support.h> // Interfaces, commands |
| 75 | |
| 76 externC void *memcpy(void *, const void *, size_t); | |
| 66 | 77 |
| 67 struct sa11x0_serial { | 78 struct sa11x0_serial { |
| 68 volatile cyg_uint32 utcr0; | 79 volatile cyg_uint32 utcr0; |
| 69 volatile cyg_uint32 utcr1; | 80 volatile cyg_uint32 utcr1; |
| 70 volatile cyg_uint32 utcr2; | 81 volatile cyg_uint32 utcr2; |
| 80 unsigned char atmel_putq[ATMEL_PUTQ_SIZE]; | 91 unsigned char atmel_putq[ATMEL_PUTQ_SIZE]; |
| 81 int atmel_putq_put, atmel_putq_get; | 92 int atmel_putq_put, atmel_putq_get; |
| 82 | 93 |
| 83 bool atmel_use_ints; | 94 bool atmel_use_ints; |
| 84 | 95 |
| 85 bool | 96 void |
| 86 atmel_putc(unsigned char c) | 97 atmel_putc(unsigned char c) |
| 87 { | 98 { |
| 88 atmel_putq[atmel_putq_put++] = c; | 99 atmel_putq[atmel_putq_put++] = c; |
| 89 if (atmel_putq_put == ATMEL_PUTQ_SIZE) { | 100 if (atmel_putq_put == ATMEL_PUTQ_SIZE) { |
| 90 atmel_putq_put = 0; | 101 atmel_putq_put = 0; |
| 323 cksum += data[i]; | 334 cksum += data[i]; |
| 324 } | 335 } |
| 325 *dp = cksum; | 336 *dp = cksum; |
| 326 pkt.len = len + 3; | 337 pkt.len = len + 3; |
| 327 atmel_pkt_send(&pkt); | 338 atmel_pkt_send(&pkt); |
| 339 return true; | |
| 328 } | 340 } |
| 329 | 341 |
| 330 #define MAX_TS_EVENTS 32 | 342 #define MAX_TS_EVENTS 32 |
| 331 static struct ts_event ts_event_list[MAX_TS_EVENTS]; | 343 static struct ts_event ts_event_list[MAX_TS_EVENTS]; |
| 332 static int num_ts_events = 0; | 344 static int num_ts_events = 0; |
| 336 ts_event_handler(atmel_pkt *pkt) | 348 ts_event_handler(atmel_pkt *pkt) |
| 337 { | 349 { |
| 338 unsigned char *buf = pkt->data; | 350 unsigned char *buf = pkt->data; |
| 339 static bool up = true; | 351 static bool up = true; |
| 340 static int down_count = 0; | 352 static int down_count = 0; |
| 341 static short last_x, last_y; | |
| 342 struct ts_event *tse; | 353 struct ts_event *tse; |
| 343 | 354 |
| 344 if (num_ts_events == MAX_TS_EVENTS) { | 355 if (num_ts_events == MAX_TS_EVENTS) { |
| 345 return; | 356 return; |
| 346 } | 357 } |
| 450 } | 461 } |
| 451 | 462 |
| 452 #ifdef CYGPKG_REDBOOT | 463 #ifdef CYGPKG_REDBOOT |
| 453 | 464 |
| 454 void | 465 void |
| 455 atmel_check(void) | 466 atmel_check(bool is_idle) |
| 456 { | 467 { |
| 457 } | 468 } |
| 458 RedBoot_idle(atmel_check, RedBoot_BEFORE_NETIO); | 469 RedBoot_idle(atmel_check, RedBoot_BEFORE_NETIO); |
| 459 #endif | 470 #endif |
