/* ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio. This file is part of ChibiOS. ChibiOS 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. ChibiOS 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 . */ /** * @file chfactory.h * @brief ChibiOS objects factory structures and macros. * * @addtogroup oslib_objects_factory * @{ */ #ifndef CHFACTORY_H #define CHFACTORY_H #if (CH_CFG_USE_FACTORY == TRUE) || defined(__DOXYGEN__) /*===========================================================================*/ /* Module constants. */ /*===========================================================================*/ /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ /** * @brief Maximum length for object names. * @details If the specified length is zero then the name is stored by * pointer but this could have unintended side effects. */ #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 #endif /** * @brief Enables the registry of generic objects. */ #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE #endif /** * @brief Enables factory for generic buffers. */ #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE #endif /** * @brief Enables factory for semaphores. */ #if !defined(CH_CFG_FACTORY_SEMAPHORES) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_SEMAPHORES TRUE #endif /** * @brief Enables factory for mailboxes. */ #if !defined(CH_CFG_FACTORY_MAILBOXES) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_MAILBOXES TRUE #endif /** * @brief Enables factory for objects FIFOs. */ #if !defined(CH_CFG_FACTORY_OBJ_FIFOS) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_OBJ_FIFOS TRUE #endif /** * @brief Enables factory for objects FIFOs. */ #if !defined(CH_CFG_FACTORY_OBJ_FIFOS) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_OBJ_FIFOS TRUE #endif /** * @brief Enables factory for Pipes. */ #if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) #define CH_CFG_FACTORY_PIPES TRUE #endif /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if (CH_CFG_FACTORY_SEMAPHORES == TRUE) && (CH_CFG_USE_SEMAPHORES == FALSE) /*lint -save -e767 [20.5] Valid because the #undef.*/ #undef CH_CFG_FACTORY_SEMAPHORES #define CH_CFG_FACTORY_SEMAPHORES FALSE /*lint restore*/ #endif #if (CH_CFG_FACTORY_MAILBOXES == TRUE) && (CH_CFG_USE_MAILBOXES == FALSE) /*lint -save -e767 [20.5] Valid because the #undef.*/ #undef CH_CFG_FACTORY_MAILBOXES #define CH_CFG_FACTORY_MAILBOXES FALSE /*lint restore*/ #endif #if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) && (CH_CFG_USE_OBJ_FIFOS == FALSE) /*lint -save -e767 [20.5] Valid because the #undef.*/ #undef CH_CFG_FACTORY_OBJ_FIFOS #define CH_CFG_FACTORY_OBJ_FIFOS FALSE /*lint restore*/ #endif #if (CH_CFG_FACTORY_PIPES == TRUE) && (CH_CFG_USE_PIPES == FALSE) /*lint -save -e767 [20.5] Valid because the #undef.*/ #undef CH_CFG_FACTORY_PIPES #define CH_CFG_FACTORY_PIPES FALSE /*lint restore*/ #endif #define CH_FACTORY_REQUIRES_POOLS \ ((CH_CFG_FACTORY_OBJECTS_REGISTRY == TRUE) || \ (CH_CFG_FACTORY_SEMAPHORES == TRUE)) #define CH_FACTORY_REQUIRES_HEAP \ ((CH_CFG_FACTORY_GENERIC_BUFFERS == TRUE) || \ (CH_CFG_FACTORY_MAILBOXES == TRUE) || \ (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) || \ (CH_CFG_FACTORY_PIPES == TRUE)) #if (CH_CFG_FACTORY_MAX_NAMES_LENGTH < 0) || \ (CH_CFG_FACTORY_MAX_NAMES_LENGTH > 32) #error "invalid CH_CFG_FACTORY_MAX_NAMES_LENGTH value" #endif #if (CH_CFG_USE_MUTEXES == FALSE) && (CH_CFG_USE_SEMAPHORES == FALSE) #error "CH_CFG_USE_FACTORY requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES" #endif #if CH_CFG_USE_MEMCORE == FALSE #error "CH_CFG_USE_FACTORY requires CH_CFG_USE_MEMCORE" #endif #if CH_FACTORY_REQUIRES_POOLS && (CH_CFG_USE_MEMPOOLS == FALSE) #error "CH_CFG_USE_MEMPOOLS is required" #endif #if CH_FACTORY_REQUIRES_HEAP && (CH_CFG_USE_HEAP == FALSE) #error "CH_CFG_USE_HEAP is required" #endif /*=====================================================
/*
    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

/**
 * @file    portab.c
 * @brief   Application portability module code.
 *
 * @addtogroup application_portability
 * @{
 */

#include "hal.h"
#include "portab.h"

/*===========================================================================*/
/* Module local definitions.                                                 */
/*===========================================================================*/

/*===========================================================================*/
/* Module exported variables.                                                */
/*===========================================================================*/

/*===========================================================================*/
/* Module local types.                                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Module local variables.                                                   */
/*===========================================================================*/

/*===========================================================================*/
/* Module local functions.                                                   */
/*===========================================================================*/

/*===========================================================================*/
/* Module exported functions.                                                */
/*===========================================================================*/

void portab_setup(void) {

}

/** @} */
return rop->objp; } #endif /* CH_CFG_FACTORY_OBJECTS_REGISTRY == TRUE */ #if (CH_CFG_FACTORY_GENERIC_BUFFERS == TRUE) || defined(__DOXYGEN__) /** * @brief Returns the size of a generic dynamic buffer object. * * @param[in] dbp dynamic buffer object reference * @return The size of the buffer object in bytes. * * @api */ static inline size_t chFactoryGetBufferSize(dyn_buffer_t *dbp) { return chHeapGetSize(dbp) - sizeof (dyn_element_t); } /** * @brief Returns the pointer to the inner buffer. * * @param[in] dbp dynamic buffer object reference * @return The pointer to the dynamic buffer. * * @api */ static inline uint8_t *chFactoryGetBuffer(dyn_buffer_t *dbp) { return dbp->buffer; } #endif /* CH_CFG_FACTORY_GENERIC_BUFFERS == TRUE */ #if (CH_CFG_FACTORY_SEMAPHORES == TRUE) || defined(__DOXYGEN__) /** * @brief Returns the pointer to the inner semaphore. * * @param[in] dsp dynamic semaphore object reference * @return The pointer to the semaphore. * * @api */ static inline semaphore_t *chFactoryGetSemaphore(dyn_semaphore_t *dsp) { return &dsp->sem; } #endif /* CH_CFG_FACTORY_SEMAPHORES == TRUE */ #if (CH_CFG_FACTORY_MAILBOXES == TRUE) || defined(__DOXYGEN__) /** * @brief Returns the pointer to the inner mailbox. * * @param[in] dmp dynamic mailbox object reference * @return The pointer to the mailbox. * * @api */ static inline mailbox_t *chFactoryGetMailbox(dyn_mailbox_t *dmp) { return &dmp->mbx; } #endif /* CH_CFG_FACTORY_MAILBOXES == TRUE */ #if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) || defined(__DOXYGEN__) /** * @brief Returns the pointer to the inner objects FIFO. * * @param[in] dofp dynamic "objects FIFO" object reference * @return The pointer to the objects FIFO. * * @api */ static inline objects_fifo_t *chFactoryGetObjectsFIFO(dyn_objects_fifo_t *dofp) { return &dofp->fifo; } #endif /* CH_CFG_FACTORY_OBJ_FIFOS == TRUE */ #if (CH_CFG_FACTORY_PIPES == TRUE) || defined(__DOXYGEN__) /** * @brief Returns the pointer to the inner pipe. * * @param[in] dpp dynamic pipe object reference * @return The pointer to the pipe. * * @api */ static inline pipe_t *chFactoryGetPipe(dyn_pipe_t *dpp) { return &dpp->pipe; } #endif /* CH_CFG_FACTORY_PIPES == TRUE */ #endif /* CH_CFG_USE_FACTORY == TRUE */ #endif /* CHFACTORY_H */ /** @} */