source: svn/trunk/newcon3bcm2_21bu/nexus/build/nfe_driver/b_bare_os.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 6.1 KB
Line 
1/***************************************************************************
2*     (c)2004-2011 Broadcom Corporation
3*
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and
6*  conditions of a separate, written license agreement executed between you and Broadcom
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8*  no license (express or implied), right to use, or waiver of any kind with respect to the
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13*
14*  Except as expressly set forth in the Authorized License,
15*
16*  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17*  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18*  and to use this information only in connection with your use of Broadcom integrated circuit products.
19*
20*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27*  USE OR PERFORMANCE OF THE SOFTWARE.
28*
29*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36*  ANY LIMITED REMEDY.
37*
38* $brcm_Workfile: b_bare_os.h $
39* $brcm_Revision: Hydra_Software_Devel/2 $
40* $brcm_Date: 6/6/11 10:24a $
41*
42* API Description:
43*   API name: Platform linuxuser
44*    linuxkernel OS routines
45*
46* Revision History:
47*
48* $brcm_Log: /magnum/basemodules/kni/bare/b_bare_os.h $
49*
50* Hydra_Software_Devel/2   6/6/11 10:24a ttrammel
51* SW7420-1819: Update NEXUS/pi for NFE 2.0.
52*
53* Hydra_Software_Devel/1   5/3/11 1:42p erickson
54* SW7420-1819: add bare OS support to magnum basemodules
55*
56***************************************************************************/
57#ifndef B_BARE_OS_H__
58#define B_BARE_OS_H__
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
64typedef uint64_t b_bare_os_tick;
65
66typedef struct b_bare_os_lock_tag *b_bare_os_lock;
67typedef struct b_bare_os_signal_tag *b_bare_os_signal;
68typedef struct b_bare_os_thread_tag *b_bare_os_thread;
69
70typedef void (*b_bare_os_special_interrupt_handler)(int irqNum);
71
72#define B_BARE_OS_ETIMEOUT  1
73#define B_BARE_OS_ERROR     (-1)
74
75typedef struct b_bare_os_thread_settings {
76    unsigned priority;
77    unsigned stack_size;
78} b_bare_os_thread_settings;
79
80typedef struct b_bare_os_interface {
81    /* calls for bare/bkni.c, nexus_platform_os.c */
82    void *(*malloc)(size_t size);
83    void (*free)(void *ptr);
84    void (*print_debug)(bool high_priority, const char *str);
85    b_bare_os_tick (*current_tick)(void);
86    unsigned (*tick_diff)(b_bare_os_tick future, b_bare_os_tick past);
87    void *(*mmap)(bool cached, uint32_t addr, size_t size);
88    void (*unmmap)(void *addr, size_t size);
89    void (*dcache_flush)(void *addr, size_t size);
90    void (*delay)(unsigned delay_us);
91    void (*sleep)(unsigned delay_ms);
92    b_bare_os_lock (*lock_create)(void);
93    int (*lock_acquire)(b_bare_os_lock lock);
94    int (*lock_try_acquire)(b_bare_os_lock lock);
95    void (*lock_release)(b_bare_os_lock lock);
96    void (*lock_destroy)(b_bare_os_lock lock);
97    b_bare_os_signal (*signal_create)(void);
98    int (*signal_wait)(b_bare_os_signal signal, unsigned timeout_ms);
99    void (*signal_set)(b_bare_os_signal signal);
100    void (*signal_destroy)(b_bare_os_signal signal);
101    int (*copy_from_process)(void *dest, const void *src, unsigned size);
102    int (*copy_to_process)(void *dest, const void *src, unsigned size);
103   
104    /* calls for bare/nexus_base_os.c */
105    b_bare_os_thread (*thread_create)(const char *name, void (*callback)(void *), void *context, b_bare_os_thread_settings *p_settings);
106    void (*thread_destroy)(b_bare_os_thread thread);
107    const char *(*getenv)(const char *name);
108    void (*setenv)(const char *name, const char *value);
109    void (*terminate_process)(unsigned id);
110   
111    /* calls for bare/nexus_platform_os.c */
112    void (*atomic_update)(unsigned register_address, uint32_t mask, uint32_t value);
113    int  (*connect_interrupt)(const char *name, unsigned irq_num, 
114        void (*callback)(void *,int), void *context_ptr, int context_int, 
115        bool shared, b_bare_os_special_interrupt_handler special_handler);
116    int  (*enable_interrupt)(unsigned irq_num);
117    void (*disable_interrupt)(unsigned irq_num);
118    void (*disconnect_interrupt)(unsigned irq_num);
119    b_bare_os_lock (*get_interrupt_lock)(void); /* special lock for interrupt context */
120        void *end_of_functions;
121} b_bare_os_interface;
122
123/* Pointer and accessor to get to the bare interface structure */
124b_bare_os_interface *b_get_bare_os(void);       /* Located in b_bare_os.c on the driver side; stubs_rev.S on the firmware side */
125extern b_bare_os_interface *pb_bare_os;         /* Located in b_base_os.c on the driver side; kni/bare/bkni.c on the firmware side */
126
127/* These functions should be be only called on the driver side */
128int b_bare_os_init(void);
129void b_bare_os_uninit(void);
130
131#ifdef __cplusplus
132}
133#endif
134
135#endif /* B_BARE_OS_H__ */
136
Note: See TracBrowser for help on using the repository browser.