Esempio n. 1
0
/*!
    \brief      handle the IAP_LEAVE request
    \param[in]  pudev: pointer to usb device instance
    \param[out] none
    \retval     none
*/
static void  iap_req_leave(void *pudev)
{
    /* lock the internal flash */
    fmc_lock();

    /* generate system reset to allow jumping to the user code */
    NVIC_SystemReset();
}
Esempio n. 2
0
/* lock the main FLASH operation
 *
 * @return 0 for success, -1 for error
*/
static int32_t flash_lock(void)
{
    fmc_lock();
    if (RESET == (FMC_CTL & FMC_CTL_LK)) {
        return -1;
    }
    return 0;
}
Esempio n. 3
0
/*!
    \brief      de-initialize the HID device
    \param[in]  pudev: pointer to USB device instance
    \param[in]  config_index: configuration index
    \param[out] none
    \retval     USB device operation status
*/
usbd_status_enum  iap_deinit (void *pudev, uint8_t config_index)
{
    /* deinitialize HID endpoints */
    usbd_ep_deinit (pudev, IAP_IN_EP);
    usbd_ep_deinit (pudev, IAP_OUT_EP);

    /* lock the internal flash */
    fmc_lock();

    return USBD_OK;
}