aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/templates
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-08 18:16:38 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-08 18:16:38 +0000
commitf407e4a84fcf2cf3bb003ed36f80ec136f8683c2 (patch)
tree4320f476744a99f1814e4ad5007e8fc87e8467ff /os/hal/templates
parent38cc48d575a6232cfd440d97711f89f5f531422d (diff)
downloadChibiOS-f407e4a84fcf2cf3bb003ed36f80ec136f8683c2.tar.gz
ChibiOS-f407e4a84fcf2cf3bb003ed36f80ec136f8683c2.tar.bz2
ChibiOS-f407e4a84fcf2cf3bb003ed36f80ec136f8683c2.zip
HAL improvements, mailboxes macro name changed.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2238 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/templates')
-rw-r--r--os/hal/templates/adc_lld.h26
-rw-r--r--os/hal/templates/i2c_lld.h13
-rw-r--r--os/hal/templates/pwm_lld.h34
-rw-r--r--os/hal/templates/uart_lld.h13
4 files changed, 65 insertions, 21 deletions
diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h
index 6486abb37..2b2e8dd58 100644
--- a/os/hal/templates/adc_lld.h
+++ b/os/hal/templates/adc_lld.h
@@ -61,12 +61,19 @@ typedef uint16_t adcsample_t;
typedef uint16_t adc_channels_num_t;
/**
+ * @brief Type of a structure representing an ADC driver.
+ */
+typedef struct ADCDriver ADCDriver;
+
+/**
* @brief ADC notification callback type.
*
+ * @param[in] adcp pointer to the @p ADCDriver object triggering the
+ * callback
* @param[in] buffer pointer to the most recent samples data
* @param[in] n number of buffer rows available starting from @p buffer
*/
-typedef void (*adccallback_t)(adcsample_t *buffer, size_t n);
+typedef void (*adccallback_t)(ADCDriver *adcp, adcsample_t *buffer, size_t n);
/**
* @brief Conversion group configuration structure.
@@ -84,6 +91,10 @@ typedef struct {
* @brief Number of the analog channels belonging to the conversion group.
*/
adc_channels_num_t acg_num_channels;
+ /**
+ * @brief Callback function associated to the group or @p NULL.
+ */
+ adccallback_t acg_callback;
/* End of the mandatory fields.*/
} ADCConversionGroup;
@@ -102,7 +113,7 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct ADCDriver {
/**
* @brief Driver state.
*/
@@ -112,10 +123,6 @@ typedef struct {
*/
const ADCConfig *ad_config;
/**
- * @brief Current callback function or @p NULL.
- */
- adccallback_t ad_callback;
- /**
* @brief Current samples buffer pointer or @p NULL.
*/
adcsample_t *ad_samples;
@@ -127,14 +134,17 @@ typedef struct {
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *ad_grpp;
-#if ADC_USE_WAIT
+#if ADC_USE_WAIT || defined(__DOXYGEN__)
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
#endif
+#if defined(ADC_DRIVER_EXT_FIELDS)
+ ADC_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} ADCDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/templates/i2c_lld.h b/os/hal/templates/i2c_lld.h
index 77c67cc07..bf7a64082 100644
--- a/os/hal/templates/i2c_lld.h
+++ b/os/hal/templates/i2c_lld.h
@@ -46,6 +46,12 @@
/* Driver data structures and types. */
/*===========================================================================*/
+
+/**
+ * @brief Type of a structure representing an I2C driver.
+ */
+typedef struct I2CDriver I2CDriver;
+
/**
* @brief I2C completion callback type.
*
@@ -70,15 +76,18 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct I2CDriver {
/** @brief Driver state.*/
i2cstate_t id_state;
/** @brief Current configuration data.*/
const I2CConfig *id_config;
/** @brief Current callback.*/
i2ccallback_t id_callback;
+#if defined(I2C_DRIVER_EXT_FIELDS)
+ I2C_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} I2CDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h
index b74582d9d..6d499d791 100644
--- a/os/hal/templates/pwm_lld.h
+++ b/os/hal/templates/pwm_lld.h
@@ -62,13 +62,34 @@ typedef uint8_t pwmchannel_t;
typedef uint16_t pwmcnt_t;
/**
+ * @brief Type of a structure representing an PWM driver.
+ */
+typedef struct PWMDriver PWMDriver;
+
+/**
+ * @brief PWM notification callback type.
+ *
+ * @param[in] pwmp pointer to a @p PWMDriver object
+ */
+typedef void (*pwmcallback_t)(PWMDriver *pwmp);
+
+/**
* @brief Driver configuration structure.
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
- * @note It could be empty on some architectures.
*/
typedef struct {
-
+ /**
+ * @brief Periodic callback pointer.
+ * @note This callback is invoked on PWM counter reset. If set to
+ * @p NULL then the callback is disabled.
+ */
+ pwmcallback_t pc_callback;
+ /**
+ * @brief Channels configurations.
+ */
+ PWMChannelConfig pc_channels[PWM_CHANNELS];
+ /* End of the mandatory fields.*/
} PWMConfig;
/**
@@ -76,7 +97,7 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct PWMDriver {
/**
* @brief Driver state.
*/
@@ -85,8 +106,11 @@ typedef struct {
* @brief Current configuration data.
*/
const PWMConfig *pd_config;
+#if defined(PWM_DRIVER_EXT_FIELDS)
+ PWM_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} PWMDriver;
+};
/*===========================================================================*/
/* Driver macros. */
@@ -103,8 +127,6 @@ extern "C" {
void pwm_lld_start(PWMDriver *pwmp);
void pwm_lld_stop(PWMDriver *pwmp);
bool_t pwm_lld_is_enabled(PWMDriver *pwmp, pwmchannel_t channel);
- void pwm_lld_set_callback(PWMDriver *pwmp, pwmchannel_t channel,
- pwmedge_t edge, pwmcallback_t callback);
void pwm_lld_enable_channel(PWMDriver *pwmp,
pwmchannel_t channel,
pwmcnt_t width);
diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h
index ba55d723b..4b80633dc 100644
--- a/os/hal/templates/uart_lld.h
+++ b/os/hal/templates/uart_lld.h
@@ -52,9 +52,7 @@
typedef uint32_t uartflags_t;
/**
- * @brief Structure representing an UART driver.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
+ * @brief Type of structure representing an UART driver.
*/
typedef struct UARTDriver UARTDriver;
@@ -68,7 +66,8 @@ typedef void (*uartcb_t)(UARTDriver *uartp);
/**
* @brief Character received UART notification callback type.
*
- * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] uartp pointer to the @p UARTDriver object triggering the
+ * callback
* @param[in] c received character
*/
typedef void (*uartccb_t)(UARTDriver *uartp, uint16_t c);
@@ -76,7 +75,8 @@ typedef void (*uartccb_t)(UARTDriver *uartp, uint16_t c);
/**
* @brief Receive error UART notification callback type.
*
- * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] uartp pointer to the @p UARTDriver object triggering the
+ * callback
* @param[in] e receive error mask
*/
typedef void (*uartecb_t)(UARTDriver *uartp, uartflags_t e);
@@ -122,6 +122,9 @@ struct UARTDriver {
* @brief Current configuration data.
*/
const UARTConfig *ud_config;
+#if defined(UART_DRIVER_EXT_FIELDS)
+ UART_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
};