comparison packages/hal/common/current/include/drv_api.h @ 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 4c750ce71ae3
children d2c90368aeef
comparison
equal deleted inserted replaced
207:74c807ddde34 208:e0c0827131d1
6 // drv_api.h 6 // drv_api.h
7 // 7 //
8 // Native API for Kernel 8 // Native API for Kernel
9 // 9 //
10 //========================================================================== 10 //==========================================================================
11 //####COPYRIGHTBEGIN#### 11 //####ECOSGPLCOPYRIGHTBEGIN####
12 // 12 // -------------------------------------------
13 // ------------------------------------------- 13 // This file is part of eCos, the Embedded Configurable Operating System.
14 // The contents of this file are subject to the Red Hat eCos Public License 14 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15 // Version 1.1 (the "License"); you may not use this file except in 15 //
16 // compliance with the License. You may obtain a copy of the License at 16 // eCos is free software; you can redistribute it and/or modify it under
17 // http://www.redhat.com/ 17 // the terms of the GNU General Public License as published by the Free
18 // 18 // Software Foundation; either version 2 or (at your option) any later version.
19 // Software distributed under the License is distributed on an "AS IS" 19 //
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // License for the specific language governing rights and limitations under 21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // the License. 22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 // 23 // for more details.
24 // The Original Code is eCos - Embedded Configurable Operating System, 24 //
25 // released September 30, 1998. 25 // You should have received a copy of the GNU General Public License along
26 // 26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // The Initial Developer of the Original Code is Red Hat. 27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 // Portions created by Red Hat are 28 //
29 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. 29 // As a special exception, if other files instantiate templates or use macros
30 // All Rights Reserved. 30 // or inline functions from this file, or you compile this file and link it
31 // ------------------------------------------- 31 // with other works to produce a work based on this file, this file does not
32 // 32 // by itself cause the resulting work to be covered by the GNU General Public
33 //####COPYRIGHTEND#### 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####
34 //========================================================================== 43 //==========================================================================
35 //#####DESCRIPTIONBEGIN#### 44 //#####DESCRIPTIONBEGIN####
36 // 45 //
37 // Author(s): nickg 46 // Author(s): nickg
38 // Date: 1999-02-24 47 // Date: 1999-02-24
62 #error Driver API requres Kernel API to be present 71 #error Driver API requres Kernel API to be present
63 #endif 72 #endif
64 73
65 #include <cyg/kernel/kapi.h> 74 #include <cyg/kernel/kapi.h>
66 75
67 #define cyg_drv_isr_lock cyg_interrupt_disable 76 #define cyg_drv_isr_lock cyg_interrupt_disable
68 #define cyg_drv_isr_unlock cyg_interrupt_enable 77 #define cyg_drv_isr_unlock cyg_interrupt_enable
69 78
70 #define cyg_drv_dsr_lock cyg_scheduler_lock 79 #define cyg_drv_dsr_lock cyg_scheduler_lock
71 #define cyg_drv_dsr_unlock cyg_scheduler_unlock 80 #define cyg_drv_dsr_unlock cyg_scheduler_unlock
72 81
73 #define cyg_drv_mutex_t cyg_mutex_t 82 #define cyg_drv_mutex_t cyg_mutex_t
74 #define cyg_drv_mutex_init cyg_mutex_init 83 #define cyg_drv_mutex_init cyg_mutex_init
75 #define cyg_drv_mutex_destroy cyg_mutex_destroy 84 #define cyg_drv_mutex_destroy cyg_mutex_destroy
76 #define cyg_drv_mutex_lock cyg_mutex_lock 85 #define cyg_drv_mutex_lock cyg_mutex_lock
77 #define cyg_drv_mutex_trylock cyg_mutex_trylock 86 #define cyg_drv_mutex_trylock cyg_mutex_trylock
78 #define cyg_drv_mutex_unlock cyg_mutex_unlock 87 #define cyg_drv_mutex_unlock cyg_mutex_unlock
79 #define cyg_drv_mutex_release cyg_mutex_release 88 #define cyg_drv_mutex_release cyg_mutex_release
80 89
81 #define cyg_drv_cond_t cyg_cond_t 90 #define cyg_drv_cond_t cyg_cond_t
82 #define cyg_drv_cond_init cyg_cond_init 91 #define cyg_drv_cond_init cyg_cond_init
83 #define cyg_drv_cond_destroy cyg_cond_destroy 92 #define cyg_drv_cond_destroy cyg_cond_destroy
84 #define cyg_drv_cond_wait cyg_cond_wait 93 #define cyg_drv_cond_wait cyg_cond_wait
85 #define cyg_drv_cond_signal cyg_cond_signal 94 #define cyg_drv_cond_signal cyg_cond_signal
86 #define cyg_drv_cond_broadcast cyg_cond_broadcast 95 #define cyg_drv_cond_broadcast cyg_cond_broadcast
87 96
88 #define cyg_drv_interrupt_create cyg_interrupt_create 97 #define cyg_drv_interrupt_create cyg_interrupt_create
89 #define cyg_drv_interrupt_delete cyg_interrupt_delete 98 #define cyg_drv_interrupt_delete cyg_interrupt_delete
90 #define cyg_drv_interrupt_attach cyg_interrupt_attach 99 #define cyg_drv_interrupt_attach cyg_interrupt_attach
91 #define cyg_drv_interrupt_detach cyg_interrupt_detach 100 #define cyg_drv_interrupt_detach cyg_interrupt_detach
92 #define cyg_drv_interrupt_mask cyg_interrupt_mask 101 #define cyg_drv_interrupt_mask cyg_interrupt_mask
93 #define cyg_drv_interrupt_unmask cyg_interrupt_unmask 102 #define cyg_drv_interrupt_unmask cyg_interrupt_unmask
94 #define cyg_drv_interrupt_acknowledge cyg_interrupt_acknowledge 103 #define cyg_drv_interrupt_mask_intunsafe cyg_interrupt_mask_intunsafe
95 #define cyg_drv_interrupt_configure cyg_interrupt_configure 104 #define cyg_drv_interrupt_unmask_intunsafe cyg_interrupt_unmask_intunsafe
96 #define cyg_drv_interrupt_level cyg_interrupt_level 105 #define cyg_drv_interrupt_acknowledge cyg_interrupt_acknowledge
97 #define cyg_drv_interrupt_set_cpu cyg_interrupt_set_cpu 106 #define cyg_drv_interrupt_configure cyg_interrupt_configure
98 #define cyg_drv_interrupt_get_cpu cyg_interrupt_get_cpu 107 #define cyg_drv_interrupt_level cyg_interrupt_level
99 108 #define cyg_drv_interrupt_set_cpu cyg_interrupt_set_cpu
100 #define cyg_drv_spinlock_t cyg_spinlock_t 109 #define cyg_drv_interrupt_get_cpu cyg_interrupt_get_cpu
101 #define cyg_drv_spinlock_init cyg_spinlock_init 110
102 #define cyg_drv_spinlock_spin cyg_spinlock_spin 111 #define cyg_drv_spinlock_t cyg_spinlock_t
103 #define cyg_drv_spinlock_clear cyg_spinlock_clear 112 #define cyg_drv_spinlock_init cyg_spinlock_init
104 #define cyg_drv_spinlock_try cyg_spinlock_try 113 #define cyg_drv_spinlock_spin cyg_spinlock_spin
105 #define cyg_drv_spinlock_test cyg_spinlock_test 114 #define cyg_drv_spinlock_clear cyg_spinlock_clear
106 #define cyg_drv_spinlock_spin_intsave cyg_spinlock_spin_intsave 115 #define cyg_drv_spinlock_try cyg_spinlock_try
107 #define cyg_drv_spinlock_clear_intsave cyg_spinlock_clear_intsave 116 #define cyg_drv_spinlock_test cyg_spinlock_test
117 #define cyg_drv_spinlock_spin_intsave cyg_spinlock_spin_intsave
118 #define cyg_drv_spinlock_clear_intsave cyg_spinlock_clear_intsave
108 119
109 #else /* CYGPKG_KERNEL */ 120 #else /* CYGPKG_KERNEL */
110 121
111 /*------------------------------------------------------------------------*/ 122 /*------------------------------------------------------------------------*/
112 /* Non-kernel version of API */ 123 /* Non-kernel version of API */
113 124
114 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ 125 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */
115 typedef cyg_addrword_t cyg_handle_t; /* Object handle */ 126 typedef cyg_addrword_t cyg_handle_t; /* Object handle */
116 typedef cyg_uint32 cyg_priority_t; /* type for priorities */ 127 typedef cyg_uint32 cyg_priority_t; /* type for priorities */
117 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ 128 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */
118 typedef cyg_uint32 cyg_cpu_t; /* CPU id */ 129 typedef cyg_uint32 cyg_cpu_t; /* CPU id */
119 typedef int cyg_bool_t; 130 typedef int cyg_bool_t;
120 typedef cyg_int32 cyg_code_t; /* type for various codes */ 131 typedef cyg_int32 cyg_code_t; /* type for various codes */
121 132
122 typedef cyg_uint32 cyg_ISR_t( cyg_vector_t vector, cyg_addrword_t data); 133 typedef cyg_uint32 cyg_ISR_t( cyg_vector_t vector, cyg_addrword_t data);
123 typedef void cyg_DSR_t(cyg_vector_t vector, 134 typedef void cyg_DSR_t(cyg_vector_t vector,
124 cyg_ucount32 count, 135 cyg_ucount32 count,
125 cyg_addrword_t data); 136 cyg_addrword_t data);
184 externC void cyg_drv_interrupt_delete( cyg_handle_t interrupt ); 195 externC void cyg_drv_interrupt_delete( cyg_handle_t interrupt );
185 externC void cyg_drv_interrupt_attach( cyg_handle_t interrupt ); 196 externC void cyg_drv_interrupt_attach( cyg_handle_t interrupt );
186 externC void cyg_drv_interrupt_detach( cyg_handle_t interrupt ); 197 externC void cyg_drv_interrupt_detach( cyg_handle_t interrupt );
187 198
188 externC void cyg_drv_interrupt_mask( cyg_vector_t vector ); 199 externC void cyg_drv_interrupt_mask( cyg_vector_t vector );
200 externC void cyg_drv_interrupt_mask_intunsafe( cyg_vector_t vector );
189 externC void cyg_drv_interrupt_unmask( cyg_vector_t vector ); 201 externC void cyg_drv_interrupt_unmask( cyg_vector_t vector );
202 externC void cyg_drv_interrupt_unmask_intunsafe( cyg_vector_t vector );
190 externC void cyg_drv_interrupt_acknowledge( cyg_vector_t vector ); 203 externC void cyg_drv_interrupt_acknowledge( cyg_vector_t vector );
191 externC void cyg_drv_interrupt_configure( 204 externC void cyg_drv_interrupt_configure(
192 cyg_vector_t vector, 205 cyg_vector_t vector,
193 cyg_bool_t level, 206 cyg_bool_t level,
194 cyg_bool_t up 207 cyg_bool_t up