source: soft/giet_vm/giet_drivers/rdk_driver.c @ 756

Last change on this file since 756 was 754, checked in by cfuguet, 9 years ago
  • Support to have a single terminal (NB_TTY_CHANNEL = 1). In this case, the terminal is shared by the system and the applications.
  • Support platforms without NIC and CMA.
  • In the MMC driver, do not initialize the distributed driver structure in clusters without memory cache (IO clusters in the LETI platform).
File size: 1.8 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2// File      : rdk_driver.c
3// Date      : 13/02/2014
4// Author    : alain greiner
5// Maintainer: cesar fuguet
6// Copyright (c) UPMC-LIP6
7///////////////////////////////////////////////////////////////////////////////
8
9#include <giet_config.h>
10#include <hard_config.h>
11#include <rdk_driver.h>
12#include <utils.h>
13#include <tty0.h>
14
15#if !defined(SEG_RDK_BASE)
16# error: You must define SEG_RDK_BASE in the hard_config.h file
17#endif
18
19/////////////////////////////////////////////////////
20unsigned int _rdk_access( unsigned int       use_irq,    // not used
21                          unsigned int       to_mem,
22                          unsigned int       lba, 
23                          unsigned long long buf_vaddr,  // actually vaddr
24                          unsigned int       count) 
25{
26#if USE_IOC_RDK
27
28#if GIET_DEBUG_IOC
29unsigned int procid  = _get_procid();
30unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
31unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH) - 1);
32unsigned int p       = procid & ((1<<P_WIDTH)-1);
33_printf("\n[RDK DEBUG] P[%d,%d,%d] enters _rdk_access at cycle %d\n"
34        "  use_irq = %d / to_mem = %d / lba = %x / paddr = %x / count = %d\n",
35        x , y , p , _get_proctime() , use_irq , to_mem , lba , buf_vaddr, count );
36#endif
37
38    char* rdk = (char*)SEG_RDK_BASE + (512*lba);
39    char* buf = (char*)buf_vaddr;
40
41    if ( to_mem ) memcpy( buf, rdk, count*512 );
42    else          memcpy( rdk, buf, count*512 );
43
44    return 0;
45
46#else
47
48    _printf("[RDK ERROR] _rdk_access() but USE_IOC_RDK not set\n");
49    return 1;
50
51#endif
52}
53
54// Local Variables:
55// tab-width: 4
56// c-basic-offset: 4
57// c-file-offsets:((innamespace . 0)(inline-open . 0))
58// indent-tabs-mode: nil
59// End:
60// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
61
Note: See TracBrowser for help on using the repository browser.