linux/drivers/staging/rtl8723bs/include/basic_types.h

/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
 *
 ******************************************************************************/
#ifndef __BASIC_TYPES_H__
#define __BASIC_TYPES_H__


#define SUCCESS
#define FAIL

#include <linux/types.h>

#define FIELD_OFFSET(s, field)

#define SIZE_PTR
#define SSIZE_PTR

/* port from fw by thomas */
/*  TODO: Belows are Sync from SD7-Driver. It is necessary to check correctness */

/*
 *Call endian free function when
 *	1. Read/write packet content.
 *	2. Before write integer to IO.
 *	3. After read integer from IO.
*/

/*  */
/*  Byte Swapping routine. */
/*  */
#define EF1Byte
#define EF2Byte
#define EF4Byte

/* Convert little data endian to host ordering */
#define EF1BYTE(_val)
#define EF2BYTE(_val)
#define EF4BYTE(_val)

/* Read data from memory */
#define READEF1BYTE(_ptr)
/* Read le16 data from memory and convert to host ordering */
#define READEF2BYTE(_ptr)
#define READEF4BYTE(_ptr)

/* Write data to memory */
#define WRITEEF1BYTE(_ptr, _val)
/* Write le data to memory in host ordering */
#define WRITEEF2BYTE(_ptr, _val)

#define WRITEEF4BYTE(_ptr, _val)

/* Create a bit mask
 * Examples:
 * BIT_LEN_MASK_32(0) => 0x00000000
 * BIT_LEN_MASK_32(1) => 0x00000001
 * BIT_LEN_MASK_32(2) => 0x00000003
 * BIT_LEN_MASK_32(32) => 0xFFFFFFFF
 */
#define BIT_LEN_MASK_32(__bitlen)
#define BIT_LEN_MASK_16(__bitlen)
#define BIT_LEN_MASK_8(__bitlen)

/* Create an offset bit mask
 * Examples:
 * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
 * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
 */
#define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen)
#define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen)
#define BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)

/*Description:
 * Return 4-byte value in host byte ordering from
 * 4-byte pointer in little-endian system.
 */
#define LE_P4BYTE_TO_HOST_4BYTE(__pstart)
#define LE_P2BYTE_TO_HOST_2BYTE(__pstart)
#define LE_P1BYTE_TO_HOST_1BYTE(__pstart)

/*  */
/* 	Description: */
/* 		Translate subfield (continuous bits in little-endian) of 4-byte value in litten byte to */
/* 		4-byte value in host byte ordering. */
/*  */
#define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen)
#define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen)
#define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen)

/*  */
/* 	Description: */
/* 		Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering */
/* 		and return the result in 4-byte value in host byte ordering. */
/*  */
#define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen)
#define LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen)
#define LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen)

/*  */
/* 	Description: */
/* 		Set subfield of little-endian 4-byte value to specified value. */
/*  */
#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val)

#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val)

#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val)

#define LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen)

#define SET_BITS_TO_LE_1BYTE_8BIT(__pStart, __BitOffset, __BitLen, __Value)

/*  Get the N-bytes alignent offset from the current length */
#define N_BYTE_ALIGMENT(__Value, __Aligment)

#define TEST_FLAG(__Flag, __testFlag)
#define SET_FLAG(__Flag, __setFlag)
#define CLEAR_FLAG(__Flag, __clearFlag)
#define CLEAR_FLAGS(__Flag)
#define TEST_FLAGS(__Flag, __testFlags)

#endif /* __BASIC_TYPES_H__ */