OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [hal/] [arm/] [sa11x0/] [ipaq/] [v2_0/] [include/] [atmel_support.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
#ifndef CYGONCE_ATMEL_SUPPORT_H
2
#define CYGONCE_ATMEL_SUPPORT_H
3
 
4
//=============================================================================
5
//
6
//      atmel_support.h
7
//
8
//      Platform specific support (register layout, etc)
9
//
10
//=============================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//=============================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    gthomas
47
// Contributors: gthomas
48
// Date:         2001-02-27
49
// Purpose:      Intel SA1110/iPAQ platform specific support routines
50
// Description: 
51
// Usage:        #include <cyg/hal/atmel_support.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//=============================================================================
56
 
57
// Command codes 
58
#define ATMEL_CMD_VERSION      0
59
#define ATMEL_CMD_UNKNOWN      1
60
#define ATMEL_CMD_KEYBD        2
61
#define ATMEL_CMD_TOUCH        3
62
#define ATMEL_CMD_EEPROM_READ  4
63
#define ATMEL_CMD_EEPROM_WRITE 5
64
#define ATMEL_CMD_THERMAL      6
65
#define ATMEL_CMD_LED          8
66
#define ATMEL_CMD_BATTERY      9
67
#define ATMEL_CMD_SPI_READ     11
68
#define ATMEL_CMD_SPI_WRITE    12
69
#define ATMEL_CMD_LIGHT        13
70
#define NUM_ATMEL_CMDS         16
71
 
72
// Structure of actual packets
73
//
74
// Byte 0 - SOF
75
// Byte 1 - (cmd << 4) | length
76
// Byte 2 - Data   |
77
// ...             | 'length' bytes (0..15) 
78
// Byte m - Data   |
79
// Byte n - Checksum 
80
//
81
// Since the length must be less than 16, the entire
82
// packet will fit in 18 bytes
83
//
84
#define ATMEL_PKT_LEN 18
85
typedef struct _atmel_pkt {
86
    struct _atmel_pkt *next;
87
    unsigned char data[ATMEL_PKT_LEN];
88
    int len, size;
89
} atmel_pkt;
90
#define ATMEL_PKT_SOF  0
91
#define ATMEL_PKT_CMD  1
92
#define ATMEL_PKT_DATA 2
93
 
94
#define ATMEL_NUM_PKT  4
95
 
96
#define SOF 0x02
97
 
98
//
99
// Keyboard events are one byte with the button code
100
// and state or'd
101
//
102
#define ATMEL_BUTTON_STATE      0x80
103
#define ATMEL_BUTTON_STATE_DOWN 0x00
104
#define ATMEL_BUTTON_STATE_UP   0x80
105
#define ATMEL_BUTTON_VALUE      0x7F
106
 
107
#define ATMEL_BUTTON_RECORD     0x01
108
#define ATMEL_BUTTON_CALENDAR   0x02
109
#define ATMEL_BUTTON_MEMO       0x03
110
#define ATMEL_BUTTON_Q          0x04
111
#define ATMEL_BUTTON_RETURN     0x05
112
#define ATMEL_BUTTON_JOY_UP     0x06
113
#define ATMEL_BUTTON_JOY_RIGHT  0x07
114
#define ATMEL_BUTTON_JOY_DOWN   0x09
115
#define ATMEL_BUTTON_JOY_LEFT   0x08
116
 
117
struct key_event {
118
    unsigned char button_info;
119
};
120
 
121
//
122
// Touch screen events
123
// Note: up/down is really hard to discern
124
//
125
struct ts_event {
126
    bool   up;
127
    short  x, y;
128
};
129
 
130
// Functions
131
void atmel_init(void);
132
bool atmel_send(int, unsigned char *, int);
133
int  atmel_recv(unsigned char *, int);
134
typedef void atmel_handler(atmel_pkt *);
135
void atmel_register(int, atmel_handler *);
136
void atmel_interrupt_mode(bool enable);
137
 
138
bool ts_get_event(struct ts_event *);
139
bool key_get_event(struct key_event *);
140
 
141
#endif /* CYGONCE_ATMEL_SUPPORT_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.