229
229
/* --- Buffer --- */
230
230
#define MAX_BUFLEN 64
231
231
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
+
232
255
/* --- extern --- */
233
256
extern unsigned int NUM_DEV [ID_DEV_SIZE ];
234
257
extern char * NAME_DEV [ID_DEV_SIZE ];
@@ -251,11 +274,26 @@ extern unsigned int motor_l_freq_is_positive;
251
274
extern unsigned int motor_r_freq_is_positive ;
252
275
extern struct i2c_device_id i2c_counter_id [];
253
276
extern struct i2c_driver i2c_counter_driver ;
277
+ extern struct file_operations dev_fops [ID_DEV_SIZE ];
254
278
255
279
#if LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 16 , 0 )
256
280
extern struct device * mcp320x_dev ;
257
281
#endif
258
282
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 );
260
298
261
299
#endif // RTMOUSE_H
0 commit comments