Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2020 The Magma Authors. |
| 3 | |
| 4 | This source code is licensed under the BSD-style license found in the |
| 5 | LICENSE file in the root directory of this source tree. |
| 6 | |
| 7 | Unless required by applicable law or agreed to in writing, software |
| 8 | distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | See the License for the specific language governing permissions and |
| 11 | limitations under the License. |
| 12 | """ |
| 13 | |
| 14 | from typing import Type |
| 15 | |
| 16 | from devices.baicells import BaicellsHandler |
| 17 | from devices.baicells_old import BaicellsOldHandler |
| 18 | from devices.baicells_qafa import BaicellsQAFAHandler |
| 19 | from devices.baicells_qafb import BaicellsQAFBHandler |
| 20 | from devices.baicells_rts import BaicellsRTSHandler |
| 21 | from devices.device_utils import EnodebDeviceName |
| 22 | from devices.experimental.cavium import CaviumHandler |
| 23 | from devices.freedomfi_one import FreedomFiOneHandler |
| 24 | from state_machines.enb_acs import EnodebAcsStateMachine |
| 25 | |
| 26 | # This exists only to break a circular dependency. Otherwise there's no |
| 27 | # point of having these names for the devices |
| 28 | |
| 29 | |
| 30 | DEVICE_HANDLER_BY_NAME = { |
| 31 | EnodebDeviceName.BAICELLS: BaicellsHandler, |
| 32 | EnodebDeviceName.BAICELLS_OLD: BaicellsOldHandler, |
| 33 | EnodebDeviceName.BAICELLS_QAFA: BaicellsQAFAHandler, |
| 34 | EnodebDeviceName.BAICELLS_QAFB: BaicellsQAFBHandler, |
| 35 | EnodebDeviceName.BAICELLS_RTS: BaicellsRTSHandler, |
| 36 | EnodebDeviceName.CAVIUM: CaviumHandler, |
| 37 | EnodebDeviceName.FREEDOMFI_ONE: FreedomFiOneHandler, |
| 38 | } |
| 39 | |
| 40 | |
| 41 | def get_device_handler_from_name( |
| 42 | name: EnodebDeviceName, |
| 43 | ) -> Type[EnodebAcsStateMachine]: |
| 44 | return DEVICE_HANDLER_BY_NAME[name] |