summaryrefslogtreecommitdiff
path: root/usb/UcmTcpciCxClientSample/Alert.h
blob: a480bb5aec90d04d95c1c0f42a8b13bc5b07dc85 (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
/*++

Module Name:

    Alert.h

Abstract:

    This file contains the declarations for alert callbacks.

Environment:

    Kernel-mode Driver Framework

--*/

#pragma once

#pragma warning(push)
#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union
#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int

// Pack structure so that we can directly fill it with the contents of the alert register.
// Without this step, the structure may have extra padding that would cause the alert register data
// to not match up with the fields in the struct.
#include <pshpack1.h>

// Alert register as defined in the USB-Port Controller Specification R1.0.
typedef union _ALERT_REGISTER
{
    UINT16 AsUInt16;

    struct
    {
        UINT16 CCStatus : 1;
        UINT16 PowerStatus : 1;
        UINT16 ReceiveSOPMessageStatus : 1;
        UINT16 ReceivedHardReset : 1;
        UINT16 TransmitSOPMessageFailed : 1;
        UINT16 TransmitSOPMessageDiscarded : 1;
        UINT16 TransmitSOPMessageSuccessful : 1;
        UINT16 VbusVoltageAlarmHi : 1;
        UINT16 VbusVoltageAlarmLo : 1;
        UINT16 Fault : 1;
        UINT16 RxBufferOverflow : 1;
        UINT16 VbusSinkDisconnectDetected : 1;
        UINT16 : 4;
    };
} ALERT_REGISTER, *PALERT_REGISTER;

#include <poppack.h>
#pragma warning(pop)

#define MAX_ALERTS 12
#define MAX_ALERTS_TO_PROCESS 10

EXTERN_C_START

EVT_WDF_INTERRUPT_ISR
OnInterruptPassiveIsr;

void
ProcessAndSendAlerts(
    _In_ PALERT_REGISTER AlertRegister,
    _In_ PDEVICE_CONTEXT DeviceContext
);

EXTERN_C_END