1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** USBX Component */
17 /** */
18 /** Utility */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23
24 /* Include necessary system files. */
25
26 #define UX_SOURCE_CODE
27
28 #include "ux_api.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _ux_utility_short_get PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Chaoqiong Xiao, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function reads a 16-bit value. */
44 /* */
45 /* INPUT */
46 /* */
47 /* address Source address */
48 /* */
49 /* OUTPUT */
50 /* */
51 /* 16-bit value */
52 /* */
53 /* CALLS */
54 /* */
55 /* None */
56 /* */
57 /* CALLED BY */
58 /* */
59 /* USBX Components */
60 /* */
61 /* RELEASE HISTORY */
62 /* */
63 /* DATE NAME DESCRIPTION */
64 /* */
65 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
66 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
67 /* resulting in version 6.1 */
68 /* */
69 /**************************************************************************/
_ux_utility_short_get(UCHAR * address)70 ULONG _ux_utility_short_get(UCHAR * address)
71 {
72
73 USHORT value;
74
75
76 /* In order to make this function endian agnostic and memory alignment
77 independent, we read a byte at a time from the address. */
78 value = (USHORT) *address++;
79 value |= (USHORT)(*address << 8);
80
81 /* Return to caller. */
82 return((ULONG) value);
83 }
84
85