summaryrefslogtreecommitdiff
path: root/spb/SkeletonI2C/skeletoni2c.h
blob: d52f1fd2376454ed532354a9ca52d709c1bd5dd4 (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
/*++

Copyright (c) Microsoft Corporation.  All rights reserved.

Module Name: 

    skeletoni2c.h

Abstract:

    This module contains the controller-specific type 
    definitions for the SPB controller driver hardware.

Environment:

    kernel-mode only

Revision History:

--*/

//
// Includes for hardware register definitions.
//

#ifndef _SKELETONI2C_H_
#define _SKELETONI2C_H_

#include "hw.h"

//
// Skeleton I2C controller registers.
//

typedef struct SKELETONI2C_REGISTERS
{
    // TODO: Update this register structure to match the
    //       register mapping of the controller hardware.

    __declspec(align(4)) HWREG<ULONG>  Reg0;
    __declspec(align(4)) HWREG<ULONG>  Reg1;
}
SKELETONI2C_REGISTERS, *PSKELETONI2C_REGISTERS;

// TODO: Update the following defines to match the bit
//       functionalities of each register.

//
// Reg0 register bits.
//

#define SI2C_REG_0_BITS_31_28               0xF0000000

//
// Reg1 register bits.
//

#define SI2C_REG_1_BITS_31_28               0xF0000000

// TODO: Define other controller-specific values.

#define SI2C_MAX_TRANSFER_LENGTH            0x00001000

// TODO: Remove these generic error defines in favor
//       of real register bit mappings defined above.

#define SI2C_STATUS_ADDRESS_NACK            0x00000000
#define SI2C_STATUS_DATA_NACK               0x00000000
#define SI2C_STATUS_GENERIC_ERROR           0x00000000


//
// Register evaluation functions.
//

FORCEINLINE
bool
TestAnyBits(
    _In_ ULONG V1,
    _In_ ULONG V2
    )
{
    return (V1 & V2) != 0;
}

FORCEINLINE
bool
TestAllBits(
    _In_ ULONG V1,
    _In_ ULONG V2
    )
{
    return ((V1 & V2) == V2);
}

#endif