Skip to content

Commit cead9f2

Browse files
committed
rtmouse_main.cで使用する関数はrtmouse_main.cに残す
1 parent 92ec244 commit cead9f2

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

src/drivers/rtmouse_dev_fops.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -202,52 +202,6 @@ static unsigned int mcp3204_get_value(int channel)
202202
return r;
203203
}
204204

205-
/*
206-
* pwm set function
207-
* called by buzzer_init(), set_motor_l_freq(), set_motor_r_freq()
208-
* and buzzer_write()
209-
*/
210-
void rpi_pwm_write32(uint32_t offset, uint32_t val)
211-
{
212-
iowrite32(val, pwm_base + offset);
213-
}
214-
215-
/*
216-
* set mask and value
217-
* called by sensor_read(), set_motor_l_freq(), set_motor_r_freq(), led_put()
218-
* and motoren_write()
219-
*/
220-
void rpi_gpio_set32(uint32_t mask, uint32_t val)
221-
{
222-
gpio_base[RPI_GPSET0_INDEX] = val & mask;
223-
}
224-
225-
/*
226-
* clear mask and value
227-
* called by sensor_read(), set_motor_l_freq(), set_motor_r_freq(), led_del()
228-
* and motoren_write()
229-
*/
230-
void rpi_gpio_clear32(uint32_t mask, uint32_t val)
231-
{
232-
gpio_base[RPI_GPCLR0_INDEX] = val & mask;
233-
}
234-
235-
/*
236-
* set function
237-
* called by buzzer_init(), set_motor_l_freq(), set_motor_r_freq() and
238-
* buzzer_write()
239-
*/
240-
int rpi_gpio_function_set(int pin, uint32_t func)
241-
{
242-
int index = RPI_GPFSEL0_INDEX + pin / 10;
243-
uint32_t mask = ~(0x7 << ((pin % 10) * 3));
244-
245-
gpio_base[index] =
246-
(gpio_base[index] & mask) | ((func & 0x7) << ((pin % 10) * 3));
247-
248-
return 1;
249-
}
250-
251205
/* --- GPIO Operation --- */
252206
/* getPWMCount function for GPIO Operation */
253207
static int getPWMCount(int freq)

src/drivers/rtmouse_main.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,52 @@ static struct i2c_driver i2c_counter_driver = {
164164
MODULE_DEVICE_TABLE(spi, mcp3204_id);
165165
MODULE_DEVICE_TABLE(i2c, i2c_counter_id);
166166

167+
/*
168+
* set function
169+
* called by buzzer_init(), set_motor_l_freq(), set_motor_r_freq() and
170+
* buzzer_write()
171+
*/
172+
int rpi_gpio_function_set(int pin, uint32_t func)
173+
{
174+
int index = RPI_GPFSEL0_INDEX + pin / 10;
175+
uint32_t mask = ~(0x7 << ((pin % 10) * 3));
176+
177+
gpio_base[index] =
178+
(gpio_base[index] & mask) | ((func & 0x7) << ((pin % 10) * 3));
179+
180+
return 1;
181+
}
182+
183+
/*
184+
* set mask and value
185+
* called by sensor_read(), set_motor_l_freq(), set_motor_r_freq(), led_put()
186+
* and motoren_write()
187+
*/
188+
void rpi_gpio_set32(uint32_t mask, uint32_t val)
189+
{
190+
gpio_base[RPI_GPSET0_INDEX] = val & mask;
191+
}
192+
193+
/*
194+
* clear mask and value
195+
* called by sensor_read(), set_motor_l_freq(), set_motor_r_freq(), led_del()
196+
* and motoren_write()
197+
*/
198+
void rpi_gpio_clear32(uint32_t mask, uint32_t val)
199+
{
200+
gpio_base[RPI_GPCLR0_INDEX] = val & mask;
201+
}
202+
203+
/*
204+
* pwm set function
205+
* called by buzzer_init(), set_motor_l_freq(), set_motor_r_freq()
206+
* and buzzer_write()
207+
*/
208+
void rpi_pwm_write32(uint32_t offset, uint32_t val)
209+
{
210+
iowrite32(val, pwm_base + offset);
211+
}
212+
167213
/*
168214
* Initialize buzzer
169215
* return 0 : device close

0 commit comments

Comments
 (0)