summaryrefslogtreecommitdiff
path: root/common/ipmbox/protocol.h
blob: 5b274c0dbbba80be6e7b20651ad0f8595dd452d3 (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
#ifndef common_ipmbox_protocol_h
#define common_ipmbox_protocol_h
/* Cesar project {{{
 *
 * Copyright (C) 2012 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    common/ipmbox/protocol.h
 * \brief   IPMbox protocol defines
 */

#include "queue.h"
#include "msg.h"

/**
 * Protocol version.
 * It must be changed when protocol is modified and is not compatible with
 * previous version. It is stored on a 32 bits.
 */
#define IPMBOX_PROTOCOL_VERSION 43

/**
 * Queues sizes in words.
 * On the TX side (A2L MBX & DATA, L2A EMPTY BUF):
 *  - L2A_EMPTY_BUF >= A2L_MBX / MSG_MBX_WORDS + A2L_DATA / MSG_DATA_WORDS
 * On the RX side (L2A MBX & DATA, A2L EMPTY BUF):
 *  - L2A_DATA / MSG_DATA_WORDS = A2L_EMPTY_BUF
 *  - L2A_MBX / MSG_MBX_WORDS = A2L_EMPTY_BUF (but this is a worst case, in
 *  real life things are not that bad, we take the risk)
 */
#define IPMBOX_PROTOCOL_QUEUE_SIZE_A2L_MBX (32 * IPMBOX_MSG_MBX_WORDS)
#define IPMBOX_PROTOCOL_QUEUE_SIZE_A2L_DATA (256 * IPMBOX_MSG_DATA_WORDS)
#define IPMBOX_PROTOCOL_QUEUE_SIZE_L2A_EMPTY_BUF (256 + 32)

#define IPMBOX_PROTOCOL_QUEUE_SIZE_L2A_MBX (32 * IPMBOX_MSG_MBX_WORDS)
#define IPMBOX_PROTOCOL_QUEUE_SIZE_L2A_DATA (256 * IPMBOX_MSG_DATA_WORDS)
#define IPMBOX_PROTOCOL_QUEUE_SIZE_A2L_EMPTY_BUF (256)

/**
 * Initialisation of IPMbox structure.
 */
typedef struct ipmbox_protocol_init_t
{
    /** Version. */
    u32 version;
    /** Pointer to shared memory. */
    volatile ipmbox_queue_ptr_t *shared_mem;
    /** Table of queues size. */
    u32 queue_size[IPMBOX_QUEUE_TYPE_NB][IPMBOX_QUEUE_DIRECTION_NB];
} ipmbox_protocol_init_t;

#endif /* common_ipmbox_protocol_h */