1 /*
2  * Copyright (c) 2015 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #include <stdint.h>
11 
12 /* in memory and DCC descriptors for the PDCC protocol */
13 
14 /* shared outside of lk repository, be careful of modifications */
15 #define PDCC_VERSION 1
16 
17 struct pdcc_buffer_descriptor {
18     uint32_t version;
19 
20     uint32_t htod_buffer_phys;
21     uint32_t htod_buffer_len;
22 
23     uint32_t dtoh_buffer_phys;
24     uint32_t dtoh_buffer_len;
25 };
26 
27 #define PDCC_VALID (1<<31)
28 #define PDCC_OPCODE_SHIFT (24)
29 #define PDCC_OPCODE(x) (((x) >> PDCC_OPCODE_SHIFT) & 0x7f)
30 #define PDCC_DATA(x) ((x) & 0x00ffffff);
31 
32 enum {
33     PDCC_OP_RESET = 0,
34     PDCC_OP_BUF_HEADER,
35     PDCC_OP_UPDATE_OUT_INDEX,
36     PDCC_OP_CONSUMED_IN,
37 };
38 
39