Skip to content

Commit dc3977e

Browse files
Merge pull request #10 from FrameworkComputer/production
From Sample Code to Production Driver
2 parents 0e1c71e + db272cc commit dc3977e

5 files changed

Lines changed: 56 additions & 45 deletions

File tree

FrameworkSensors/AccelerometerClient.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (C) Microsoft Corporation, All Rights Reserved.
2+
// Copyright (C) Framework Computer Inc, All Rights Reserved.
23
//
34
// Abstract:
45
//
@@ -13,19 +14,18 @@
1314

1415
#include "AccelerometerClient.tmh"
1516

16-
#define SENSORV2_POOL_TAG_ACCELEROMETER '2CaL'
17+
#define FWK_SENSORS_POOL_TAG_ACCELEROMETER 'ccAF'
1718

1819
#define AccelerometerDevice_Default_MinDataInterval (4)
1920
#define AccelerometerDevice_Default_Axis_Threshold (1.0f)
2021
#define AccelerometerDevice_Axis_Resolution (4.0f / 65536.0f) // in delta g
2122
#define AccelerometerDevice_Axis_Minimum (-2.0f) // in g
2223
#define AccelerometerDevice_Axis_Maximum (2.0f) // in g
2324

24-
// TODO: New GUID for this?
2525
// Accelerometer Unique ID
26-
// {2BAAA1A7-6795-42A0-B830-82526CFD28D1}
26+
// {A931067B-D450-42A4-8B20-2647D4CA9D2D}
2727
DEFINE_GUID(GUID_AccelerometerDevice_UniqueID,
28-
0x2baaa1a7, 0x6795, 0x42a0, 0xb8, 0x30, 0x82, 0x52, 0x6c, 0xfd, 0x28, 0xd1);
28+
0xa931067b, 0xd450, 0x42a4, 0x8b, 0x20, 0x26, 0x47, 0xd4, 0xca, 0x9d, 0x2d);
2929

3030
// Sensor data
3131
typedef enum
@@ -111,7 +111,7 @@ AccelerometerDevice::Initialize(
111111
MemoryAttributes.ParentObject = SensorInstance;
112112
Status = WdfMemoryCreate(&MemoryAttributes,
113113
PagedPool,
114-
SENSORV2_POOL_TAG_ACCELEROMETER,
114+
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
115115
Size,
116116
&MemoryHandle,
117117
(PVOID*)&m_pEnumerationProperties);
@@ -163,7 +163,7 @@ AccelerometerDevice::Initialize(
163163
MemoryAttributes.ParentObject = SensorInstance;
164164
Status = WdfMemoryCreate(&MemoryAttributes,
165165
PagedPool,
166-
SENSORV2_POOL_TAG_ACCELEROMETER,
166+
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
167167
Size,
168168
&MemoryHandle,
169169
(PVOID*)&m_pSupportedDataFields);
@@ -197,7 +197,7 @@ AccelerometerDevice::Initialize(
197197
MemoryAttributes.ParentObject = SensorInstance;
198198
Status = WdfMemoryCreate(&MemoryAttributes,
199199
PagedPool,
200-
SENSORV2_POOL_TAG_ACCELEROMETER,
200+
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
201201
Size,
202202
&MemoryHandle,
203203
(PVOID*)&m_pData);
@@ -252,7 +252,7 @@ AccelerometerDevice::Initialize(
252252
MemoryAttributes.ParentObject = SensorInstance;
253253
Status = WdfMemoryCreate(&MemoryAttributes,
254254
PagedPool,
255-
SENSORV2_POOL_TAG_ACCELEROMETER,
255+
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
256256
Size,
257257
&MemoryHandle,
258258
(PVOID*)&m_pProperties);
@@ -295,7 +295,7 @@ AccelerometerDevice::Initialize(
295295
MemoryAttributes.ParentObject = SensorInstance;
296296
Status = WdfMemoryCreate(&MemoryAttributes,
297297
PagedPool,
298-
SENSORV2_POOL_TAG_ACCELEROMETER,
298+
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
299299
Size,
300300
&MemoryHandle,
301301
(PVOID*)&m_pDataFieldProperties);
@@ -335,7 +335,7 @@ AccelerometerDevice::Initialize(
335335
MemoryAttributes.ParentObject = SensorInstance;
336336
Status = WdfMemoryCreate(&MemoryAttributes,
337337
PagedPool,
338-
SENSORV2_POOL_TAG_ACCELEROMETER,
338+
FWK_SENSORS_POOL_TAG_ACCELEROMETER,
339339
Size,
340340
&MemoryHandle,
341341
(PVOID*)&m_pThresholds);

FrameworkSensors/AlsClient.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "AlsClient.tmh"
1515

16-
#define SENSORV2_POOL_TAG_AMBIENT_LIGHT '2LmA'
16+
#define FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT 'SLAF'
1717

1818
#define Als_Initial_MinDataInterval_Ms (10) // 100Hz
1919
#define Als_Initial_Lux_Threshold_Pct (1.0f) // Percent threshold: 100%
@@ -29,9 +29,9 @@
2929
#define AlsDevice_Resolution_Lux (AlsDevice_Range_Lux / AlsDevice_Precision)
3030

3131
// Ambient Light Sensor Unique ID
32-
// {2D2A4524-51E3-4E68-9B0F-5CAEDFB12C02}
32+
// {506AC61B-C762-499E-A848-685FC45DF39F}
3333
DEFINE_GUID(GUID_AlsDevice_UniqueID,
34-
0x2d2a4524, 0x51e3, 0x4e68, 0x9b, 0xf, 0x5c, 0xae, 0xdf, 0xb1, 0x2c, 0x2);
34+
0x506ac61b, 0xc762, 0x499e, 0xa8, 0x48, 0x68, 0x5f, 0xc4, 0x5d, 0xf3, 0x9f);
3535

3636
// Sensor data
3737
typedef enum
@@ -148,7 +148,7 @@ AlsDevice::Initialize(
148148
MemoryAttributes.ParentObject = SensorInstance;
149149
Status = WdfMemoryCreate(&MemoryAttributes,
150150
PagedPool,
151-
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
151+
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
152152
Size,
153153
&MemoryHandle,
154154
(PVOID*)&m_pEnumerationProperties);
@@ -208,7 +208,7 @@ AlsDevice::Initialize(
208208
MemoryAttributes.ParentObject = SensorInstance;
209209
Status = WdfMemoryCreate(&MemoryAttributes,
210210
PagedPool,
211-
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
211+
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
212212
Size,
213213
&MemoryHandle,
214214
(PVOID*)&m_pSupportedDataFields);
@@ -243,7 +243,7 @@ AlsDevice::Initialize(
243243
MemoryAttributes.ParentObject = SensorInstance;
244244
Status = WdfMemoryCreate(&MemoryAttributes,
245245
PagedPool,
246-
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
246+
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
247247
Size,
248248
&MemoryHandle,
249249
(PVOID*)&m_pData);
@@ -305,7 +305,7 @@ AlsDevice::Initialize(
305305
MemoryAttributes.ParentObject = SensorInstance;
306306
Status = WdfMemoryCreate(&MemoryAttributes,
307307
PagedPool,
308-
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
308+
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
309309
Size,
310310
&MemoryHandle,
311311
(PVOID*)&m_pProperties);
@@ -373,7 +373,7 @@ AlsDevice::Initialize(
373373
MemoryAttributes.ParentObject = SensorInstance;
374374
Status = WdfMemoryCreate(&MemoryAttributes,
375375
PagedPool,
376-
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
376+
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
377377
Size,
378378
&MemoryHandle,
379379
(PVOID*)&m_pDataFieldProperties);
@@ -412,7 +412,7 @@ AlsDevice::Initialize(
412412
MemoryAttributes.ParentObject = SensorInstance;
413413
Status = WdfMemoryCreate(&MemoryAttributes,
414414
PagedPool,
415-
SENSORV2_POOL_TAG_AMBIENT_LIGHT,
415+
FWK_SENSORS_POOL_TAG_AMBIENT_LIGHT,
416416
Size,
417417
&MemoryHandle,
418418
(PVOID*)&m_pThresholds);

FrameworkSensors/EcCommunication.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
2-
// Only need EC commands to use EC_CMD_MOTION_SENSE_CMD to determine which accel sensors there are and which position they are
3-
// ALl the rest can be done using memory map reads
1+
// Copyright (C) Framework Computer Inc, All Rights Reserved.
2+
//
3+
// Abstract:
4+
//
5+
// This module contains the implementation of communication with the embedded controller.
6+
//
7+
// Only need EC commands to use EC_CMD_MOTION_SENSE_CMD to determine which
8+
// accel sensors there are and which position they are. ALl the rest can be
9+
// done using memory map reads.
10+
//
11+
// Environment:
12+
//
13+
// Windows User-Mode Driver Framework (UMDF)
414

515
#include "Clients.h"
616
#include "EcCommunication.h"

FrameworkSensors/SensorsTrace.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//Copyright (C) Microsoft Corporation, All Rights Reserved
2+
//Copyright (C) Framework Computer Inc, All Rights Reserved
23
//
34
//Abstract:
45
//
@@ -16,19 +17,20 @@ extern "C" {
1617

1718
// Define the tracing flags.
1819
//
19-
// Tracing GUID - 3C773167-F26D-4F72-A1DE-95F1FD795840
20-
21-
#define WPP_CONTROL_GUIDS \
22-
WPP_DEFINE_CONTROL_GUID( \
23-
SimpleDeviceOrientationSensorTraceGuid, (3C773167,F26D,4F72,A1DE,95F1FD795840), \
24-
WPP_DEFINE_BIT(EntryExit) \
25-
WPP_DEFINE_BIT(DataFlow) \
26-
WPP_DEFINE_BIT(Verbose) \
27-
WPP_DEFINE_BIT(Information) \
28-
WPP_DEFINE_BIT(Warning) \
29-
WPP_DEFINE_BIT(Error) \
30-
WPP_DEFINE_BIT(Fatal) \
31-
WPP_DEFINE_BIT(DriverStatus) \
20+
// Tracing GUID - B915AE22-198E-4CF7-BF4D-395FAD3F645A
21+
22+
23+
#define WPP_CONTROL_GUIDS \
24+
WPP_DEFINE_CONTROL_GUID( \
25+
FrameworkSensorsTraceGuid, (B915AE22,198E,4CF7,BF4D,395FAD3F645A), \
26+
WPP_DEFINE_BIT(EntryExit) \
27+
WPP_DEFINE_BIT(DataFlow) \
28+
WPP_DEFINE_BIT(Verbose) \
29+
WPP_DEFINE_BIT(Information) \
30+
WPP_DEFINE_BIT(Warning) \
31+
WPP_DEFINE_BIT(Error) \
32+
WPP_DEFINE_BIT(Fatal) \
33+
WPP_DEFINE_BIT(DriverStatus) \
3234
)
3335

3436
#define WPP_FLAG_LEVEL_LOGGER(flag, level) WPP_LEVEL_LOGGER(flag)

FrameworkSensors/SimpleDeviceOrientationClient.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "SimpleDeviceOrientationClient.tmh"
1414

15-
#define SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER 'sodS'
15+
#define FWK_SENSORS_POOL_TAG_ORIENTATION 'irOF'
1616

1717
#define SimpleDeviceOrientationDevice_Default_MinDataInterval (4)
1818
#define SimpleDeviceOrientationDevice_Default_Axis_Threshold (1.0f)
@@ -21,10 +21,9 @@
2121
#define SimpleDeviceOrientationDevice_Axis_Maximum (2.0f) // in g
2222

2323
// Simple Device Orientation ID
24-
// {4A303B3E-332A-4044-A35A-282F3D6D56E5}
24+
// {D1FCD247-5848-433A-9129-4C0B93979BE4}
2525
DEFINE_GUID(GUID_SimpleDeviceOrientationDevice_UniqueID,
26-
0x4a303b3e, 0x332a, 0x4044, 0xa3, 0x5a, 0x28, 0x2f, 0x3d, 0x6d, 0x56,
27-
0xe5);
26+
0xd1fcd247, 0x5848, 0x433a, 0x91, 0x29, 0x4c, 0xb, 0x93, 0x97, 0x9b, 0xe4);
2827

2928
// Sensor data
3029
typedef enum
@@ -108,7 +107,7 @@ SimpleDeviceOrientationDevice::Initialize(
108107
MemoryAttributes.ParentObject = SensorInstance;
109108
Status = WdfMemoryCreate(&MemoryAttributes,
110109
PagedPool,
111-
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
110+
FWK_SENSORS_POOL_TAG_ORIENTATION,
112111
Size,
113112
&MemoryHandle,
114113
(PVOID*)&m_pEnumerationProperties);
@@ -160,7 +159,7 @@ SimpleDeviceOrientationDevice::Initialize(
160159
MemoryAttributes.ParentObject = SensorInstance;
161160
Status = WdfMemoryCreate(&MemoryAttributes,
162161
PagedPool,
163-
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
162+
FWK_SENSORS_POOL_TAG_ORIENTATION,
164163
Size,
165164
&MemoryHandle,
166165
(PVOID*)&m_pSupportedDataFields);
@@ -192,7 +191,7 @@ SimpleDeviceOrientationDevice::Initialize(
192191
MemoryAttributes.ParentObject = SensorInstance;
193192
Status = WdfMemoryCreate(&MemoryAttributes,
194193
PagedPool,
195-
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
194+
FWK_SENSORS_POOL_TAG_ORIENTATION,
196195
Size,
197196
&MemoryHandle,
198197
(PVOID*)&m_pData);
@@ -237,7 +236,7 @@ SimpleDeviceOrientationDevice::Initialize(
237236
MemoryAttributes.ParentObject = SensorInstance;
238237
Status = WdfMemoryCreate(&MemoryAttributes,
239238
PagedPool,
240-
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
239+
FWK_SENSORS_POOL_TAG_ORIENTATION,
241240
Size,
242241
&MemoryHandle,
243242
(PVOID*)&m_pProperties);
@@ -280,7 +279,7 @@ SimpleDeviceOrientationDevice::Initialize(
280279
MemoryAttributes.ParentObject = SensorInstance;
281280
Status = WdfMemoryCreate(&MemoryAttributes,
282281
PagedPool,
283-
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
282+
FWK_SENSORS_POOL_TAG_ORIENTATION,
284283
Size,
285284
&MemoryHandle,
286285
(PVOID*)&m_pDataFieldProperties);
@@ -320,7 +319,7 @@ SimpleDeviceOrientationDevice::Initialize(
320319
MemoryAttributes.ParentObject = SensorInstance;
321320
Status = WdfMemoryCreate(&MemoryAttributes,
322321
PagedPool,
323-
SENSORV2_POOL_TAG_LINEAR_ACCELEROMETER,
322+
FWK_SENSORS_POOL_TAG_ORIENTATION,
324323
Size,
325324
&MemoryHandle,
326325
(PVOID*)&m_pThresholds);

0 commit comments

Comments
 (0)