• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description: The Header File For oal_netbuf_data.c
15  * Create: 2022-04-14
16  */
17 
18 #ifndef __OAL_NETBUF_DATA_H__
19 #define __OAL_NETBUF_DATA_H__
20 #include "oal_netbuf_ext.h"
21 #include "dmac_ext_if_device.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif
28 
oal_netbuf_tx_data(const oal_netbuf_stru * netbuf)29 static INLINE__ osal_u8 *oal_netbuf_tx_data(const oal_netbuf_stru *netbuf)
30 {
31     mac_tx_ctl_stru *tx_ctl = (mac_tx_ctl_stru *)oal_netbuf_cb_const(netbuf);
32     return oal_netbuf_header(netbuf) + tx_ctl->frame_header_length;
33 }
34 
oal_netbuf_tx_data_const(const oal_netbuf_stru * netbuf)35 static INLINE__ const osal_u8 *oal_netbuf_tx_data_const(const oal_netbuf_stru *netbuf)
36 {
37     mac_tx_ctl_stru *tx_ctl = (mac_tx_ctl_stru *)oal_netbuf_cb_const(netbuf);
38     return oal_netbuf_header(netbuf) + tx_ctl->frame_header_length;
39 }
40 
oal_netbuf_rx_data(const oal_netbuf_stru * netbuf)41 static INLINE__ osal_u8 *oal_netbuf_rx_data(const oal_netbuf_stru *netbuf)
42 {
43     mac_rx_ctl_stru *rx_ctl = (mac_rx_ctl_stru *)oal_netbuf_cb_const(netbuf);
44     return oal_netbuf_header(netbuf) + rx_ctl->mac_header_len;
45 }
46 
oal_netbuf_rx_data_const(const oal_netbuf_stru * netbuf)47 static INLINE__ const osal_u8 *oal_netbuf_rx_data_const(const oal_netbuf_stru *netbuf)
48 {
49     mac_rx_ctl_stru *rx_ctl = (mac_rx_ctl_stru *)oal_netbuf_cb_const(netbuf);
50     return oal_netbuf_header_const(netbuf) + rx_ctl->mac_header_len;
51 }
52 
oal_netbuf_rx_frame_len(oal_netbuf_stru * netbuf)53 static INLINE__ osal_u16 oal_netbuf_rx_frame_len(oal_netbuf_stru *netbuf)
54 {
55     mac_rx_ctl_stru *rx_ctl = (mac_rx_ctl_stru *)oal_netbuf_cb(netbuf);
56     return rx_ctl->frame_len;
57 }
58 
oal_netbuf_rx_header_len(oal_netbuf_stru * netbuf)59 static INLINE__ osal_u16 oal_netbuf_rx_header_len(oal_netbuf_stru *netbuf)
60 {
61     mac_rx_ctl_stru *rx_ctl = (mac_rx_ctl_stru *)oal_netbuf_cb(netbuf);
62     return rx_ctl->mac_header_len;
63 }
64 
65 #ifdef __cplusplus
66 #if __cplusplus
67 }
68 #endif
69 #endif
70 #endif
71