Add software

This commit is contained in:
RocketGod
2022-09-22 09:26:57 -07:00
parent fee0ab05fd
commit 957ea3d712
4511 changed files with 1943182 additions and 0 deletions

View File

@ -0,0 +1,121 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 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 xxx.c
* @brief XXX Driver code.
*
* @addtogroup XXX
* @{
*/
#include "ch.h"
#include "hal.h"
#if HAL_USE_XXX || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/**
* @brief XXX Driver initialization.
* @note This function is implicitly invoked by @p halInit(), there is
* no need to explicitly initialize the driver.
*
* @init
*/
void xxxInit(void) {
xxx_lld_init();
}
/**
* @brief Initializes the standard part of a @p XXXDriver structure.
*
* @param[out] xxxp pointer to the @p XXXDriver object
*
* @init
*/
void xxxObjectInit(XXXDriver *xxxp) {
xxxp->state = XXX_STOP;
xxxp->config = NULL;
}
/**
* @brief Configures and activates the XXX peripheral.
*
* @param[in] xxxp pointer to the @p XXXDriver object
* @param[in] config pointer to the @p XXXConfig object
*
* @api
*/
void xxxStart(XXXDriver *xxxp, const XXXConfig *config) {
chDbgCheck((xxxp != NULL) && (config != NULL), "xxxStart");
chSysLock();
chDbgAssert((xxxp->state == XXX_STOP) || (xxxp->state == XXX_READY),
"xxxStart(), #1", "invalid state");
xxxp->config = config;
xxx_lld_start(xxxp);
xxxp->state = XXX_READY;
chSysUnlock();
}
/**
* @brief Deactivates the XXX peripheral.
*
* @param[in] xxxp pointer to the @p XXXDriver object
*
* @api
*/
void xxxStop(XXXDriver *xxxp) {
chDbgCheck(xxxp != NULL, "xxxStop");
chSysLock();
chDbgAssert((xxxp->state == XXX_STOP) || (xxxp->state == XXX_READY),
"xxxStop(), #1", "invalid state");
xxx_lld_stop(xxxp);
xxxp->state = XXX_STOP;
chSysUnlock();
}
#endif /* HAL_USE_XXX */
/** @} */

View File

@ -0,0 +1,85 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 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 xxx.h
* @brief XXX Driver macros and structures.
*
* @addtogroup XXX
* @{
*/
#ifndef _XXX_H_
#define _XXX_H_
#if HAL_USE_XXX || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief Driver state machine possible states.
*/
typedef enum {
XXX_UNINIT = 0, /**< Not initialized. */
XXX_STOP = 1, /**< Stopped. */
XXX_READY = 2, /**< Ready. */
} xxxstate_t;
/**
* @brief Type of a structure representing a XXX driver.
*/
typedef struct XXXDriver XXXDriver;
#include "xxx_lld.h"
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
void xxxInit(void);
void xxxObjectInit(XXXDriver *xxxp);
void xxxStart(XXXDriver *xxxp, const XXXConfig *config);
void xxxStop(XXXDriver *xxxp);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_XXX */
#endif /* _XXX_H_ */
/** @} */

View File

@ -0,0 +1,122 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 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 templates/xxx_lld.c
* @brief XXX Driver subsystem low level driver source template.
*
* @addtogroup XXX
* @{
*/
#include "ch.h"
#include "hal.h"
#if HAL_USE_XXX || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/**
* @brief XXX1 driver identifier.
*/
#if PLATFORM_XXX_USE_XXX1 || defined(__DOXYGEN__)
XXXDriver XXXD1;
#endif
/*===========================================================================*/
/* Driver local types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/**
* @brief Low level XXX driver initialization.
*
* @notapi
*/
void xxx_lld_init(void) {
#if PLATFORM_XXX_USE_XXX1
/* Driver initialization.*/
xxxObjectInit(&XXXD1);
#endif /* PLATFORM_XXX_USE_XXX1 */
}
/**
* @brief Configures and activates the XXX peripheral.
*
* @param[in] xxxp pointer to the @p XXXDriver object
*
* @notapi
*/
void xxx_lld_start(XXXDriver *xxxp) {
if (xxxp->state == XXX_STOP) {
/* Enables the peripheral.*/
#if PLATFORM_XXX_USE_XXX1
if (&XXXD1 == xxxp) {
}
#endif /* PLATFORM_XXX_USE_XXX1 */
}
/* Configures the peripheral.*/
}
/**
* @brief Deactivates the XXX peripheral.
*
* @param[in] xxxp pointer to the @p XXXDriver object
*
* @notapi
*/
void xxx_lld_stop(XXXDriver *xxxp) {
if (xxxp->state == XXX_READY) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
#if PLATFORM_XXX_USE_XXX1
if (&XXXD1 == xxxp) {
}
#endif /* PLATFORM_XXX_USE_XXX1 */
}
}
#endif /* HAL_USE_XXX */
/** @} */

View File

@ -0,0 +1,113 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 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 templates/xxx_lld.h
* @brief XXX Driver subsystem low level driver header template.
*
* @addtogroup XXX
* @{
*/
#ifndef _XXX_LLD_H_
#define _XXX_LLD_H_
#if HAL_USE_XXX || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
* @name Configuration options
* @{
*/
/**
* @brief XXX driver enable switch.
* @details If set to @p TRUE the support for XXX1 is included.
*/
#if !defined(PLATFORM_XXX_USE_XXX1) || defined(__DOXYGEN__)
#define PLATFORM_XXX_USE_XXX1 FALSE
#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief Type of a structure representing an XXX driver.
*/
typedef struct XXXDriver XXXDriver;
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/
typedef struct {
} XXXConfig;
/**
* @brief Structure representing an XXX driver.
*/
struct XXXDriver {
/**
* @brief Driver state.
*/
xxxstate_t state;
/**
* @brief Current configuration data.
*/
const XXXConfig *config;
/* End of the mandatory fields.*/
};
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if PLATFORM_XXX_USE_XXX1 && !defined(__DOXYGEN__)
extern XXXDriver XXXD1;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void xxx_lld_init(void);
void xxx_lld_start(XXXDriver *xxxp);
void xxx_lld_stop(XXXDriver *xxxp);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_XXX */
#endif /* _XXX_LLD_H_ */
/** @} */