//int TimeCount=1000;
static int SetSpeed(unsigned int speed)// 1~100
{
int TimeCount=1000;
TimeCount=TimeCount*speed;
printk("TimeCount is %d\n\n",TimeCount);
hireg_writel(TimeCount,HI_TIMER23_BASE+TIMER13_BGLOAD);
return 0;
static int SetSpeed(unsigned int speed)// 1~100
{
int TimeCount=1000;
TimeCount=TimeCount*speed;
printk("TimeCount is %d\n\n",TimeCount);
hireg_writel(TimeCount,HI_TIMER23_BASE+TIMER13_BGLOAD);
return 0;
}
在电机驱动中有个设置速度的小函数,结果我在外边定义的变量,导致每次调用此函数是TimeCount都累次增加。
所以如果是C99之前的标准,需要我们自己定义bool,如
typedef enum {false = 0, true = 1} bool;

3540

被折叠的 条评论
为什么被折叠?



