@ -128,6 +142,8 @@ static int pwm_open(FAR struct file *filep)
@@ -128,6 +142,8 @@ static int pwm_open(FAR struct file *filep)
uint8_ttmp;
intret;
pwmvdbg("crefs: %d\n",upper->crefs);
/* Get exclusive access to the device structures */
ret=sem_wait(&upper->sem);
@ -159,6 +175,9 @@ static int pwm_open(FAR struct file *filep)
@@ -159,6 +175,9 @@ static int pwm_open(FAR struct file *filep)
/* Yes.. perform one time hardware initialization. */
DEBUGASSERT(lower->ops->setup!=NULL);
pwmvdbg("calling setup\n");
ret=lower->ops->setup(lower);
if(ret<0)
{
@ -192,6 +211,8 @@ static int pwm_close(FAR struct file *filep)
@@ -192,6 +211,8 @@ static int pwm_close(FAR struct file *filep)
FARstructpwm_upperhalf_s*upper=inode->i_private;
intret;
pwmvdbg("crefs: %d\n",upper->crefs);
/* Get exclusive access to the device structures */
ret=sem_wait(&upper->sem);
@ -219,6 +240,9 @@ static int pwm_close(FAR struct file *filep)
@@ -219,6 +240,9 @@ static int pwm_close(FAR struct file *filep)
/* Disable the PWM device */
DEBUGASSERT(lower->ops->shutdown!=NULL);
pwmvdbg("calling shutdown: %d\n");
lower->ops->shutdown(lower);
}
ret=OK;
@ -275,6 +299,8 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@@ -275,6 +299,8 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Handle built-in ioctl commands */
pwmvdbg("cmd: %d arg: %ld\n",cmd,arg);
switch(cmd)
{
/* PWMIOC_SETCHARACTERISTICS - Set the characteristics of the next pulsed
@ -290,6 +316,11 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@@ -290,6 +316,11 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@ -308,7 +339,11 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@@ -308,7 +339,11 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@ -320,6 +355,11 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@@ -320,6 +355,11 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@ -335,6 +375,9 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@@ -335,6 +375,9 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@ -347,6 +390,8 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
@@ -347,6 +390,8 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)