summaryrefslogtreecommitdiff
path: root/cesar/cp/av/cco/bw/src/bw.c
blob: ffc99cd14f6585ffe9e6e9c282a2ef93bac5711a (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
/* Cesar project {{{
 *
 * Copyright (C) 2009 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/av/cco/bw/src/bw.c
 * \brief   Homeplug AV bandwith manager.
 * \ingroup cp_av
 *
 */
#include "common/std.h"
#include "mac/common/timings.h"
#include "cp/cco/bw/bw.h"
#include "cp/av/cco/bw/bw.h"

#include "cp/inc/context.h"

/** Define the Minimum allocation size. */
#define CP_AV_CCO_BW_ALLOC_MIN_SIZE_TCK (MAC_AIFS_TCK + MAC_US_TO_TCK (100))

void
cp_av_cco_bw_schedules_default (cp_t *ctx)
{
    cp_cco_bw_alloc_t * alloc;
    dbg_assert (ctx);

    /* Create an allocation for the station. */
    alloc = cp_cco_bw_alloc_init (ctx);
    alloc->stpf = false;
    alloc->end_time_atu =
        MAC_TCK_TO_ATU(BSU_ACLF_50HZ_CLK_MAX_TCK
                       + CP_AV_CCO_BW_ALLOC_MIN_SIZE_TCK);
    alloc->glid = MAC_LID_SHARED_CSMA;
    alloc->persistence = CP_CCO_BW_ALLOC_PERSISTENCE_PERSISTENT;
    alloc->pscd = 0;
    alloc->cscd = 7;
    cp_cco_bw_alloc_add (ctx, &ctx->bw.alloc_list, alloc);
    slab_release (alloc);
}