@@ -16,6 +16,7 @@
#include "gpio.h"
#include "i2c.h"
+#include "pwm.h"
#include "i2s.h"
extern int bbb_backend;
@@ -74,38 +75,6 @@ struct protocol_version_rsp {
__u8 version_minor;
};
-/* PWM */
-struct pwm_count_rsp {
- __u8 count;
-};
-
-struct pwm_activate_req {
- __u8 which;
-};
-
-struct pwm_deactivate_req {
- __u8 which;
-};
-
-struct pwm_config_req {
- __u8 which;
- __le32 duty __attribute__((__packed__));
- __le32 period __attribute__((__packed__));
-};
-
-struct pwm_polarity_req {
- __u8 which;
- __u8 polarity;
-};
-
-struct pwm_enable_req {
- __u8 which;
-};
-
-struct pwm_disable_req {
- __u8 which;
-};
-
/* Ops */
struct op_msg {
struct op_header header;
@@ -130,13 +99,13 @@ struct op_msg {
struct gb_i2c_functionality_response i2c_fcn_rsp;
struct gb_i2c_transfer_request i2c_xfer_req;
struct gb_i2c_transfer_response i2c_xfer_rsp;
- struct pwm_count_rsp pwm_cnt_rsp;
- struct pwm_activate_req pwm_act_req;
- struct pwm_deactivate_req pwm_deact_req;
- struct pwm_config_req pwm_cfg_req;
- struct pwm_polarity_req pwm_pol_req;
- struct pwm_enable_req pwm_enb_req;
- struct pwm_disable_req pwm_dis_req;
+ struct gb_pwm_count_response pwm_cnt_rsp;
+ struct gb_pwm_activate_request pwm_act_req;
+ struct gb_pwm_deactivate_request pwm_deact_req;
+ struct gb_pwm_config_request pwm_cfg_req;
+ struct gb_pwm_polarity_request pwm_pol_req;
+ struct gb_pwm_enable_request pwm_enb_req;
+ struct gb_pwm_disable_request pwm_dis_req;
struct gb_i2s_mgmt_get_supported_configurations_response i2s_mgmt_get_sup_conf_rsp;
struct gb_i2s_mgmt_get_processing_delay_response i2s_mgmt_get_proc_delay_rsp;
};
@@ -18,17 +18,6 @@
#include "gbsim.h"
-#define GB_PWM_TYPE_INVALID 0x00
-#define GB_PWM_TYPE_PROTOCOL_VERSION 0x01
-#define GB_PWM_TYPE_PWM_COUNT 0x02
-#define GB_PWM_TYPE_ACTIVATE 0x03
-#define GB_PWM_TYPE_DEACTIVATE 0x04
-#define GB_PWM_TYPE_CONFIG 0x05
-#define GB_PWM_TYPE_POLARITY 0x06
-#define GB_PWM_TYPE_ENABLE 0x07
-#define GB_PWM_TYPE_DISABLE 0x08
-#define GB_PWM_TYPE_RESPONSE 0x80
-
static int pwm_on[2];
static pwm *pwms[2];
@@ -71,7 +60,7 @@ void pwm_handler(__u8 *rbuf, size_t size)
write(cport_in, cport_rsp, sz + 1);
break;
case GB_PWM_TYPE_PWM_COUNT:
- sz = sizeof(struct op_header) + sizeof(struct pwm_count_rsp);
+ sz = sizeof(struct op_header) + sizeof(struct gb_pwm_count_response);
op_rsp->header.size = htole16((__u16)sz);
op_rsp->header.id = oph->id;
op_rsp->header.type = OP_RESPONSE | GB_PWM_TYPE_PWM_COUNT;
Instead of duplicating the definitions, reuse the definitions in the newly split out greybus pwm.h header. Cc: Alex Elder <alex.elder@linaro.org> Cc: Greg Kroah-Hartman <gregkh@google.com> Signed-off-by: John Stultz <john.stultz@linaro.org> --- gbsim.h | 47 ++++++++--------------------------------------- pwm.c | 13 +------------ 2 files changed, 9 insertions(+), 51 deletions(-)