1 /***************************************************************************//** 2 * \file cyhal_hwmgr_impl.h 3 * 4 * Description: 5 * This file provides internal device specific hardware manager utilities. 6 * 7 ******************************************************************************** 8 * \copyright 9 * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or 10 * an affiliate of Cypress Semiconductor Corporation 11 * 12 * SPDX-License-Identifier: Apache-2.0 13 * 14 * Licensed under the Apache License, Version 2.0 (the "License"); 15 * you may not use this file except in compliance with the License. 16 * You may obtain a copy of the License at 17 * 18 * http://www.apache.org/licenses/LICENSE-2.0 19 * 20 * Unless required by applicable law or agreed to in writing, software 21 * distributed under the License is distributed on an "AS IS" BASIS, 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 * See the License for the specific language governing permissions and 24 * limitations under the License. 25 *******************************************************************************/ 26 27 #pragma once 28 29 #include "cyhal_hw_resources.h" 30 #include "cyhal_triggers.h" 31 32 #if defined(__cplusplus) 33 extern "C" { 34 #endif 35 36 /** Function pointer for use with _cyhal_hwmgr_reserve_instance for getting the input 37 * destination of the specified hardware type given a specific block/channel */ 38 typedef cyhal_dest_t (*_cyhal_hwmgr_get_input_dest_t)(uint8_t block_num, uint8_t channel_num); 39 /** Function pointer for use with _cyhal_hwmgr_reserve_instance for getting the output 40 * source of the specified hardware type given a specific block/channel */ 41 typedef cyhal_source_t (*_cyhal_hwmgr_get_output_source_t)(uint8_t block_num, uint8_t channel_num); 42 43 44 /** Attempts to reserve a resource of the specified \p type that is able to connect to the 45 * \p src and \p dest signals if provided. 46 * @param[in] type The type of resource to reserve 47 * @param[in] src The optional input source to the resource type to be reserved 48 * @param[in] dest The optional destination target of the resource type to be reserved 49 * @param[in] get_src Function to use to get a source for a specific block/channel 50 * @param[in] get_dest Function to use to get a destination for a specific block/channel 51 * @param[out] obj The reserved resource if successful 52 * @return The status of the reservation request 53 */ 54 cy_rslt_t _cyhal_hwmgr_allocate_with_connection(cyhal_resource_t type, const cyhal_source_t *src, const cyhal_dest_t *dest, 55 _cyhal_hwmgr_get_output_source_t get_src, _cyhal_hwmgr_get_input_dest_t get_dest, cyhal_resource_inst_t *obj); 56 57 #if defined(__cplusplus) 58 } 59 #endif 60