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

Last change on this file since 754 was 754, checked in by cfuguet, 8 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
RevLine 
[529]1///////////////////////////////////////////////////////////////////////////////
[298]2// File      : rdk_driver.c
3// Date      : 13/02/2014
4// Author    : alain greiner
5// Maintainer: cesar fuguet
6// Copyright (c) UPMC-LIP6
[529]7///////////////////////////////////////////////////////////////////////////////
[298]8
9#include <giet_config.h>
[320]10#include <hard_config.h>
[298]11#include <rdk_driver.h>
12#include <utils.h>
[456]13#include <tty0.h>
[298]14
[320]15#if !defined(SEG_RDK_BASE)
16# error: You must define SEG_RDK_BASE in the hard_config.h file
17#endif
18
[529]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) 
[298]25{
[437]26#if USE_IOC_RDK
[298]27
[754]28#if GIET_DEBUG_IOC
[529]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 );
[298]36#endif
37
[529]38    char* rdk = (char*)SEG_RDK_BASE + (512*lba);
[754]39    char* buf = (char*)buf_vaddr;
[437]40
[529]41    if ( to_mem ) memcpy( buf, rdk, count*512 );
42    else          memcpy( rdk, buf, count*512 );
[437]43
[298]44    return 0;
[437]45
[320]46#else
[437]47
[529]48    _printf("[RDK ERROR] _rdk_access() but USE_IOC_RDK not set\n");
[320]49    return 1;
[437]50
[320]51#endif
[298]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.