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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [sa11x0/] [ipaq/] [current/] [include/] [atmel_support.h] - Blame information for rev 786

Details | Compare with Previous | View Log

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