aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/Utilities/Update.c
blob: 422c1632b4c40c99570efa953ad709d1361d137a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-
#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();
    }
}
var text = obj as string; if (string.IsNullOrWhiteSpace(text)) Kinds = _packIconKinds.Value; else Kinds = _packIconKinds.Value.Where( x => x.ToString().IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0); } private void CopyToClipboard(object obj) { var kind = (PackIconKind?)obj; string toBeCopied = $"<materialDesign:PackIcon Kind=\"{kind}\" />"; Clipboard.SetDataObject(toBeCopied); _snackbarMessageQueue.Enqueue(toBeCopied + " copied to clipboard"); } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }