Added elfAcquireBus()/eflReleaseBus() functions to EFL driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15070 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
eb47d2ca91
commit
655ea2923c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
ChibiOS - Copyright (C) 2006..2021 Giovanni Di Sirio
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -35,6 +35,14 @@
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the @p eflAcquireUse() and @p eflReleaseUse() APIs.
|
||||||
|
* @note Disabling this option saves both code and data space.
|
||||||
|
*/
|
||||||
|
#if !defined(EFL_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
|
||||||
|
#define EFL_USE_MUTUAL_EXCLUSION TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Derived constants and error checks. */
|
/* Derived constants and error checks. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -96,10 +104,16 @@ typedef struct hal_efl_config {
|
||||||
*/
|
*/
|
||||||
struct hal_efl_driver {
|
struct hal_efl_driver {
|
||||||
/**
|
/**
|
||||||
* @brief SNORDriver Virtual Methods Table.
|
* @brief EFlashDriver Virtual Methods Table.
|
||||||
*/
|
*/
|
||||||
const struct EFlashDriverVMT *vmt;
|
const struct EFlashDriverVMT *vmt;
|
||||||
_efl_driver_data
|
_efl_driver_data
|
||||||
|
#if (EFL_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @brief Mutex protecting EFL.
|
||||||
|
*/
|
||||||
|
mutex_t mutex;
|
||||||
|
#endif /* EFL_USE_MUTUAL_EXCLUSION == TRUE */
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
efl_lld_driver_fields;
|
efl_lld_driver_fields;
|
||||||
};
|
};
|
||||||
|
@ -115,10 +129,12 @@ struct hal_efl_driver {
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void eflInit(void);
|
void eflInit(void);
|
||||||
void eflObjectInit(EFlashDriver *eflp);
|
void eflObjectInit(EFlashDriver *eflp);
|
||||||
msg_t eflStart(EFlashDriver *eflp, const EFlashConfig *config);
|
msg_t eflStart(EFlashDriver *eflp, const EFlashConfig *config);
|
||||||
void eflStop(EFlashDriver *eflp);
|
void eflStop(EFlashDriver *eflp);
|
||||||
|
void eflAcquireBus(EFlashDriver *eflp);
|
||||||
|
void eflReleaseBus(EFlashDriver *eflp);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
ChibiOS - Copyright (C) 2006..2021 Giovanni Di Sirio
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -80,6 +80,9 @@ void eflObjectInit(EFlashDriver *eflp) {
|
||||||
|
|
||||||
eflp->vmt = &vmt;
|
eflp->vmt = &vmt;
|
||||||
eflp->state = FLASH_STOP;
|
eflp->state = FLASH_STOP;
|
||||||
|
#if EFL_USE_MUTUAL_EXCLUSION == TRUE
|
||||||
|
osalMutexObjectInit(&eflp->mutex);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,6 +148,42 @@ void eflStop(EFlashDriver *eflp) {
|
||||||
osalSysUnlock();
|
osalSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (EFL_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @brief Gains exclusive access to EFL.
|
||||||
|
* @details This function tries to gain ownership of EFL. If EFL
|
||||||
|
* is already being used then the invoking thread is queued.
|
||||||
|
* @pre In order to use this function the option @p EFL_USE_MUTUAL_EXCLUSION
|
||||||
|
* must be enabled.
|
||||||
|
*
|
||||||
|
* @param[in] eflp pointer to the @p EFlashDriver object
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void eflAcquireBus(EFlashDriver *eflp) {
|
||||||
|
|
||||||
|
osalDbgCheck(eflp != NULL);
|
||||||
|
|
||||||
|
osalMutexLock(&eflp->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Releases exclusive access to EFL.
|
||||||
|
* @pre In order to use this function the option @p EFL_USE_MUTUAL_EXCLUSION
|
||||||
|
* must be enabled.
|
||||||
|
*
|
||||||
|
* @param[in] eflp pointer to the @p EFlashDriver object
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void eflReleaseBus(EFlashDriver *eflp) {
|
||||||
|
|
||||||
|
osalDbgCheck(eflp != NULL);
|
||||||
|
|
||||||
|
osalMutexUnlock(&eflp->mutex);
|
||||||
|
}
|
||||||
|
#endif /* EFL_USE_MUTUAL_EXCLUSION == TRUE */
|
||||||
|
|
||||||
#endif /* HAL_USE_EFL == TRUE */
|
#endif /* HAL_USE_EFL == TRUE */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** Next ***
|
*** Next ***
|
||||||
|
- NEW: Added elfAcquireBus()/eflReleaseBus() functions to EFL driver.
|
||||||
- NEW: Increased stacks size in RT test suite from 128 to 192. added an
|
- NEW: Increased stacks size in RT test suite from 128 to 192. added an
|
||||||
option to override the stack size by defining THREADS_STACK_SIZE
|
option to override the stack size by defining THREADS_STACK_SIZE
|
||||||
in the makefile.
|
in the makefile.
|
||||||
|
|
Loading…
Reference in New Issue