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 interface to buffer management
20 #ifndef angel_buffers_h
21 #define angel_buffers_h
23 #include "chandefs.h" /* CHAN_HEADER_SIZE */
26 /* the handle to a buffer */
27 typedef unsigned char *p_Buffer;
31 * Angel Packets are structured as a fixed size header, followed
35 # define BUFFERDATA(b) (b) /* channels layer takes care of it */
37 # define BUFFERDATA(b) (&((b)[CHAN_HEADER_SIZE]))
42 * The buffer management function prototypes are only applicable
43 * when compiling target code
48 * Function: Angel_BufferQuerySizes
49 * Purpose: Request infomation on the default and maximum buffer sizes
50 * that can be allocated
53 * In/Out: default_size, max_size: pointers to place the
57 void Angel_BufferQuerySizes(unsigned int *default_size,
58 unsigned int *max_size );
61 * Function: Angel_RxEnginBuffersLeft
62 * Purpose: return the number of free buffers
65 * Returns: number of free buffers
67 unsigned int Angel_BuffersLeft( void );
70 * Function: Angel_BufferAlloc
71 * Purpose: allocate a buffer that is at least req_size bytes long
74 * Input: req_size the required size of the buffer
76 * Returns: pointer to the buffer NULL if unable to
79 p_Buffer Angel_BufferAlloc(unsigned int req_size);
82 * Function: Angel_BufferRelease
83 * Purpose: release a buffer back to the free pool
86 * Input: pointer to the buffer to free
88 void Angel_BufferRelease(p_Buffer buffer);
91 /* return values for angel_InitBuffers */
92 typedef enum buf_init_error{
98 * Function: Angel_InitBuffers
99 * Purpose: Initalised and malloc the buffer pool
105 buf_init_error Angel_InitBuffers(void);
107 #endif /* def TARGET */
109 #endif /* ndef angel_buffers_h */