Ejemplo n.º 1
0
void vfss_request(VFSS_TYPE *vfss, IPC* ipc)
{
    if ((HAL_ITEM(ipc->cmd) == IPC_OPEN) && (ipc->param1 == VFS_VOLUME_HANDLE))
    {
        vfss_open_volume(vfss, (IO*)ipc->param2);
        return;
    }
    if (vfss->volume.process == INVALID_HANDLE)
    {
        error(ERROR_NOT_CONFIGURED);
        return;
    }
    //vfss request
    if ((HAL_ITEM(ipc->cmd) == IPC_CLOSE) && (ipc->param1 == VFS_VOLUME_HANDLE))
    {
        vfss_close_volume(vfss);
        return;
    }
#if (VFS_BER)
    if ((vfss->volume.sector_mode == SECTOR_MODE_BER) && (ipc->param1 == VFS_BER_HANDLE))
    {
        ber_request(vfss, ipc);
        return;
    }
#endif //VFS_BER
    //forward to fs
#if (VFS_NO_FS == 0)
#if (VFS_SFS)
    sfs_request(vfss, ipc);
#else

    fat16_request(vfss, ipc);
#endif  // VFS_SFS
#endif // VFS_NO_FS
}
Ejemplo n.º 2
0
static bool loras_request_check_pre(LORA* lora, IPC* ipc)
{
    if (!lora->opened && (HAL_ITEM(ipc->cmd) != IPC_OPEN))
    {
        error(ERROR_NOT_CONFIGURED);
        return false;
    }

    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        if (lora->opened)
        {
            error(ERROR_ALREADY_CONFIGURED);
            return false;
        }
        break;
    case IPC_CLOSE:
        //tbd
        break;
    case IPC_WRITE:
    case IPC_READ:
    case LORA_GET_STATS:
    case LORA_CLEAR_STATS:
        if (lora->status == LORA_STATUS_TRANSFER_IN_PROGRESS)
        {
            error(ERROR_INVALID_STATE);
            return false;
        }
        break;
    case IPC_CANCEL_IO:
        if (lora->status != LORA_STATUS_TRANSFER_IN_PROGRESS)
        {
            error(ERROR_INVALID_STATE);
            return false;
        }
        break;
    case IPC_TIMEOUT:
        switch (ipc->param1)
        {
        case LORA_TIMER_TXRX_TIMEOUT_ID:
        //todo: os timers issue
        case LORA_TIMER_POLL_TIMEOUT_ID:
            if (lora->status != LORA_STATUS_TRANSFER_IN_PROGRESS)
            {
                error(ERROR_INVALID_STATE);
                return false;
            }
            break;
        default:
            error(ERROR_NOT_SUPPORTED);
            break;
        }
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }
    return true;
}
Ejemplo n.º 3
0
void ti_uart_request(EXO* exo, IPC* ipc)
{
    if (ipc->param1 > UART_0)
    {
        kerror(ERROR_INVALID_PARAMS);
        return;
    }
    if (HAL_ITEM(ipc->cmd) == IPC_OPEN)
    {
        ti_uart_open(exo, ipc->param2);
        return;
    }
    if (!exo->uart.active)
    {
        kerror(ERROR_NOT_ACTIVE);
        return;
    }

    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_CLOSE:
        ti_uart_close(exo);
        break;
    case IPC_UART_SET_BAUDRATE:
        ti_uart_set_baudrate(ipc);
        break;
    case IPC_FLUSH:
        ti_uart_flush(exo);
        break;
    case IPC_GET_TX_STREAM:
        ipc->param2 = ti_uart_get_tx_stream(exo);
        break;
    case IPC_GET_RX_STREAM:
        ipc->param2 = ti_uart_get_rx_stream(exo);
        break;
    case IPC_UART_GET_LAST_ERROR:
        ipc->param2 = ti_uart_get_last_kerror(exo);
        break;
    case IPC_UART_CLEAR_ERROR:
        ti_uart_clear_kerror(exo);
        break;
    case IPC_UART_SETUP_PRINTK:
        ti_uart_setup_printk();
        break;
    case IPC_STREAM_WRITE:
        ti_uart_stream_write(exo);
        break;
    default:
        kerror(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 4
0
bool lpc_timer_request(EXO* exo, IPC* ipc)
{
    TIMER timer = (TIMER)ipc->param1;
    if (timer >= TIMER_MAX)
    {
        kerror(ERROR_NOT_SUPPORTED);
        return true;
    }
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        lpc_timer_open(exo, timer, ipc->param2);
        break;
    case IPC_CLOSE:
        lpc_timer_close(exo, timer);
        break;
    case TIMER_START:
        lpc_timer_start(exo, timer, ipc->param2, ipc->param3);
        break;
    case TIMER_STOP:
        lpc_timer_stop(exo, timer);
        break;
    case TIMER_SETUP_CHANNEL:
        lpc_timer_setup_channel(exo, timer, TIMER_CHANNEL_VALUE(ipc->param2), TIMER_CHANNEL_TYPE_VALUE(ipc->param2), ipc->param3);
        break;
    default:
        kerror(ERROR_NOT_SUPPORTED);
    }
    return true;
}
Ejemplo n.º 5
0
static inline void lpc_usb_device_request(CORE* core, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case USB_GET_SPEED:
        ipc->param2 = lpc_usb_get_speed(core);
        break;
    case IPC_OPEN:
        lpc_usb_open_device(core, ipc->process);
        break;
    case IPC_CLOSE:
        lpc_usb_close_device(core);
        break;
    case USB_SET_ADDRESS:
        lpc_usb_set_address(core, ipc->param2);
        break;
#if (USB_DEBUG_ERRORS)
    case LPC_USB_ERROR:
        printd("USB driver error: %#x\n", ipc->param2);
        //posted from isr
        break;
#endif
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 6
0
void udps_request(TCPIPS* tcpips, IPC* ipc)
{
    if (!tcpips->connected)
    {
        error(ERROR_NOT_ACTIVE);
        return;
    }
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        if (ipc->param2 == LOCALHOST)
            udps_listen(tcpips, ipc);
        else
            udps_connect(tcpips, ipc);
        break;
    case IPC_CLOSE:
        udps_close(tcpips, ipc->param1);
        break;
    case IPC_READ:
        udps_read(tcpips, ipc->param1, (IO*)ipc->param2);
        break;
    case IPC_WRITE:
        udps_write(tcpips, ipc->param1, (IO*)ipc->param2);
        break;
    case IPC_FLUSH:
        udps_flush(tcpips, ipc->param1);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 7
0
void stm32_pin_request(CORE* core, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case STM32_GPIO_DISABLE_PIN:
        stm32_gpio_disable_pin(&core->gpio, (PIN)ipc->param1);
        break;
    case STM32_GPIO_ENABLE_PIN:
#if defined(STM32F1)
        stm32_gpio_enable_pin(&core->gpio, (PIN)ipc->param1, (STM32_GPIO_MODE)ipc->param2, ipc->param3);
#else
        stm32_gpio_enable_pin(&core->gpio, (PIN)ipc->param1, ipc->param2, (AF)ipc->param3);
#endif
        break;
    case STM32_GPIO_ENABLE_EXTI:
        stm32_gpio_enable_exti(&core->gpio, (PIN)ipc->param1, ipc->param2);
        break;
    case STM32_GPIO_DISABLE_EXTI:
        stm32_gpio_disable_exti(&core->gpio, (PIN)ipc->param1);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 8
0
void lpc_sdmmc_request(CORE* core, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        lpc_sdmmc_open(core, (HANDLE)ipc->param1);
        break;
    case IPC_CLOSE:
        lpc_sdmmc_close(core);
        break;
    case IPC_READ:
        lpc_sdmmc_io(core, ipc->process, (HANDLE)ipc->param1, (IO*)ipc->param2, ipc->param3, true);
        break;
    case IPC_WRITE:
        lpc_sdmmc_io(core, ipc->process, (HANDLE)ipc->param1, (IO*)ipc->param2, ipc->param3, false);
        break;
    case IPC_FLUSH:
        lpc_sdmmc_flush(core);
        break;
    case LPC_SDMMC_VERIFY:
        lpc_sdmmc_verify(core);
        break;
    case STORAGE_GET_MEDIA_DESCRIPTOR:
        lpc_sdmmc_get_media_descriptor(core, ipc->process, (HANDLE)ipc->param1, (IO*)ipc->param2);
        break;
    case STORAGE_NOTIFY_ACTIVITY:
        lpc_sdmmc_request_notify_activity(core, ipc->process);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 9
0
void scsis_request(SCSIS* scsis, IPC* ipc)
{
    if (HAL_GROUP(ipc->cmd) != scsis->storage_descriptor->hal)
    {
        error(ERROR_NOT_SUPPORTED);
        return;
    }
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_READ:
    case IPC_WRITE:
        //IDLE - means resetted before - ignore IO messages
        if (scsis->state != SCSIS_STATE_IDLE)
            scsis_bc_storage_io_complete(scsis, (int)ipc->param3);
        break;
    case STORAGE_GET_MEDIA_DESCRIPTOR:
        scsis_get_media_descriptor(scsis, (int)ipc->param3);
        break;
    case STORAGE_NOTIFY_STATE_CHANGE:
        if (scsis->storage_descriptor->flags & SCSI_STORAGE_DESCRIPTOR_REMOVABLE)
        {
#if (SCSI_MMC)
            scsis->media_status_changed = true;
#endif //SCSI_MMC
            if (scsis->media != NULL)
                scsis_media_removed(scsis);
            else
                scsis_request_media(scsis);
            storage_request_notify_state_change(scsis->storage_descriptor->hal, scsis->storage_descriptor->storage, scsis->storage_descriptor->user);
        }
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 10
0
void stm32_timer_request(EXO* exo, IPC* ipc)
{
    TIMER_NUM num = (TIMER_NUM)ipc->param1;
    if (num >= TIMERS_COUNT)
    {
        kerror(ERROR_INVALID_PARAMS);
        return;
    }
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        stm32_timer_open(exo, num, ipc->param2);
        break;
    case IPC_CLOSE:
        stm32_timer_close(exo, num);
        break;
    case TIMER_START:
        stm32_timer_start(exo, num, (TIMER_VALUE_TYPE)ipc->param2, ipc->param3);
        break;
    case TIMER_STOP:
        stm32_timer_stop(num);
        break;
#if (TIMER_IO)
    case TIMER_SETUP_CHANNEL:
        stm32_timer_setup_channel(num, TIMER_CHANNEL_VALUE(ipc->param2), TIMER_CHANNEL_TYPE_VALUE(ipc->param2), ipc->param3);
        break;
#endif //TIMER_IO
    default:
        kerror(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 11
0
static inline void stm32_otg_device_request(EXO* exo, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case USB_GET_SPEED:
        ipc->param2 = stm32_otg_get_speed(exo);
        break;
    case IPC_OPEN:
        stm32_otg_open_device(exo, ipc->process);
        break;
    case IPC_CLOSE:
        stm32_otg_close_device(exo);
        break;
    case USB_SET_ADDRESS:
        stm32_otg_set_address(ipc->param2);
        break;
#if (USB_TEST_MODE_SUPPORT)
    case USB_SET_TEST_MODE:
        stm32_otg_set_test_mode(exo, ipc->param2);
        break;
#endif //USB_TEST_MODE_SUPPORT
    default:
        kerror(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 12
0
static void loras_request(LORA* lora, IPC* ipc)
{
    if (!loras_request_check_pre(lora, ipc))
    {
        return;
    }

    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        loras_open(lora, ipc->process, (IO*)ipc->param1);
        break;
    case IPC_CLOSE:
        loras_close(lora);
        break;
    case IPC_WRITE:
        loras_tx_async(lora, (IO*)ipc->param1);
        break;
    case IPC_READ:
        loras_rx_async(lora, (IO*)ipc->param1);
        break;
    case LORA_GET_STATS:
        loras_get_stats(lora, (IO*)ipc->param1, (IO*)ipc->param2);
        break;
    case LORA_CLEAR_STATS:
        loras_clear_stats(lora);
        break;
    case IPC_CANCEL_IO:
        loras_abort_rx_transfer(lora);
        break;
    case IPC_TIMEOUT:
        switch (ipc->param1)
        {
        case LORA_TIMER_TXRX_TIMEOUT_ID:
            loras_timer_txrx_timeout(lora);
            break;
        case LORA_TIMER_POLL_TIMEOUT_ID:
            loras_timer_poll_timeout(lora);
            break;
        default:
            error(ERROR_NOT_SUPPORTED);
            break;
        }
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }

    if (!loras_request_check_post(lora, ipc))
    {
        return;
    }
}
Ejemplo n.º 13
0
static inline void hidd_kbd_driver_event(USBD* usbd, HIDD_KBD* hidd, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_WRITE:
        hidd_kbd_write_complete(usbd, hidd);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 14
0
static inline void mscd_driver_event(USBD* usbd, MSCD* mscd, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_WRITE:
    case IPC_READ:
        mscd_usb_io_complete(usbd, mscd, (int)ipc->param3);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 15
0
void stm32_wdt_request(IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case WDT_KICK:
        stm32_wdt_kick();
        break;
    default:
        kerror(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 16
0
void lpc_eep_request(CORE* core, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_READ:
        lpc_eep_read(core, ipc);
        break;
    case IPC_WRITE:
        lpc_eep_write(core, ipc);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
    }
}
Ejemplo n.º 17
0
void icmps_request(TCPIPS* tcpips, IPC* ipc)
{
    IP ip;
    switch (HAL_ITEM(ipc->cmd))
    {
    case ICMP_PING:
        ip.u32.ip = ipc->param1;
        icmps_ping(tcpips, &ip, ipc->process);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 18
0
static inline void lpc_usb_ep_request(CORE* core, IPC* ipc)
{
    if (USB_EP_NUM(ipc->param1) >= USB_EP_COUNT_MAX)
    {
        error(ERROR_INVALID_PARAMS);
        return;
    }
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        lpc_usb_open_ep(core, ipc->param1, ipc->param2, ipc->param3);
        break;
    case IPC_CLOSE:
        lpc_usb_close_ep(core, ipc->param1);
        break;
    case IPC_FLUSH:
        lpc_usb_ep_flush(core, ipc->param1);
        break;
    case USB_EP_SET_STALL:
        lpc_usb_ep_set_stall(core, ipc->param1);
        break;
    case USB_EP_CLEAR_STALL:
        lpc_usb_ep_clear_stall(core, ipc->param1);
        break;
    case USB_EP_IS_STALL:
        ipc->param2 = lpc_usb_ep_is_stall(ipc->param1);
        break;
    case IPC_READ:
        lpc_usb_read(core, ipc);
        break;
    case IPC_WRITE:
        lpc_usb_write(core, ipc);
        //posted with io, no return IPC
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 19
0
static void stm32_otg_ep_request(EXO* exo, IPC* ipc)
{
    if (USB_EP_NUM(ipc->param1) >= USB_EP_COUNT_MAX)
    {
        kerror(ERROR_INVALID_PARAMS);
        return;
    }
    switch (HAL_ITEM(ipc->cmd))
    {
    case IPC_OPEN:
        stm32_otg_open_ep(exo, ipc->param1, ipc->param2, ipc->param3);
        break;
    case IPC_CLOSE:
        stm32_otg_close_ep(exo, ipc->param1);
        break;
    case IPC_FLUSH:
        stm32_otg_ep_flush(exo, ipc->param1);
        break;
    case USB_EP_SET_STALL:
        stm32_otg_ep_set_stall(exo, ipc->param1);
        break;
    case USB_EP_CLEAR_STALL:
        stm32_otg_ep_clear_stall(exo, ipc->param1);
        break;
    case USB_EP_IS_STALL:
        ipc->param2 = stm32_otg_ep_is_stall(ipc->param1);
        break;
    case IPC_READ:
        stm32_otg_read(exo, ipc);
        break;
    case IPC_WRITE:
        stm32_otg_write(exo, ipc);
        break;
    default:
        kerror(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 20
0
void stm32_adc_request(CORE* core, IPC* ipc)
{
    switch (HAL_ITEM(ipc->cmd))
    {
    case ADC_GET:
        ipc->param2 = stm32_adc_get(core, ipc->param1, ipc->param2);
        break;
    case IPC_OPEN:
        if (ipc->param1 == STM32_ADC_DEVICE)
            stm32_adc_open_device(core);
        else
            stm32_adc_open_channel(core, ipc->param1);
        break;
    case IPC_CLOSE:
        if (ipc->param1 == STM32_ADC_DEVICE)
            stm32_adc_close_device(core);
        else
            stm32_adc_close_channel(core, ipc->param1);
        break;
    default:
        error(ERROR_NOT_SUPPORTED);
        break;
    }
}
Ejemplo n.º 21
0
void hidd_kbd_class_request(USBD* usbd, void* param, IPC* ipc)
{
    HIDD_KBD* hidd = (HIDD_KBD*)param;
    if (HAL_GROUP(ipc->cmd) == HAL_USB)
        hidd_kbd_driver_event(usbd, hidd, ipc);
    else
        switch (HAL_ITEM(ipc->cmd))
        {
        case USB_HID_KBD_MODIFIER_CHANGE:
            hidd_kbd_modifier_change(usbd, hidd, ipc->param2);
            break;
        case USB_HID_KBD_KEY_PRESS:
            hidd_kbd_key_press(usbd, hidd, ipc->param2);
            break;
        case USB_HID_KBD_KEY_RELEASE:
            hidd_kbd_key_release(usbd, hidd, ipc->param2);
            break;
        case USB_HID_KBD_GET_LEDS_STATE:
            hidd_kbd_get_leds_state(hidd, ipc);
            break;
        default:
            error(ERROR_NOT_SUPPORTED);
        }
}