2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
17 * Title: Public client interface to devices
20 #ifndef angel_devclnt_h
21 #define angel_devclnt_h
24 * This header exports the public interface to Angel-compliant device
27 * They are intended to be used solely by Angel, not by the User
28 * Application. See devappl.h for the User Application interface to
34 /* General purpose constants, macros, enums, typedefs */
37 * possible channels at device level
41 * these are used as array indices, so be specific about their values
43 typedef enum DevChanID
{
44 DC_DBUG
= 0, /* reliable debug packets
45 * containing SDBG, CLIB,UDBG, etc.) */
46 DC_APPL
= 1, /* application packets */
50 /* Publically-accessible globals */
53 /* Public functions */
56 * Function: angel_DeviceWrite
57 * Purpose: The main entry point for asynchronous writes to a device.
60 * Input: devID index of the device to write to
62 * length how much data to write
63 * callback callback here when write finished
65 * cb_data data to be passed to callback
66 * chanID device channel to use
70 * Returns: DE_OKAY write request is underway
71 * DE_NO_DEV no such device
72 * DE_BAD_DEV device does not support angel writes
73 * DE_BAD_CHAN no such device channel
74 * DE_BUSY device busy with another write
75 * DE_INVAL silly length
80 * Other side effects: -
82 * Commence asynchronous transmission of a buffer on a device. The
83 * callback will occur when the write completes or if there is an
86 * This must be called for each packet to be sent.
89 DevError
angel_DeviceWrite(DeviceID devID
, p_Buffer buff
,
90 unsigned length
, DevWrite_CB_Fn callback
,
91 void *cb_data
, DevChanID chanID
);
95 * Function: angel_DeviceRegisterRead
96 * Purpose: The main entry point for asynchronous reads from a device.
99 * Input: devID index of the device to read from
100 * callback callback here when read finished
102 * cb_data data to be passed to callback
103 * get_buff callback to be used to acquire buffer
104 * for incoming packets
105 * getb_data data to be passed to get_buff
106 * chanID device channel to use
110 * Returns: DE_OKAY read request is underway
111 * DE_NO_DEV no such device
112 * DE_BAD_DEV device does not support angel reads
113 * DE_BAD_CHAN no such device channel
114 * DE_BUSY device busy with another read
115 * DE_INVAL silly length
118 * Modifies globals: -
120 * Other side effects: -
122 * Register asynchronous packet read from a device. The callback will
123 * occur when the read completes or if there is an error.
125 * This is persistent: the read remains registered for all incoming
126 * packets on the device channel.
129 DevError
angel_DeviceRegisterRead(DeviceID devID
,
130 DevRead_CB_Fn callback
, void *cb_data
,
131 DevGetBuff_Fn get_buff
, void *getb_data
,
136 * Function: angel_DeviceControl
137 * Purpose: Call a control function for a device
140 * Input: devID index of the device to control to
141 * op operation to perform
142 * arg parameter depending on op
144 * Returns: DE_OKAY control request is underway
145 * DE_NO_DEV no such device
146 * DE_BAD_OP device does not support operation
149 * Modifies globals: -
151 * Other side effects: -
153 * Have a device perform a control operation. Extra parameters vary
154 * according to the operation requested.
157 DevError
angel_DeviceControl(DeviceID devID
, DeviceControl op
, void *arg
);
161 * Function: angel_ReceiveMode
162 * Purpose: enable or disable reception across all devices
165 * Input: mode choose enable or disable
167 * Pass the mode parameter to the receive_mode control method of each device
170 void angel_ReceiveMode(DevRecvMode mode
);
174 * Function: angel_ResetDevices
175 * Purpose: reset all devices
179 * Call the reset control method for each device
182 void angel_ResetDevices(void);
186 * Function: angel_InitialiseDevices
187 * Purpose: initialise the device driver layer
191 * Set up the device driver layer and call the init method for each device
194 void angel_InitialiseDevices(void);
198 * Function: angel_IsAngelDevice
199 * Purpose: Find out if a device supports Angel packets
202 * Input: devID index of the device to control to
204 * Returns: TRUE supports Angel packets
208 * Modifies globals: -
210 * Other side effects: -
213 bool angel_IsAngelDevice(DeviceID devID
);
216 #if !defined(MINIMAL_ANGEL) || MINIMAL_ANGEL == 0
219 * Function: angel_ApplDeviceHandler
220 * Purpose: The entry point for User Application Device Driver requests
221 * in a full functiionality version of Angel.
222 * It will never be called directly by the User Application,
223 * but gets called indirectly, via the SWI handler.
226 * Input: swi_r0 Argument to SWI indicating that
227 * angel_ApplDeviceHandler was to be called. This
228 * will not be used in this function, but is needed
229 * by the SWI handler.
230 * arg_blk pointer to block of arguments
231 * arg_blk[0] is one of
232 * angel_SWIreason_ApplDevice_{Read,Write,Yield}
233 * which indicates which angel_Device* fn is to
234 * be called. arg_blk[1] - arg_blk[n] are the
235 * arguments to the corresponding
236 * angel_ApplDevice* function.
240 * Returns: whatever the specified angel_Device* function
244 * Modifies globals: -
246 * Other side effects: -
248 * This has the side effects of angel_Device{Read,Write,Yield}
249 * depending upon which is operation is specified as described above.
252 DevError
angel_ApplDeviceHandler(
253 unsigned swi_r0
, unsigned *arg_blk
256 #endif /* ndef MINIMAL_ANGEL */
258 #endif /* ndef angel_devclnt_h */
This page took 0.0341320000000001 seconds and 4 git commands to generate.