[BSP] Fix stm32f10x BSP error code.
This commit is contained in:
parent
1e9f9824d3
commit
045f6c368c
|
@ -16,8 +16,6 @@
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include <gpio.h>
|
|
||||||
#include <stm32f10x_exti.h>
|
|
||||||
|
|
||||||
#ifdef RT_USING_PIN
|
#ifdef RT_USING_PIN
|
||||||
|
|
||||||
|
@ -591,12 +589,12 @@ rt_err_t stm32_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
|
||||||
index = get_pin(pin);
|
index = get_pin(pin);
|
||||||
if (index == RT_NULL)
|
if (index == RT_NULL)
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
irqindex = bit2bitno(index->pin);
|
irqindex = bit2bitno(index->pin);
|
||||||
if(irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
|
if(irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
level = rt_hw_interrupt_disable();
|
level = rt_hw_interrupt_disable();
|
||||||
|
@ -612,7 +610,7 @@ rt_err_t stm32_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
|
||||||
if(pin_irq_hdr_tab[irqindex].pin != -1)
|
if(pin_irq_hdr_tab[irqindex].pin != -1)
|
||||||
{
|
{
|
||||||
rt_hw_interrupt_enable(level);
|
rt_hw_interrupt_enable(level);
|
||||||
return RT_EBUSY;
|
return -RT_EBUSY;
|
||||||
}
|
}
|
||||||
pin_irq_hdr_tab[irqindex].pin = pin;
|
pin_irq_hdr_tab[irqindex].pin = pin;
|
||||||
pin_irq_hdr_tab[irqindex].hdr = hdr;
|
pin_irq_hdr_tab[irqindex].hdr = hdr;
|
||||||
|
@ -631,12 +629,12 @@ rt_err_t stm32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
|
||||||
index = get_pin(pin);
|
index = get_pin(pin);
|
||||||
if (index == RT_NULL)
|
if (index == RT_NULL)
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
irqindex = bit2bitno(index->pin);
|
irqindex = bit2bitno(index->pin);
|
||||||
if(irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
|
if(irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
level = rt_hw_interrupt_disable();
|
level = rt_hw_interrupt_disable();
|
||||||
|
@ -667,20 +665,20 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
index = get_pin(pin);
|
index = get_pin(pin);
|
||||||
if (index == RT_NULL)
|
if (index == RT_NULL)
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
if(enabled == PIN_IRQ_ENABLE)
|
if(enabled == PIN_IRQ_ENABLE)
|
||||||
{
|
{
|
||||||
irqindex = bit2bitno(index->pin);
|
irqindex = bit2bitno(index->pin);
|
||||||
if(irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
|
if(irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
level = rt_hw_interrupt_disable();
|
level = rt_hw_interrupt_disable();
|
||||||
if(pin_irq_hdr_tab[irqindex].pin == -1)
|
if(pin_irq_hdr_tab[irqindex].pin == -1)
|
||||||
{
|
{
|
||||||
rt_hw_interrupt_enable(level);
|
rt_hw_interrupt_enable(level);
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
irqmap = &pin_irq_map[irqindex];
|
irqmap = &pin_irq_map[irqindex];
|
||||||
/* GPIO Periph clock enable */
|
/* GPIO Periph clock enable */
|
||||||
|
@ -720,7 +718,7 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
irqmap = get_pin_irq_map(index->pin);
|
irqmap = get_pin_irq_map(index->pin);
|
||||||
if(irqmap == RT_NULL)
|
if(irqmap == RT_NULL)
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
EXTI_InitStructure.EXTI_Line = irqmap->irqbit;
|
EXTI_InitStructure.EXTI_Line = irqmap->irqbit;
|
||||||
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
|
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||||
|
@ -730,7 +728,7 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return RT_ENOSYS;
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
|
|
Loading…
Reference in New Issue