OpenCores
URL https://opencores.org/ocsvn/igor/igor/trunk

Subversion Repositories igor

[/] [igor/] [trunk/] [avr/] [eth-test/] [encdec.c] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 atypic
#include <stdint.h>
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include "encdec.h"
5
#include "device.h"
6
 
7
/* Decode an object, returning the data and setting the size. */
8
uint32_t
9
decode_object(uint32_t data, uint32_t devnum, uint8_t *osize)
10
{
11
        uint32_t retval;
12
 
13
        *osize = DATA_SIZE_TYPE(DATA_TYPE_DEV(devnum));
14
        retval = DATA_TYPE_DEV(devnum) == TYPE_NONE ? data :
15
            OBJECT_DATUM(data);
16
        return (retval);
17
}
18
 
19
/* Encode an object, returning the data. */
20
uint32_t
21
encode_object(uint32_t data, uint32_t devnum)
22
{
23
        uint32_t retval;
24
        uint8_t otype;
25
 
26
        otype = DATA_TYPE_DEV(devnum);
27
        retval = (otype == TYPE_NONE) ? data : OBJECT_NEW(otype, data);
28
        return (retval);
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.