summaryrefslogtreecommitdiff
path: root/cros_ec/chip_stub/include/ec_os_types.h
blob: f9c4a263e065752dcf7df1235b3f05ba7c093b8a (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
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Operating system object types for EC.  These are
 * implementation-dependent; this file should come from the
 * implementation include directory. */

#ifndef __CROS_EC_OS_TYPES_H
#define __CROS_EC_OS_TYPES_H

#include "ec_common.h"

/* Structure sizes depend on the underlying implementation.  These
 * sizes are correct for the pthreads implementation. */
#define EC_TASK_STRUCT_SIZE 32
#define EC_SWI_STRUCT_SIZE 120
#define EC_TIMER_STRUCT_SIZE 120
#define EC_SEMAPHORE_STRUCT_SIZE 32
#define EC_EVENT_STRUCT_SIZE 104

/*****************************************************************************/
/* Tasks */

/* Task priority range */
#define EC_TASK_PRIORITY_LOWEST 0
#define EC_TASK_PRIORITY_DEFAULT 3
#define EC_TASK_PRIORITY_HIGHEST 7

/* Task instance.  Treat this as an opaque identifier. */
typedef struct EcTask {
  union {
    uint64_t align; /* Align on something big */
    uint8_t data[EC_TASK_STRUCT_SIZE];
  };
} EcTask;

/*****************************************************************************/
/* Software interrupts (SWI) */

/* SWI priority range */
#define EC_SWI_PRIORITY_LOWEST 0
#define EC_SWI_PRIORITY_DEFAULT 3
#define EC_SWI_PRIORITY_HIGHEST 7

/* SWI instance.  Treat this as an opaque identifier. */
typedef struct EcSwi {
  union {
    uint64_t align; /* Align on something big */
    uint8_t data[EC_SWI_STRUCT_SIZE];
  };
} EcSwi;

/*****************************************************************************/
/* Timers */

/* Timer priority range */
#define EC_TIMER_PRIORITY_LOWEST 0
#define EC_TIMER_PRIORITY_DEFAULT 3
#define EC_TIMER_PRIORITY_HIGHEST 7

/* Timer instance.  Treat this as an opaque identifier. */
typedef struct EcTimer {
  union {
    uint64_t align; /* Align on something big */
    uint8_t data[EC_TIMER_STRUCT_SIZE];
  };
} EcTimer;

/*****************************************************************************/
/* Semaphores */

/* Semaphore instance.  Treat this as an opaque identifier. */
typedef struct EcSemaphore {
  union {
    uint64_t align; /* Align on something big */
    uint8_t data[EC_SEMAPHORE_STRUCT_SIZE];
  };
} EcSemaphore;

/*****************************************************************************/
/* Events */

/* Event instance.  Treat this as an opaque identifier. */
typedef struct EcEvent {
  union {
    uint64_t align; /* Align on something big */
    uint8_t data[EC_EVENT_STRUCT_SIZE];
  };
} EcEvent;

#endif