comparison packages/devs/common/current/include/iorb.h @ 0:3111d98ba7b3 ecos-v1_1-release

Initial commit of eCos version 1.1
author jlarmour
date Tue, 11 May 1999 11:16:07 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3111d98ba7b3
1 #ifndef CYGONCE_DEVS_COMMON_IORB_H
2 #define CYGONCE_DEVS_COMMON_IORB_H
3
4 //==========================================================================
5 //
6 // iorb.h
7 //
8 // Header file for IORB data structure
9 //
10 //==========================================================================
11 //####COPYRIGHTBEGIN####
12 //
13 // -------------------------------------------
14 // The contents of this file are subject to the Cygnus eCos Public License
15 // Version 1.0 (the "License"); you may not use this file except in
16 // compliance with the License. You may obtain a copy of the License at
17 // http://sourceware.cygnus.com/ecos
18 //
19 // Software distributed under the License is distributed on an "AS IS"
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
21 // License for the specific language governing rights and limitations under
22 // the License.
23 //
24 // The Original Code is eCos - Embedded Cygnus Operating System, released
25 // September 30, 1998.
26 //
27 // The Initial Developer of the Original Code is Cygnus. Portions created
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved.
29 // -------------------------------------------
30 //
31 //####COPYRIGHTEND####
32 //==========================================================================
33 //#####DESCRIPTIONBEGIN####
34 //
35 // Author(s): proven
36 // Contributors: proven
37 // Date: 1998-04-20
38 // Purpose: Define IORB data structure
39 // Description: This file contains the C/C++ struct declaration of Cyg_IORB.
40 // Cyg_IORB is the basic class for all device operations for
41 // both the C and C++ API.
42 // Usage: #include <cyg/devs/common/iorb.h>
43 //
44 //####DESCRIPTIONEND####
45 //
46 //==========================================================================
47
48 #include <cyg/infra/cyg_type.h>
49 #include <cyg/infra/cyg_ass.h> // assertion macros
50 #include <cyg/infra/cyg_trac.h> // tracing macros
51
52 // -------------------------------------------------------------------------
53 // Cyg_IORB
54
55 /*
56 * This struct will be accessed by some ISR routines. Any field that is
57 * modified by an ISR routine must be declared volatile. Currently this
58 * includes next, ret_length, and resultstatus.
59 *
60 * Note: For next this means the pointer next is volatile not the contents.
61 */
62 typedef struct Cyg_IORB_t
63 {
64 #ifdef __cplusplus
65 friend class Cyg_Device;
66
67 private:
68 Cyg_Device * pdevice;
69
70 // Accessor functions
71 void set_pdevice(Cyg_Device * device) { pdevice = device; }
72
73 public:
74
75 // Accessor functions
76 Cyg_Device *
77 get_pdevice(void) { return(pdevice); }
78
79 #else
80 // Make sure the C and C++ versions are the same size;
81 CYG_ADDRESS pdevice;
82 #endif
83
84 struct Cyg_IORB_t * volatile next;
85
86 void * buffer; // ptr to buffer
87 cyg_uint32 buffer_length; // length of buffer
88 volatile cyg_uint32 xferred_length; // length of buffer xferd
89
90 cyg_uint8 opcode; // operation code + options
91 volatile cyg_uint8 status; // state, result + error code
92
93 CYG_ADDRWORD callback_data; // data field for callback routine
94 void (*callback)( struct Cyg_IORB_t * piorb);
95 } Cyg_IORB;
96
97 // opflags codes
98 #define CYG_IORB_NOBLOCK 0x01 // opcode for special serial reads
99
100 // Resultstatus codes
101 #define CYG_IORB_OK 0x00
102 #define CYG_IORB_CANCELED 0x02
103
104 #endif // CYGONCE_DEVS_COMMON_IORB_H
105 // End of iorb.h
106