openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

int.h (2711B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:    int.h
      8  */
      9 
     10 #ifndef _BCM_INIT_INT_H_
     11 #define _BCM_INIT_INT_H_
     12 
     13 #if defined(INCLUDE_INT)
     14 #include <soc/shared/int.h>
     15 #include <soc/shared/int_msg.h>
     16 #include <soc/profile_mem.h>
     17 #include <shared/idxres_fl.h>
     18 #include <bcm/int.h>
     19 
     20 /*
     21  * Macro:
     22  *     _BCM_INT_ALLOC
     23  * Purpose:
     24  *      Generic memory allocation routine.
     25  * Parameters:
     26  *    _ptr_     - Pointer to allocated memory.
     27  *    _ptype_   - Pointer type.
     28  *    _size_    - Size of heap memory to be allocated.
     29  *    _descr_   - Information about this memory allocation.
     30  */
     31 #define _BCM_INT_ALLOC(_ptr_,_ptype_,_size_,_descr_)                        \
     32     do {                                                                    \
     33         if (NULL == (_ptr_)) {                                              \
     34             (_ptr_) = (_ptype_ *) sal_alloc((_size_), (_descr_));           \
     35         }                                                                   \
     36         if((_ptr_) != NULL) {                                               \
     37             sal_memset((_ptr_), 0, (_size_));                               \
     38         }  else {                                                           \
     39             LOG_ERROR(BSL_LS_BCM_FLOWTRACKER,                               \
     40                     (BSL_META("INT Error: Allocation failure %s\n"),        \
     41                      (_descr_)));                                           \
     42         }                                                                   \
     43     } while (0)
     44 
     45 /* Internal data structure to store
     46  * global INT information.
     47  */
     48 typedef struct _bcm_int_turnaround_info_s {
     49     /* flags, See BCM_INT_INT_INFO_FLAGS_XXX */
     50     uint32 flags;
     51 
     52     /* DMA Buffer used for messaging between SDK and UKERNEL. */
     53     uint8 *dma_buffer;
     54 
     55     /* Length of the DMA buffer */
     56     int dma_buffer_len;
     57 
     58     /* uController number running INT appl */
     59     int uc_num;
     60 
     61     /* CPU cos queue map INT Turnaround index */
     62     int cosq_turnaround_index;
     63 
     64     /* CPU cos queue map INT Turnaround Hop Limit index */
     65     int cosq_hoplimit_index;
     66 } _bcm_int_turnaround_info_t;
     67 
     68 /* Global data structures extern declarations */
     69 extern _bcm_int_turnaround_info_t *int_global_info[BCM_MAX_NUM_UNITS];
     70 
     71 /* Get the INT_TURNAROUND_INFO struct for the unit */
     72 #define INT_TURNAROUND_INFO_GET(_u) int_global_info[(_u)]
     73 
     74 /* Tx and Rx channel index used by INT Turnaround EAPP */
     75 #define BCM_INT_EAPP_TX_CHANNEL 0
     76 #define BCM_INT_EAPP_RX_CHANNEL 1
     77 
     78 #endif /* INCLUDE_INT */
     79 #endif  /* !_BCM_INIT_INT_H_ */