RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / shared / bcm_notif_priv.h
blob9e6250e53a219d58e1c6a3743e7c93339c3bfa16
1 /*
2 * Private header file for event-component data structure and API
4 * Copyright (C) 2012, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
12 * $Id$
17 * Here is a picture of the data structure that's maintained.
18 * The list is circular for efficiency: FIFO insert is constant time.
19 * It's traversed FIFO to signal interest.
20 * Any client may ask to be removed.
23 * --------------------------------------------+
24 * | |
25 * | +-------+ +-------+ +-------+ |
26 * +->| x c n |----->| x c n |----->| x c n |---
27 * +-------+ +-------+ +-------+
28 * ^
29 * |
30 * +------+
31 * listp--->| tail |
32 * +------+
35 * x is client passthru data for notifications
36 * c is the client callback
37 * n is a "next" pointer of the list
38 * tail is the server's pointer to the list.
40 * Copyright (C) 2012, Broadcom Corporation
41 * All Rights Reserved.
43 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
44 * the contents of this file may not be disclosed to third parties, copied
45 * or duplicated in any form, in whole or in part, without the prior
46 * written permission of Broadcom Corporation.
49 #ifndef BCM_NOTIF_PRIV_H
50 #define BCM_NOTIF_PRIV_H 1
52 #include <osl.h>
53 #include <bcm_notif_pub.h>
54 #include <bcm_mpool_pub.h>
57 /* Global notifier module state */
58 struct bcm_notif_module {
60 /* Operating system handle. */
61 osl_t *osh;
63 /* Memory pool manager handle. */
64 bcm_mpm_mgr_h mpm;
66 /* Memory pool for server notifier objects. */
67 bcm_mp_pool_h server_mem_pool;
69 /* Memory pool for client request objects. */
70 bcm_mp_pool_h client_mem_pool;
75 * Private helper type for nodes in the linked list of client registrations
77 struct bcm_notif_client_request {
78 bcm_notif_client_data passthru;
79 bcm_notif_client_callback callback;
80 struct bcm_notif_client_request *next;
84 * This type defines the overall list. The list is kept circular. This way
85 * We can insert to tail easily, and invoke client callbacks in exactly the same
86 * order in which they express interest.
88 struct bcm_notif_list_struct {
89 /* Circular list of client requests. */
90 struct bcm_notif_client_request *tail;
92 /* Pointer to global notif state. */
93 bcm_notif_module_t *notif_module;
95 /* Used to ensure that nested events do not occur, and that list operations
96 * are not performed within client callbacks.
98 bool allow_list_operations;
101 #endif /* BCM_NOTIF_PRIV_H */