出现implicit declaration of function 'h1940_latch_control错误的解决方法
来源:互联网 发布:谈谈大数据税务应用 编辑:程序博客网 时间:2024/06/08 02:59
出现drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
drivers/leds/leds-h1940.c:33: error: implicit declaration of function 'h1940_latch_control错误
以下为解决方法:打开leds-h1940.c "+"表示添加 "//"表示注释或者删除
/*
* drivers/leds/leds-h1940.c
* Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details.
*
* H1940 leds driver
*
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/leds.h>
#include <linux/gpio.h>
#include <mach/regs-gpio.h>
#include <mach/hardware.h>
#include <mach/h1940-latch.h>
/*
* Green led.
*/
static void h1940_greenled_set(struct led_classdev *led_dev,
enum led_brightness value)
{
switch (value) {
case LED_HALF:
// h1940_latch_control(0, H1940_LATCH_LED_FLASH);
// s3c2410_gpio_setpin(S3C2410_GPA7, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(7), 1);
break;
case LED_FULL:
// h1940_latch_control(0, H1940_LATCH_LED_GREEN);
// s3c2410_gpio_setpin(S3C2410_GPA7, 1);
+ gpio_set_value(H1940_LATCH_LED_GREEN, 1);
+ gpio_set_value(S3C2410_GPA(7), 1);
break;
default:
case LED_OFF:
// h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
// h1940_latch_control(H1940_LATCH_LED_GREEN, 0);
// s3c2410_gpio_setpin(S3C2410_GPA7, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(H1940_LATCH_LED_GREEN, 0);
+ gpio_set_value(S3C2410_GPA(7), 0);
break;
}
}
static struct led_classdev h1940_greenled = {
.name = "h1940:green",
.brightness_set = h1940_greenled_set,
.default_trigger = "h1940-charger",
};
/*
* Red led.
*/
static void h1940_redled_set(struct led_classdev *led_dev,
enum led_brightness value)
{
switch (value) {
case LED_HALF:
// h1940_latch_control(0, H1940_LATCH_LED_FLASH);
// s3c2410_gpio_setpin(S3C2410_GPA1, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(1), 1);
break;
case LED_FULL:
// h1940_latch_control(0, H1940_LATCH_LED_RED);
// s3c2410_gpio_setpin(S3C2410_GPA1, 1);
+ gpio_set_value(H1940_LATCH_LED_RED, 1);
+ gpio_set_value(S3C2410_GPA(1), 1);
break;
default:
case LED_OFF:
// h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
// h1940_latch_control(H1940_LATCH_LED_RED, 0);
// s3c2410_gpio_setpin(S3C2410_GPA1, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(H1940_LATCH_LED_RED, 0);
+ gpio_set_value(S3C2410_GPA(1), 0);
break;
}
}
static struct led_classdev h1940_redled = {
.name = "h1940:red",
.brightness_set = h1940_redled_set,
.default_trigger = "h1940-charger",
};
/*
* Blue led.
* (it can only be blue flashing led)
*/
static void h1940_blueled_set(struct led_classdev *led_dev,
enum led_brightness value)
{
if (value) {
/* flashing Blue */
// h1940_latch_control(0, H1940_LATCH_LED_FLASH);
// s3c2410_gpio_setpin(S3C2410_GPA3, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(3), 1);
} else {
// h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
// s3c2410_gpio_setpin(S3C2410_GPA3, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(S3C2410_GPA(3), 0);
}
}
static int __devinit h1940leds_probe(struct platform_device *pdev)
{
//int ret;
+ int ret, gpioidx = 0;
+ int led_gpios[] = {
+ H1940_LATCH_LED_GREEN,
+ H1940_LATCH_LED_RED,
+ H1940_LATCH_LED_FLASH,
+ S3C2410_GPA(1),
+ S3C2410_GPA(3),
+ S3C2410_GPA(7),
};
for (gpioidx = 0; gpioidx < ARRAY_SIZE(led_gpios); gpioidx++) {
ret = gpio_request(led_gpios[gpioidx], "h1940 leds");
if (ret < 0)
goto err_gpio;
ret = gpio_direction_output(led_gpios[gpioidx], 0);
if (ret < 0)
goto err_gpio;
}
ret = led_classdev_register(&pdev->dev, &h1940_greenled);
if (ret)
goto err_green;
ret = led_classdev_register(&pdev->dev, &h1940_redled);
if (ret)
goto err_red;
ret = led_classdev_register(&pdev->dev, &h1940_blueled);
if (ret)
goto err_blue;
return 0;
err_blue:
led_classdev_unregister(&h1940_redled);
err_red:
led_classdev_unregister(&h1940_greenled);
err_green:
+err_gpio:
+ while (--gpioidx >= 0)
+ gpio_free(led_gpios[gpioidx]);
+
return ret;
}
static int h1940leds_remove(struct platform_device *pdev)
{
led_classdev_unregister(&h1940_greenled);
led_classdev_unregister(&h1940_redled);
led_classdev_unregister(&h1940_blueled);
+ gpio_free(H1940_LATCH_LED_GREEN);
+ gpio_free(H1940_LATCH_LED_RED);
+ gpio_free(H1940_LATCH_LED_FLASH);
+ gpio_free(S3C2410_GPA(1));
+ gpio_free(S3C2410_GPA(3));
+ gpio_free(S3C2410_GPA(7));
return 0;
}
阅读全文
0 0
- 出现implicit declaration of function 'h1940_latch_control错误的解决方法
- implicit declaration of function ‘malloc’的解决方法
- 编译内核出现implicit declaration of function 'iowrite16be'解决方法
- error: implicit declaration of function 'acquire_console_sem'错误解决方法
- 头文件#ifndef定义重复的宏也会出现 implicit declaration of function 错误
- implicit declaration of function 'kzalloc' 解决方法
- implicit declaration of function 'kzalloc' 解决方法
- 出现警告:implicit declaration of function
- implicit declaration of function 'KBUILD_STR' 错误
- implicit declaration of function
- implicit declaration of function
- implicit declaration of function
- implicit declaration of function '...' 的warning
- implicit declaration of function 's3c2410_gpio_cfgpin"的解决办法
- implicit declaration of function XXXXXXX 的warning
- 错误 implicit declaration of function 'class_create' implicit declaration of function 'class_device_
- 内核error: implicit declaration of function 'irq_to_gpio' 解决方法
- implicit declaration of function-linux C文件编译warning解决方法
- Spring 小总结
- Gnome安装及个性化设置
- 任务(1)
- hibernate 出现unexpected token: xxx 解决办法
- Spring Boot注解(annotation)列表
- 出现implicit declaration of function 'h1940_latch_control错误的解决方法
- python笔记_3
- 简析短信轰炸给平台注册场景带来的交互安全威胁
- overview_java(五)
- HIVE全部函数详解
- 自动化测试入门教程(Maven + TestNG + Selenium)
- 百度地图集成问题1-20170913
- android项目分层解析
- Linux常用指令整理