summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/inc/bridgedma_common.h
blob: e6171f7e3e8a35cbc2974660eea076ebd694f6be (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
#ifndef hal_phy_inc_bridgedma_common_h
#define hal_phy_inc_bridgedma_common_h
/* Cesar project {{{
 *
 * Copyright (C) 2009 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/phy/inc/bridgedma_common.h
 * \brief   Common part of the bridge DMA structure.
 * \ingroup hal_phy
 *
 */
#include "hal/phy/bridgedma.h"

/** Last job next special value for bridgedma. */
#define PHY_BRGDMA_SPC_ADDRESS(addr) \
    ((addr) | 0x1)

/** Convert special BRGDMA address to a valid one. */
#define PHY_BRGDMA_CORRECT_ADDRESS(addr) \
    ((addr) & ~0x1)

struct phy_bridgedma_list_t
{
    /** The head of the chain. */
    phy_bridgedma_job_t *head;
    /** The tail of the chain. */
    phy_bridgedma_job_t *tail;
};
typedef struct phy_bridgedma_list_t phy_bridgedma_list_t;

struct phy_bridgedma_common_t
{
    /** User data passed to any callback. */
    void *user_data;
    /** Bridge DMA interrupt callback. */
    phy_bridgedma_cb_t bridgedma_cb;
    /** DSR callback. */
    phy_deferred_cb_t deferred_cb;
    /** Jobs being processed by the DMA. */
    phy_bridgedma_list_t jobs_process;
};
typedef struct phy_bridgedma_common_t phy_bridgedma_common_t;

#endif /* hal_phy_inc_bridgedma_common_h */