git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1349 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
471dc00786
commit
19bcadbd6c
|
@ -24,8 +24,10 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <adc.h>
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if CH_HAL_USE_ADC
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Low Level Driver exported variables. */
|
/* Low Level Driver exported variables. */
|
||||||
|
@ -94,4 +96,6 @@ void adc_lld_stop_conversion(ADCDriver *adcp) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_ADC */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#ifndef _ADC_LLD_H_
|
#ifndef _ADC_LLD_H_
|
||||||
#define _ADC_LLD_H_
|
#define _ADC_LLD_H_
|
||||||
|
|
||||||
|
#if CH_HAL_USE_ADC
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -132,6 +134,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_ADC */
|
||||||
|
|
||||||
#endif /* _ADC_LLD_H_ */
|
#endif /* _ADC_LLD_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <can.h>
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if CH_HAL_USE_CAN
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Low Level Driver exported variables. */
|
/* Low Level Driver exported variables. */
|
||||||
|
@ -87,7 +89,7 @@ void can_lld_stop(CANDriver *canp) {
|
||||||
*/
|
*/
|
||||||
bool_t can_lld_can_transmit(CANDriver *canp) {
|
bool_t can_lld_can_transmit(CANDriver *canp) {
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +117,7 @@ msg_t can_lld_transmit(CANDriver *canp, const CANFrame *cfp) {
|
||||||
*/
|
*/
|
||||||
bool_t can_lld_can_receive(CANDriver *canp) {
|
bool_t can_lld_can_receive(CANDriver *canp) {
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,4 +154,6 @@ void can_lld_wakeup(CANDriver *canp) {
|
||||||
}
|
}
|
||||||
#endif /* CAN_USE_SLEEP_MODE */
|
#endif /* CAN_USE_SLEEP_MODE */
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_CAN */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#ifndef _CAN_LLD_H_
|
#ifndef _CAN_LLD_H_
|
||||||
#define _CAN_LLD_H_
|
#define _CAN_LLD_H_
|
||||||
|
|
||||||
|
#if CH_HAL_USE_CAN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This switch defines whether the driver implementation supports
|
* @brief This switch defines whether the driver implementation supports
|
||||||
* a low power switch mode with automatic an wakeup feature.
|
* a low power switch mode with automatic an wakeup feature.
|
||||||
|
@ -58,12 +60,28 @@
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CAN frame.
|
||||||
|
* @note Accessing the frame data as word16 or word32 is not portable because
|
||||||
|
* machine data endianness, it can be still useful for a quick filling.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint8_t cf_DLC:4; /**< @brief Data length. */
|
||||||
|
uint8_t cf_IDE:1; /**< @brief Identifier type. */
|
||||||
|
uint8_t cf_RTR:1; /**< @brief Frame type. */
|
||||||
|
uint32_t cf_id; /**< @brief Frame identifier. */
|
||||||
|
union {
|
||||||
|
uint8_t cf_data8[8]; /**< @brief Frame data. */
|
||||||
|
uint16_t cf_data16[4]; /**< @brief Frame data. */
|
||||||
|
uint32_t cf_data32[2]; /**< @brief Frame data. */
|
||||||
|
};
|
||||||
|
} CANFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Driver configuration structure.
|
* @brief Driver configuration structure.
|
||||||
* @note It could be empty on some architectures.
|
* @note It could be empty on some architectures.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
} CANConfig;
|
} CANConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +112,7 @@ typedef struct {
|
||||||
* @brief One or more transmission slots become available.
|
* @brief One or more transmission slots become available.
|
||||||
*/
|
*/
|
||||||
EventSource can_txempty_event;
|
EventSource can_txempty_event;
|
||||||
#if CAN_USE_SLEEP_MODE || defined __DOXYGEN__)
|
#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief Entering sleep state event.
|
* @brief Entering sleep state event.
|
||||||
*/
|
*/
|
||||||
|
@ -129,6 +147,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_CAN */
|
||||||
|
|
||||||
#endif /* _CAN_LLD_H_ */
|
#endif /* _CAN_LLD_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/hal_lld.c
|
||||||
|
* @brief HAL Driver subsystem low level driver source template
|
||||||
|
* @addtogroup HAL_LLD
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
#include <hal.h>
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver local variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver local functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver interrupt handlers. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Low level HAL driver initialization.
|
||||||
|
*/
|
||||||
|
void hal_lld_init(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/hal_lld.h
|
||||||
|
* @brief HAL subsystem low level driver header template
|
||||||
|
* @addtogroup HAL_LLD
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_LLD_H_
|
||||||
|
#define _HAL_LLD_H_
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver pre-compile time settings. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver constants. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver data structures and types. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* External declarations. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void hal_lld_init(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _HAL_LLD_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/halconf.h
|
||||||
|
* @brief HAL configuration header.
|
||||||
|
* @addtogroup HAL_CONF
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HALCONF_H_
|
||||||
|
#define _HALCONF_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the PAL subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_PAL TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ADC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_ADC TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the CAN subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_CAN TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MAC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_MAC TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MII subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_MII) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_MII TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SERIAL subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_SERIAL TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SPI subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_SPI TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MMC_SPI subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||||
|
#define CH_HAL_USE_MMC_SPI TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _HALCONF_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -24,8 +24,10 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <mac.h>
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if CH_HAL_USE_MAC
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Low level MAC initialization.
|
* @brief Low level MAC initialization.
|
||||||
|
@ -146,4 +148,6 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_MAC */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#ifndef _MAC_LLD_H_
|
#ifndef _MAC_LLD_H_
|
||||||
#define _MAC_LLD_H_
|
#define _MAC_LLD_H_
|
||||||
|
|
||||||
|
#if CH_HAL_USE_MAC
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -112,6 +114,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_MAC */
|
||||||
|
|
||||||
#endif /* _MAC_LLD_H_ */
|
#endif /* _MAC_LLD_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file XXX.c
|
||||||
|
* @brief XXX Driver code.
|
||||||
|
* @addtogroup XXX
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
#include <xxx.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief XXX Driver initialization.
|
||||||
|
*/
|
||||||
|
void xxxInit(void) {
|
||||||
|
|
||||||
|
xxx_lld_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes the standard part of a @p XXXDriver structure.
|
||||||
|
*
|
||||||
|
* @param[in] xxxp pointer to the @p XXXDriver object
|
||||||
|
*/
|
||||||
|
void xxxObjectInit(XXXDriver *xxxp) {
|
||||||
|
|
||||||
|
xxxp->xxx_state = XXX_STOP;
|
||||||
|
xxxp->xxx_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
|
||||||
|
*/
|
||||||
|
void xxxStart(XXXDriver *xxxp, const XXXConfig *config) {
|
||||||
|
|
||||||
|
chDbgCheck((xxxp != NULL) && (config != NULL), "xxxStart");
|
||||||
|
|
||||||
|
chSysLock();
|
||||||
|
chDbgAssert((xxxp->xxx_state == XXX_STOP) || (xxxp->xxx_state == XXX_READY),
|
||||||
|
"xxxStart(), #1",
|
||||||
|
"invalid state");
|
||||||
|
xxxp->xxx_config = config;
|
||||||
|
xxx_lld_start(xxxp);
|
||||||
|
xxxp->xxx_state = XXX_READY;
|
||||||
|
chSysUnlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deactivates the XXX peripheral.
|
||||||
|
*
|
||||||
|
* @param[in] xxxp pointer to the @p XXXDriver object
|
||||||
|
*/
|
||||||
|
void xxxStop(XXXDriver *xxxp) {
|
||||||
|
|
||||||
|
chDbgCheck(xxxp != NULL, "xxxStop");
|
||||||
|
|
||||||
|
chSysLock();
|
||||||
|
chDbgAssert((xxxp->xxx_state == XXX_STOP) || (xxxp->xxx_state == XXX_READY),
|
||||||
|
"xxxStop(), #1",
|
||||||
|
"invalid state");
|
||||||
|
xxx_lld_stop(xxxp);
|
||||||
|
xxxp->xxx_state = XXX_STOP;
|
||||||
|
chSysUnlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file xxx.h
|
||||||
|
* @brief XXX Driver macros and structures.
|
||||||
|
* @addtogroup XXX
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XXX_H_
|
||||||
|
#define _XXX_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Driver state machine possible states.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
XXX_UNINIT = 0, /**< @brief Not initialized. */
|
||||||
|
XXX_STOP = 1, /**< @brief Stopped. */
|
||||||
|
XXX_READY = 2, /**< @brief Ready. */
|
||||||
|
} xxxstate_t;
|
||||||
|
|
||||||
|
#include "xxx_lld.h"
|
||||||
|
|
||||||
|
#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 /* _XXX_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/xxx_lld.c
|
||||||
|
* @brief XXX Driver subsystem low level driver source template
|
||||||
|
* @addtogroup XXX_LLD
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
#include <xxx.h>
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver local variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver local functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver interrupt handlers. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Low level XXX driver initialization.
|
||||||
|
*/
|
||||||
|
void xxx_lld_init(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures and activates the XXX peripheral.
|
||||||
|
*
|
||||||
|
* @param[in] xxxp pointer to the @p XXXDriver object
|
||||||
|
*/
|
||||||
|
void xxx_lld_start(XXXDriver *xxxp) {
|
||||||
|
|
||||||
|
if (xxxp->xxx_state == XXX_STOP) {
|
||||||
|
/* Clock activation.*/
|
||||||
|
}
|
||||||
|
/* Configuration.*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deactivates the XXX peripheral.
|
||||||
|
*
|
||||||
|
* @param[in] xxxp pointer to the @p XXXDriver object
|
||||||
|
*/
|
||||||
|
void xxx_lld_stop(XXXDriver *xxxp) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT 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/RT 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/xxx_lld.h
|
||||||
|
* @brief XXX Driver subsystem low level driver header template
|
||||||
|
* @addtogroup XXX_LLD
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XXX_LLD_H_
|
||||||
|
#define _XXX_LLD_H_
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver pre-compile time settings. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver constants. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver data structures and types. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Driver configuration structure.
|
||||||
|
* @note It could be empty on some architectures.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
} XXXConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Structure representing an XXX driver.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
/**
|
||||||
|
* @brief Driver state.
|
||||||
|
*/
|
||||||
|
xxxstate_t xxx_state;
|
||||||
|
/**
|
||||||
|
* @brief Current configuration data.
|
||||||
|
*/
|
||||||
|
const XXXConfig *xxx_config;
|
||||||
|
/* End of the mandatory fields.*/
|
||||||
|
} XXXDriver;
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* External declarations. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#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 /* _XXX_LLD_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -24,9 +24,9 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <mac.h>
|
#include "mac.h"
|
||||||
#include <mii.h>
|
#include "mii.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Low level MII driver initialization.
|
* @brief Low level MII driver initialization.
|
||||||
|
|
|
@ -24,7 +24,31 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <pal.h>
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if CH_HAL_USE_PAL
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver local variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver local functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver interrupt handlers. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver exported functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_PAL */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#ifndef _PAL_LLD_H_
|
#ifndef _PAL_LLD_H_
|
||||||
#define _PAL_LLD_H_
|
#define _PAL_LLD_H_
|
||||||
|
|
||||||
|
#if CH_HAL_USE_PAL
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Unsupported modes and specific modes */
|
/* Unsupported modes and specific modes */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -317,6 +319,8 @@ typedef uint32_t ioportid_t;
|
||||||
*/
|
*/
|
||||||
#define pal_lld_setpadmode(port, pad, mode)
|
#define pal_lld_setpadmode(port, pad, mode)
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_PAL */
|
||||||
|
|
||||||
#endif /* _PAL_LLD_H_ */
|
#endif /* _PAL_LLD_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <serial.h>
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if CH_HAL_USE_SERIAL
|
||||||
|
|
||||||
/** @brief Driver default configuration.*/
|
/** @brief Driver default configuration.*/
|
||||||
static const SerialDriverConfig default_config = {
|
static const SerialDriverConfig default_config = {
|
||||||
|
@ -84,4 +86,6 @@ void sd_lld_stop(SerialDriver *sdp) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_SERIAL */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#ifndef _SERIAL_LLD_H_
|
#ifndef _SERIAL_LLD_H_
|
||||||
#define _SERIAL_LLD_H_
|
#define _SERIAL_LLD_H_
|
||||||
|
|
||||||
|
#if CH_HAL_USE_SERIAL
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -104,6 +106,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_SERIAL */
|
||||||
|
|
||||||
#endif /* _SERIAL_LLD_H_ */
|
#endif /* _SERIAL_LLD_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <spi.h>
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if CH_HAL_USE_SPI
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Low Level Driver exported variables. */
|
/* Low Level Driver exported variables. */
|
||||||
|
@ -153,4 +155,6 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_SPI */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#ifndef _SPI_LLD_H_
|
#ifndef _SPI_LLD_H_
|
||||||
#define _SPI_LLD_H_
|
#define _SPI_LLD_H_
|
||||||
|
|
||||||
|
#if CH_HAL_USE_SPI
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -99,6 +101,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CH_HAL_USE_SPI */
|
||||||
|
|
||||||
#endif /* _SPI_LLD_H_ */
|
#endif /* _SPI_LLD_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
Loading…
Reference in New Issue