Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
| 17 | * |
| 18 | * |
| 19 | ******************************************************************************/ |
| 20 | #ifndef __HAL_VERSION_DEF_H__ |
| 21 | #define __HAL_VERSION_DEF_H__ |
| 22 | |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 23 | enum HAL_CHIP_TYPE { |
| 24 | TEST_CHIP = 0, |
| 25 | NORMAL_CHIP = 1, |
| 26 | FPGA = 2, |
| 27 | }; |
| 28 | |
| 29 | enum HAL_CUT_VERSION { |
| 30 | A_CUT_VERSION = 0, |
| 31 | B_CUT_VERSION = 1, |
| 32 | C_CUT_VERSION = 2, |
| 33 | D_CUT_VERSION = 3, |
| 34 | E_CUT_VERSION = 4, |
| 35 | F_CUT_VERSION = 5, |
| 36 | G_CUT_VERSION = 6, |
| 37 | }; |
| 38 | |
| 39 | enum HAL_VENDOR { |
| 40 | CHIP_VENDOR_TSMC = 0, |
| 41 | CHIP_VENDOR_UMC = 1, |
| 42 | }; |
| 43 | |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 44 | struct HAL_VERSION { |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 45 | enum HAL_CHIP_TYPE ChipType; |
| 46 | enum HAL_CUT_VERSION CUTVersion; |
| 47 | enum HAL_VENDOR VendorType; |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | /* Get element */ |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 51 | #define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 52 | #define GET_CVID_MANUFACTUER(version) (((version).VendorType)) |
| 53 | #define GET_CVID_CUT_VERSION(version) (((version).CUTVersion)) |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 54 | |
| 55 | /* Common Macro. -- */ |
| 56 | /* HAL_VERSION VersionID */ |
| 57 | |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 58 | /* HAL_CHIP_TYPE_E */ |
| 59 | #define IS_TEST_CHIP(version) \ |
| 60 | ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false) |
| 61 | #define IS_NORMAL_CHIP(version) \ |
| 62 | ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) |
| 63 | |
| 64 | /* HAL_CUT_VERSION_E */ |
| 65 | #define IS_A_CUT(version) \ |
| 66 | ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false) |
| 67 | #define IS_B_CUT(version) \ |
| 68 | ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false) |
| 69 | #define IS_C_CUT(version) \ |
| 70 | ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false) |
| 71 | #define IS_D_CUT(version) \ |
| 72 | ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false) |
| 73 | #define IS_E_CUT(version) \ |
| 74 | ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false) |
| 75 | |
| 76 | |
| 77 | /* HAL_VENDOR_E */ |
| 78 | #define IS_CHIP_VENDOR_TSMC(version) \ |
| 79 | ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false) |
| 80 | #define IS_CHIP_VENDOR_UMC(version) \ |
| 81 | ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) |
| 82 | |
Larry Finger | b1da99b | 2013-08-21 22:34:04 -0500 | [diff] [blame] | 83 | #endif |