diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-13 17:36:26 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-13 17:36:26 +0200 |
| commit | b279560f0b4dfdd16dea6b70975dfc1961b8d61e (patch) | |
| tree | ed4da72f9f77cc9dbec7405533e331ed9dc074ea /Software/Embedded_SW/Embedded/Common | |
| parent | 97ea085d1fac43aedc5258486ef355eb13abc195 (diff) | |
| parent | 677b58ea79beb4a6ff4643b7099f0eeb7b9c3a64 (diff) | |
| download | Tango-b279560f0b4dfdd16dea6b70975dfc1961b8d61e.tar.gz Tango-b279560f0b4dfdd16dea6b70975dfc1961b8d61e.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common')
3 files changed, 112 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 6b7e816c4..c1f673745 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -77,7 +77,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - Fresult = f_open(FileHandle,request->filename,FA_READ | FA_WRITE | FA_OPEN_ALWAYS ); + Fresult = f_open(FileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS ); if (Fresult == FR_OK) { FileLength = request->length; diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 0f8f8a22a..2da8581c0 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {001,002,000,002}; +TangoVersion_t _gTangoVersion = {001,002,002,000}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Update.c b/Software/Embedded_SW/Embedded/Common/Utilities/Update.c new file mode 100644 index 000000000..422c1632b --- /dev/null +++ b/Software/Embedded_SW/Embedded/Common/Utilities/Update.c @@ -0,0 +1,110 @@ + +#include "include.h" +//#include <stdbool.h> +#include <ti/sysbios/knl/Semaphore.h> +#include <ti/sysbios/BIOS.h> + +#include <driverlib/rom.h> +#include <driverlib/sysctl.h> +#include <driverlib/usb.h> +#include <usblib/usblib.h> +#include <usblib/device/usbdevice.h> +#include <inc/hw_nvic.h> +#include <inc/hw_types.h> +#include <inc/hw_memmap.h> + + +#include "Drivers/USB_Communication/USBCDCD.h" + + +extern Semaphore_Handle updateSem; + + +void UpdateUsb(void) +{ + // + // Terminate the USB device and detach from the bus. + // + USBDCDTerm(0); + + // + // Disable all interrupts. + // + ROM_IntMasterDisable(); + + // + // Disable SysTick and its interrupt. + // + ROM_SysTickIntDisable(); + ROM_SysTickDisable(); + + // + // Disable all processor interrupts. Instead of disabling them one at a + // time, a direct write to NVIC is done to disable all peripheral + // interrupts. + // + HWREG(NVIC_DIS0) = 0xffffffff; + HWREG(NVIC_DIS1) = 0xffffffff; + HWREG(NVIC_DIS2) = 0xffffffff; + HWREG(NVIC_DIS3) = 0xffffffff; + HWREG(NVIC_DIS4) = 0xffffffff; + + // + // Enable and reset the USB peripheral. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); + ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0); + ROM_USBClockEnable(USB0_BASE, 8, USB_CLOCK_INTERNAL); + + // + // Wait for about a second. + // + ROM_SysCtlDelay(SYS_CLK_FREQ / 3); + + // + // Re-enable interrupts at the NVIC level. + // + ROM_IntMasterEnable(); + + // + // Call the USB boot loader. + // + ROM_UpdateUSB(0); + + // + // Should never get here, but just in case. + // + while(1) + { + } +} + +Void updateTask(UArg arg0, UArg arg1) +{ + + // + // Wait until new updTE ARRIVED + // + Semaphore_pend(updateSem, BIOS_WAIT_FOREVER); + UpdateUsb(); +} +extern Semaphore_Handle ReconnectSem; + + +void ReconnectUsb(void) +{ + //USBCDC_close(); +} + +Void ReconnectTask(UArg arg0, UArg arg1) +{ + + // + // Wait until new updTE ARRIVED + // + while (1) + { + Semaphore_pend(ReconnectSem, BIOS_WAIT_FOREVER); + ReconnectUsb(); + } +} |
