Skip to content

Commit bd7640b

Browse files
committed
デバイス関連の関数をrtmouse_dev.cへ移動
1 parent 93ad739 commit bd7640b

File tree

3 files changed

+883
-857
lines changed

3 files changed

+883
-857
lines changed

src/drivers/rtmouse.h

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,29 @@
229229
/* --- Buffer --- */
230230
#define MAX_BUFLEN 64
231231

232+
/* --- Variable Type definitions --- */
233+
/* SPI */
234+
struct mcp3204_drvdata {
235+
struct spi_device *spi;
236+
struct mutex lock;
237+
unsigned char tx[MCP320X_PACKET_SIZE] ____cacheline_aligned;
238+
unsigned char rx[MCP320X_PACKET_SIZE] ____cacheline_aligned;
239+
struct spi_transfer xfer ____cacheline_aligned;
240+
struct spi_message msg ____cacheline_aligned;
241+
};
242+
243+
/* I2C */
244+
struct rtcnt_device_info {
245+
struct cdev cdev;
246+
unsigned int device_major;
247+
unsigned int device_minor;
248+
struct class *device_class;
249+
struct i2c_client *client;
250+
struct mutex lock;
251+
int signed_pulse_count;
252+
int raw_pulse_count;
253+
};
254+
232255
/* --- extern --- */
233256
extern unsigned int NUM_DEV[ID_DEV_SIZE];
234257
extern char *NAME_DEV[ID_DEV_SIZE];
@@ -251,11 +274,26 @@ extern unsigned int motor_l_freq_is_positive;
251274
extern unsigned int motor_r_freq_is_positive;
252275
extern struct i2c_device_id i2c_counter_id[];
253276
extern struct i2c_driver i2c_counter_driver;
277+
extern struct file_operations dev_fops[ID_DEV_SIZE];
254278

255279
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
256280
extern struct device *mcp320x_dev;
257281
#endif
258282

259-
void tmp_func(void);
283+
/* --- function --- */
284+
int dev_open(struct inode *inode, struct file *filep);
285+
int dev_release(struct inode *inode, struct file *filep);
286+
int i2c_dev_open(struct inode *inode, struct file *filep);
287+
int i2c_dev_release(struct inode *inode, struct file *filep);
288+
ssize_t led_write(struct file *filep, const char __user *buf, size_t count, loff_t *f_pos);
289+
ssize_t buzzer_write(struct file *filep, const char __user *buf, size_t count, loff_t *f_pos);
290+
ssize_t rawmotor_l_write(struct file *filep, const char __user *buf, size_t count, loff_t *f_pos);
291+
ssize_t rawmotor_r_write(struct file *filep, const char __user *buf, size_t count, loff_t *f_pos);
292+
ssize_t motoren_write(struct file *filep, const char __user *buf, size_t count, loff_t *f_pos);
293+
ssize_t motor_write(struct file *filep, const char __user *buf, size_t count, loff_t *f_pos);
294+
int rpi_gpio_function_set(int pin, uint32_t func);
295+
void rpi_gpio_set32(uint32_t mask, uint32_t val);
296+
void rpi_gpio_clear32(uint32_t mask, uint32_t val);
297+
int buzzer_init(void);
260298

261299
#endif // RTMOUSE_H

0 commit comments

Comments
 (0)