From 8c5f2324d7aa61669324aec1a0ad091fe1379489 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Thu, 8 Dec 2016 13:51:04 +0100 Subject: src: unicens: import sources This patch adds the source tree of the NetworkManager v3.0.4. Additionally, it provides the needed configuration scripts. Change-Id: I23778b51423b51a4f87741957e0fb208bceb79b3 Signed-off-by: Christian Gromm --- Src/Network/base/DriverConfiguration.h | 239 +++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 Src/Network/base/DriverConfiguration.h (limited to 'Src/Network/base/DriverConfiguration.h') diff --git a/Src/Network/base/DriverConfiguration.h b/Src/Network/base/DriverConfiguration.h new file mode 100644 index 0000000..b2fd44a --- /dev/null +++ b/Src/Network/base/DriverConfiguration.h @@ -0,0 +1,239 @@ +/* + * Video On Demand Samples + * + * Copyright (C) 2015 Microchip Technology Germany II GmbH & Co. KG + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * You may also obtain this software under a propriety license from Microchip. + * Please contact Microchip for further information. + * + */ + +/*----------------------------------------------------------*/ +/*! \file + * \brief This component provides helper tools to deal with USB endpoints. + */ +/*----------------------------------------------------------*/ +#ifndef DRIVERCONFIGURATION_H +#define DRIVERCONFIGURATION_H + +#include +#include +#include "Types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + /*----------------------------------------------------------*/ + /*! \brief Checks if the given USB device instance exists. + * + * \param deviceInstance - The device instance of the USB INIC, starting at 0 for the first instance. + * + * \return true: Device exists. + * \return false: Device does not exist. + */ + /*----------------------------------------------------------*/ + bool ExistsUsbDeviceInstance( uint8_t deviceInstance ); + + /*----------------------------------------------------------*/ + /*! \brief Checks if the given MLB device instance exists. + * + * \param deviceInstance - The device instance of the MLB INIC, starting at 0 for the first instance. + * + * \return true: Device exists. + * \return false: Device does not exist. + */ + /*----------------------------------------------------------*/ + bool ExistsMlbDeviceInstance( uint8_t deviceInstance ); + + /*----------------------------------------------------------*/ + /*! \brief Checks if the given I2C device instance exists. + * + * \param deviceInstance - The device instance of the I2C INIC, starting at 0 for the first instance. + * + * \return true: Device exists. + * \return false: Device does not exist. + */ + /*----------------------------------------------------------*/ + bool ExistsI2CDeviceInstance( uint8_t deviceInstance ); + + /*----------------------------------------------------------*/ + /*! \brief Retreives the Linux character device names for the given USB device instance and the endpoint address. + * + * \note If the given buffer is too small to hold the whole path, the string is truncated and not useable! + * + * \param deviceInstance - The device instance of the USB INIC, starting at 0 for the first instance. + * \param endpointAddress - The USB endpoint address, RX endpoints starting with upper bit set (0x8X). + * \param deviceName - [in,out] Given buffer will be filled with device name (starting with /dev/). + * \param deviceNameLength - The length of the given deviceName buffer in bytes. + * \param systemName - [in,out] Given buffer will be filled with system name (starting with /sys/). + * \param systemNameLength - The length of the given systemName buffer in bytes. + * \param linkName - [in,out] Given buffer will be filled with the string needed to register this device to an AIM + * \param linkNameLength - The length of the given linkName buffer in bytes. + * + * \return true: Operation was successful. + * \return false: Operation failed, device or endpoint does not exist. + */ + /*----------------------------------------------------------*/ + bool GetUsbDeviceNames( uint8_t deviceInstance, uint8_t endpointAddress, char *deviceName, + uint16_t deviceNameLength, char *systemName, uint16_t systemNameLength, char *linkName, + uint16_t linkNameLength ); + + + /*----------------------------------------------------------*/ + /*! \brief Retreives the Linux character device names for the given MLB device instance and the endpoint address. + * + * \note If the given buffer is too small to hold the whole path, the string is truncated and not useable! + * + * \param deviceInstance - The device instance of the USB INIC, starting at 0 for the first instance. + * \param mlbChannelAddress - The MLB channel address + * \param deviceName - [in,out] Given buffer will be filled with device name (starting with /dev/). + * \param deviceNameLength - The length of the given deviceName buffer in bytes. + * \param systemName - [in,out] Given buffer will be filled with system name (starting with /sys/). + * \param systemNameLength - The length of the given systemName buffer in bytes. + * \param linkName - [in,out] Given buffer will be filled with the string needed to register this device to an AIM + * \param linkNameLength - The length of the given linkName buffer in bytes. + * + * \return true: Operation was successful. + * \return false: Operation failed, device or endpoint does not exist. + */ + /*----------------------------------------------------------*/ + bool GetMlbDeviceNames( uint8_t deviceInstance, uint8_t mlbChannelAddress, char *deviceName, + uint16_t deviceNameLength, char *systemName, uint16_t systemNameLength, char *linkName, + uint16_t linkNameLength ); + + + /*----------------------------------------------------------*/ + /*! \brief Retreives the Linux character device names for the given I2C device instance and the endpoint address. + * + * \note If the given buffer is too small to hold the whole path, the string is truncated and not useable! + * + * \param deviceInstance - The device instance of the I2C INIC, starting at 0 for the first instance. + * \param isTx - true, if the names for transmission path should be retrieved, otherwise for the reception path. + * \param deviceName - [in,out] Given buffer will be filled with device name (starting with /dev/). + * \param deviceNameLength - The length of the given deviceName buffer in bytes. + * \param systemName - [in,out] Given buffer will be filled with system name (starting with /sys/). + * \param systemNameLength - The length of the given systemName buffer in bytes. + * \param linkName - [in,out] Given buffer will be filled with the string needed to register this device to an AIM + * \param linkNameLength - The length of the given linkName buffer in bytes. + * + * \return true: Operation was successful. + * \return false: Operation failed, device or endpoint does not exist. + */ + /*----------------------------------------------------------*/ + bool GetI2CDeviceNames( uint8_t deviceInstance, bool isTx, char *deviceName, uint16_t deviceNameLength, + char *systemName, uint16_t systemNameLength, char *linkName, uint16_t linkNameLength ); + + /*----------------------------------------------------------*/ + /*! \brief Closes the MOST channel. + * + * \param device - The system path to configure the MOST device (starting with "/sys/"). + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool CloseMostChannel( const char *device ); + + /*----------------------------------------------------------*/ + /*! \brief Configures the MOST channel. + * + * \param device - The system path to configure the MOST device (starting with "/sys/"). + * \param mostType - The MOST data type (control, asynchron, synchron, isochron). + * \param direction - The direction of the stream (directionRX, directionTX). + * \param numBuf - The amount of buffers. + * \param bufSize - The size of each buffer in bytes. + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool ConfigureMostChannel( const char *device, EPDataType_t mostType, EPDirection_t direction, uint32_t numBuf, + uint32_t bufSize ); + + /*----------------------------------------------------------*/ + /*! \brief Configures the isochronous channel of a device. + * \note This function has to be called before ConfigureMostChannel! + * + * \param device - The system path to configure the MOST device (starting with "/sys/"). + * \param subbufferSize - The amount of bytes for a single subbuffer (eg. 188 or 196 bytes). + * \param packetsPerTransaction - The amount of ischronous packets per transaction. + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool ConfigureIsocChannel( const char *device, uint32_t subbufferSize, uint32_t packetsPerTransaction ); + + /*----------------------------------------------------------*/ + /*! \brief Configures the Synchronous channel of a device. + * \note This function has to be called before ConfigureMostChannel! + * + * \param device - The system path to configure the MOST device (starting with "/sys/"). + * \param syncBlockWidth - The bandwidth of a single synchronous frame. Ignored if not sync channel. + * \param amounOfSyncFrames - The amount of synchronous frames per USB packet. Ignored if not sync channel. + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool ConfigureSyncChannel( const char *device, uint32_t syncBlockWidth, uint32_t amounOfSyncFrames ); + + + /*----------------------------------------------------------*/ + /*! \brief Creates a character device for the given device's link name. + * + * \param linkName - [in] Link name, which is needed to register this device to an AIM. + * \param deviceName - [in,out] Device name (starting with /dev/). + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool LinkToCharacterDevice( const char *linkName, const char *deviceName ); + + + /*----------------------------------------------------------*/ + /*! \brief Creates a audio device (ALSA) for the given device's link name. + * + * \param linkName - [in] Link name, which is needed to register this device to an AIM. + * \param subBufferSize - [in] The amount of bytes for all channels of this connection on the MOST. + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool LinkToAudioDevice( const char *linkName, uint16_t subBufferSize ); + + /*----------------------------------------------------------*/ + /*! \brief Creates a Video for Linux device (V4L) for the given device's link name. + * + * \param linkName - [in] Link name, which is needed to register this device to an AIM. + * + * \return True if no error + */ + /*----------------------------------------------------------*/ + bool LinkToVideoForLinuxDevice( const char *linkName ); + + + /*----------------------------------------------------------*/ + /*! \brief Parsed the global errno variable and generate a human readable error description out of it. + * + * \return Zero terminated error description string. + */ + /*----------------------------------------------------------*/ + const char *GetErrnoString(); + +#ifdef __cplusplus +} +#endif + +#endif //DRIVERCONFIGURATION_H -- cgit 1.2.3-korg