summaryrefslogtreecommitdiff
path: root/cleopatre/devkit/plcdrv/inc/mailbox.h
blob: f176eab9a47138a44db0d6a955685c7af59e0895 (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
97
#ifndef mailbox_h
#define mailbox_h
/* Cleopatre project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    mailbox.h
 * \brief   interfaces for mailbox layer
 * \ingroup Cleopatre - PlcDrv
 *
 * this file content interfaces and exported macros, variables... For the
 * mailbox layer
 */

#include "common.h"

#ifdef __UTESTS__
#include <linux/netdevice.h>
#endif

/**
 * Initialize the mailbox layer.
 *
 * \param  info  initialisation structure.
 * \param  dev   network device structure
 * \return  error code.
 */
int mailbox_init(struct init_info *info, struct net_device *dev);

/**
 * UnInitialize the mailbox layer.
 */
int mailbox_uninit(void);

/**
 * Prepare the mailbox message
 * corresponding to a sending frame
 * and send it to CESAR.
 *
 * \param  pointer  the data message pointer.
 * \param  length  the length of the data message.
 * \param  prio  message priority.
 * \param  type  type of message.
 * \return  error code.
 */
int mailbox_send(void *pointer, uint32_t length, uint32_t prio, enum buffer_type type);

/**
 * Prepare the mailbox message
 * corresponding to a new buffer
 * and send it to CESAR.
 *
 * \param  pointer  the buffer pointer.
 * \param  type  type of message.
 * \return  error code.
 */
int mailbox_buffer_add(void *pointer, enum buffer_type type);

/**
 * Send a DEBUG_DUMP to CESAR (using the mailbox).
 *
 * \param  buffer  pointer to the buffer to send to CESAR
 * \param  length  length of the buffer to send to CESAR
 * \return  error code
 *
 * \note this function is quite similar to mailbox_buffer_add or mailbox_send
 * (its actually does the same thing as the last one), but only support
 * mailbox message type DEBUG_DUMP.
 */
int mailbox_send_debug_dump(void *buffer, uint length);

/**
 * Manage the Hardware after knowing
 * that a txdone arrived.
 *
 * \return  error code.
 */
int mailbox_txdone(void);

/**
 * Receive everything from the HLE layer.
 *
 * \param  budget  budget before giving hand to caller
 * \return  error code.
 */
int mailbox_receive(unsigned int *budget);

/**
 * Receive part for interrupt context.
 */
void mailbox_receive_isr(void);

#endif /* mailbox_h */